From 6a1dfc3b9134774419db16ec81ae5163aedf187f Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 29 Jan 2022 21:10:48 +0100 Subject: [PATCH 1/3] Update submodules --- components/TFT_eSPI | 2 +- components/arduino-esp32 | 2 +- components/esp-gui-lib | 2 +- components/espasyncota | 2 +- components/espchrono | 2 +- components/espconfiglib | 2 +- components/espcpputils | 2 +- components/esphttpdutils | 2 +- components/espwifistack | 2 +- esp-idf | 2 +- main/cloud.cpp | 5 +++-- main/displays/menus/wifiapclientsmenu.cpp | 2 +- main/drivingstatistics.h | 5 ++++- main/modes/defaultmode.cpp | 8 ++++---- 14 files changed, 22 insertions(+), 18 deletions(-) diff --git a/components/TFT_eSPI b/components/TFT_eSPI index d04ecac..9af512f 160000 --- a/components/TFT_eSPI +++ b/components/TFT_eSPI @@ -1 +1 @@ -Subproject commit d04ecacb6b75f5bc67db117c395dc97e312f1643 +Subproject commit 9af512fd2782c4fb9224e10e64408db250d6b346 diff --git a/components/arduino-esp32 b/components/arduino-esp32 index 40409a3..59d3f4b 160000 --- a/components/arduino-esp32 +++ b/components/arduino-esp32 @@ -1 +1 @@ -Subproject commit 40409a3e4fe4fc5c436dc0d5082c4b576557062b +Subproject commit 59d3f4bd4fda8ed7471ff4fed4574a76dd5862b1 diff --git a/components/esp-gui-lib b/components/esp-gui-lib index 91181ef..eb17c28 160000 --- a/components/esp-gui-lib +++ b/components/esp-gui-lib @@ -1 +1 @@ -Subproject commit 91181efef8f2c2fb473086407d67ba01a3b34ed2 +Subproject commit eb17c286fe7a793bc223236e6328c7f6ed1bdf95 diff --git a/components/espasyncota b/components/espasyncota index ebfbee9..67d7c6d 160000 --- a/components/espasyncota +++ b/components/espasyncota @@ -1 +1 @@ -Subproject commit ebfbee903bfe823aebbd6b78513e4b954d5b3f8e +Subproject commit 67d7c6d72124cd00b0bf3cea81fbd53eb0338730 diff --git a/components/espchrono b/components/espchrono index c273edf..9c57959 160000 --- a/components/espchrono +++ b/components/espchrono @@ -1 +1 @@ -Subproject commit c273edf2788eaecdac0113a9afc383686bb4f458 +Subproject commit 9c57959705a1c44f3cf137f9193040774adecd34 diff --git a/components/espconfiglib b/components/espconfiglib index 0b138ba..fdb4ef6 160000 --- a/components/espconfiglib +++ b/components/espconfiglib @@ -1 +1 @@ -Subproject commit 0b138ba5b765782d0f9eeb6329434c0383c7674d +Subproject commit fdb4ef6dbfda85e7d41eefaf96f70308108e546e diff --git a/components/espcpputils b/components/espcpputils index 4d36c0a..247f89a 160000 --- a/components/espcpputils +++ b/components/espcpputils @@ -1 +1 @@ -Subproject commit 4d36c0a994fb0bfe3dee82456c7e4b38b432f397 +Subproject commit 247f89af97cd5178b69d2716d7d9ee1a6b1d2701 diff --git a/components/esphttpdutils b/components/esphttpdutils index bcf4936..7f62bb5 160000 --- a/components/esphttpdutils +++ b/components/esphttpdutils @@ -1 +1 @@ -Subproject commit bcf49369fd0af49f52ae092c6b331dcb8cc4e9cb +Subproject commit 7f62bb5344600ed0ae9c63d261d554f3d12a9240 diff --git a/components/espwifistack b/components/espwifistack index 25bb86f..bced0e2 160000 --- a/components/espwifistack +++ b/components/espwifistack @@ -1 +1 @@ -Subproject commit 25bb86f9eb82437393c6ad94c72ea22ccb692b1b +Subproject commit bced0e2852d3aeb43470c6a666ef8d3b8c684a12 diff --git a/esp-idf b/esp-idf index 7405732..a9ef558 160000 --- a/esp-idf +++ b/esp-idf @@ -1 +1 @@ -Subproject commit 740573214d850e05bd5814e8ee3b3eddcfdcc94e +Subproject commit a9ef558d9d3cf7b3497dd3976e2b5a6f51042ea1 diff --git a/main/cloud.cpp b/main/cloud.cpp index 3a75653..26ed792 100644 --- a/main/cloud.cpp +++ b/main/cloud.cpp @@ -11,6 +11,7 @@ #include #include #include +#include // local includes #include "globals.h" @@ -95,8 +96,8 @@ void cloudCollect() cloudBuffer += ','; cloudBuffer += fmt::format("[{},{},{}", - std::chrono::milliseconds{espchrono::millis_clock::now().time_since_epoch()}.count(), - std::chrono::milliseconds{espchrono::utc_clock::now().time_since_epoch()}.count(), + std::chrono::floor(espchrono::millis_clock::now().time_since_epoch()).count(), + std::chrono::floor(espchrono::utc_clock::now().time_since_epoch()).count(), heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)); if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED) { diff --git a/main/displays/menus/wifiapclientsmenu.cpp b/main/displays/menus/wifiapclientsmenu.cpp index f10bd40..c36b4f6 100644 --- a/main/displays/menus/wifiapclientsmenu.cpp +++ b/main/displays/menus/wifiapclientsmenu.cpp @@ -134,7 +134,7 @@ std::string WifiApClientMenuItem::text() const return fmt::format("{}{}&c {}", rssiToColor(m_info.rssi), m_info.rssi, - (std::chrono::milliseconds{espchrono::millis_clock::now().time_since_epoch()} % 4000ms) < 2000ms ? + (espchrono::millis_clock::now().time_since_epoch() % 4000ms) < 2000ms ? wifi_stack::toString(wifi_stack::mac_t{m_info.mac}) : wifi_stack::toString(m_ip) ); diff --git a/main/drivingstatistics.h b/main/drivingstatistics.h index 1ec2eed..ade5f85 100644 --- a/main/drivingstatistics.h +++ b/main/drivingstatistics.h @@ -4,10 +4,13 @@ #include #include +// 3rdparty lib includes +#include + struct DrivingStatistics { float meters_driven; - std::chrono::milliseconds currentDrivingTime; + espchrono::millis_clock::duration currentDrivingTime; double totalMeters; uint32_t last_cm_written; float wh_used; diff --git a/main/modes/defaultmode.cpp b/main/modes/defaultmode.cpp index e972b58..165fb42 100644 --- a/main/modes/defaultmode.cpp +++ b/main/modes/defaultmode.cpp @@ -177,13 +177,13 @@ void DefaultMode::update() { if (m_lastPwm < pwm && profileSettings.defaultMode.enableSmoothingUp) { - pwm = std::min(pwm, m_lastPwm + (profileSettings.defaultMode.smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::min(pwm, m_lastPwm + (profileSettings.defaultMode.smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); if (pwm < 1000.) pwm = 1000.; } else if (m_lastPwm > pwm && profileSettings.defaultMode.enableSmoothingDown) { - pwm = std::max(pwm, m_lastPwm - (profileSettings.defaultMode.smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::max(pwm, m_lastPwm - (profileSettings.defaultMode.smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); } } } @@ -201,7 +201,7 @@ void DefaultMode::update() auto difference_to_target = std::abs(pwm-m_lastPwm); effective_smoothing *= std::max((difference_to_target / 500),0.5f); - pwm = std::min(pwm, m_lastPwm + (effective_smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::min(pwm, m_lastPwm + (effective_smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); } else if (m_lastPwm > pwm && profileSettings.defaultMode.enableFieldWeakSmoothingDown) { @@ -209,7 +209,7 @@ void DefaultMode::update() auto difference_to_target = std::abs(pwm-m_lastPwm); effective_smoothing *= std::max((difference_to_target / 500),0.5f); - pwm = std::max(pwm, m_lastPwm - (effective_smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::max(pwm, m_lastPwm - (effective_smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); } } } From e187f2fa77c7c8d8f3fcfe51b600067189359341 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 29 Jan 2022 21:43:18 +0100 Subject: [PATCH 2/3] Fixed espnow rotz --- main/espnowfunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/espnowfunctions.cpp b/main/espnowfunctions.cpp index 993af0f..48940f0 100644 --- a/main/espnowfunctions.cpp +++ b/main/espnowfunctions.cpp @@ -302,7 +302,7 @@ esp_err_t send_espnow_message(std::string_view message) else { const auto timeAfter = espchrono::millis_clock::now(); - ESP_LOGI(TAG, "Successfully executed esp_now_send(): Took %lldms", std::chrono::milliseconds{timeAfter-timeBefore}.count()); + ESP_LOGI(TAG, "Successfully executed esp_now_send(): Took %lldms", std::chrono::floor(timeAfter-timeBefore).count()); } } return ESP_OK; From 28ebb57cf3e17fbde90be6b9019a5a26c7a63d53 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 29 Jan 2022 21:58:10 +0100 Subject: [PATCH 3/3] Fix seatbot --- main/modes/wheelchairmode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/modes/wheelchairmode.cpp b/main/modes/wheelchairmode.cpp index 69b8713..a50a164 100644 --- a/main/modes/wheelchairmode.cpp +++ b/main/modes/wheelchairmode.cpp @@ -189,11 +189,11 @@ void WheelchairMode::update() { if (m_lastPwm < pwm && profileSettings.defaultMode.enableSmoothingUp) { - pwm = std::min(pwm, m_lastPwm + (profileSettings.defaultMode.smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::min(pwm, m_lastPwm + (profileSettings.defaultMode.smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); } else if (m_lastPwm > pwm && profileSettings.defaultMode.enableSmoothingDown) { - pwm = std::max(pwm, m_lastPwm - (profileSettings.defaultMode.smoothing * std::chrono::milliseconds{now - m_lastTime}.count() / 100.f)); + pwm = std::max(pwm, m_lastPwm - (profileSettings.defaultMode.smoothing * std::chrono::floor(now - m_lastTime).count() / 100.f)); } }