diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index b4906cd60..67b680233 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -57,21 +57,21 @@ static bool isPowered() static void sdsEnter() { - LOG_DEBUG("State: SDS"); + LOG_POWERFSM("State: SDS"); // FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false, false); } static void lowBattSDSEnter() { - LOG_DEBUG("State: Lower batt SDS"); + LOG_POWERFSM("State: Lower batt SDS"); doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false, true); } extern Power *power; static void shutdownEnter() { - LOG_DEBUG("State: SHUTDOWN"); + LOG_POWERFSM("State: SHUTDOWN"); shutdownAtMsec = millis(); } @@ -81,7 +81,7 @@ static uint32_t secsSlept; static void lsEnter() { - LOG_INFO("lsEnter begin, ls_secs=%u", config.power.ls_secs); + LOG_POWERFSM("lsEnter begin, ls_secs=%u", config.power.ls_secs); if (screen) screen->setOn(false); secsSlept = 0; // How long have we been sleeping this time @@ -155,12 +155,12 @@ static void lsIdle() static void lsExit() { - LOG_INFO("Exit state: LS"); + LOG_POWERFSM("State: lsExit"); } static void nbEnter() { - LOG_DEBUG("State: NB"); + LOG_POWERFSM("State: nbEnter"); if (screen) screen->setOn(false); #ifdef ARCH_ESP32 @@ -173,6 +173,7 @@ static void nbEnter() static void darkEnter() { + LOG_POWERFSM("State: darkEnter"); setBluetoothEnable(true); if (screen) screen->setOn(false); @@ -180,7 +181,7 @@ static void darkEnter() static void serialEnter() { - LOG_DEBUG("State: SERIAL"); + LOG_POWERFSM("State: serialEnter"); setBluetoothEnable(false); if (screen) { screen->setOn(true); @@ -189,13 +190,14 @@ static void serialEnter() static void serialExit() { + LOG_POWERFSM("State: serialExit"); // Turn bluetooth back on when we leave serial stream API setBluetoothEnable(true); } static void powerEnter() { - // LOG_DEBUG("State: POWER"); + LOG_POWERFSM("State: powerEnter"); if (!isPowered()) { // If we got here, we are in the wrong state - we should be in powered, let that state handle things LOG_INFO("Loss of power in Powered"); @@ -210,6 +212,7 @@ static void powerEnter() static void powerIdle() { + // LOG_POWERFSM("State: powerIdle"); // very chatty if (!isPowered()) { // If we got here, we are in the wrong state LOG_INFO("Loss of power in Powered"); @@ -219,12 +222,13 @@ static void powerIdle() static void powerExit() { + LOG_POWERFSM("State: powerExit"); setBluetoothEnable(true); } static void onEnter() { - LOG_DEBUG("State: ON"); + LOG_POWERFSM("State: onEnter"); if (screen) screen->setOn(true); setBluetoothEnable(true); @@ -232,6 +236,7 @@ static void onEnter() static void onIdle() { + LOG_POWERFSM("State: onIdle"); if (isPowered()) { // If we got here, we are in the wrong state - we should be in powered, let that state handle things powerFSM.trigger(EVENT_POWER_CONNECTED); @@ -240,7 +245,7 @@ static void onIdle() static void bootEnter() { - LOG_DEBUG("State: BOOT"); + LOG_POWERFSM("State: bootEnter"); } State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN"); @@ -317,11 +322,6 @@ void PowerFSM_setup() // if any packet destined for phone arrives, turn on bluetooth at least powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone"); - // Removed 2.7: we don't show the nodes individually for every node on the screen anymore - // powerFSM.add_transition(&stateNB, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update"); - // powerFSM.add_transition(&stateDARK, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update"); - // powerFSM.add_transition(&stateON, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update"); - // Show the received text message powerFSM.add_transition(&stateLS, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text"); powerFSM.add_transition(&stateNB, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text"); diff --git a/src/PowerFSM.h b/src/PowerFSM.h index 6330a5fc6..182ac082a 100644 --- a/src/PowerFSM.h +++ b/src/PowerFSM.h @@ -2,6 +2,12 @@ #include "configuration.h" +#ifdef PowerFSMDebug +#define LOG_POWERFSM(...) LOG_DEBUG(__VA_ARGS__) +#else +#define LOG_POWERFSM(...) +#endif + // See sw-design.md for documentation #define EVENT_PRESS 1 diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index e8c2e4b88..d58927f1e 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1605,6 +1605,7 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event) int Screen::handleInputEvent(const InputEvent *event) { + LOG_INPUT("Screen Input event %u! kb %u", event->inputEvent, event->kbchar); if (!screenOn) return 0; diff --git a/src/input/InputBroker.h b/src/input/InputBroker.h index 36328ca64..022101f7d 100644 --- a/src/input/InputBroker.h +++ b/src/input/InputBroker.h @@ -3,6 +3,12 @@ #include "Observer.h" #include "freertosinc.h" +#ifdef InputBrokerDebug +#define LOG_INPUT(...) LOG_DEBUG(__VA_ARGS__) +#else +#define LOG_INPUT(...) +#endif + enum input_broker_event { INPUT_BROKER_NONE = 0, INPUT_BROKER_SELECT = 10, diff --git a/src/modules/SystemCommandsModule.cpp b/src/modules/SystemCommandsModule.cpp index dc5d8b41f..7fa4485c8 100644 --- a/src/modules/SystemCommandsModule.cpp +++ b/src/modules/SystemCommandsModule.cpp @@ -1,4 +1,5 @@ #include "SystemCommandsModule.h" +#include "input/InputBroker.h" #include "meshUtils.h" #if HAS_SCREEN #include "graphics/Screen.h" @@ -22,7 +23,7 @@ SystemCommandsModule::SystemCommandsModule() int SystemCommandsModule::handleInputEvent(const InputEvent *event) { - LOG_INFO("Input event %u! kb %u", event->inputEvent, event->kbchar); + LOG_INPUT("SystemCommands Input event %u! kb %u", event->inputEvent, event->kbchar); // System commands (all others fall through) switch (event->kbchar) { // Fn key symbols