Merge branch 'cloud' into cloud-branch-rewrite
This commit is contained in:
175
main/battery.h
175
main/battery.h
@ -12,7 +12,8 @@
|
||||
x(_22P) \
|
||||
x(HG2) \
|
||||
x(MH1) \
|
||||
x(VTC5)
|
||||
x(VTC5) \
|
||||
x(BAK_25R)
|
||||
DECLARE_TYPESAFE_ENUM(BatteryCellType, : uint8_t, BatteryCellTypeValues)
|
||||
|
||||
namespace {
|
||||
@ -24,86 +25,98 @@ float getBatteryPercentage(float batVoltage, BatteryCellType cellType)
|
||||
{
|
||||
const float cellVoltage = batVoltage / settings.battery.cellsSeries;
|
||||
|
||||
switch (cellType)
|
||||
{
|
||||
case BatteryCellType::_22P:
|
||||
{
|
||||
const float expected_ah = 2.2;
|
||||
if (cellVoltage > 4.15)
|
||||
return 100;
|
||||
|
||||
CURVE(4.15, 4.04, 0, 0.25)
|
||||
CURVE(4.04, 3.95, 0.25, 0.5)
|
||||
CURVE(3.95, 3.86, 0.5, 0.75)
|
||||
CURVE(3.86, 3.74, 0.75, 1.0)
|
||||
CURVE(3.74, 3.64, 1.0, 1.25)
|
||||
CURVE(3.64, 3.59, 1.25, 1.5)
|
||||
CURVE(3.59, 3.54, 1.5, 1.75)
|
||||
CURVE(3.54, 3.43, 1.75, 2.0)
|
||||
CURVE(3.43, 3.35, 2.0, 2.1)
|
||||
CURVE(3.35, 2.50, 2.1, 2.2)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::MH1:
|
||||
{
|
||||
const float expected_ah = 3.2;
|
||||
if (cellVoltage > 4.15)
|
||||
return 100;
|
||||
|
||||
CURVE(4.15, 4.09, 0, 0.25)
|
||||
CURVE(4.09, 4.04, 0.25, 0.5)
|
||||
CURVE(4.04, 3.95, 0.5, 0.75)
|
||||
CURVE(3.95, 3.88, 0.75, 1.0)
|
||||
CURVE(3.88, 3.79, 1.0, 1.25)
|
||||
CURVE(3.79, 3.70, 1.25, 1.5)
|
||||
CURVE(3.70, 3.65, 1.5, 1.75)
|
||||
CURVE(3.65, 3.60, 1.75, 2.0)
|
||||
CURVE(3.60, 3.56, 2.0, 2.25)
|
||||
CURVE(3.56, 3.50, 2.25, 2.5)
|
||||
CURVE(3.50, 3.40, 2.5, 2.75)
|
||||
CURVE(3.40, 3.30, 2.75, 3.0)
|
||||
CURVE(3.30, 2.5, 3.0, 3.2)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::HG2:
|
||||
{
|
||||
const float expected_ah = 3.0;
|
||||
if (cellVoltage > 4.15)
|
||||
return 100;
|
||||
|
||||
CURVE(4.15, 4.08, 0, 0.25)
|
||||
CURVE(4.08, 4.01, 0.25, 0.5)
|
||||
CURVE(4.01, 3.92, 0.5, 0.75)
|
||||
CURVE(3.92, 3.84, 0.75, 1.0)
|
||||
CURVE(3.84, 3.75, 1.0, 1.25)
|
||||
CURVE(3.75, 3.67, 1.25, 1.5)
|
||||
CURVE(3.67, 3.62, 1.5, 1.75)
|
||||
CURVE(3.62, 3.55, 1.75, 2.0)
|
||||
CURVE(3.55, 3.44, 2.0, 2.25)
|
||||
CURVE(3.44, 3.30, 2.25, 2.5)
|
||||
CURVE(3.30, 3.05, 2.5, 2.75)
|
||||
CURVE(3.05, 2.50, 2.75, 3.0)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::VTC5:
|
||||
{
|
||||
const float expected_ah = 2.6;
|
||||
if (cellVoltage > 4.15)
|
||||
return 100;
|
||||
|
||||
CURVE(4.15, 4.08, 0, 0.25)
|
||||
CURVE(4.08, 3.98, 0.25, 0.5)
|
||||
CURVE(3.98, 3.89, 0.5, 0.75)
|
||||
CURVE(3.89, 3.79, 0.75, 1.0)
|
||||
CURVE(3.79, 3.71, 1.0, 1.25)
|
||||
CURVE(3.71, 3.64, 1.25, 1.5)
|
||||
CURVE(3.64, 3.53, 1.5, 1.75)
|
||||
CURVE(3.53, 3.44, 1.75, 2.0)
|
||||
CURVE(3.44, 3.20, 2.0, 2.25)
|
||||
CURVE(3.20, 2.80, 2.25, 2.5)
|
||||
CURVE(2.80, 2.50, 2.5, 2.60)
|
||||
break;
|
||||
}
|
||||
switch (cellType) {
|
||||
case BatteryCellType::_22P: {
|
||||
const float expected_ah = 2.2;
|
||||
if(cellVoltage > 4.15){
|
||||
return 100;
|
||||
}
|
||||
CURVE(4.15, 4.04, 0, 0.25)
|
||||
CURVE(4.04, 3.95, 0.25, 0.5)
|
||||
CURVE(3.95, 3.86, 0.5, 0.75)
|
||||
CURVE(3.86, 3.74, 0.75, 1.0)
|
||||
CURVE(3.74, 3.64, 1.0, 1.25)
|
||||
CURVE(3.64, 3.59, 1.25, 1.5)
|
||||
CURVE(3.59, 3.54, 1.5, 1.75)
|
||||
CURVE(3.54, 3.43, 1.75, 2.0)
|
||||
CURVE(3.43, 3.35, 2.0, 2.1)
|
||||
CURVE(3.35, 2.50, 2.1, 2.2)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::MH1: {
|
||||
const float expected_ah = 3.2;
|
||||
if(cellVoltage > 4.15){
|
||||
return 100;
|
||||
}
|
||||
CURVE(4.15, 4.09, 0, 0.25)
|
||||
CURVE(4.09, 4.04, 0.25, 0.5)
|
||||
CURVE(4.04, 3.95, 0.5, 0.75)
|
||||
CURVE(3.95, 3.88, 0.75, 1.0)
|
||||
CURVE(3.88, 3.79, 1.0, 1.25)
|
||||
CURVE(3.79, 3.70, 1.25, 1.5)
|
||||
CURVE(3.70, 3.65, 1.5, 1.75)
|
||||
CURVE(3.65, 3.60, 1.75, 2.0)
|
||||
CURVE(3.60, 3.56, 2.0, 2.25)
|
||||
CURVE(3.56, 3.50, 2.25, 2.5)
|
||||
CURVE(3.50, 3.40, 2.5, 2.75)
|
||||
CURVE(3.40, 3.30, 2.75, 3.0)
|
||||
CURVE(3.30, 2.50, 3.0, 3.2)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::HG2: {
|
||||
const float expected_ah = 3.0;
|
||||
if(cellVoltage > 4.15){
|
||||
return 100;
|
||||
}
|
||||
CURVE(4.15, 4.08, 0, 0.25)
|
||||
CURVE(4.08, 4.01, 0.25, 0.5)
|
||||
CURVE(4.01, 3.92, 0.5, 0.75)
|
||||
CURVE(3.92, 3.84, 0.75, 1.0)
|
||||
CURVE(3.84, 3.75, 1.0, 1.25)
|
||||
CURVE(3.75, 3.67, 1.25, 1.5)
|
||||
CURVE(3.67, 3.62, 1.5, 1.75)
|
||||
CURVE(3.62, 3.55, 1.75, 2.0)
|
||||
CURVE(3.55, 3.44, 2.0, 2.25)
|
||||
CURVE(3.44, 3.30, 2.25, 2.5)
|
||||
CURVE(3.30, 3.05, 2.5, 2.75)
|
||||
CURVE(3.05, 2.50, 2.75, 3.0)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::VTC5: {
|
||||
const float expected_ah = 2.6;
|
||||
if(cellVoltage > 4.15){
|
||||
return 100;
|
||||
}
|
||||
CURVE(4.15, 4.08, 0, 0.25)
|
||||
CURVE(4.08, 3.98, 0.25, 0.5)
|
||||
CURVE(3.98, 3.89, 0.5, 0.75)
|
||||
CURVE(3.89, 3.79, 0.75, 1.0)
|
||||
CURVE(3.79, 3.71, 1.0, 1.25)
|
||||
CURVE(3.71, 3.64, 1.25, 1.5)
|
||||
CURVE(3.64, 3.53, 1.5, 1.75)
|
||||
CURVE(3.53, 3.44, 1.75, 2.0)
|
||||
CURVE(3.44, 3.20, 2.0, 2.25)
|
||||
CURVE(3.20, 2.80, 2.25, 2.5)
|
||||
CURVE(2.80, 2.50, 2.5, 2.60)
|
||||
break;
|
||||
}
|
||||
case BatteryCellType::BAK_25R: {
|
||||
const float expected_ah = 2.5;
|
||||
if(cellVoltage > 4.15){
|
||||
return 100;
|
||||
}
|
||||
CURVE(4.15, 4.06, 0, 0.25)
|
||||
CURVE(4.06, 3.96, 0.25, 0.5)
|
||||
CURVE(3.96, 3.88, 0.5, 0.75)
|
||||
CURVE(3.88, 3.77, 0.75, 1)
|
||||
CURVE(3.77, 3.68, 1, 1.25)
|
||||
CURVE(3.68, 3.62, 1.25, 1.5)
|
||||
CURVE(3.62, 3.56, 1.5, 1.75)
|
||||
CURVE(3.56, 3.47, 1.75, 2)
|
||||
CURVE(3.47, 3.31, 2, 2.25)
|
||||
CURVE(3.31, 2.50, 2.25, 2.5)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0.f;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ namespace {
|
||||
bool request_running = false;
|
||||
uint16_t request_failed = false;
|
||||
bool parsing_finished = false;
|
||||
static bool redownload = true;
|
||||
cpputils::DelayedConstruction<AsyncHttpRequest> request;
|
||||
|
||||
std::string get_ota_url_from_index(uint16_t index)
|
||||
@ -114,7 +113,6 @@ namespace {
|
||||
url_for_latest = fix_url(fmt::format("{}{}", stringSettings.otaServerUrl, doc["latest"].as<std::string>()));
|
||||
url_for_hashes = fix_url(fmt::format("{}{}", stringSettings.otaServerUrl, doc["url"].as<std::string>()));
|
||||
parsing_finished = true;
|
||||
redownload = false;
|
||||
}
|
||||
|
||||
void setup_request()
|
||||
@ -125,11 +123,6 @@ namespace {
|
||||
|
||||
void start_descriptor_request(std::string server_base_url)
|
||||
{
|
||||
if (!redownload)
|
||||
{
|
||||
parsing_finished = true;
|
||||
return;
|
||||
}
|
||||
if (!request.constructed())
|
||||
{
|
||||
ESP_LOGW("BOBBY", "request is im oarsch");
|
||||
|
@ -17,18 +17,6 @@
|
||||
#include "displays/menus/mainmenu.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
namespace {
|
||||
|
||||
class RedownloadJsonAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
redownload = true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
@ -37,7 +25,6 @@ OtaMenu::OtaMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILD>, SwitchScreenAction<SelectBuildMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATENOW>, SwitchScreenAction<UpdateDisplay>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_REDOWNLOAD>, RedownloadJsonAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
stringSettings.otaUrl = m_buildserver_url;
|
||||
}
|
||||
saveSettings();
|
||||
redownload = true;
|
||||
url_for_latest.clear();
|
||||
url_for_hashes.clear();
|
||||
availableVersions = {};
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "buildserver.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
class SelectBuildServerMenu :
|
||||
public espgui::MenuDisplay,
|
||||
public espgui::StaticText<TEXT_SELECTBUILDSERVERMENU>
|
||||
|
@ -32,6 +32,5 @@ void showSpeedSyncAnimation();
|
||||
void showCustomColor();
|
||||
|
||||
void initLedStrip();
|
||||
|
||||
void updateLedStrip();
|
||||
#endif
|
||||
|
@ -102,6 +102,7 @@ constexpr char TEXT_BATTERY_TYPE_22P[] = "22P cells";
|
||||
constexpr char TEXT_BATTERY_TYPE_HG2[] = "HG2 cells";
|
||||
constexpr char TEXT_BATTERY_TYPE_MH1[] = "MH1 cells";
|
||||
constexpr char TEXT_BATTERY_TYPE_VTC5[] = "VTC5 cells";
|
||||
constexpr char TEXT_BATTERY_TYPE_BAK_25R[] = "BAK / 25R cells";
|
||||
constexpr char TEXT_BATTERY_WHKM[] = "Wh per km";
|
||||
constexpr char TEXT_BATTERY_APPLYCALIB[] = "Apply calibration";
|
||||
constexpr char TEXT_VOLTAGECALIBRATION_RESET[] = "Reset calibration";
|
||||
@ -489,7 +490,6 @@ constexpr char TEXT_OTA_NOBUILDSERVERAVAILABLE[] = "E:No server saved.";
|
||||
constexpr char TEXT_OTA_NOBUILDSERVERSELECTED[] = "E:No server selected.";
|
||||
constexpr char TEXT_OTA_NOCONNECTION[] = "E:No internet.";
|
||||
constexpr char TEXT_OTA_WAITFORRESPONSE[] = "Wait for response...";
|
||||
constexpr char TEXT_REDOWNLOAD[] = "Reload list";
|
||||
|
||||
//LedstripColorMenu
|
||||
constexpr char TEXT_LEDSTRIPCOLORMENU[] = "Customize Ledstrip";
|
||||
|
Reference in New Issue
Block a user