diff --git a/Core/Inc/git_rev.h b/Core/Inc/git_rev.h index 8918131..cc8099f 100644 --- a/Core/Inc/git_rev.h +++ b/Core/Inc/git_rev.h @@ -7,6 +7,6 @@ // Auto generated header file containing the last git revision -#define GIT_HASH "e0a068f" +#define GIT_HASH "c9c911b" #endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H \ No newline at end of file diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index a641658..e6ecd2a 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -81,6 +81,7 @@ void CheckRefillConditions(Config_Store &cfg, io::PressureChannel &tankLevel, io //Check whether refilling is necessary if(HAL_GetTick() > (c_RefillCooldown + (cfg.RefillCooldown.getValue() * 60*1000))) { + S_refillcooldown = 0; if (tankLevel.getPercent() < cfg.RefillBelow.getValue()) { if (cfg.RefillBlockEnable.getValue() && !rblock) { refillPump.switchRelay(io::RelayChannel::state::ON); @@ -266,8 +267,7 @@ int main(void) { display.LCDSetCursor(0, 0); display.LCDSendCString( - const_cast(std::string("Tank: " + std::to_string(tankLevel0.getPercent()) + " %").c_str())); - + const_cast(fmt::format("Fuellstand {:3} % ", tankLevel0.getPercent()).c_str())); display.LCDSetCursor(0, 1); if (S_tankempty) { display.LCDSendCString(const_cast(std::string("Tank Wassermangel ").c_str())); @@ -290,7 +290,11 @@ int main(void) { display.LCDSetCursor(0, 3); if (S_refillcooldown > 0) { - display.LCDSendCString(const_cast(fmt::format("Nsp. wartet: {:3} min", S_refillcooldown / 60).c_str())); + int remaining_mins = S_refillcooldown / 60; + if(remaining_mins > 0) + display.LCDSendCString(const_cast(fmt::format("Nsp. wartet: {:3} min", S_refillcooldown / 60).c_str())); + else + display.LCDSendCString(const_cast(fmt::format("Nsp. wartet: {:3} s ", S_refillcooldown).c_str())); } else if (S_refillempty) { display.LCDSendCString(const_cast(std::string("Nachspeisung mangel ").c_str())); HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h index e01ca8e..48aaf63 100644 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h +++ b/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h @@ -7,6 +7,7 @@ #include #include "Menu_Entry_Type_Delegate.h" +#include "fmt/core.h" namespace floatpump { namespace menu { diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h index 929b9a2..3249da4 100644 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h +++ b/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h @@ -6,6 +6,7 @@ #define FLOATPUMP_MENU_ENTRY_TYPE_PERCENT_H #include "Menu_Entry_Type_Delegate.h" +#include "fmt/core.h" namespace floatpump::menu { diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp index d6b6451..e3a494e 100644 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp +++ b/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp @@ -13,10 +13,9 @@ namespace floatpump { std::string Menu_Entry_Type_Numeric::toString() { if (m_entered) { - return "# " + std::to_string(*m_value); + return fmt::format("> {{:5}", *m_value); } else { - return " " + std::to_string(*m_value); - } + return fmt::format(" {{:5}", *m_value); } } void Menu_Entry_Type_Numeric::u_press() { diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp index 7d10da5..97e020a 100644 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp +++ b/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp @@ -6,9 +6,9 @@ std::string floatpump::menu::Menu_Entry_Type_Percent::toString() { if (m_entered) { - return std::string("# " + std::to_string(*m_value) + "%"); + return fmt::format("> {:3} %", *m_value); } else { - return std::string(" " + std::to_string(*m_value) + "%"); + return fmt::format(" {:3} %", *m_value); } }