Code cleanup

This commit is contained in:
fvanroie 2021-05-11 01:33:39 +02:00
parent 64eeb49a78
commit 5a847f0da2
6 changed files with 15 additions and 29 deletions

View File

@ -363,8 +363,8 @@ void haspSetup(void)
if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE;
// haspFonts[0] = lv_font_load("E:/font_1.fnt");
// haspFonts[2] = lv_font_load("E:/font_2.fnt");
// haspFonts[3] = lv_font_load("E:/font_3.fnt");
// haspFonts[2] = lv_font_load("E:/font_2.fnt");
// haspFonts[3] = lv_font_load("E:/font_3.fnt");
/* ********** Theme Initializations ********** */
if(haspThemeId == 8) haspThemeId = 1; // update old HASP id
@ -461,7 +461,7 @@ void haspSetup(void)
hasp_init();
hasp_load_json();
haspPages.set(haspStartPage, LV_SCR_LOAD_ANIM_NONE);
haspPages.set(haspStartPage, LV_SCR_LOAD_ANIM_FADE_ON);
}
/**********************

View File

@ -249,7 +249,8 @@ static int hasp_parse_json_attributes(lv_obj_t* obj, const JsonObject& doc)
std::string v;
for(JsonPair keyValue : doc) {
LOG_VERBOSE(TAG_HASP, F(D_BULLET "%s=%s"), keyValue.key().c_str(), keyValue.value().as<std::string>().c_str());
// LOG_VERBOSE(TAG_HASP, F(D_BULLET "%s=%s"), keyValue.key().c_str(),
// keyValue.value().as<std::string>().c_str());
v = keyValue.value().as<std::string>();
hasp_process_obj_attribute(obj, keyValue.key().c_str(), keyValue.value().as<std::string>().c_str(), true);
i++;
@ -259,7 +260,7 @@ static int hasp_parse_json_attributes(lv_obj_t* obj, const JsonObject& doc)
v.reserve(64);
for(JsonPair keyValue : doc) {
LOG_DEBUG(TAG_HASP, F(D_BULLET "%s=%s"), keyValue.key().c_str(), keyValue.value().as<String>().c_str());
// LOG_DEBUG(TAG_HASP, F(D_BULLET "%s=%s"), keyValue.key().c_str(), keyValue.value().as<String>().c_str());
v = keyValue.value().as<String>();
hasp_process_obj_attribute(obj, keyValue.key().c_str(), keyValue.value().as<String>().c_str(), true);
i++;

View File

@ -298,6 +298,8 @@ void guiSetup()
IRAM_ATTR void guiLoop(void)
{
lv_task_handler(); // process animations
#if defined(STM32F4xx)
// tick.update();
#endif

View File

@ -319,25 +319,7 @@ void debugSetup(JsonObject settings)
}
IRAM_ATTR void debugLoop(void)
{
/* int16_t keypress;
do {
switch(keypress = debugConsole.readKey()) {
case ConsoleInput::KEY_PAGE_UP:
dispatch_page_next(LV_SCR_LOAD_ANIM_NONE);
break;
case ConsoleInput::KEY_PAGE_DOWN:
dispatch_page_prev(LV_SCR_LOAD_ANIM_NONE);
break;
case(ConsoleInput::KEY_FN)...(ConsoleInput::KEY_FN + 12):
dispatch_set_page(keypress - ConsoleInput::KEY_FN, LV_SCR_LOAD_ANIM_NONE);
break;
}
} while(keypress != 0); */
}
{}
void printLocalTime()
{

View File

@ -104,7 +104,7 @@ void setup()
#endif
mainLastLoopTime = millis() - 1000; // reset loop counter
delay(250);
delay(20);
guiStart();
}

View File

@ -115,7 +115,7 @@ void setup()
IRAM_ATTR void loop()
{
guiLoop();
haspLoop();
// haspLoop();
networkLoop();
#if HASP_USE_GPIO > 0
@ -126,10 +126,10 @@ IRAM_ATTR void loop()
mqttLoop();
#endif // MQTT
// debugLoop();
haspDevice.loop();
#if HASP_USE_CONSOLE > 0
// debugLoop();
consoleLoop();
#endif
@ -137,8 +137,8 @@ IRAM_ATTR void loop()
if(millis() - mainLastLoopTime >= 1000) {
/* Runs Every Second */
haspEverySecond(); // sleep timer
debugEverySecond(); // statusupdate
haspEverySecond(); // sleep timer & statusupdate
// debugEverySecond();
/* Runs Every 5 Seconds */
if(mainLoopCounter == 0 || mainLoopCounter == 5) {
@ -165,6 +165,7 @@ IRAM_ATTR void loop()
} else {
mainLoopCounter++;
}
mainLastLoopTime += 1000;
}