Replaced all of the logging with proper log levels

This commit is contained in:
Ben Meadors
2022-12-30 10:27:07 -06:00
parent 8193215294
commit f1cdfd163d
68 changed files with 519 additions and 524 deletions

View File

@@ -32,7 +32,7 @@ static bool isPowered()
static void sdsEnter()
{
LOG_DEBUG("Enter state: SDS\n");
LOG_INFO("Enter state: SDS\n");
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
doDeepSleep(getConfiguredOrDefaultMs(config.power.sds_secs));
}
@@ -41,7 +41,7 @@ extern Power *power;
static void shutdownEnter()
{
LOG_DEBUG("Enter state: SHUTDOWN\n");
LOG_INFO("Enter state: SHUTDOWN\n");
power->shutdown();
}
@@ -51,16 +51,16 @@ static uint32_t secsSlept;
static void lsEnter()
{
LOG_DEBUG("lsEnter begin, ls_secs=%u\n", config.power.ls_secs);
LOG_INFO("lsEnter begin, ls_secs=%u\n", config.power.ls_secs);
screen->setOn(false);
secsSlept = 0; // How long have we been sleeping this time
// LOG_DEBUG("lsEnter end\n");
// LOG_INFO("lsEnter end\n");
}
static void lsIdle()
{
// LOG_DEBUG("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
// LOG_INFO("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
#ifdef ARCH_ESP32
@@ -82,7 +82,7 @@ static void lsIdle()
wakeCause2 = doLightSleep(1); // leave led on for 1ms
secsSlept += sleepTime;
// LOG_DEBUG("sleeping, flash led!\n");
// LOG_INFO("sleeping, flash led!\n");
break;
case ESP_SLEEP_WAKEUP_UART:
@@ -93,7 +93,7 @@ static void lsIdle()
default:
// We woke for some other reason (button press, device interrupt)
// uint64_t status = esp_sleep_get_ext1_wakeup_status();
LOG_DEBUG("wakeCause2 %d\n", wakeCause2);
LOG_INFO("wakeCause2 %d\n", wakeCause2);
#ifdef BUTTON_PIN
bool pressed = !digitalRead(BUTTON_PIN);
@@ -117,7 +117,7 @@ static void lsIdle()
} else {
// Time to stop sleeping!
setLed(false);
LOG_DEBUG("reached ls_secs, servicing loop()\n");
LOG_INFO("Reached ls_secs, servicing loop()\n");
powerFSM.trigger(EVENT_WAKE_TIMER);
}
#endif
@@ -125,7 +125,7 @@ static void lsIdle()
static void lsExit()
{
LOG_DEBUG("Exit state: LS\n");
LOG_INFO("Exit state: LS\n");
// setGPSPower(true); // restore GPS power
if (gps)
gps->forceWake(true);
@@ -133,7 +133,7 @@ static void lsExit()
static void nbEnter()
{
LOG_DEBUG("Enter state: NB\n");
LOG_INFO("Enter state: NB\n");
screen->setOn(false);
setBluetoothEnable(false);
@@ -148,7 +148,7 @@ static void darkEnter()
static void serialEnter()
{
LOG_DEBUG("Enter state: SERIAL\n");
LOG_INFO("Enter state: SERIAL\n");
setBluetoothEnable(false);
screen->setOn(true);
screen->print("Serial connected\n");
@@ -161,10 +161,10 @@ static void serialExit()
static void powerEnter()
{
LOG_DEBUG("Enter state: POWER\n");
LOG_INFO("Enter state: POWER\n");
if (!isPowered()) {
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
LOG_DEBUG("Loss of power in Powered\n");
LOG_INFO("Loss of power in Powered\n");
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
} else {
screen->setOn(true);
@@ -177,7 +177,7 @@ static void powerIdle()
{
if (!isPowered()) {
// If we got here, we are in the wrong state
LOG_DEBUG("Loss of power in Powered\n");
LOG_INFO("Loss of power in Powered\n");
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
}
}
@@ -191,7 +191,7 @@ static void powerExit()
static void onEnter()
{
LOG_DEBUG("Enter state: ON\n");
LOG_INFO("Enter state: ON\n");
screen->setOn(true);
setBluetoothEnable(true);
@@ -221,7 +221,7 @@ static void screenPress()
static void bootEnter()
{
LOG_DEBUG("Enter state: BOOT\n");
LOG_INFO("Enter state: BOOT\n");
}
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
@@ -240,7 +240,7 @@ void PowerFSM_setup()
bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0);
bool hasPower = isPowered();
LOG_DEBUG("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0);
LOG_INFO("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0);
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
// wake timer expired or a packet arrived