From 873b84cd5b7b8b60f367ddc631dec8d14bad45e5 Mon Sep 17 00:00:00 2001 From: Robin Dietzel Date: Fri, 20 Jan 2023 15:38:15 +0100 Subject: [PATCH] CHANGE: removed format lib --- CMakeLists.txt | 3 --- Core/Inc/git_rev.h | 2 +- Core/Src/main.cpp | 17 +++++++---------- Lib/fmt | 1 - .../floatpump/Inc/Menu_Entry_Type_Numeric.h | 1 - .../floatpump/Inc/Menu_Entry_Type_Percent.h | 1 - .../floatpump/Src/Menu_Entry_Type_Numeric.cpp | 5 +++-- .../floatpump/Src/Menu_Entry_Type_Percent.cpp | 4 ++-- 8 files changed, 13 insertions(+), 21 deletions(-) delete mode 160000 Lib/fmt diff --git a/CMakeLists.txt b/CMakeLists.txt index 78e80c4..a378d4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,6 @@ else () add_compile_options(-Og -g) endif () -add_subdirectory(Lib/fmt) include_directories(USB_DEVICE/App USB_DEVICE/Target Core/Inc Drivers/STM32F4xx_HAL_Driver/Inc Drivers/STM32F4xx_HAL_Driver/Inc/Legacy Middlewares/ST/STM32_USB_Device_Library/Core/Inc Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc Drivers/CMSIS/Device/ST/STM32F4xx/Include Drivers/CMSIS/Include Middlewares/floatpump/Inc) @@ -75,8 +74,6 @@ add_link_options(-T ${LINKER_SCRIPT}) add_executable(${PROJECT_NAME}.elf ${SOURCES} ${LINKER_SCRIPT}) -target_link_libraries(${PROJECT_NAME}.elf fmt::fmt-header-only) - set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex) set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin) diff --git a/Core/Inc/git_rev.h b/Core/Inc/git_rev.h index cc8099f..dd32da0 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 "c9c911b" +#define GIT_HASH "57ae289" #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 e6ecd2a..738b6ed 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -2,9 +2,6 @@ #include "usb_device.h" #include "usbd_cdc_if.h" -#include "fmt/core.h" - - #include "LCD_I2C_Driver.h" #include "InitSequence.h" #include "button_input.h" @@ -122,9 +119,6 @@ void CheckRefillConditions(Config_Store &cfg, io::PressureChannel &tankLevel, io int main(void) { - Config_Store globalConfig; - globalConfig.loadFromFlash(); - // Step 1: Initialize HAL HAL_Init(); @@ -141,12 +135,15 @@ int main(void) { MX_USART1_UART_Init(); - //Disable Interrupt for Debouncing timer during display initialisation (exact timings are necessary) HAL_NVIC_DisableIRQ(TIM2_IRQn); LCD_I2C_Driver &display = floatpump::LCD_I2C_Driver::getInstance(hi2c1, SLAVE_ADDRESS_LCD); HAL_NVIC_EnableIRQ(TIM2_IRQn); + //Restore configuration + Config_Store globalConfig; + globalConfig.loadFromFlash(); + //Run init Sequence InitSequence initializer(display); initializer.runInitSequence(); @@ -267,7 +264,7 @@ int main(void) { display.LCDSetCursor(0, 0); display.LCDSendCString( - const_cast(fmt::format("Fuellstand {:3} % ", tankLevel0.getPercent()).c_str())); + const_cast(std::string("Fuellstand " + std::to_string(tankLevel0.getPercent()) + " %").c_str())); display.LCDSetCursor(0, 1); if (S_tankempty) { display.LCDSendCString(const_cast(std::string("Tank Wassermangel ").c_str())); @@ -292,9 +289,9 @@ int main(void) { if (S_refillcooldown > 0) { 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())); + display.LCDSendCString(const_cast(std::string("Nsp. wartet: min " + std::to_string( S_refillcooldown / 60)).c_str())); else - display.LCDSendCString(const_cast(fmt::format("Nsp. wartet: {:3} s ", S_refillcooldown).c_str())); + display.LCDSendCString(const_cast(std::string("Nsp. wartet: s " + std::to_string(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/Lib/fmt b/Lib/fmt deleted file mode 160000 index 676c2a1..0000000 --- a/Lib/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 676c2a107e9575663f79095d9b2c9d15168e1285 diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h index 48aaf63..e01ca8e 100644 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h +++ b/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h @@ -7,7 +7,6 @@ #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 3249da4..929b9a2 100644 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h +++ b/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h @@ -6,7 +6,6 @@ #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 e3a494e..e6385b3 100644 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp +++ b/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp @@ -13,9 +13,10 @@ namespace floatpump { std::string Menu_Entry_Type_Numeric::toString() { if (m_entered) { - return fmt::format("> {{:5}", *m_value); + return std::string("> " + std::to_string(*m_value)); } else { - return fmt::format(" {{:5}", *m_value); } + return std::string(" " + std::to_string(*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 97e020a..f0bccf4 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 fmt::format("> {:3} %", *m_value); + return std::string("> %" + std::to_string(*m_value)); } else { - return fmt::format(" {:3} %", *m_value); + return std::string(" %" + std::to_string(*m_value)); } }