fix screen switching
This commit is contained in:
@ -23,7 +23,8 @@ typedef enum {
|
|||||||
} oledScreen_t;
|
} oledScreen_t;
|
||||||
|
|
||||||
void oledInit(void);
|
void oledInit(void);
|
||||||
void oledClear();
|
void oledClearActiveScreen();
|
||||||
|
void oledClearAllScreens();
|
||||||
void oledPrint(oledScreen_t screen, char msg[]);
|
void oledPrint(oledScreen_t screen, char msg[]);
|
||||||
void oledPrintf(oledScreen_t screen, const char *format, ...);
|
void oledPrintf(oledScreen_t screen, const char *format, ...);
|
||||||
void oledSetActiveScreen(oledScreen_t screen);
|
void oledSetActiveScreen(oledScreen_t screen);
|
||||||
|
@ -39,7 +39,7 @@ void my_setup_2() {
|
|||||||
logMsg("Application starting");
|
logMsg("Application starting");
|
||||||
|
|
||||||
oledInit();
|
oledInit();
|
||||||
oledClear();
|
oledClearAllScreens();
|
||||||
oledSetActiveScreen(OLED_SCREEN0);
|
oledSetActiveScreen(OLED_SCREEN0);
|
||||||
oledPrint(OLED_SCREEN0, "App starting");
|
oledPrint(OLED_SCREEN0, "App starting");
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ static void mqttStatusPublisher(void *handle) {
|
|||||||
bool res = publish(&mqttClient, StatusTopic, (const uint8_t*)buf, strlen(buf), false);
|
bool res = publish(&mqttClient, StatusTopic, (const uint8_t*)buf, strlen(buf), false);
|
||||||
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
|
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
|
||||||
|
|
||||||
oledClear();
|
|
||||||
oledSetActiveScreen(OLED_SCREEN1);
|
oledSetActiveScreen(OLED_SCREEN1);
|
||||||
|
oledClearActiveScreen();
|
||||||
uint8_t *addr = wizGetIPAddress();
|
uint8_t *addr = wizGetIPAddress();
|
||||||
oledPrintf(OLED_SCREEN1, "Addr:%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
|
oledPrintf(OLED_SCREEN1, "Addr:%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
|
||||||
oledPrintf(OLED_SCREEN1, "Network available:%d", isNetworkAvailable());
|
oledPrintf(OLED_SCREEN1, "Network available:%d", isNetworkAvailable());
|
||||||
|
@ -406,7 +406,13 @@ static uint8_t currentLine = 0;
|
|||||||
static char lines[NUM_OF_SCREENS][MAX_LINES+1][MAX_CHARS+1];
|
static char lines[NUM_OF_SCREENS][MAX_LINES+1][MAX_CHARS+1];
|
||||||
static oledScreen_t activeScreen = OLED_SCREEN0;
|
static oledScreen_t activeScreen = OLED_SCREEN0;
|
||||||
|
|
||||||
void oledClear() {
|
void oledClearActiveScreen() {
|
||||||
|
oled_CLS();
|
||||||
|
memset(lines[activeScreen], 0, sizeof(lines[activeScreen]));
|
||||||
|
currentLine = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void oledClearAllScreens() {
|
||||||
oled_CLS();
|
oled_CLS();
|
||||||
memset(lines, 0, sizeof(lines));
|
memset(lines, 0, sizeof(lines));
|
||||||
currentLine = 0;
|
currentLine = 0;
|
||||||
|
Reference in New Issue
Block a user