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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user