Improved Bootscreen
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEScan.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
#include "Tone32.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Wire.h>
|
||||
#include <SSD1306Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "Tone32.h"
|
||||
//#include "SparkLine.h"
|
||||
|
||||
// ssd1306 display
|
||||
SSD1306Wire display(0x3c, 5, 4);
|
||||
#define SSD1306_128_64
|
||||
|
||||
@@ -33,6 +35,25 @@ BLEScan *scanner;
|
||||
std::map<std::string, unsigned long> seenNotifiers;
|
||||
|
||||
|
||||
/**
|
||||
* UI related functions
|
||||
*/
|
||||
void displayBootscreen() {
|
||||
Serial.println("Show bootscreen");
|
||||
display.clear();
|
||||
display.setColor(WHITE);
|
||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display.fillRect(4, 8, 121, 24);
|
||||
display.drawRect(4, 32, 121, 19);
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
display.drawString(64, 35, "Exposure API Scanner");
|
||||
display.setColor(BLACK);
|
||||
display.setFont(ArialMT_Plain_24);
|
||||
display.drawString(64, 7, "COVID-19");
|
||||
display.display();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a new exposure notifier is seen.
|
||||
*/
|
||||
@@ -95,13 +116,7 @@ void setup() {
|
||||
// Initialize display
|
||||
Serial.println("Init Display");
|
||||
display.init();
|
||||
display.clear();
|
||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display.setFont(ArialMT_Plain_24);
|
||||
display.drawString(64, 10, "COVID-19");
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
display.drawString(64, 32, "Exposure API Scanner");
|
||||
display.display();
|
||||
displayBootscreen();
|
||||
|
||||
// Initialize scanner.
|
||||
BLEDevice::init("ESP");
|
||||
@@ -130,9 +145,11 @@ void loop() {
|
||||
Serial.printf("Show data on SSD1306 display");
|
||||
display.clear();
|
||||
display.setColor(WHITE);
|
||||
display.drawRect(0, 0, 128, 64); // UI Outline
|
||||
display.fillRect(0, 0, 128, 14);
|
||||
display.setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
display.drawRect(0, 0, 128, 64); // UI Outline
|
||||
display.fillRect(0, 0, 128, 14); // UI Header
|
||||
display.drawString(64, 0, "Exposure API Counter");
|
||||
if (seenNotifiers.size() == 1) {
|
||||
display.drawString(64, 48, "Device in last " + String(FORGET_AFTER_MINUTES) +"min.");
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
This repository contains code to scan the official COVID19 Exposure API with an ESP32 using Bluetooth LE and shows a counter on an SSD1306 OLED display.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Code is based on [BLE Exposure Notification Beeper](https://github.com/kmetz/BLEExposureNotificationBeeper) which uses an LED and a piezo buzzer to notify about new detected devices but would not show the device count so I added the display part to it. You can still use the LED/Buzzer because this part is not touched in the code. In case you want to do so use this wiring:
|
||||
|
||||
@@ -40,6 +39,9 @@ In case you have an [Anycubic i3 Mega](https://www.anycubic.com/products/anycubi
|
||||
|
||||
## Used Libraries
|
||||
+ [ESP8266-oled-ssd1306 by ThingPulse](https://github.com/ThingPulse/esp8266-oled-ssd1306)
|
||||
+ [ESParkline](https://github.com/0xPIT/ESParklines)
|
||||
+ [Adafruit-GFX-Library](https://github.com/adafruit/Adafruit-GFX-Library)
|
||||
+ [FixedPoints](https://github.com/Pharap/FixedPointsArduino)
|
||||
|
||||
## To do
|
||||
- [ ] [Sparklines](https://github.com/0xPIT/ESParklines)
|
||||
|
||||
Reference in New Issue
Block a user