Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/UIController/UIController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void UIController::run()
break;
}
}
else
else if (isInitialized)
{
lv_obj_clear_flag(ui_homeErrorPanel, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(ui_homeButton, LV_OBJ_FLAG_HIDDEN);
Expand All @@ -163,6 +163,15 @@ void UIController::run()
lv_label_set_text(ui_homeErrorTitle, "Conectando ao WiFi e LNBits...");
lv_label_set_text(ui_homeErrorSubTitle, "Aguarde...\n");
}
else
{
lv_obj_clear_flag(ui_homeErrorPanel, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(ui_homeButton, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(ui_homeSubTitle, LV_OBJ_FLAG_HIDDEN);
lv_img_set_src(ui_homeErrorIcon, &ui_img_wifi_png);
lv_label_set_text(ui_homeErrorTitle, "Já configurou sua máquina café?");
lv_label_set_text(ui_homeErrorSubTitle, "Por favor, aguarde alguns segundos ou conecte-se ao AP para ajustar as configurações iniciais.");
}

delayLvgl = lv_timer_handler();
vTaskDelay(delayLvgl + 1 / portTICK_PERIOD_MS);
Expand Down
2 changes: 2 additions & 0 deletions lib/UIController/UIController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class UIController
void clearQrCode();
void setWaitingPaymentFor(uint8_t type);
uint8_t getDelayLvgl() const { return delayLvgl; };
void setIsInitialized(bool isInitialized) { UIController::isInitialized = isInitialized; }

static void task(void *pvParameters);

Expand All @@ -30,6 +31,7 @@ class UIController
uint8_t timerButtonNumber;
uint8_t waitingPaymentFor = 0;
uint8_t delayLvgl = 0;
bool isInitialized = false;

static void qrCodeTimerCallback(lv_timer_t *timer);

Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void setup()
log_i("'q' - Set Quantity");
#endif

uiController.begin();

if (!configManager.begin())
{
log_e("Failed to initialize config manager");
Expand All @@ -51,19 +53,20 @@ void setup()
}

initialized = true;
uiController.setIsInitialized(true);

log_i("WiFi connected.");

lightningController.websocketInit();

coffeeTask.begin();
uiController.begin();
}

void loop()
{
if (!initialized)
return;

wifiManager.process();

lightningController.websocketLoop();
Expand Down