@VK3YY ,
That is what I would expect it to do.
The SOTACAT is battery powered. Since the project is open source, there are different implementations of the hardware out there. Some have a power switch, and some use the TRRS connector as a switch. It is possible that when people finish using the SOTACAT they may forget to turn it off, and that would run the battery dry. So there is a watchdog timer that shuts the unit down if it can’t communicate with the Elecraft after 60 seconds, and if thinks that it is not on a charger.
Here is the relevant code (the full code is here: https://github.com/SOTAmat/SOTAcat):
The setup.cpp
file has this code which spins up a background task to manage auto-power-off:
// Note the current time since our inactivity power down time will be based on this.
time (&LastUserActivityUnixTime);
// Start a watchdog timer to shut the unit down if we aren't able to fully initialize within 60 seconds.
TaskHandle_t xSetupWatchdogHandle = NULL;
xTaskCreate (&startup_watchdog_timer, "startup_watchdog_task", 2048, NULL, SC_TASK_PRIORITY_NORMAL, &xSetupWatchdogHandle);
ESP_LOGI (TAG8, "shutdown watchdog started.");
… and here is the implementation of the auto-power-off watchdog task:
/**
* Start a watchdog timer to shut the unit down if we aren't able to fully initialize within 60 seconds,
* and our battery is below the BATTERY_SHUTOFF_PERCENTAGE
*/
void startup_watchdog_timer (void * _) {
do {
vTaskDelay (pdMS_TO_TICKS (60000));
}
// We will never turn off if the unit is plugged in and is charging,
// as the battery voltage will never dip below 80%.
while (get_battery_percentage() >= BATTERY_SHUTOFF_PERCENTAGE);
ESP_LOGI (TAG8, "Startup watchdog timer expired, and battery not charged; shutting down.");
enter_deep_sleep();
}
…and so after 60,000 milliseconds (which is 60 seconds), the code does indeed go into deep sleep mode to preserve the battery if it can’t communicate with the Elecraft. And here is the enter_deep_sleep
routine:
void enter_deep_sleep () {
ESP_LOGV (TAG8, "trace: %s()", __func__);
ESP_LOGI (TAG8, "preparing for deep sleep:");
esp_wifi_stop();
ESP_LOGI (TAG8, "wifi is stopped.");
shutdown_adc();
ESP_LOGI (TAG8, "adc is shutdown.");
// Return all the GPIO pins to their isolated state so that there isn't current drain when sleeping
gpio_set_level (LED_BLUE, LED_OFF);
gpio_set_direction (LED_BLUE, GPIO_MODE_INPUT);
gpio_pullup_dis (LED_BLUE);
gpio_pulldown_dis (LED_BLUE);
gpio_set_level (LED_RED, LED_OFF);
gpio_set_direction (LED_RED, GPIO_MODE_INPUT);
gpio_pullup_dis (LED_RED);
gpio_pulldown_dis (LED_RED);
if (LED_RED_SUPL > 0) {
gpio_set_direction (LED_RED_SUPL, GPIO_MODE_INPUT);
gpio_pullup_dis (LED_RED_SUPL);
gpio_pulldown_dis (LED_RED_SUPL);
}
#ifndef SEEED_XIAO
rtc_gpio_isolate (LED_BLUE);
rtc_gpio_isolate (LED_RED);
rtc_gpio_isolate (LED_RED_SUPL);
#endif
ESP_LOGI (TAG8, "all gpio pins off and isolated.");
ESP_LOGI (TAG8, "entering deep sleep...");
ESP_LOGI (TAG8, "goodnight!");
esp_deep_sleep_start();
}
Is there a reason you aren’t plugging the SOTACAT into the Elecraft?
Does your unit have a Battery monitoring circuit so it can tell if it is being charged?
73 de AB6D - Brian