CHANGE: removed format lib

This commit is contained in:
Robin Dietzel 2023-01-20 15:38:15 +01:00
parent 85c4d24e3b
commit 873b84cd5b
8 changed files with 13 additions and 21 deletions

View File

@ -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)

View File

@ -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

View File

@ -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<char *>(fmt::format("Fuellstand {:3} % ", tankLevel0.getPercent()).c_str()));
const_cast<char *>(std::string("Fuellstand " + std::to_string(tankLevel0.getPercent()) + " %").c_str()));
display.LCDSetCursor(0, 1);
if (S_tankempty) {
display.LCDSendCString(const_cast<char *>(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<char *>(fmt::format("Nsp. wartet: {:3} min", S_refillcooldown / 60).c_str()));
display.LCDSendCString(const_cast<char *>(std::string("Nsp. wartet: min " + std::to_string( S_refillcooldown / 60)).c_str()));
else
display.LCDSendCString(const_cast<char *>(fmt::format("Nsp. wartet: {:3} s ", S_refillcooldown).c_str()));
display.LCDSendCString(const_cast<char *>(std::string("Nsp. wartet: s " + std::to_string(S_refillcooldown)).c_str()));
} else if (S_refillempty) {
display.LCDSendCString(const_cast<char *>(std::string("Nachspeisung mangel ").c_str()));
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);

@ -1 +0,0 @@
Subproject commit 676c2a107e9575663f79095d9b2c9d15168e1285

View File

@ -7,7 +7,6 @@
#include <string>
#include "Menu_Entry_Type_Delegate.h"
#include "fmt/core.h"
namespace floatpump {
namespace menu {

View File

@ -6,7 +6,6 @@
#define FLOATPUMP_MENU_ENTRY_TYPE_PERCENT_H
#include "Menu_Entry_Type_Delegate.h"
#include "fmt/core.h"
namespace floatpump::menu {

View File

@ -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() {

View File

@ -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));
}
}