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-08 18:32:31 +08:00
|
|
|
int 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-09 01:19:45 +08:00
|
|
|
int frameCount = 3;
|
|
|
|
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-09 15:47:13 +08:00
|
|
|
oledTitle(display, "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-09 15:47:13 +08:00
|
|
|
display->drawString(0+x, 16+y, "Today");
|
|
|
|
display->drawString(0+x, 30+y, "Last Week");
|
|
|
|
display->drawString(0+x, 44+y, "Last Month");
|
|
|
|
|
|
|
|
// 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-09 15:47:13 +08:00
|
|
|
oledTitle(display, "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-09 15:47:13 +08:00
|
|
|
display->drawString(0+x, 16+y, "Follower");
|
|
|
|
display->drawString(0+x, 30+y, "View");
|
|
|
|
display->drawString(0+x, 44+y, "Likes");
|
|
|
|
|
|
|
|
// 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-09 15:47:13 +08:00
|
|
|
oledTitle(display, "INFO BOARD", x, y);
|
|
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
2022-01-08 18:32:31 +08:00
|
|
|
|
|
|
|
// Version
|
2022-01-09 17:42:48 +08:00
|
|
|
display->drawString(0+x, 16+y, "Ver: " + Board.Version);
|
|
|
|
display->drawString(0+x, 30+y, "IP : " + Board.ip.toString());
|
|
|
|
display->drawString(0+x, 44+y, "Mem: " + (String)(80.0-ESP.getFreeHeap()/1024) + "/80 kB");
|
2022-01-08 18:32:31 +08:00
|
|
|
}
|