Merge pull request #252 from bobbycar-graz/update_submodules

Update submodules
This commit is contained in:
2022-01-29 23:07:19 +01:00
committed by GitHub
16 changed files with 25 additions and 21 deletions

Submodule esp-idf updated: 740573214d...a9ef558d9d

View File

@ -11,6 +11,7 @@
#include <esphttpdutils.h> #include <esphttpdutils.h>
#include <fmt/core.h> #include <fmt/core.h>
#include <tickchrono.h> #include <tickchrono.h>
#include <wrappers/websocket_client.h>
// local includes // local includes
#include "globals.h" #include "globals.h"
@ -95,8 +96,8 @@ void cloudCollect()
cloudBuffer += ','; cloudBuffer += ',';
cloudBuffer += fmt::format("[{},{},{}", cloudBuffer += fmt::format("[{},{},{}",
std::chrono::milliseconds{espchrono::millis_clock::now().time_since_epoch()}.count(), std::chrono::floor<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<std::chrono::milliseconds>(espchrono::utc_clock::now().time_since_epoch()).count(),
heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)); heap_caps_get_free_size(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT));
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED) if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
{ {

View File

@ -134,7 +134,7 @@ std::string WifiApClientMenuItem::text() const
return fmt::format("{}{}&c {}", return fmt::format("{}{}&c {}",
rssiToColor(m_info.rssi), rssiToColor(m_info.rssi),
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(wifi_stack::mac_t{m_info.mac}) :
wifi_stack::toString(m_ip) wifi_stack::toString(m_ip)
); );

View File

@ -4,10 +4,13 @@
#include <string> #include <string>
#include <chrono> #include <chrono>
// 3rdparty lib includes
#include <espchrono.h>
struct DrivingStatistics struct DrivingStatistics
{ {
float meters_driven; float meters_driven;
std::chrono::milliseconds currentDrivingTime; espchrono::millis_clock::duration currentDrivingTime;
double totalMeters; double totalMeters;
uint32_t last_cm_written; uint32_t last_cm_written;
float wh_used; float wh_used;

View File

@ -302,7 +302,7 @@ esp_err_t send_espnow_message(std::string_view message)
else else
{ {
const auto timeAfter = espchrono::millis_clock::now(); 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<std::chrono::milliseconds>(timeAfter-timeBefore).count());
} }
} }
return ESP_OK; return ESP_OK;

View File

@ -177,13 +177,13 @@ void DefaultMode::update()
{ {
if (m_lastPwm < pwm && profileSettings.defaultMode.enableSmoothingUp) 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
if (pwm < 1000.) if (pwm < 1000.)
pwm = 1000.; pwm = 1000.;
} }
else if (m_lastPwm > pwm && profileSettings.defaultMode.enableSmoothingDown) 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
} }
} }
} }
@ -201,7 +201,7 @@ void DefaultMode::update()
auto difference_to_target = std::abs(pwm-m_lastPwm); auto difference_to_target = std::abs(pwm-m_lastPwm);
effective_smoothing *= std::max((difference_to_target / 500),0.5f); 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
} }
else if (m_lastPwm > pwm && profileSettings.defaultMode.enableFieldWeakSmoothingDown) else if (m_lastPwm > pwm && profileSettings.defaultMode.enableFieldWeakSmoothingDown)
{ {
@ -209,7 +209,7 @@ void DefaultMode::update()
auto difference_to_target = std::abs(pwm-m_lastPwm); auto difference_to_target = std::abs(pwm-m_lastPwm);
effective_smoothing *= std::max((difference_to_target / 500),0.5f); 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
} }
} }
} }

View File

@ -189,11 +189,11 @@ void WheelchairMode::update()
{ {
if (m_lastPwm < pwm && profileSettings.defaultMode.enableSmoothingUp) 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
} }
else if (m_lastPwm > pwm && profileSettings.defaultMode.enableSmoothingDown) 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<std::chrono::milliseconds>(now - m_lastTime).count() / 100.f));
} }
} }