76 lines
2.4 KiB
C++
76 lines
2.4 KiB
C++
#ifndef __IMAGE__
|
|
#include <image.h>
|
|
#endif
|
|
|
|
#include <font.h>
|
|
#include <utils.h>
|
|
|
|
// Overlays
|
|
const uint8_t overlaysCount = 1;
|
|
OverlayCallback overlays[] = { timeOverlay };
|
|
|
|
void timeOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) {
|
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
|
display->drawString(64, 54, ntpTime());
|
|
}
|
|
|
|
// frames
|
|
const uint8_t frameCount = 3;
|
|
FrameCallback frames[] = { oledWebFrame, oledBilibiliFrame, oledOsFrame };
|
|
|
|
void oledTitle(OLEDDisplay *display, String s, int16_t x, int16_t y) {
|
|
// Title
|
|
display->setFont(Roboto_Mono_13);
|
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
|
display->drawString(64+x, 0+y, s);
|
|
display->setFont(Roboto_Mono_10);
|
|
}
|
|
|
|
void oledWebFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
// Title
|
|
oledTitle(display, "Fox Home", x, y);
|
|
|
|
// Items
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
display->drawString(0+x, 16+y, "Today");
|
|
display->drawString(0+x, 30+y, "Last Week");
|
|
display->drawString(0+x, 44+y, "Last Month");
|
|
|
|
// Values
|
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
|
display->drawString(120+x, 16+y, (String)dayView);
|
|
display->drawString(120+x, 30+y, (String)weekView);
|
|
display->drawString(120+x, 44+y, (String)monthView);
|
|
}
|
|
|
|
void oledMQTTFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
|
|
}
|
|
|
|
void oledBilibiliFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
// Title
|
|
oledTitle(display, "BiliBili", x, y);
|
|
|
|
// Items
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
display->drawString(0+x, 16+y, "Follower");
|
|
display->drawString(0+x, 30+y, "View");
|
|
display->drawString(0+x, 44+y, "Likes");
|
|
|
|
// Values
|
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
|
display->drawString(120+x, 16+y, (String)follower);
|
|
display->drawString(120+x, 30+y, (String)view);
|
|
display->drawString(120+x, 44+y, (String)likes);
|
|
}
|
|
|
|
void oledOsFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) {
|
|
// Title
|
|
oledTitle(display, "INFO BOARD", x, y);
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
|
|
// Version
|
|
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.0) + "/80 kB");
|
|
} |