Test if screen address was found

This commit is contained in:
Jm Casler 2021-12-18 11:02:54 -05:00
parent d1370071da
commit f3fc88ac5d
3 changed files with 13 additions and 7 deletions

View File

@ -703,6 +703,7 @@ void _screen_header()
Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev) Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev)
{ {
address_found = address;
cmdQueue.setReader(this); cmdQueue.setReader(this);
} }
@ -940,10 +941,12 @@ void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiStat
* it is expected that this will be used during the boot phase */ * it is expected that this will be used during the boot phase */
void Screen::setSSLFrames() void Screen::setSSLFrames()
{ {
// DEBUG_MSG("showing SSL frames\n"); if (address_found) {
static FrameCallback sslFrames[] = {drawSSLScreen}; // DEBUG_MSG("showing SSL frames\n");
ui.setFrames(sslFrames, 1); static FrameCallback sslFrames[] = {drawSSLScreen};
ui.update(); ui.setFrames(sslFrames, 1);
ui.update();
}
} }
// restore our regular frame list // restore our regular frame list

View File

@ -97,6 +97,8 @@ class Screen : public concurrency::OSThread
Screen(const Screen &) = delete; Screen(const Screen &) = delete;
Screen &operator=(const Screen &) = delete; Screen &operator=(const Screen &) = delete;
uint8_t address_found;
/// Initializes the UI, turns on the display, starts showing boot screen. /// Initializes the UI, turns on the display, starts showing boot screen.
// //
// Not thread safe - must be called before any other methods are called. // Not thread safe - must be called before any other methods are called.

View File

@ -6,6 +6,8 @@
#include <HTTPMultipartBodyParser.hpp> #include <HTTPMultipartBodyParser.hpp>
#include <HTTPURLEncodedBodyParser.hpp> #include <HTTPURLEncodedBodyParser.hpp>
#include "sleep.h" #include "sleep.h"
#include "graphics/Screen.h"
#include <WebServer.h> #include <WebServer.h>
#include <WiFi.h> #include <WiFi.h>
@ -179,9 +181,8 @@ void createSSLCert()
yield(); yield();
esp_task_wdt_reset(); esp_task_wdt_reset();
if ((millis() / 1000 >= 3) && screen) { if (millis() / 1000 >= 3) {
if (screen) screen->setSSLFrames();
screen->setSSLFrames();
} }
} }
runLoop = false; runLoop = false;