improved logging

This commit is contained in:
KlausMu 2024-05-10 12:33:35 +02:00
parent 8f0ceeb72b
commit 8db3cefeed
18 changed files with 246 additions and 161 deletions

View file

@ -24,9 +24,9 @@ int lastActiveGUIlistIndex;
void init_preferences_HAL(void) { void init_preferences_HAL(void) {
// set some values for tests // set some values for tests
activeScene = ""; // "Off", "TV", "Fire TV", "Chromecast", "Apple TV"; activeScene = ""; // "Off", "TV", "Fire TV", "Chromecast", "Apple TV";
activeGUIname = ""; // "Scene selection", "Smart Home", "Settings", "IR Receiver" // "Numpad", "Apple TV" activeGUIname = "Scene selection"; // "Scene selection", "Smart Home", "Settings", "IR Receiver" // "Numpad", "Apple TV"
activeGUIlist = MAIN_GUI_LIST; // MAIN_GUI_LIST, SCENE_GUI_LIST; activeGUIlist = MAIN_GUI_LIST; // MAIN_GUI_LIST, SCENE_GUI_LIST;
lastActiveGUIlistIndex = 0; lastActiveGUIlistIndex = 0;
} }
void save_preferences_HAL(void) { void save_preferences_HAL(void) {

View file

@ -26,6 +26,12 @@ build_flags =
-D USE_SCENE_SPECIFIC_GUI_LIST=1 -D USE_SCENE_SPECIFIC_GUI_LIST=1
-D SCR_WIDTH=${env.custom_screen_width} -D SCR_WIDTH=${env.custom_screen_width}
-D SCR_HEIGHT=${env.custom_screen_heigth} -D SCR_HEIGHT=${env.custom_screen_heigth}
;-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_NONE
;-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_ERROR
;-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_WARN
-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_INFO
;-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_DEBUG
;-D OMOTE_LOG_LEVEL=OMOTE_LOG_LEVEL_VERBOSE
;-- lvgl ------------------------------------------------------------------ ;-- lvgl ------------------------------------------------------------------
; lvgl variant 1: ; lvgl variant 1:
; Don't use lv_conf.h. Tweak params via platfom.ini. See lv_conf_internal.h line 31. Don't change this line. ; Don't use lv_conf.h. Tweak params via platfom.ini. See lv_conf_internal.h line 31. Don't change this line.
@ -48,13 +54,11 @@ build_flags =
; Enable the log module ; Enable the log module
-D LV_USE_LOG=1 -D LV_USE_LOG=1
-D LV_LOG_PRINTF=1 -D LV_LOG_PRINTF=1
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_WARN
-D LV_LOG_LEVEL=LV_LOG_LEVEL_ERROR
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_USER
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_NONE ;-D LV_LOG_LEVEL=LV_LOG_LEVEL_NONE
; trace really gives a lot of messages ... ;-D LV_LOG_LEVEL=LV_LOG_LEVEL_USER
-D LV_LOG_LEVEL=LV_LOG_LEVEL_ERROR
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_WARN
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
;-D LV_LOG_LEVEL=LV_LOG_LEVEL_TRACE ;-D LV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
; --- ; ---
; Enable asserts if an operation is failed or an invalid data is found. ; Enable asserts if an operation is failed or an invalid data is found.

View file

@ -6,6 +6,7 @@
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/scenes/sceneHandler.h" #include "applicationInternal/scenes/sceneHandler.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/omote_log.h"
#include "devices/misc/device_specialCommands.h" #include "devices/misc/device_specialCommands.h"
// show WiFi status // show WiFi status
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
@ -179,7 +180,7 @@ std::string convertStringListToString(std::list<std::string> listOfStrings) {
void executeCommandWithData(uint16_t command, commandData commandData, std::string additionalPayload = "") { void executeCommandWithData(uint16_t command, commandData commandData, std::string additionalPayload = "") {
switch (commandData.commandHandler) { switch (commandData.commandHandler) {
case IR: { case IR: {
// Serial.printf(" generic IR, payloads %s\r\n", convertStringListToString(commandData.commandPayloads).c_str()); omote_log_v(" generic IR, payloads %s\r\n", convertStringListToString(commandData.commandPayloads).c_str());
// we received a comma separated list of strings // we received a comma separated list of strings
// the first string is the IR protocol, the second is the payload to be sent // the first string is the IR protocol, the second is the payload to be sent
@ -187,7 +188,7 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
// get protocol and erase first element in list // get protocol and erase first element in list
std::string protocol = *it; std::string protocol = *it;
it = commandData.commandPayloads.erase(it); it = commandData.commandPayloads.erase(it);
// Serial.printf(" protocol %s, payload %s\r\n", protocol.c_str(), convertStringListToString(commandData.commandPayloads).c_str()); omote_log_v(" protocol %s, payload %s\r\n", protocol.c_str(), convertStringListToString(commandData.commandPayloads).c_str());
sendIRcode((IRprotocols)std::stoi(protocol), commandData.commandPayloads, additionalPayload); sendIRcode((IRprotocols)std::stoi(protocol), commandData.commandPayloads, additionalPayload);
break; break;
@ -204,7 +205,7 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
} else { } else {
payload = additionalPayload; payload = additionalPayload;
} }
Serial.printf("execute: will send MQTT, topic '%s', payload '%s'\r\n", topic.c_str(), payload.c_str()); omote_log_d("execute: will send MQTT, topic '%s', payload '%s'\r\n", topic.c_str(), payload.c_str());
publishMQTTMessage(topic.c_str(), payload.c_str()); publishMQTTMessage(topic.c_str(), payload.c_str());
break; break;
} }
@ -219,7 +220,7 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
if (additionalPayload != "") { if (additionalPayload != "") {
payload = additionalPayload; payload = additionalPayload;
} }
Serial.printf("execute: will send BLE keyboard command, command '%u', payload '%s'\r\n", command, payload.c_str()); omote_log_d("execute: will send BLE keyboard command, command '%u', payload '%s'\r\n", command, payload.c_str());
keyboard_ble_executeCommand(command, payload); keyboard_ble_executeCommand(command, payload);
break; break;
} }
@ -227,14 +228,14 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
case SCENE: { case SCENE: {
// let the sceneHandler do the scene stuff // let the sceneHandler do the scene stuff
Serial.printf("execute: will send scene command to the sceneHandler\r\n"); omote_log_d("execute: will send scene command to the sceneHandler\r\n");
handleScene(command, commandData, additionalPayload); handleScene(command, commandData, additionalPayload);
break; break;
} }
case GUI: { case GUI: {
// let the sceneHandler find and show the gui // let the sceneHandler find and show the gui
Serial.printf("execute: will send gui command to the sceneHandler\r\n"); omote_log_d("execute: will send gui command to the sceneHandler\r\n");
handleGUI(command, commandData, additionalPayload); handleGUI(command, commandData, additionalPayload);
break; break;
} }
@ -242,7 +243,7 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
case SPECIAL: { case SPECIAL: {
if (command == MY_SPECIAL_COMMAND) { if (command == MY_SPECIAL_COMMAND) {
// do your special command here // do your special command here
Serial.printf("execute: could execute a special command here, if you define one\r\n"); omote_log_d("execute: could execute a special command here, if you define one\r\n");
} }
break; break;
@ -253,14 +254,14 @@ void executeCommandWithData(uint16_t command, commandData commandData, std::stri
void executeCommand(uint16_t command, std::string additionalPayload) { void executeCommand(uint16_t command, std::string additionalPayload) {
try { try {
if (commands.count(command) > 0) { if (commands.count(command) > 0) {
Serial.printf("command: will execute command '%u' with additionalPayload '%s'\r\n", command, additionalPayload.c_str()); omote_log_d("command: will execute command '%u' with additionalPayload '%s'\r\n", command, additionalPayload.c_str());
executeCommandWithData(command, commands.at(command), additionalPayload); executeCommandWithData(command, commands.at(command), additionalPayload);
} else { } else {
Serial.printf("command: command '%u' not found\r\n", command); omote_log_w("command: command '%u' not found\r\n", command);
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("executeCommand: internal error, command not registered\r\n"); omote_log_e("executeCommand: internal error, command not registered\r\n");
} }
} }

View file

@ -4,6 +4,7 @@
#include "applicationInternal/gui/guiMemoryOptimizer.h" #include "applicationInternal/gui/guiMemoryOptimizer.h"
// for changing to scene Selection gui // for changing to scene Selection gui
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
#include "scenes/scene__default.h" #include "scenes/scene__default.h"
lv_color_t color_primary = lv_color_hex(0x303030); // gray lv_color_t color_primary = lv_color_hex(0x303030); // gray
@ -45,7 +46,7 @@ void pageIndicator_navigate_event_cb(lv_event_t* e) {
// callback when sceneLabel or pageIndicator was clicked // callback when sceneLabel or pageIndicator was clicked
void sceneLabel_or_pageIndicator_event_cb(lv_event_t* e) { void sceneLabel_or_pageIndicator_event_cb(lv_event_t* e) {
Serial.println("- Scene selection: sceneLabel or pageIndicator clicked received for navigating to scene selection page"); omote_log_d("- Scene selection: sceneLabel or pageIndicator clicked received for navigating to scene selection page\r\n");
executeCommand(SCENE_SELECTION); executeCommand(SCENE_SELECTION);
} }
@ -54,7 +55,7 @@ void screen_gesture_event_cb(lv_event_t* e) {
lv_obj_t* screen = lv_event_get_current_target(e); lv_obj_t* screen = lv_event_get_current_target(e);
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act()); lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
if (dir == LV_DIR_BOTTOM) { if (dir == LV_DIR_BOTTOM) {
Serial.println("- Scene selection: swipe down received for navigating to scene selection page"); omote_log_d("- Scene selection: swipe down received for navigating to scene selection page\r\n");
executeCommand(SCENE_SELECTION); executeCommand(SCENE_SELECTION);
} }
} }
@ -77,7 +78,7 @@ void tabview_content_is_scrolling_event_cb(lv_event_t* e){
if ((tabviewX >= 475) && (tabviewX <= 480)) {tabviewX = 480;} if ((tabviewX >= 475) && (tabviewX <= 480)) {tabviewX = 480;}
// we need 158 more (the size of one page indicator), because we always have one more page indicator at the beginning and at the end (so normally 5 when having 3 tabs) // we need 158 more (the size of one page indicator), because we always have one more page indicator at the beginning and at the end (so normally 5 when having 3 tabs)
int16_t panelX = tabviewX * bias - offset + 158; int16_t panelX = tabviewX * bias - offset + 158;
// Serial.printf("scroll %d to %d\r\n", tabviewX, panelX); omote_log_v("scroll %d to %d\r\n", tabviewX, panelX);
lv_obj_scroll_to_x(panel, panelX, LV_ANIM_OFF); lv_obj_scroll_to_x(panel, panelX, LV_ANIM_OFF);
// lv_obj_scroll_to_x(panel, lv_obj_get_scroll_x(tabviewContent) * bias - offset, LV_ANIM_OFF); // lv_obj_scroll_to_x(panel, lv_obj_get_scroll_x(tabviewContent) * bias - offset, LV_ANIM_OFF);
} }
@ -118,7 +119,7 @@ void tabview_tab_changed_event_cb(lv_event_t* e) {
lv_anim_set_ready_cb(anim, tabview_animation_ready_cb); lv_anim_set_ready_cb(anim, tabview_animation_ready_cb);
} else { } else {
// Swipe is complete, no additional animation is needed. Most likely only possible in simulator // Swipe is complete, no additional animation is needed. Most likely only possible in simulator
Serial.println("Change of tab detected, without animation at the end. Will directly do my job after sliding."); omote_log_d("Change of tab detected, without animation at the end. Will directly do my job after sliding.\r\n");
guis_doTabCreationAfterSliding(newTabID); guis_doTabCreationAfterSliding(newTabID);
} }
} }

View file

@ -4,6 +4,7 @@
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/omote_log.h"
struct t_gui_on_tab { struct t_gui_on_tab {
lv_obj_t* tab; lv_obj_t* tab;
@ -85,11 +86,11 @@ bool gui_memoryOptimizer_isGUInameInMemory(std::string GUIname) {
} }
void notify_active_tabs_before_delete(t_gui_state *gui_state) { void notify_active_tabs_before_delete(t_gui_state *gui_state) {
Serial.printf(" Will notify tabs about deletion\r\n"); omote_log_d(" Will notify tabs about deletion\r\n");
std::string nameOfTab; std::string nameOfTab;
for (int index=0; index <= 2; index++) { for (int index=0; index <= 2; index++) {
if (gui_state->gui_on_tab[index].gui_list_index == -1) { if (gui_state->gui_on_tab[index].gui_list_index == -1) {
Serial.printf(" Will not notify tab %d about deletion because it does not exist\r\n", index); omote_log_d(" Will not notify tab %d about deletion because it does not exist\r\n", index);
continue; continue;
} }
@ -97,11 +98,11 @@ void notify_active_tabs_before_delete(t_gui_state *gui_state) {
// The gui_list might have changed (when switching from a scene specific list to the main list or vice versa), so index could have changed as well. // The gui_list might have changed (when switching from a scene specific list to the main list or vice versa), so index could have changed as well.
nameOfTab = gui_state->gui_on_tab[index].GUIname; nameOfTab = gui_state->gui_on_tab[index].GUIname;
if (nameOfTab == "") { if (nameOfTab == "") {
Serial.printf(" Will not notify tab %d about deletion because it is not set\r\n", index); omote_log_w(" Will not notify tab %d about deletion because it is not set\r\n", index);
} else if (registered_guis_byName_map.count(nameOfTab) == 0) { } else if (registered_guis_byName_map.count(nameOfTab) == 0) {
Serial.printf(" Can not notify tab %d about deletion because name \"%s\" was not found in registry\r\n", index, nameOfTab.c_str()); omote_log_w(" Can not notify tab %d about deletion because name \"%s\" was not found in registry\r\n", index, nameOfTab.c_str());
} else { } else {
Serial.printf(" Will notify tab %d with name \"%s\" about deletion\r\n", index, nameOfTab.c_str()); omote_log_d(" Will notify tab %d with name \"%s\" about deletion\r\n", index, nameOfTab.c_str());
registered_guis_byName_map.at(nameOfTab).this_notify_tab_before_delete(); registered_guis_byName_map.at(nameOfTab).this_notify_tab_before_delete();
} }
} }
@ -179,11 +180,11 @@ void create_new_tab(lv_obj_t* tabview, t_gui_on_tab *gui_on_tab) {
std::string nameOfTab = get_name_of_gui_to_be_shown(gui_on_tab->gui_list_index); std::string nameOfTab = get_name_of_gui_to_be_shown(gui_on_tab->gui_list_index);
if (nameOfTab == "") { if (nameOfTab == "") {
Serial.printf(" Will not create new tab because no name was provided\r\n"); omote_log_d(" Will not create new tab because no name was provided\r\n");
} else if (registered_guis_byName_map.count(nameOfTab) == 0) { } else if (registered_guis_byName_map.count(nameOfTab) == 0) {
Serial.printf(" Will not create new tab because name %s was not found in registry\r\n", nameOfTab.c_str()); omote_log_w(" Will not create new tab because name %s was not found in registry\r\n", nameOfTab.c_str());
} else { } else {
Serial.printf(" Will create tab with name \"%s\" \r\n", nameOfTab.c_str()); omote_log_d(" Will create tab with name \"%s\" \r\n", nameOfTab.c_str());
// save name of tab for deletion later // save name of tab for deletion later
gui_on_tab->GUIname = nameOfTab; gui_on_tab->GUIname = nameOfTab;
// create tab and save pointer to tab in gui_on_tab // create tab and save pointer to tab in gui_on_tab
@ -207,7 +208,7 @@ void setGUIlistIndicesToBeShown_forSpecificGUIlistIndex(int gui_list_index, t_gu
// Set the gui_list_indeces to be shown for a specific gui_list_index // Set the gui_list_indeces to be shown for a specific gui_list_index
if (gui_list_index == 0) { if (gui_list_index == 0) {
// first state // first state
Serial.printf(" GUIlistIndices: will resume at specific index with \"first state\"\r\n"); omote_log_d(" GUIlistIndices: will resume at specific index with \"first state\"\r\n");
gui_state->gui_on_tab[0] = {NULL, "", 0}; gui_state->gui_on_tab[0] = {NULL, "", 0};
// take care if there is only one gui in list // take care if there is only one gui in list
gui_state->gui_on_tab[1] = {NULL, "", get_gui_list_active_withFallback()->size() >= 2 ? 1 : -1}; gui_state->gui_on_tab[1] = {NULL, "", get_gui_list_active_withFallback()->size() >= 2 ? 1 : -1};
@ -215,14 +216,14 @@ void setGUIlistIndicesToBeShown_forSpecificGUIlistIndex(int gui_list_index, t_gu
gui_state->activeTabID = 0; gui_state->activeTabID = 0;
} else if (gui_list_index == get_gui_list_active_withFallback()->size() -1) { } else if (gui_list_index == get_gui_list_active_withFallback()->size() -1) {
// last state // last state
Serial.printf(" GUIlistIndices: will resume at specific index with \"last state\"\r\n"); omote_log_d(" GUIlistIndices: will resume at specific index with \"last state\"\r\n");
gui_state->gui_on_tab[0] = {NULL, "", gui_list_index -1}; gui_state->gui_on_tab[0] = {NULL, "", gui_list_index -1};
gui_state->gui_on_tab[1] = {NULL, "", gui_list_index}; gui_state->gui_on_tab[1] = {NULL, "", gui_list_index};
gui_state->gui_on_tab[2] = {NULL, "", -1}; gui_state->gui_on_tab[2] = {NULL, "", -1};
gui_state->activeTabID = 1; gui_state->activeTabID = 1;
} else { } else {
// any other state // any other state
Serial.printf(" GUIlistIndices: will resume at specific index with \"state between\"\r\n"); omote_log_d(" GUIlistIndices: will resume at specific index with \"state between\"\r\n");
gui_state->gui_on_tab[0] = {NULL, "", gui_list_index -1}; gui_state->gui_on_tab[0] = {NULL, "", gui_list_index -1};
gui_state->gui_on_tab[1] = {NULL, "", gui_list_index}; gui_state->gui_on_tab[1] = {NULL, "", gui_list_index};
gui_state->gui_on_tab[2] = {NULL, "", gui_list_index +1}; gui_state->gui_on_tab[2] = {NULL, "", gui_list_index +1};
@ -231,7 +232,7 @@ void setGUIlistIndicesToBeShown_forSpecificGUIlistIndex(int gui_list_index, t_gu
} }
void setGUIlistIndicesToBeShown_forFirstGUIinGUIlist(t_gui_state *gui_state) { void setGUIlistIndicesToBeShown_forFirstGUIinGUIlist(t_gui_state *gui_state) {
Serial.printf(" GUIlistIndices: will show the first gui from \"gui_list\" as initial state\r\n"); omote_log_d(" GUIlistIndices: will show the first gui from \"gui_list\" as initial state\r\n");
// take care if there is no gui in list // take care if there is no gui in list
gui_state->gui_on_tab[0] = {NULL, "", get_gui_list_active_withFallback()->size() != 0 ? 0 : -1}; gui_state->gui_on_tab[0] = {NULL, "", get_gui_list_active_withFallback()->size() != 0 ? 0 : -1};
// take care if there is only one gui in list // take care if there is only one gui in list
@ -245,7 +246,7 @@ void setGUIlistIndicesToBeShown_afterSlide(t_gui_state *gui_state) {
if (gui_state->oldTabID > gui_state->activeTabID) { if (gui_state->oldTabID > gui_state->activeTabID) {
// swipe to previous item in list // swipe to previous item in list
Serial.printf(" Will swipe to previous item in list\r\n"); omote_log_d(" Will swipe to previous item in list\r\n");
oldListIndex = gui_state->gui_on_tab[1].gui_list_index_previous; oldListIndex = gui_state->gui_on_tab[1].gui_list_index_previous;
if ((oldListIndex == 1)) { if ((oldListIndex == 1)) {
// next state is the "first state" // next state is the "first state"
@ -261,7 +262,7 @@ void setGUIlistIndicesToBeShown_afterSlide(t_gui_state *gui_state) {
} }
} else { } else {
// swipe to next item in list // swipe to next item in list
Serial.printf(" Will swipe to next item in list\r\n"); omote_log_d(" Will swipe to next item in list\r\n");
if (gui_state->gui_on_tab[2].gui_list_index_previous == -1) { if (gui_state->gui_on_tab[2].gui_list_index_previous == -1) {
// last state was the first state // last state was the first state
oldListIndex = gui_state->gui_on_tab[0].gui_list_index_previous; // is always 0 oldListIndex = gui_state->gui_on_tab[0].gui_list_index_previous; // is always 0
@ -287,14 +288,14 @@ void setGUIlistIndicesToBeShown_afterSlide(t_gui_state *gui_state) {
void doTabCreation_strategyMax3(lv_obj_t* tabview, t_gui_state *gui_state) { void doTabCreation_strategyMax3(lv_obj_t* tabview, t_gui_state *gui_state) {
// create the tabs // create the tabs
Serial.printf(" Will create tabs. List indices of the three tabs are %d, %d, %d, tab nr %d will be activated\r\n", gui_state->gui_on_tab[0].gui_list_index, gui_state->gui_on_tab[1].gui_list_index, gui_state->gui_on_tab[2].gui_list_index, gui_state->activeTabID); omote_log_d(" Will create tabs. List indices of the three tabs are %d, %d, %d, tab nr %d will be activated\r\n", gui_state->gui_on_tab[0].gui_list_index, gui_state->gui_on_tab[1].gui_list_index, gui_state->gui_on_tab[2].gui_list_index, gui_state->activeTabID);
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
create_new_tab(tabview, &gui_state->gui_on_tab[i]); create_new_tab(tabview, &gui_state->gui_on_tab[i]);
} }
if (get_gui_list_active_withFallback()->size() > 0) { if (get_gui_list_active_withFallback()->size() > 0) {
std::string nameOfNewActiveTab = get_gui_list_active_withFallback()->at(gui_state->gui_on_tab[gui_state->activeTabID].gui_list_index); std::string nameOfNewActiveTab = get_gui_list_active_withFallback()->at(gui_state->gui_on_tab[gui_state->activeTabID].gui_list_index);
Serial.printf(" New visible tab is \"%s\"\r\n", nameOfNewActiveTab.c_str()); omote_log_d(" New visible tab is \"%s\"\r\n", nameOfNewActiveTab.c_str());
// set active tab // set active tab
setActiveTab(gui_state->activeTabID, LV_ANIM_OFF); setActiveTab(gui_state->activeTabID, LV_ANIM_OFF);
@ -306,10 +307,10 @@ LV_IMG_DECLARE(gradientLeft);
LV_IMG_DECLARE(gradientRight); LV_IMG_DECLARE(gradientRight);
void fillPanelWithPageIndicator_strategyMax3(lv_obj_t* panel, lv_obj_t* img1, lv_obj_t* img2, t_gui_state *gui_state) { void fillPanelWithPageIndicator_strategyMax3(lv_obj_t* panel, lv_obj_t* img1, lv_obj_t* img2, t_gui_state *gui_state) {
Serial.printf(" Will fill panel with page indicators\r\n"); omote_log_d(" Will fill panel with page indicators\r\n");
if (get_gui_list_active_withFallback()->size() == 0) { if (get_gui_list_active_withFallback()->size() == 0) {
Serial.printf(" no tab available, so no page indicators\r\n"); omote_log_d(" no tab available, so no page indicators\r\n");
// at least add the style // at least add the style
lv_obj_add_style(panel, &panel_style, 0); lv_obj_add_style(panel, &panel_style, 0);
#ifdef drawRedBorderAroundMainWidgets #ifdef drawRedBorderAroundMainWidgets
@ -529,7 +530,7 @@ void gui_memoryOptimizer_doContentCreation(lv_obj_t** tabview, lv_obj_t** panel,
// find the position of the current GUI in the gui list which was active last (both were automatically saved in the preferences) // find the position of the current GUI in the gui list which was active last (both were automatically saved in the preferences)
void gui_memoryOptimizer_onStartup(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2) { void gui_memoryOptimizer_onStartup(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2) {
Serial.printf("Startup: try to resume at scene \"%s\" with GUI \"%s\"\r\n", gui_memoryOptimizer_getActiveSceneName().c_str(), gui_memoryOptimizer_getActiveGUIname().c_str()); omote_log_i("Startup: try to resume at scene \"%s\" with GUI \"%s\"\r\n", gui_memoryOptimizer_getActiveSceneName().c_str(), gui_memoryOptimizer_getActiveGUIname().c_str());
// Get last state from preferences and save it in gui_state // Get last state from preferences and save it in gui_state
// So it is ok to call them without using the return values. // So it is ok to call them without using the return values.
@ -543,7 +544,7 @@ void gui_memoryOptimizer_onStartup(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_
// find index of gui_memoryOptimizer_getActiveGUIname() in gui_list_active // find index of gui_memoryOptimizer_getActiveGUIname() in gui_list_active
for (int i=0; i<get_gui_list_active_withFallback()->size(); i++) { for (int i=0; i<get_gui_list_active_withFallback()->size(); i++) {
if (get_gui_list_active_withFallback()->at(i) == gui_memoryOptimizer_getActiveGUIname()) { if (get_gui_list_active_withFallback()->at(i) == gui_memoryOptimizer_getActiveGUIname()) {
Serial.printf("Startup: found GUI with name \"%s\" in \"gui_list_active\" at position %d\r\n", gui_memoryOptimizer_getActiveGUIname().c_str(), i); omote_log_i("Startup: found GUI with name \"%s\" in \"gui_list_active\" at position %d\r\n", gui_memoryOptimizer_getActiveGUIname().c_str(), i);
gui_list_index = i; gui_list_index = i;
break; break;
} }
@ -556,7 +557,7 @@ void gui_memoryOptimizer_onStartup(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_
} else { } else {
// gui was not found // gui was not found
Serial.printf("Startup: GUI with name \"%s\" was not found. Will start with first GUI of main_gui_list\r\n", gui_memoryOptimizer_getActiveGUIname().c_str()); omote_log_w("Startup: GUI with name \"%s\" was not found. Will start with first GUI of main_gui_list\r\n", gui_memoryOptimizer_getActiveGUIname().c_str());
gui_memoryOptimizer_setActiveGUIlist(MAIN_GUI_LIST); gui_memoryOptimizer_setActiveGUIlist(MAIN_GUI_LIST);
setGUIlistIndicesToBeShown_forFirstGUIinGUIlist(&gui_state); setGUIlistIndicesToBeShown_forFirstGUIinGUIlist(&gui_state);
@ -576,12 +577,12 @@ void gui_memoryOptimizer_afterSliding(lv_obj_t** tabview, lv_obj_t** panel, lv_o
// So we always have 3 tabs. // So we always have 3 tabs.
// After the animation, the tabview and hence all tabs are deleted and recreated. // After the animation, the tabview and hence all tabs are deleted and recreated.
Serial.printf("--- Start of tab deletion and creation\r\n"); omote_log_d("--- Start of tab deletion and creation\r\n");
gui_state.oldTabID = gui_state.activeTabID; gui_state.oldTabID = gui_state.activeTabID;
gui_state.activeTabID = newTabID; gui_state.activeTabID = newTabID;
Serial.printf("Changing from oldTabID %d \"%s\" to newTabID %d \"%s\"\r\n", omote_log_d("Changing from oldTabID %d \"%s\" to newTabID %d \"%s\"\r\n",
gui_state.oldTabID, gui_state.gui_on_tab[gui_state.oldTabID].GUIname.c_str(), gui_state.oldTabID, gui_state.gui_on_tab[gui_state.oldTabID].GUIname.c_str(),
gui_state.activeTabID, gui_state.gui_on_tab[gui_state.activeTabID].GUIname.c_str()); gui_state.activeTabID, gui_state.gui_on_tab[gui_state.activeTabID].GUIname.c_str());
@ -608,7 +609,7 @@ void gui_memoryOptimizer_afterSliding(lv_obj_t** tabview, lv_obj_t** panel, lv_o
// 3. after gui list has changed (called by handleScene()), when switching between main_gui_list and scene specific list. Will show first GUi in list // 3. after gui list has changed (called by handleScene()), when switching between main_gui_list and scene specific list. Will show first GUi in list
void gui_memoryOptimizer_afterGUIlistChanged(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2, GUIlists newGUIlist) { void gui_memoryOptimizer_afterGUIlistChanged(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2, GUIlists newGUIlist) {
Serial.printf("--- Will change to new gui_list\r\n"); omote_log_d("--- Will change to new gui_list\r\n");
if (gui_state.last_active_gui_list != newGUIlist) { if (gui_state.last_active_gui_list != newGUIlist) {
// we are changing the gui_list, so save the last_active_gui_list_index // we are changing the gui_list, so save the last_active_gui_list_index
@ -630,10 +631,10 @@ void gui_memoryOptimizer_afterGUIlistChanged(lv_obj_t** tabview, lv_obj_t** pane
// 4. navigate to a specific GUI in gui_list // 4. navigate to a specific GUI in gui_list
void gui_memoryOptimizer_navigateToGUI(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2, GUIlists GUIlist, int gui_list_index) { void gui_memoryOptimizer_navigateToGUI(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2, GUIlists GUIlist, int gui_list_index) {
Serial.printf("--- Will navigate to specific GUI\r\n"); omote_log_d("--- Will navigate to specific GUI\r\n");
if ( !((gui_list_index >= 0) && (gui_list_index < get_gui_list_withFallback(GUIlist)->size()))) { if ( !((gui_list_index >= 0) && (gui_list_index < get_gui_list_withFallback(GUIlist)->size()))) {
Serial.printf(" cannot navigate to GUI because gui_list_index \"%d\" is out of range\r\n", gui_list_index); omote_log_w(" cannot navigate to GUI because gui_list_index \"%d\" is out of range\r\n", gui_list_index);
return; return;
} }
@ -658,15 +659,15 @@ void gui_memoryOptimizer_navigateToGUI(lv_obj_t** tabview, lv_obj_t** panel, lv_
void gui_memoryOptimizer_navigateToLastActiveGUIofPreviousGUIlist(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2) { void gui_memoryOptimizer_navigateToLastActiveGUIofPreviousGUIlist(lv_obj_t** tabview, lv_obj_t** panel, lv_obj_t** img1, lv_obj_t** img2) {
#if (USE_SCENE_SPECIFIC_GUI_LIST == 0) #if (USE_SCENE_SPECIFIC_GUI_LIST == 0)
Serial.printf("--- Cannot navigate to last GUI from scene, because scene specific gui lists are not enabled\r\n"); omote_log_w("--- Cannot navigate to last GUI from scene, because scene specific gui lists are not enabled\r\n");
return; return;
#endif #endif
if (gui_memoryOptimizer_getLastActiveGUIlistIndex() == -1) { if (gui_memoryOptimizer_getLastActiveGUIlistIndex() == -1) {
Serial.printf("--- Cannot navigate to last GUI from scene, because it is not set\r\n"); omote_log_w("--- Cannot navigate to last GUI from scene, because it is not set\r\n");
return; return;
} else { } else {
Serial.printf("--- Will navigate to last GUI from scene\r\n"); omote_log_d("--- Will navigate to last GUI from scene\r\n");
} }
// navigate to the other gui_list // navigate to the other gui_list
@ -706,6 +707,6 @@ void gui_memoryOptimizer_doContentCreation(lv_obj_t** tabview, lv_obj_t** panel,
// so that we can use SCENE_BACK_TO_PREVIOUS_GUI_LIST // so that we can use SCENE_BACK_TO_PREVIOUS_GUI_LIST
gui_state->last_active_gui_list = gui_memoryOptimizer_getActiveGUIlist(); gui_state->last_active_gui_list = gui_memoryOptimizer_getActiveGUIlist();
Serial.printf("------------ End of tab deletion and creation\r\n"); omote_log_d("------------ End of tab deletion and creation\r\n");
} }

View file

@ -7,6 +7,7 @@
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/omote_log.h"
#include "scenes/scene__default.h" #include "scenes/scene__default.h"
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
@ -27,7 +28,7 @@ void register_gui(
) { ) {
if (registered_guis_byName_map.count(a_name) > 0) { if (registered_guis_byName_map.count(a_name) > 0) {
Serial.printf("ERROR!!!: you cannot register two guis having the same name '%s'\r\n", a_name.c_str()); omote_log_e("ERROR!!!: you cannot register two guis having the same name '%s'\r\n", a_name.c_str());
return; return;
} }

View file

@ -3,6 +3,7 @@
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
const uint8_t ROWS = 5; //five rows const uint8_t ROWS = 5; //five rows
const uint8_t COLS = 5; //five columns const uint8_t COLS = 5; //five columns
@ -36,10 +37,10 @@ void doShortPress(char keyChar, int keyCode){
uint16_t command = get_command_short(gui_memoryOptimizer_getActiveSceneName(), keyChar); uint16_t command = get_command_short(gui_memoryOptimizer_getActiveSceneName(), keyChar);
if (command != COMMAND_UNKNOWN) { if (command != COMMAND_UNKNOWN) {
Serial.printf("key: key '%c', will use command '%u'\r\n", keyChar, command); omote_log_d("key: key '%c', will use command '%u'\r\n", keyChar, command);
executeCommand(command); executeCommand(command);
} else { } else {
Serial.printf("key: key '%c', but no command defined\r\n", keyChar); omote_log_w("key: key '%c', but no command defined\r\n", keyChar);
} }
} }
} }
@ -47,10 +48,10 @@ void doShortPress(char keyChar, int keyCode){
void doLongPress(char keyChar, int keyCode){ void doLongPress(char keyChar, int keyCode){
uint16_t command = get_command_long(gui_memoryOptimizer_getActiveSceneName(), keyChar); uint16_t command = get_command_long(gui_memoryOptimizer_getActiveSceneName(), keyChar);
if (command != COMMAND_UNKNOWN) { if (command != COMMAND_UNKNOWN) {
Serial.printf("key: key '%c' (long press), will use command '%u'\r\n", keyChar, command); omote_log_d("key: key '%c' (long press), will use command '%u'\r\n", keyChar, command);
executeCommand(command); executeCommand(command);
} else { } else {
Serial.printf("key: key '%c' (long press), but no command defined\r\n", keyChar); omote_log_w("key: key '%c' (long press), but no command defined\r\n", keyChar);
} }
} }
@ -69,52 +70,52 @@ void keypad_loop(void) {
int keyCode = keypad_keys[i].kcode; int keyCode = keypad_keys[i].kcode;
if (keypad_keys[i].kstate == PRESSED) { if (keypad_keys[i].kstate == PRESSED) {
// Serial.println("pressed"); omote_log_v("pressed\r\n");
if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != PRESSED)) { if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != PRESSED)) {
// Serial.printf("key: PRESSED of SHORT key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: PRESSED of SHORT key %c (%d)\r\n", keyChar, keyCode);
doShortPress(keyChar, keyCode); doShortPress(keyChar, keyCode);
} else if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT_REPEATED) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != PRESSED)) { // here do not repeat it too early, do the repeat only in HOLD } else if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT_REPEATED) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != PRESSED)) { // here do not repeat it too early, do the repeat only in HOLD
// Serial.printf("key: PRESSED of SHORT_REPEATED key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: PRESSED of SHORT_REPEATED key %c (%d)\r\n", keyChar, keyCode);
doShortPress(keyChar, keyCode); doShortPress(keyChar, keyCode);
} }
lastKeyState[keyCode/ROWS][keyCode%ROWS] = PRESSED; lastKeyState[keyCode/ROWS][keyCode%ROWS] = PRESSED;
} else if (keypad_keys[i].kstate == HOLD) { } else if (keypad_keys[i].kstate == HOLD) {
// Serial.println("hold"); omote_log_v("hold\r\n");
if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORTorLONG) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != HOLD)) { if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORTorLONG) && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != HOLD)) {
// Serial.printf("key: HOLD of SHORTorLONG key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: HOLD of SHORTorLONG key %c (%d)\r\n", keyChar, keyCode);
// Serial.printf("will set keyIsHold to TRUE for keycode %d\r\n", keyCode); omote_log_v("will set keyIsHold to TRUE for keycode %d\r\n", keyCode);
keyIsHold[keyCode/ROWS][keyCode%ROWS] = true; keyIsHold[keyCode/ROWS][keyCode%ROWS] = true;
doLongPress(keyChar, keyCode); doLongPress(keyChar, keyCode);
} else if (get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT_REPEATED) { // this is the only case where we do not check the lastKeyState, because here it is intended to repeat the action } else if (get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORT_REPEATED) { // this is the only case where we do not check the lastKeyState, because here it is intended to repeat the action
// Serial.printf("key: HOLD of SHORT_REPEATED key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: HOLD of SHORT_REPEATED key %c (%d)\r\n", keyChar, keyCode);
doShortPress(keyChar, keyCode); doShortPress(keyChar, keyCode);
} }
lastKeyState[keyCode/ROWS][keyCode%ROWS] = HOLD; lastKeyState[keyCode/ROWS][keyCode%ROWS] = HOLD;
} else if (keypad_keys[i].kstate == RELEASED) { } else if (keypad_keys[i].kstate == RELEASED) {
// Serial.println("released"); omote_log_v("released\r\n");
if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORTorLONG) && !keyIsHold[keyCode/ROWS][keyCode%ROWS] && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != RELEASED)) { if ((get_key_repeatMode(gui_memoryOptimizer_getActiveSceneName(), keyChar) == SHORTorLONG) && !keyIsHold[keyCode/ROWS][keyCode%ROWS] && (lastKeyState[keyCode/ROWS][keyCode%ROWS] != RELEASED)) {
// Serial.printf("value of keyIsHold for keycode %d is %d\r\n", keyCode, keyIsHold[keyCode/ROWS][keyCode%ROWS]); omote_log_v("value of keyIsHold for keycode %d is %d\r\n", keyCode, keyIsHold[keyCode/ROWS][keyCode%ROWS]);
// Serial.printf("key: RELEASED of SHORTorLONG key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: RELEASED of SHORTorLONG key %c (%d)\r\n", keyChar, keyCode);
doShortPress(keyChar, keyCode); doShortPress(keyChar, keyCode);
} }
// Serial.printf("will set keyIsHold to FALSE for keycode %d\r\n", keyCode); omote_log_v("will set keyIsHold to FALSE for keycode %d\r\n", keyCode);
keyIsHold[keyCode/ROWS][keyCode%ROWS] = false; keyIsHold[keyCode/ROWS][keyCode%ROWS] = false;
// Serial.printf("key: press of key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: press of key %c (%d)\r\n", keyChar, keyCode);
lastKeyState[keyCode/ROWS][keyCode%ROWS] = RELEASED; lastKeyState[keyCode/ROWS][keyCode%ROWS] = RELEASED;
} else if (keypad_keys[i].kstate == IDLE) { } else if (keypad_keys[i].kstate == IDLE) {
// Serial.println("idle"); omote_log_v("idle\r\n");
// Serial.printf("key: idle of key %c (%d)\r\n", keyChar, keyCode); omote_log_v("key: idle of key %c (%d)\r\n", keyChar, keyCode);
lastKeyState[keyCode/ROWS][keyCode%ROWS] = IDLE; lastKeyState[keyCode/ROWS][keyCode%ROWS] = IDLE;
} }

View file

@ -1,6 +1,7 @@
#include <lvgl.h> #include <lvgl.h>
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/omote_log.h"
bool showMemoryUsage = 0; bool showMemoryUsage = 0;
@ -22,7 +23,7 @@ void setShowMemoryUsage(bool aShowMemoryUsage) {
} }
void doLogMemoryUsage() { void doLogMemoryUsage() {
// Serial.println("inside doLogMemoryUsage"); omote_log_v("inside doLogMemoryUsage\r\n");
unsigned long systemHeapSize; unsigned long systemHeapSize;
unsigned long freeSystemHeap; unsigned long freeSystemHeap;
unsigned long maxAllocSystemHeap; unsigned long maxAllocSystemHeap;
@ -51,13 +52,13 @@ void doLogMemoryUsage() {
#if defined(SHOW_LOG_ON_SERIAL) #if defined(SHOW_LOG_ON_SERIAL)
// Serial log every 5 sec // Serial log every 5 sec
if(millis() - updateSerialLogTimer >= 5000) { if(millis() - updateSerialLogTimer >= 5000) {
// Serial.println("inside doLogMemoryUsage: will do serial log"); omote_log_v("inside doLogMemoryUsage: will do serial log\r\n");
updateSerialLogTimer = millis(); updateSerialLogTimer = millis();
if (doESPHeapWarning) { if (doESPHeapWarning) {
Serial.println("WARNING: ESP heap is getting low. You might encounter weird behaviour of your OMOTE, especially when using WiFi and/or BLE."); omote_log_w("WARNING: ESP heap is getting low. You might encounter weird behaviour of your OMOTE, especially when using WiFi and/or BLE.\r\n");
} }
Serial.printf( omote_log_d(
"ESP32 heap: size: %6lu, used: %6lu (%2.0f%%), free: %6lu (%2.0f%%), heapMax: %6lu, heapMin: %6lu\r\n", "ESP32 heap: size: %6lu, used: %6lu (%2.0f%%), free: %6lu (%2.0f%%), heapMax: %6lu, heapMin: %6lu\r\n",
systemHeapSize, systemHeapSize,
systemHeapSize - freeSystemHeap, float(systemHeapSize - freeSystemHeap) / systemHeapSize * 100, systemHeapSize - freeSystemHeap, float(systemHeapSize - freeSystemHeap) / systemHeapSize * 100,
@ -66,9 +67,9 @@ void doLogMemoryUsage() {
#if LV_MEM_CUSTOM == 0 #if LV_MEM_CUSTOM == 0
if (doLVGLMemoryWarning) { if (doLVGLMemoryWarning) {
Serial.println("WARNING: LVGL memory is getting low. You GUI might stop working. In that case, increase \"-D LV_MEM_SIZE\" in platformio.ini"); omote_log_w("WARNING: LVGL memory is getting low. You GUI might stop working. In that case, increase \"-D LV_MEM_SIZE\" in platformio.ini\r\n");
} }
Serial.printf( omote_log_d(
"lvgl memory: size: %6lu, used: %6lu (%2d%%), free: %6lu (%2d%%), max_used: %6lu, free_biggest: %6lu, frag_pct: %2d%%\r\n", "lvgl memory: size: %6lu, used: %6lu (%2d%%), free: %6lu (%2d%%), max_used: %6lu, free_biggest: %6lu, frag_pct: %2d%%\r\n",
mon.total_size, mon.total_size,
mon.total_size - mon.free_size, mon.used_pct, mon.total_size - mon.free_size, mon.used_pct,
@ -76,7 +77,7 @@ void doLogMemoryUsage() {
mon.max_used, mon.free_biggest_size, mon.frag_pct); mon.max_used, mon.free_biggest_size, mon.frag_pct);
#endif #endif
} else { } else {
// Serial.println("inside doLogMemoryUsage: serial log skipped"); omote_log_v("inside doLogMemoryUsage: serial log skipped\r\n");
} }
#endif #endif
@ -115,7 +116,7 @@ void doLogMemoryUsage() {
} }
} }
if (MemoryUsageLabel != NULL) { if (MemoryUsageLabel != NULL) {
// Serial.printf("inside doLogMemoryUsage: will do GUI log %s\r\n", buffer); omote_log_v("inside doLogMemoryUsage: will do GUI log %s\r\n", buffer);
lv_label_set_text(MemoryUsageLabel, buffer); lv_label_set_text(MemoryUsageLabel, buffer);
} }
} else { } else {

View file

@ -0,0 +1,66 @@
#ifndef __OMOTE_LOG_H__
#define __OMOTE_LOG_H__
#ifdef __cplusplus
extern "C"
{
#endif
#define OMOTE_LOG_LEVEL_NONE (0)
#define OMOTE_LOG_LEVEL_ERROR (1)
#define OMOTE_LOG_LEVEL_WARN (2)
#define OMOTE_LOG_LEVEL_INFO (3)
#define OMOTE_LOG_LEVEL_DEBUG (4)
#define OMOTE_LOG_LEVEL_VERBOSE (5)
#ifndef CONFIG_OMOTE_LOG_DEFAULT_LEVEL
#define CONFIG_OMOTE_LOG_DEFAULT_LEVEL OMOTE_LOG_LEVEL_NONE
#endif
#ifndef OMOTE_LOG_LEVEL
#define OMOTE_LOG_LEVEL CONFIG_OMOTE_LOG_DEFAULT_LEVEL
#endif
#define OMOTE_LOG_FORMAT(letter, format) "[OMOTE " #letter "][%8lu]: " format , (unsigned long) millis()
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_VERBOSE
#define omote_log_v(format, ...) Serial.printf(OMOTE_LOG_FORMAT(V, format), ##__VA_ARGS__)
#else
#define omote_log_v(format, ...) do {} while(0)
#endif
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_DEBUG
#define omote_log_d(format, ...) Serial.printf(OMOTE_LOG_FORMAT(D, format), ##__VA_ARGS__)
#else
#define omote_log_d(format, ...) do {} while(0)
#endif
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_INFO
#define omote_log_i(format, ...) Serial.printf(OMOTE_LOG_FORMAT(I, format), ##__VA_ARGS__)
#else
#define omote_log_i(format, ...) do {} while(0)
#endif
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_WARN
#define omote_log_w(format, ...) Serial.printf(OMOTE_LOG_FORMAT(W, format), ##__VA_ARGS__)
#else
#define omote_log_w(format, ...) do {} while(0)
#endif
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_ERROR
#define omote_log_e(format, ...) Serial.printf(OMOTE_LOG_FORMAT(E, format), ##__VA_ARGS__)
#else
#define omote_log_e(format, ...) do {} while(0)
#endif
#if OMOTE_LOG_LEVEL >= OMOTE_LOG_LEVEL_NONE
#define omote_log_n(format, ...) Serial.printf(OMOTE_LOG_FORMAT(E, format), ##__VA_ARGS__)
#else
#define omote_log_n(format, ...) do {} while(0)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __OMOTE_LOG_H__ */

View file

@ -5,6 +5,7 @@
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
#include "guis/gui_sceneSelection.h" #include "guis/gui_sceneSelection.h"
#include "scenes/scene__default.h" #include "scenes/scene__default.h"
@ -23,7 +24,7 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
// --- do not switch scene, but show scene selection gui. From that on, we are in the main_gui_list. ---------------- // --- do not switch scene, but show scene selection gui. From that on, we are in the main_gui_list. ----------------
if (scene_name == scene_name_selection) { if (scene_name == scene_name_selection) {
Serial.println("scene: will show scene selection gui"); omote_log_d("scene: will show scene selection gui\r\n");
showSpecificGUI(MAIN_GUI_LIST, tabName_sceneSelection); showSpecificGUI(MAIN_GUI_LIST, tabName_sceneSelection);
return; return;
} }
@ -32,17 +33,17 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
if ((scene_name == scene_gui_next) || (scene_name == scene_gui_prev)) { if ((scene_name == scene_gui_next) || (scene_name == scene_gui_prev)) {
if (scene_name == scene_gui_prev) { if (scene_name == scene_gui_prev) {
if (gui_memoryOptimizer_getActiveTabID() == 0) { if (gui_memoryOptimizer_getActiveTabID() == 0) {
Serial.println("scene: cannot navigate to prev gui, because there is none"); omote_log_d("scene: cannot navigate to prev gui, because there is none\r\n");
} else { } else {
Serial.println("scene: will navigate to prev gui"); omote_log_d("scene: will navigate to prev gui\r\n");
setActiveTab(gui_memoryOptimizer_getActiveTabID() -1, LV_ANIM_ON, true); setActiveTab(gui_memoryOptimizer_getActiveTabID() -1, LV_ANIM_ON, true);
} }
} else if (scene_name == scene_gui_next) { } else if (scene_name == scene_gui_next) {
if (!gui_memoryOptimizer_isTabIDInMemory(gui_memoryOptimizer_getActiveTabID() +1)) { if (!gui_memoryOptimizer_isTabIDInMemory(gui_memoryOptimizer_getActiveTabID() +1)) {
Serial.println("scene: cannot navigate to next gui, because there is none"); omote_log_d("scene: cannot navigate to next gui, because there is none\r\n");
} else { } else {
Serial.println("scene: will navigate to next gui"); omote_log_d("scene: will navigate to next gui\r\n");
setActiveTab(gui_memoryOptimizer_getActiveTabID() +1, LV_ANIM_ON, true); setActiveTab(gui_memoryOptimizer_getActiveTabID() +1, LV_ANIM_ON, true);
} }
@ -54,10 +55,10 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
if (scene_name == scene_back_to_previous_gui_list) { if (scene_name == scene_back_to_previous_gui_list) {
if (get_scene_has_gui_list(gui_memoryOptimizer_getActiveSceneName())) { if (get_scene_has_gui_list(gui_memoryOptimizer_getActiveSceneName())) {
Serial.println("scene: will navigate back to last active gui from previous gui list"); omote_log_d("scene: will navigate back to last active gui from previous gui list\r\n");
guis_doTabCreationForNavigateToLastActiveGUIofPreviousGUIlist(); guis_doTabCreationForNavigateToLastActiveGUIofPreviousGUIlist();
} else { } else {
Serial.println("scene: cannot navigate back to last active gui from previous gui list, because no scene specific gui list was defined"); omote_log_d("scene: cannot navigate back to last active gui from previous gui list, because no scene specific gui list was defined\r\n");
} }
return; return;
@ -79,19 +80,19 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
// check if we know the new scene // check if we know the new scene
if (!sceneExists(scene_name)) { if (!sceneExists(scene_name)) {
Serial.printf("scene: cannot start scene %s, because it is unknown\r\n", scene_name.c_str()); omote_log_w("scene: cannot start scene %s, because it is unknown\r\n", scene_name.c_str());
return; return;
} else { } else {
Serial.printf("scene: will switch from old scene %s to new scene %s\r\n", gui_memoryOptimizer_getActiveSceneName().c_str(), scene_name.c_str()); omote_log_d("scene: will switch from old scene %s to new scene %s\r\n", gui_memoryOptimizer_getActiveSceneName().c_str(), scene_name.c_str());
} }
// do not activate the same scene again, only when forced to do so (e.g. by long press on the gui or when selected by hardware key) // do not activate the same scene again, only when forced to do so (e.g. by long press on the gui or when selected by hardware key)
bool callEndAndStartSequences; bool callEndAndStartSequences;
if ((scene_name == gui_memoryOptimizer_getActiveSceneName()) && ((isForcePayload != "FORCE") && (additionalPayload != "FORCE"))) { if ((scene_name == gui_memoryOptimizer_getActiveSceneName()) && ((isForcePayload != "FORCE") && (additionalPayload != "FORCE"))) {
Serial.printf("scene: will not start scene again, because it is already active\r\n"); omote_log_d("scene: will not start scene again, because it is already active\r\n");
callEndAndStartSequences = false; callEndAndStartSequences = false;
} else if ((scene_name == gui_memoryOptimizer_getActiveSceneName()) && ((isForcePayload == "FORCE") || (additionalPayload == "FORCE"))) { } else if ((scene_name == gui_memoryOptimizer_getActiveSceneName()) && ((isForcePayload == "FORCE") || (additionalPayload == "FORCE"))) {
Serial.printf("scene: scene is already active, but FORCE was set, so start scene again\r\n"); omote_log_d("scene: scene is already active, but FORCE was set, so start scene again\r\n");
callEndAndStartSequences = true; callEndAndStartSequences = true;
} else { } else {
// this is the default when switching to a different scene // this is the default when switching to a different scene
@ -104,18 +105,18 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
if (callEndAndStartSequences) { if (callEndAndStartSequences) {
// end old scene // end old scene
if (!sceneExists(gui_memoryOptimizer_getActiveSceneName()) && (gui_memoryOptimizer_getActiveSceneName() != "")) { if (!sceneExists(gui_memoryOptimizer_getActiveSceneName()) && (gui_memoryOptimizer_getActiveSceneName() != "")) {
Serial.printf("scene: WARNING: cannot end scene %s, because it is unknown\r\n", gui_memoryOptimizer_getActiveSceneName().c_str()); omote_log_w("scene: WARNING: cannot end scene %s, because it is unknown\r\n", gui_memoryOptimizer_getActiveSceneName().c_str());
} else { } else {
if (gui_memoryOptimizer_getActiveSceneName() != "") { if (gui_memoryOptimizer_getActiveSceneName() != "") {
Serial.printf("scene: will call end sequence for scene %s\r\n", gui_memoryOptimizer_getActiveSceneName().c_str()); omote_log_d("scene: will call end sequence for scene %s\r\n", gui_memoryOptimizer_getActiveSceneName().c_str());
scene_end_sequence_from_registry(gui_memoryOptimizer_getActiveSceneName()); scene_end_sequence_from_registry(gui_memoryOptimizer_getActiveSceneName());
} }
} }
// start new scene // start new scene
Serial.printf("scene: will call start sequence for scene %s\r\n", scene_name.c_str()); omote_log_d("scene: will call start sequence for scene %s\r\n", scene_name.c_str());
scene_start_sequence_from_registry(scene_name); scene_start_sequence_from_registry(scene_name);
} }
@ -123,7 +124,7 @@ void handleScene(uint16_t command, commandData commandData, std::string addition
if (SceneLabel != NULL) {lv_label_set_text(SceneLabel, gui_memoryOptimizer_getActiveSceneName().c_str());} if (SceneLabel != NULL) {lv_label_set_text(SceneLabel, gui_memoryOptimizer_getActiveSceneName().c_str());}
Serial.printf("scene: scene handling finished, new scene %s is active\r\n", gui_memoryOptimizer_getActiveSceneName().c_str()); omote_log_d("scene: scene handling finished, new scene %s is active\r\n", gui_memoryOptimizer_getActiveSceneName().c_str());
guis_doTabCreationAfterGUIlistChanged(SCENE_GUI_LIST); guis_doTabCreationAfterGUIlistChanged(SCENE_GUI_LIST);
} }
@ -135,7 +136,7 @@ void showSpecificGUI(GUIlists GUIlist, std::string GUIname) {
int gui_list_index = -1; int gui_list_index = -1;
for (int i=0; i < gui_list_for_search->size(); i++) { for (int i=0; i < gui_list_for_search->size(); i++) {
if (gui_list_for_search->at(i) == GUIname) { if (gui_list_for_search->at(i) == GUIname) {
Serial.printf("showSpecificGUI: found GUI with name \"%s\" in %s at position %d\r\n", GUIname.c_str(), GUIlist == MAIN_GUI_LIST ? "\"main_gui_list\"" : "\"scene gui list\"", i); omote_log_d("showSpecificGUI: found GUI with name \"%s\" in %s at position %d\r\n", GUIname.c_str(), GUIlist == MAIN_GUI_LIST ? "\"main_gui_list\"" : "\"scene gui list\"", i);
gui_list_index = i; gui_list_index = i;
break; break;
} }
@ -147,7 +148,7 @@ void showSpecificGUI(GUIlists GUIlist, std::string GUIname) {
} else { } else {
// gui was not found // gui was not found
Serial.printf("showSpecificGUI: GUI with name \"%s\" was not found in gui list %s. Cannot navigate to that GUI\r\n", GUIname.c_str(), GUIlist == MAIN_GUI_LIST ? "\"main_gui_list\"" : "\"scene gui list\""); omote_log_w("showSpecificGUI: GUI with name \"%s\" was not found in gui list %s. Cannot navigate to that GUI\r\n", GUIname.c_str(), GUIlist == MAIN_GUI_LIST ? "\"main_gui_list\"" : "\"scene gui list\"");
return; return;
} }
} }

View file

@ -5,6 +5,7 @@
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
// scenes // scenes
#include "scenes/scene__default.h" #include "scenes/scene__default.h"
@ -52,7 +53,7 @@ void scene_start_sequence_from_registry(std::string sceneName) {
registered_scenes.at(sceneName).this_scene_start_sequence(); registered_scenes.at(sceneName).this_scene_start_sequence();
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("scene_start_sequence_from_registry: internal error, sceneName not registered\r\n"); omote_log_e("scene_start_sequence_from_registry: internal error, sceneName not registered\r\n");
} }
} }
@ -61,7 +62,7 @@ void scene_end_sequence_from_registry(std::string sceneName) {
registered_scenes.at(sceneName).this_scene_end_sequence(); registered_scenes.at(sceneName).this_scene_end_sequence();
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("scene_end_sequence_from_registry: internal error, sceneName not registered\r\n"); omote_log_e("scene_end_sequence_from_registry: internal error, sceneName not registered\r\n");
} }
} }
@ -70,27 +71,27 @@ repeatModes get_key_repeatMode(std::string sceneName, char keyChar) {
// look if the map of the active gui has a definition for it // look if the map of the active gui has a definition for it
std::string GUIname = gui_memoryOptimizer_getActiveGUIname(); std::string GUIname = gui_memoryOptimizer_getActiveGUIname();
if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_repeatModes != NULL) && (registered_guis_byName_map.at(GUIname).this_key_repeatModes->count(keyChar) > 0)) { if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_repeatModes != NULL) && (registered_guis_byName_map.at(GUIname).this_key_repeatModes->count(keyChar) > 0)) {
// Serial.printf("get_key_repeatMode: will use key from gui %s\r\n", GUIname.c_str()); omote_log_v("get_key_repeatMode: will use key from gui %s\r\n", GUIname.c_str());
return registered_guis_byName_map.at(GUIname).this_key_repeatModes->at(keyChar); return registered_guis_byName_map.at(GUIname).this_key_repeatModes->at(keyChar);
// look if the map of the active scene has a definition for it // look if the map of the active scene has a definition for it
} else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_repeatModes->count(keyChar) > 0)) { } else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_repeatModes->count(keyChar) > 0)) {
// Serial.printf("get_key_repeatMode: will use key from scene %s\r\n", sceneName.c_str()); omote_log_v("get_key_repeatMode: will use key from scene %s\r\n", sceneName.c_str());
return registered_scenes.at(sceneName).this_key_repeatModes->at(keyChar); return registered_scenes.at(sceneName).this_key_repeatModes->at(keyChar);
// look if there is a default definition // look if there is a default definition
} else if (key_repeatModes_default.count(keyChar) > 0) { } else if (key_repeatModes_default.count(keyChar) > 0) {
// Serial.printf("get_key_repeatMode: will use default key\r\n"); omote_log_v("get_key_repeatMode: will use default key\r\n");
return key_repeatModes_default.at(keyChar); return key_repeatModes_default.at(keyChar);
// no key definition found // no key definition found
} else { } else {
// Serial.printf("get_key_repeatMode: WARNING no key definition found\r\n"); omote_log_v("get_key_repeatMode: WARNING no key definition found\r\n");
return REPEAT_MODE_UNKNOWN; return REPEAT_MODE_UNKNOWN;
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_key_repeatMode: internal error, sceneName not registered\r\n"); omote_log_e("get_key_repeatMode: internal error, sceneName not registered\r\n");
return REPEAT_MODE_UNKNOWN; return REPEAT_MODE_UNKNOWN;
} }
} }
@ -100,27 +101,27 @@ uint16_t get_command_short(std::string sceneName, char keyChar) {
// look if the map of the active gui has a definition for it // look if the map of the active gui has a definition for it
std::string GUIname = gui_memoryOptimizer_getActiveGUIname(); std::string GUIname = gui_memoryOptimizer_getActiveGUIname();
if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_commands_short != NULL) && (registered_guis_byName_map.at(GUIname).this_key_commands_short->count(keyChar) > 0)) { if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_commands_short != NULL) && (registered_guis_byName_map.at(GUIname).this_key_commands_short->count(keyChar) > 0)) {
// Serial.printf("get_command_short: will use key from gui %s\r\n", GUIname.c_str()); omote_log_v("get_command_short: will use key from gui %s\r\n", GUIname.c_str());
return registered_guis_byName_map.at(GUIname).this_key_commands_short->at(keyChar); return registered_guis_byName_map.at(GUIname).this_key_commands_short->at(keyChar);
// look if the map of the active scene has a definition for it // look if the map of the active scene has a definition for it
} else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_commands_short->count(keyChar) > 0)) { } else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_commands_short->count(keyChar) > 0)) {
// Serial.printf("get_command_short: will use key from scene %s\r\n", sceneName.c_str()); omote_log_v("get_command_short: will use key from scene %s\r\n", sceneName.c_str());
return registered_scenes.at(sceneName).this_key_commands_short->at(keyChar); return registered_scenes.at(sceneName).this_key_commands_short->at(keyChar);
// look if there is a default definition // look if there is a default definition
} else if (key_commands_short_default.count(keyChar) > 0) { } else if (key_commands_short_default.count(keyChar) > 0) {
// Serial.printf("get_command_short: will use default key\r\n"); omote_log_v("get_command_short: will use default key\r\n");
return key_commands_short_default.at(keyChar); return key_commands_short_default.at(keyChar);
// no key definition found // no key definition found
} else { } else {
// Serial.printf("get_command_short: WARNING no key definition found\r\n"); omote_log_v("get_command_short: WARNING no key definition found\r\n");
return COMMAND_UNKNOWN; return COMMAND_UNKNOWN;
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_command_short: internal error, sceneName not registered\r\n"); omote_log_e("get_command_short: internal error, sceneName not registered\r\n");
return COMMAND_UNKNOWN; return COMMAND_UNKNOWN;
} }
@ -131,27 +132,27 @@ uint16_t get_command_long(std::string sceneName, char keyChar) {
// look if the map of the active gui has a definition for it // look if the map of the active gui has a definition for it
std::string GUIname = gui_memoryOptimizer_getActiveGUIname(); std::string GUIname = gui_memoryOptimizer_getActiveGUIname();
if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_commands_long != NULL) && (registered_guis_byName_map.at(GUIname).this_key_commands_long->count(keyChar) > 0)) { if ((registered_guis_byName_map.count(GUIname) > 0) && (registered_guis_byName_map.at(GUIname).this_key_commands_long != NULL) && (registered_guis_byName_map.at(GUIname).this_key_commands_long->count(keyChar) > 0)) {
// Serial.printf("get_command_long: will use key from gui %s\r\n", GUIname.c_str()); omote_log_v("get_command_long: will use key from gui %s\r\n", GUIname.c_str());
return registered_guis_byName_map.at(GUIname).this_key_commands_long->at(keyChar); return registered_guis_byName_map.at(GUIname).this_key_commands_long->at(keyChar);
// look if the map of the active scene has a definition for it // look if the map of the active scene has a definition for it
} else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_commands_long->count(keyChar) > 0)) { } else if ((registered_scenes.count(sceneName) > 0) && (registered_scenes.at(sceneName).this_key_commands_long->count(keyChar) > 0)) {
// Serial.printf("get_command_long: will use key from scene %s\r\n", sceneName.c_str()); omote_log_v("get_command_long: will use key from scene %s\r\n", sceneName.c_str());
return registered_scenes.at(sceneName).this_key_commands_long->at(keyChar); return registered_scenes.at(sceneName).this_key_commands_long->at(keyChar);
// look if there is a default definition // look if there is a default definition
} else if (key_commands_long_default.count(keyChar) > 0) { } else if (key_commands_long_default.count(keyChar) > 0) {
// Serial.printf("get_command_long: will use default key\r\n"); omote_log_v("get_command_long: will use default key\r\n");
return key_commands_long_default.at(keyChar); return key_commands_long_default.at(keyChar);
// no key definition found // no key definition found
} else { } else {
// Serial.printf("get_command_long: WARNING no key definition found\r\n"); omote_log_v("get_command_long: WARNING no key definition found\r\n");
return COMMAND_UNKNOWN; return COMMAND_UNKNOWN;
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_command_long: internal error, sceneName not registered\r\n"); omote_log_e("get_command_long: internal error, sceneName not registered\r\n");
return COMMAND_UNKNOWN; return COMMAND_UNKNOWN;
} }
@ -169,7 +170,7 @@ gui_list get_gui_list_withFallback(GUIlists gui_list) {
#if (USE_SCENE_SPECIFIC_GUI_LIST != 0) #if (USE_SCENE_SPECIFIC_GUI_LIST != 0)
// look if the active scene has a definition for a gui list // look if the active scene has a definition for a gui list
if ((registered_scenes.count(gui_memoryOptimizer_getActiveSceneName()) > 0) && (registered_scenes.at(gui_memoryOptimizer_getActiveSceneName()).this_gui_list != NULL)) { if ((registered_scenes.count(gui_memoryOptimizer_getActiveSceneName()) > 0) && (registered_scenes.at(gui_memoryOptimizer_getActiveSceneName()).this_gui_list != NULL)) {
// Serial.printf("get_gui_list: will use gui_list from scene %s\r\n", sceneName.c_str()); omote_log_v("get_gui_list: will use gui_list from scene %s\r\n", sceneName.c_str());
return registered_scenes.at(gui_memoryOptimizer_getActiveSceneName()).this_gui_list; return registered_scenes.at(gui_memoryOptimizer_getActiveSceneName()).this_gui_list;
} else { } else {
// no scene specific gui list was defined // no scene specific gui list was defined
@ -182,7 +183,7 @@ gui_list get_gui_list_withFallback(GUIlists gui_list) {
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_gui_list: internal error, sceneName not registered\r\n"); omote_log_e("get_gui_list: internal error, sceneName not registered\r\n");
return NULL; return NULL;
} }
} }
@ -201,7 +202,7 @@ bool get_scene_has_gui_list(std::string sceneName) {
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_scene_has_gui_list: internal error, sceneName not registered\r\n"); omote_log_e("get_scene_has_gui_list: internal error, sceneName not registered\r\n");
return false; return false;
} }
} }
@ -210,18 +211,18 @@ uint16_t get_activate_scene_command(std::string sceneName) {
try { try {
// look if the scene is known // look if the scene is known
if ((registered_scenes.count(sceneName) > 0)) { if ((registered_scenes.count(sceneName) > 0)) {
// Serial.printf("get_activate_scene_command: will use activate_scene_command from scene %s\r\n", sceneName.c_str()); omote_log_v("get_activate_scene_command: will use activate_scene_command from scene %s\r\n", sceneName.c_str());
return registered_scenes.at(sceneName).this_activate_scene_command; return registered_scenes.at(sceneName).this_activate_scene_command;
// if the scene is not know, simply return 0 // if the scene is not know, simply return 0
} else { } else {
// Serial.printf("get_activate_scene_command: will return 0\r\n"); omote_log_v("get_activate_scene_command: will return 0\r\n");
return 0; return 0;
} }
} }
catch (const std::out_of_range& oor) { catch (const std::out_of_range& oor) {
Serial.printf("get_activate_scene_command: internal error, sceneName not registered\r\n"); omote_log_e("get_activate_scene_command: internal error, sceneName not registered\r\n");
return 0; return 0;
} }

View file

@ -1,4 +1,5 @@
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
#include "device_keyboard_ble.h" #include "device_keyboard_ble.h"
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
@ -72,34 +73,34 @@ void keyboard_ble_executeCommand(uint16_t command, std::string additionalPayload
if (doLog) { if (doLog) {
if (keyboardBLE_isConnected()) { if (keyboardBLE_isConnected()) {
Serial.println("BLE keyboard connected, could send key"); omote_log_d("BLE keyboard connected, can send key\r\n");
} else { } else {
Serial.println("BLE keyboard NOT connected, cannot send key"); omote_log_d("BLE keyboard NOT connected, cannot send key\r\n");
} }
} }
if (command == KEYBOARD_BLE_UP) { if (command == KEYBOARD_BLE_UP) {
if (doLog) {Serial.printf("UP received\r\n");} if (doLog) {omote_log_d("UP received\r\n");}
keyboardBLE_write(BLE_KEY_UP_ARROW); keyboardBLE_write(BLE_KEY_UP_ARROW);
} else if (command == KEYBOARD_BLE_DOWN) { } else if (command == KEYBOARD_BLE_DOWN) {
if (doLog) {Serial.printf("DOWN received\r\n");} if (doLog) {omote_log_d("DOWN received\r\n");}
keyboardBLE_write(BLE_KEY_DOWN_ARROW); keyboardBLE_write(BLE_KEY_DOWN_ARROW);
} else if (command == KEYBOARD_BLE_RIGHT) { } else if (command == KEYBOARD_BLE_RIGHT) {
if (doLog) {Serial.printf("RIGHT received\r\n");} if (doLog) {omote_log_d("RIGHT received\r\n");}
keyboardBLE_write(BLE_KEY_RIGHT_ARROW); keyboardBLE_write(BLE_KEY_RIGHT_ARROW);
} else if (command == KEYBOARD_BLE_LEFT) { } else if (command == KEYBOARD_BLE_LEFT) {
if (doLog) {Serial.printf("LEFT received\r\n");} if (doLog) {omote_log_d("LEFT received\r\n");}
keyboardBLE_write(BLE_KEY_LEFT_ARROW); keyboardBLE_write(BLE_KEY_LEFT_ARROW);
} else if (command == KEYBOARD_BLE_SELECT) { } else if (command == KEYBOARD_BLE_SELECT) {
if (doLog) {Serial.printf("SELECT received\r\n");} if (doLog) {omote_log_d("SELECT received\r\n");}
keyboardBLE_write(BLE_KEY_RETURN); keyboardBLE_write(BLE_KEY_RETURN);
} else if (command == KEYBOARD_BLE_SENDSTRING) { } else if (command == KEYBOARD_BLE_SENDSTRING) {
if (doLog) {Serial.printf("SENDSTRING received\r\n");} if (doLog) {omote_log_d("SENDSTRING received\r\n");}
if (additionalPayload != "") { if (additionalPayload != "") {
keyboardBLE_sendString(additionalPayload.c_str()); keyboardBLE_sendString(additionalPayload.c_str());
} }
@ -107,19 +108,19 @@ void keyboard_ble_executeCommand(uint16_t command, std::string additionalPayload
} else if (command == KEYBOARD_BLE_BACK) { } else if (command == KEYBOARD_BLE_BACK) {
if (doLog) {Serial.printf("BACK received\r\n");} if (doLog) {omote_log_d("BACK received\r\n");}
// test which one works best for your device // test which one works best for your device
// keyboardBLE_write(KEY_ESC); // keyboardBLE_write(KEY_ESC);
consumerControlBLE_write(BLE_KEY_MEDIA_WWW_BACK); consumerControlBLE_write(BLE_KEY_MEDIA_WWW_BACK);
} else if (command == KEYBOARD_BLE_HOME) { } else if (command == KEYBOARD_BLE_HOME) {
if (doLog) {Serial.printf("HOME received\r\n");} if (doLog) {omote_log_d("HOME received\r\n");}
// test which one works best for your device // test which one works best for your device
// keyboardBLE_home(); // keyboardBLE_home();
consumerControlBLE_write(BLE_KEY_MEDIA_WWW_HOME); consumerControlBLE_write(BLE_KEY_MEDIA_WWW_HOME);
} else if (command == KEYBOARD_BLE_MENU) { } else if (command == KEYBOARD_BLE_MENU) {
if (doLog) {Serial.printf("MENU received\r\n");} if (doLog) {omote_log_d("MENU received\r\n");}
keyboardBLE_write(0xED); // 0xDA + 13 = 0xED keyboardBLE_write(0xED); // 0xDA + 13 = 0xED
@ -128,49 +129,49 @@ void keyboard_ble_executeCommand(uint16_t command, std::string additionalPayload
// https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/src/USBHIDConsumerControl.h // https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/src/USBHIDConsumerControl.h
// https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/main/adafruit_hid/consumer_control_code.py // https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/main/adafruit_hid/consumer_control_code.py
} else if (command == KEYBOARD_BLE_SCAN_PREVIOUS_TRACK) { } else if (command == KEYBOARD_BLE_SCAN_PREVIOUS_TRACK) {
if (doLog) {Serial.printf("SCAN_PREVIOUS_TRACK received\r\n");} if (doLog) {omote_log_d("SCAN_PREVIOUS_TRACK received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_PREVIOUS_TRACK); consumerControlBLE_write(BLE_KEY_MEDIA_PREVIOUS_TRACK);
} else if (command == KEYBOARD_BLE_REWIND_LONG) { } else if (command == KEYBOARD_BLE_REWIND_LONG) {
if (doLog) {Serial.printf("REWIND_LONG received\r\n");} if (doLog) {omote_log_d("REWIND_LONG received\r\n");}
//keyboardBLE_longpress(KEY_LEFT_ARROW); //keyboardBLE_longpress(KEY_LEFT_ARROW);
consumerControlBLE_longpress(BLE_KEY_MEDIA_REWIND); consumerControlBLE_longpress(BLE_KEY_MEDIA_REWIND);
} else if (command == KEYBOARD_BLE_REWIND) { } else if (command == KEYBOARD_BLE_REWIND) {
if (doLog) {Serial.printf("REWIND received\r\n");} if (doLog) {omote_log_d("REWIND received\r\n");}
//keyboardBLE_write(KEY_LEFT_ARROW); //keyboardBLE_write(KEY_LEFT_ARROW);
consumerControlBLE_write(BLE_KEY_MEDIA_REWIND); consumerControlBLE_write(BLE_KEY_MEDIA_REWIND);
} else if (command == KEYBOARD_BLE_PLAYPAUSE) { } else if (command == KEYBOARD_BLE_PLAYPAUSE) {
if (doLog) {Serial.printf("PLAYPAUSE received\r\n");} if (doLog) {omote_log_d("PLAYPAUSE received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_PLAY_PAUSE); consumerControlBLE_write(BLE_KEY_MEDIA_PLAY_PAUSE);
} else if (command == KEYBOARD_BLE_FASTFORWARD) { } else if (command == KEYBOARD_BLE_FASTFORWARD) {
if (doLog) {Serial.printf("FASTFORWARD received\r\n");} if (doLog) {omote_log_d("FASTFORWARD received\r\n");}
//keyboardBLE_write(KEY_RIGHT_ARROW); //keyboardBLE_write(KEY_RIGHT_ARROW);
consumerControlBLE_write(BLE_KEY_MEDIA_FASTFORWARD); consumerControlBLE_write(BLE_KEY_MEDIA_FASTFORWARD);
} else if (command == KEYBOARD_BLE_FASTFORWARD_LONG) { } else if (command == KEYBOARD_BLE_FASTFORWARD_LONG) {
if (doLog) {Serial.printf("FASTFORWARD_LONG received\r\n");} if (doLog) {omote_log_d("FASTFORWARD_LONG received\r\n");}
//keyboardBLE_longpress(KEY_RIGHT_ARROW); //keyboardBLE_longpress(KEY_RIGHT_ARROW);
consumerControlBLE_longpress(BLE_KEY_MEDIA_FASTFORWARD); consumerControlBLE_longpress(BLE_KEY_MEDIA_FASTFORWARD);
} else if (command == KEYBOARD_BLE_SCAN_NEXT_TRACK) { } else if (command == KEYBOARD_BLE_SCAN_NEXT_TRACK) {
if (doLog) {Serial.printf("SCAN_NEXT_TRACK received\r\n");} if (doLog) {omote_log_d("SCAN_NEXT_TRACK received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_NEXT_TRACK); consumerControlBLE_write(BLE_KEY_MEDIA_NEXT_TRACK);
} else if (command == KEYBOARD_BLE_MUTE) { } else if (command == KEYBOARD_BLE_MUTE) {
if (doLog) {Serial.printf("MUTE received\r\n");} if (doLog) {omote_log_d("MUTE received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_MUTE); consumerControlBLE_write(BLE_KEY_MEDIA_MUTE);
} else if (command == KEYBOARD_BLE_VOLUME_INCREMENT) { } else if (command == KEYBOARD_BLE_VOLUME_INCREMENT) {
if (doLog) {Serial.printf("VOLUME_INCREMENT received\r\n");} if (doLog) {omote_log_d("VOLUME_INCREMENT received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_VOLUME_UP); consumerControlBLE_write(BLE_KEY_MEDIA_VOLUME_UP);
} else if (command == KEYBOARD_BLE_VOLUME_DECREMENT) { } else if (command == KEYBOARD_BLE_VOLUME_DECREMENT) {
if (doLog) {Serial.printf("VOLUME_DECREMENT received\r\n");} if (doLog) {omote_log_d("VOLUME_DECREMENT received\r\n");}
consumerControlBLE_write(BLE_KEY_MEDIA_VOLUME_DOWN); consumerControlBLE_write(BLE_KEY_MEDIA_VOLUME_DOWN);
} }

View file

@ -2,6 +2,7 @@
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/omote_log.h"
#include "devices/mediaPlayer/device_appleTV/gui_appleTV.h" #include "devices/mediaPlayer/device_appleTV/gui_appleTV.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
@ -17,7 +18,7 @@ static void appleKey_event_cb(lv_event_t* e) {
// Send IR command based on the event user data // Send IR command based on the event user data
int user_data = *((int*)(&(e->user_data))); int user_data = *((int*)(&(e->user_data)));
executeCommand(APPLETV_GUI_EVENT_USER_DATA, std::to_string(50 + user_data)); executeCommand(APPLETV_GUI_EVENT_USER_DATA, std::to_string(50 + user_data));
// Serial.println(50 + user_data); omote_log_v("%d\r\n", 50 + user_data);
} }
void create_tab_content_appleTV(lv_obj_t* tab) { void create_tab_content_appleTV(lv_obj_t* tab) {

View file

@ -3,6 +3,7 @@
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/omote_log.h"
#include "guis/gui_irReceiver.h" #include "guis/gui_irReceiver.h"
lv_obj_t* menuBoxToggle; lv_obj_t* menuBoxToggle;
@ -40,7 +41,7 @@ void showMQTTmessage(std::string topic, std::string payload) {
void printIRMessages(bool clearMessages = false) { void printIRMessages(bool clearMessages = false) {
if (!tabIsInMemory) {return;} if (!tabIsInMemory) {return;}
//Serial.println(""); omote_log_v("\r\n");
int messagePosLoop; int messagePosLoop;
if (messageCount < maxCountMessages) { if (messageCount < maxCountMessages) {
messagePosLoop = 0; messagePosLoop = 0;
@ -48,12 +49,12 @@ void printIRMessages(bool clearMessages = false) {
messagePosLoop = messagePos; messagePosLoop = messagePos;
} }
//Serial.printf("will start printing messages, beginning at position %d\r\n", messagePosLoop); omote_log_v("will start printing messages, beginning at position %d\r\n", messagePosLoop);
for (int i=0; i<maxCountMessages; i++) { for (int i=0; i<maxCountMessages; i++) {
if (clearMessages) { if (clearMessages) {
IRmessages[messagePosLoop] = ""; IRmessages[messagePosLoop] = "";
} }
//Serial.printf("will print at line %d the message at position %d: %s\r\n", i, messagePosLoop, IRmessages[messagePosLoop].c_str()); omote_log_v("will print at line %d the message at position %d: %s\r\n", i, messagePosLoop, IRmessages[messagePosLoop].c_str());
lv_label_set_text(irReceivedMessage[i], IRmessages[messagePosLoop].c_str()); lv_label_set_text(irReceivedMessage[i], IRmessages[messagePosLoop].c_str());
messagePosLoop += 1; messagePosLoop += 1;
if (messagePosLoop == maxCountMessages) { if (messagePosLoop == maxCountMessages) {
@ -68,17 +69,17 @@ void printIRMessages(bool clearMessages = false) {
void showNewIRmessage(std::string message) { void showNewIRmessage(std::string message) {
setLastActivityTimestamp(); // Reset the sleep timer when a IR message is received setLastActivityTimestamp(); // Reset the sleep timer when a IR message is received
// Serial.printf(" new IR message received: %s\r\n", message.c_str()); omote_log_v(" new IR message received: %s\r\n", message.c_str());
// const char *a = message.c_str(); // const char *a = message.c_str();
std::string messageStr; std::string messageStr;
messageStr.append(message.c_str()); messageStr.append(message.c_str());
// std::string aMessage = s(a); // std::string aMessage = s(a);
messageStr.erase(std::remove(messageStr.begin(), messageStr.end(), '\n'), messageStr.cend()); messageStr.erase(std::remove(messageStr.begin(), messageStr.end(), '\n'), messageStr.cend());
//Serial.printf(" will put message %s to list\r\n", messageStr.c_str()); omote_log_v(" will put message %s to list\r\n", messageStr.c_str());
messageCount += 1; messageCount += 1;
IRmessages[messagePos] = (std::to_string(messageCount) + ": " + messageStr).c_str(); IRmessages[messagePos] = (std::to_string(messageCount) + ": " + messageStr).c_str();
//Serial.printf(" this is the message at position %d: %s\r\n", messagePos, IRmessages[messagePos].c_str()); omote_log_v(" this is the message at position %d: %s\r\n", messagePos, IRmessages[messagePos].c_str());
messagePos += 1; messagePos += 1;
if (messagePos == maxCountMessages) { if (messagePos == maxCountMessages) {
messagePos = 0; messagePos = 0;
@ -90,13 +91,13 @@ void showNewIRmessage(std::string message) {
static void IRReceiverOnSetting_event_cb(lv_event_t* e){ static void IRReceiverOnSetting_event_cb(lv_event_t* e){
set_irReceiverEnabled(lv_obj_has_state(lv_event_get_target(e), LV_STATE_CHECKED)); set_irReceiverEnabled(lv_obj_has_state(lv_event_get_target(e), LV_STATE_CHECKED));
if (get_irReceiverEnabled()) { if (get_irReceiverEnabled()) {
Serial.println("will turn on IR receiver"); omote_log_d("will turn on IR receiver\r\n");
start_infraredReceiver(); start_infraredReceiver();
lv_obj_set_size(menuBoxMessages, lv_pct(100), boxHeightActivated); lv_obj_set_size(menuBoxMessages, lv_pct(100), boxHeightActivated);
messageCount = 0; messageCount = 0;
printIRMessages(); printIRMessages();
} else { } else {
Serial.println("will turn off IR receiver"); omote_log_d("will turn off IR receiver\r\n");
shutdown_infraredReceiver(); shutdown_infraredReceiver();
printIRMessages(true); printIRMessages(true);
messagePos = 0; messagePos = 0;

View file

@ -2,6 +2,7 @@
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/omote_log.h"
#include "guis/gui_numpad.h" #include "guis/gui_numpad.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
@ -29,7 +30,7 @@ static void virtualKeypad_event_cb(lv_event_t* e) {
std::string numberStr = std::to_string(number); std::string numberStr = std::to_string(number);
executeCommand(KEYBOARD_SENDSTRING, numberStr); executeCommand(KEYBOARD_SENDSTRING, numberStr);
} else { } else {
Serial.printf("gui_numpad: no known scene is active, don't know what to do with user_data %d\r\n", user_data); omote_log_w("gui_numpad: no known scene is active, don't know what to do with user_data %d\r\n", user_data);
} }
} }

View file

@ -4,6 +4,7 @@
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/scenes/sceneRegistry.h" #include "applicationInternal/scenes/sceneRegistry.h"
#include "applicationInternal/commandHandler.h" #include "applicationInternal/commandHandler.h"
#include "applicationInternal/omote_log.h"
#include "guis/gui_sceneSelection.h" #include "guis/gui_sceneSelection.h"
static uint16_t activate_scene_command; static uint16_t activate_scene_command;
@ -36,23 +37,23 @@ static void sceneSelection_event_cb(lv_event_t* e) {
// only on short press: LV_EVENT_SHORT_CLICKED // only on short press: LV_EVENT_SHORT_CLICKED
// both on short press and long press: LV_EVENT_CLICKED // both on short press and long press: LV_EVENT_CLICKED
// if (lv_event_get_code(e) == LV_EVENT_PRESSED) { // if (lv_event_get_code(e) == LV_EVENT_PRESSED) {
// Serial.println("pressed"); // omote_log_v("pressed\r\n");
// } // }
// if (lv_event_get_code(e) == LV_EVENT_RELEASED) { // if (lv_event_get_code(e) == LV_EVENT_RELEASED) {
// Serial.println("released"); // omote_log_v("released\r\n");
// } // }
if (lv_event_get_code(e) == LV_EVENT_SHORT_CLICKED) { if (lv_event_get_code(e) == LV_EVENT_SHORT_CLICKED) {
lastShortClickedReceived = user_data; lastShortClickedReceived = user_data;
lastShortClickedReceivedTime = millis(); lastShortClickedReceivedTime = millis();
// Serial.println("short clicked, will see what happens next"); omote_log_v("short clicked, will see what happens next\r\n");
return; return;
} else if (lv_event_get_code(e) == LV_EVENT_CLICKED) { } else if (lv_event_get_code(e) == LV_EVENT_CLICKED) {
if ((lastShortClickedReceived == user_data) && (millis() - lastShortClickedReceivedTime < 10)) { if ((lastShortClickedReceived == user_data) && (millis() - lastShortClickedReceivedTime < 10)) {
// Serial.println("clicked, will send short click"); omote_log_v("clicked, will send short click\r\n");
doForceScene = false; doForceScene = false;
} else { } else {
// Serial.println("clicked, will send long click"); omote_log_v("clicked, will send long click\r\n");
doForceScene = true; doForceScene = true;
} }
} else { } else {
@ -77,16 +78,16 @@ static void sceneSelection_event_cb(lv_event_t* e) {
if (doForceScene) { if (doForceScene) {
// put the force flag into the highest bit // put the force flag into the highest bit
scene_command_including_force = activate_scene_command | 0x8000; scene_command_including_force = activate_scene_command | 0x8000;
Serial.printf("Scene with index %d and name %s was FORCE selected\r\n", user_data, scene_name.c_str()); omote_log_d("Scene with index %d and name %s was FORCE selected\r\n", user_data, scene_name.c_str());
} else { } else {
scene_command_including_force = activate_scene_command; scene_command_including_force = activate_scene_command;
Serial.printf("Scene with index %d and name %s was selected\r\n", user_data, scene_name.c_str()); omote_log_d("Scene with index %d and name %s was selected\r\n", user_data, scene_name.c_str());
} }
lv_timer_t *my_timer = lv_timer_create(activate_scene_cb, 50, (void *)(uintptr_t) scene_command_including_force); lv_timer_t *my_timer = lv_timer_create(activate_scene_cb, 50, (void *)(uintptr_t) scene_command_including_force);
lv_timer_set_repeat_count(my_timer, 1); lv_timer_set_repeat_count(my_timer, 1);
} else { } else {
Serial.printf("Cannot activate scene %s, because command was not found\r\n", scene_name.c_str()); omote_log_w("Cannot activate scene %s, because command was not found\r\n", scene_name.c_str());
} }
} }

View file

@ -3,6 +3,7 @@
#include "applicationInternal/memoryUsage.h" #include "applicationInternal/memoryUsage.h"
#include "applicationInternal/gui/guiBase.h" #include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h" #include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/omote_log.h"
#include "guis/gui_settings.h" #include "guis/gui_settings.h"
// LVGL declarations // LVGL declarations
@ -40,7 +41,7 @@ static void timout_event_cb(lv_event_t* e){
case 5: {set_sleepTimeout( 600000); break;} case 5: {set_sleepTimeout( 600000); break;}
case 6: {set_sleepTimeout(3600000); break;} case 6: {set_sleepTimeout(3600000); break;}
} }
// Serial.printf("New timeout: %lu ms\r\n", actualSleepTimeout); omote_log_v("New timeout: %lu ms\r\n", actualSleepTimeout);
setLastActivityTimestamp(); setLastActivityTimestamp();
// save preferences now, otherwise if you set a very big timeout and upload your firmware again, it never got saved // save preferences now, otherwise if you set a very big timeout and upload your firmware again, it never got saved
save_preferences(); save_preferences();

View file

@ -1,6 +1,7 @@
// OMOTE firmware for ESP32 // OMOTE firmware for ESP32
// 2023-2024 Maximilian Kern / Klaus Musch // 2023-2024 Maximilian Kern / Klaus Musch
#include "applicationInternal/omote_log.h"
// init hardware and hardware loop // init hardware and hardware loop
#include "applicationInternal/hardware/hardwarePresenter.h" #include "applicationInternal/hardware/hardwarePresenter.h"
// register devices and their commands // register devices and their commands
@ -139,7 +140,7 @@ int main(int argc, char *argv[]) {
init_mqtt(); init_mqtt();
#endif #endif
Serial.printf("Setup finished in %lu ms.\r\n", millis()); omote_log_i("Setup finished in %lu ms.\r\n", millis());
#if defined(WIN32) || defined(__linux__) #if defined(WIN32) || defined(__linux__)
// In Windows/Linux there is no loop function that is automatically being called. So we have to do this on our own infinitely here in main() // In Windows/Linux there is no loop function that is automatically being called. So we have to do this on our own infinitely here in main()