82 lines
2.5 KiB
C++
82 lines
2.5 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, F("Fox Home"), x, y);
|
|
|
|
// Items
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
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"));
|
|
|
|
// 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, F("BiliBili"), x, y);
|
|
|
|
// Items
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
display->drawString(0+x, 16+y, F("Follower"));
|
|
display->drawString(0+x, 30+y, F("View"));
|
|
display->drawString(0+x, 44+y, F("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, F("INFO BOARD"), x, y);
|
|
|
|
// Items
|
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
display->drawString(0+x, 16+y, F("Ver: "));
|
|
display->drawString(0+x, 30+y, F("IP : "));
|
|
display->drawString(0+x, 44+y, F("Mem: "));
|
|
|
|
// 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");
|
|
} |