2022-01-08 18:32:31 +08:00
|
|
|
#ifndef __IMAGE__
|
|
|
|
#include <image.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <font.h>
|
|
|
|
#include <utils.h>
|
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
// Overlays
|
2022-01-10 03:15:46 +08:00
|
|
|
const uint8_t overlaysCount = 1;
|
2022-01-09 01:19:45 +08:00
|
|
|
OverlayCallback overlays[] = { timeOverlay };
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
void timeOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
|
2022-01-08 18:32:31 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
2022-01-09 17:42:48 +08:00
|
|
|
display->drawString(64, 54, ntpTime());
|
2022-01-08 18:32:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// frames
|
2022-01-10 03:15:46 +08:00
|
|
|
const uint8_t frameCount = 3;
|
2022-01-09 01:19:45 +08:00
|
|
|
FrameCallback frames[] = { oledWebFrame, oledBilibiliFrame, oledOsFrame };
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-09 16:53:22 +08:00
|
|
|
void oledTitle(OLEDDisplay *display, String s, int16_t x, int16_t y) {
|
2022-01-08 18:32:31 +08:00
|
|
|
// Title
|
|
|
|
display->setFont(Roboto_Mono_13);
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
2022-01-09 15:47:13 +08:00
|
|
|
display->drawString(64+x, 0+y, s);
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setFont(Roboto_Mono_10);
|
|
|
|
}
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
void oledWebFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
|
|
// Title
|
2022-01-10 20:26:01 +08:00
|
|
|
oledTitle(display, F("Fox Home"), x, y);
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-09 15:47:13 +08:00
|
|
|
// Items
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
2022-01-10 20:26:01 +08:00
|
|
|
display->drawString(0+x, 16+y, F("Today"));
|
|
|
|
display->drawString(0+x, 30+y, F("Last Week"));
|
|
|
|
display->drawString(0+x, 44+y, F("Last Month"));
|
2022-01-09 15:47:13 +08:00
|
|
|
|
|
|
|
// Values
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
2022-01-09 15:47:13 +08:00
|
|
|
display->drawString(120+x, 16+y, (String)dayView);
|
|
|
|
display->drawString(120+x, 30+y, (String)weekView);
|
|
|
|
display->drawString(120+x, 44+y, (String)monthView);
|
2022-01-08 18:32:31 +08:00
|
|
|
}
|
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
void oledMQTTFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
2022-01-08 18:32:31 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
void oledBilibiliFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
|
|
// Title
|
2022-01-10 20:26:01 +08:00
|
|
|
oledTitle(display, F("BiliBili"), x, y);
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-09 15:47:13 +08:00
|
|
|
// Items
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
2022-01-10 20:26:01 +08:00
|
|
|
display->drawString(0+x, 16+y, F("Follower"));
|
|
|
|
display->drawString(0+x, 30+y, F("View"));
|
|
|
|
display->drawString(0+x, 44+y, F("Likes"));
|
2022-01-09 15:47:13 +08:00
|
|
|
|
|
|
|
// Values
|
2022-01-09 01:19:45 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
2022-01-09 15:47:13 +08:00
|
|
|
display->drawString(120+x, 16+y, (String)follower);
|
|
|
|
display->drawString(120+x, 30+y, (String)view);
|
|
|
|
display->drawString(120+x, 44+y, (String)likes);
|
2022-01-08 18:32:31 +08:00
|
|
|
}
|
|
|
|
|
2022-01-09 01:19:45 +08:00
|
|
|
void oledOsFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
2022-01-08 18:32:31 +08:00
|
|
|
// Title
|
2022-01-10 20:26:01 +08:00
|
|
|
oledTitle(display, F("INFO BOARD"), x, y);
|
|
|
|
|
|
|
|
// Items
|
2022-01-09 15:47:13 +08:00
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
2022-01-10 20:26:01 +08:00
|
|
|
display->drawString(0+x, 16+y, F("Ver: "));
|
|
|
|
display->drawString(0+x, 30+y, F("IP : "));
|
|
|
|
display->drawString(0+x, 44+y, F("Mem: "));
|
2022-01-08 18:32:31 +08:00
|
|
|
|
2022-01-10 20:26:01 +08:00
|
|
|
// Values
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
|
|
|
display->drawString(120+x, 16+y, Board.Version);
|
|
|
|
display->drawString(120+x, 30+y, Board.ip.toString());
|
|
|
|
display->drawString(120+x, 44+y, (String)(ESP.getFreeHeap()) + " byte");
|
2022-01-08 18:32:31 +08:00
|
|
|
}
|