#ifndef __IMAGE__ #include #endif #include #include // Overlays int overlaysCount = 1; OverlayCallback overlays[] = { timeOverlay }; void timeOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) { String time(""); if( localIP == "Unconnected" ) { unsigned long mscount = millis(); unsigned long sec = mscount / 1000; unsigned long mse = mscount / 100 - sec * 10; time = (String)sec + "." + (String)mse; } else { time = ntpTime(); } display->setTextAlignment(TEXT_ALIGN_CENTER); display->drawString(64, 54, time); display->setTextAlignment(TEXT_ALIGN_LEFT); } // frames int frameCount = 3; FrameCallback frames[] = { oledWebFrame, oledBilibiliFrame, oledOsFrame }; static void oledTitle(OLEDDisplay *display, String s) { // Title display->setFont(Roboto_Mono_13); display->setTextAlignment(TEXT_ALIGN_CENTER); display->drawString(64, 0, s); display->setFont(Roboto_Mono_10); display->setTextAlignment(TEXT_ALIGN_LEFT); } void oledWebFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { // Title oledTitle(display, "Fox Home"); // Day View display->drawString(0, 16, "Today"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 16, (String)dayView); display->setTextAlignment(TEXT_ALIGN_LEFT); // Week View display->drawString(0, 30, "Last Week"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 30, (String)weekView); display->setTextAlignment(TEXT_ALIGN_LEFT); // Month View display->drawString(0, 44, "Last Month"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 44, (String)monthView); display->setTextAlignment(TEXT_ALIGN_LEFT); } 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"); // Follower display->drawString(0, 16, "Follower"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 16, (String)follower); display->setTextAlignment(TEXT_ALIGN_LEFT); // View display->drawString(0, 30, "View"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 30, (String)view); display->setTextAlignment(TEXT_ALIGN_LEFT); // Likes display->drawString(0, 44, "Likes"); display->setTextAlignment(TEXT_ALIGN_RIGHT); display->drawString(120, 44, (String)likes); display->setTextAlignment(TEXT_ALIGN_LEFT); } void oledOsFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { // Title oledTitle(display, "INFO BOARD"); // Version display->drawFastImage(0, 16, 16, 16, Board_Icon); display->drawString(24, 18, ver); // WiFi if( localIP == "Unconnected") display->drawFastImage(0, 34, 16, 16, Wifi_Unconnected_Icon); else display->drawFastImage(0, 34, 16, 16, Wifi_Connected_Icon); display->drawString(24, 36, localIP); }