Improvements & fixes (#178)

- Fix for unPhone sleep: it would wake up every minute briefly (draining the battery over the course of 1-3 days)
- Minor WiFi improvements (mainly added logging and improved filtering on connect .. the latter probably doesn't matter)
This commit is contained in:
Ken Van Hoeylandt 2025-01-22 23:10:28 +01:00 committed by GitHub
parent 12a9839420
commit dc20ed4874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 6 deletions

View File

@ -25,7 +25,8 @@ static void updatePowerSwitch() {
} }
} else { // power switch off and usb plugged in we sleep } else { // power switch off and usb plugged in we sleep
unPhoneFeatures.wakeOnPowerSwitch(); unPhoneFeatures.wakeOnPowerSwitch();
esp_sleep_enable_timer_wakeup(60000000); // ea min: USB? else->shipping // Using UINT64_MAX leads to boot loops because of a bug in esp_sleep_start() converting it to int64_t before sleeping
esp_sleep_enable_timer_wakeup(UINT64_MAX / 2); // ea min: USB? else->shipping
esp_deep_sleep_start(); // deep sleep, wait for wakeup on GPIO esp_deep_sleep_start(); // deep sleep, wait for wakeup on GPIO
} }

View File

@ -12,9 +12,10 @@
- EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in) - EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in)
- Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack size (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting. - Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack size (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting.
- M5Stack Core only shows 4MB of SPIRAM in use - M5Stack Core only shows 4MB of SPIRAM in use
- Oops crashlog site: Add copy-pasteable addr2line command (e.g. xtensa-esp32s3-elf-addr2line -pfiaC -e Tactility.elf 00000000)
# TODOs # TODOs
- Expose app::Paths to TactilityC
- Refactor ServiceManifest into C++ class-based design like the App class
- Experiment with what happens when using C++ code in an external app (without using standard library!) - Experiment with what happens when using C++ code in an external app (without using standard library!)
- Boards' CMakeLists.txt manually declare each source folder. Update them all to do a recursive search of all folders. - Boards' CMakeLists.txt manually declare each source folder. Update them all to do a recursive search of all folders.
- We currently build all boards for a given platform (e.g. ESP32S3), but it's better to filter all irrelevant ones based on the Kconfig board settings: - We currently build all boards for a given platform (e.g. ESP32S3), but it's better to filter all irrelevant ones based on the Kconfig board settings:
@ -45,12 +46,10 @@
- Audio player app - Audio player app
- Audio recording app - Audio recording app
- OTA updates - OTA updates
- Web flasher
- T-Deck Plus: Create separate board config? - T-Deck Plus: Create separate board config?
- Support for displays with different DPI. Consider the layer-based system like on Android. - Support for displays with different DPI. Consider the layer-based system like on Android.
- Make firmwares available via web serial website
- If present, use LED to show boot/wifi status - If present, use LED to show boot/wifi status
- T-Deck Power: capacity estimation uses linear voltage curve, but it should use some sort of battery discharge curve. - Capacity based on voltage: estimation for various devices uses linear voltage curve, but it should use some sort of battery discharge curve.
- Statusbar widget to show how much memory is in use? - Statusbar widget to show how much memory is in use?
- Wrapper for Slider that shows "+" and "-" buttons, and also the value in a label. - Wrapper for Slider that shows "+" and "-" buttons, and also the value in a label.
- Display app: Add toggle to display performance measurement overlay (consider showing FPS in statusbar!) - Display app: Add toggle to display performance measurement overlay (consider showing FPS in statusbar!)

View File

@ -446,6 +446,12 @@ static void eventHandler(TT_UNUSED void* arg, esp_event_base_t event_base, int32
return; return;
} }
if (event_base == WIFI_EVENT) {
TT_LOG_I(TAG, "eventHandler: WIFI_EVENT (%ld)", event_id);
} else if (event_base == IP_EVENT) {
TT_LOG_W(TAG, "eventHandler: IP_EVENT (%ld)", event_id);
}
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
TT_LOG_I(TAG, "eventHandler: sta start"); TT_LOG_I(TAG, "eventHandler: sta start");
if (wifi->getRadioState() == RadioState::ConnectionPending) { if (wifi->getRadioState() == RadioState::ConnectionPending) {
@ -708,6 +714,8 @@ static void dispatchConnect(std::shared_ptr<void> context) {
} }
} }
wifi->setScanActive(false);
wifi->setRadioState(RadioState::ConnectionPending); wifi->setRadioState(RadioState::ConnectionPending);
publish_event_simple(wifi, EventType::ConnectionPending); publish_event_simple(wifi, EventType::ConnectionPending);
@ -729,7 +737,7 @@ static void dispatchConnect(std::shared_ptr<void> context) {
.sort_method = WIFI_CONNECT_AP_BY_SIGNAL, .sort_method = WIFI_CONNECT_AP_BY_SIGNAL,
.threshold = { .threshold = {
.rssi = 0, .rssi = 0,
.authmode = WIFI_AUTH_WPA2_WPA3_PSK, .authmode = WIFI_AUTH_OPEN,
}, },
.pmf_cfg = { .pmf_cfg = {
.capable = false, .capable = false,
@ -762,6 +770,13 @@ static void dispatchConnect(std::shared_ptr<void> context) {
memcpy(wifi_config.sta.ssid, wifi_singleton->connection_target.ssid, sizeof(wifi_config.sta.ssid)); memcpy(wifi_config.sta.ssid, wifi_singleton->connection_target.ssid, sizeof(wifi_config.sta.ssid));
memcpy(wifi_config.sta.password, wifi_singleton->connection_target.password, sizeof(wifi_config.sta.password)); memcpy(wifi_config.sta.password, wifi_singleton->connection_target.password, sizeof(wifi_config.sta.password));
if (wifi_singleton->connection_target.password[0] != 0x00U) {
wifi_config.sta.threshold.authmode = WIFI_AUTH_WPA2_WPA3_PSK;
} else {
wifi_config.sta.threshold.authmode = WIFI_AUTH_OPEN;
}
TT_LOG_I(TAG, "esp_wifi_set_config()");
esp_err_t set_config_result = esp_wifi_set_config(WIFI_IF_STA, &wifi_config); esp_err_t set_config_result = esp_wifi_set_config(WIFI_IF_STA, &wifi_config);
if (set_config_result != ESP_OK) { if (set_config_result != ESP_OK) {
wifi->setRadioState(RadioState::On); wifi->setRadioState(RadioState::On);
@ -770,6 +785,7 @@ static void dispatchConnect(std::shared_ptr<void> context) {
return; return;
} }
TT_LOG_I(TAG, "esp_wifi_start()");
esp_err_t wifi_start_result = esp_wifi_start(); esp_err_t wifi_start_result = esp_wifi_start();
if (wifi_start_result != ESP_OK) { if (wifi_start_result != ESP_OK) {
wifi->setRadioState(RadioState::On); wifi->setRadioState(RadioState::On);