diff --git a/Tactility/Include/Tactility/hal/uart/Configuration.h b/Tactility/Include/Tactility/hal/uart/Configuration.h index 733afb108..e479190d8 100644 --- a/Tactility/Include/Tactility/hal/uart/Configuration.h +++ b/Tactility/Include/Tactility/hal/uart/Configuration.h @@ -1,5 +1,6 @@ #pragma once +#include #include "UartCompat.h" namespace tt::hal::uart { @@ -40,4 +41,4 @@ struct Configuration { #endif -} \ No newline at end of file +} diff --git a/Tactility/Source/app/gpssettings/GpsSettings.cpp b/Tactility/Source/app/gpssettings/GpsSettings.cpp index aadeff917..8b9613008 100644 --- a/Tactility/Source/app/gpssettings/GpsSettings.cpp +++ b/Tactility/Source/app/gpssettings/GpsSettings.cpp @@ -123,7 +123,7 @@ class GpsSettingsApp final : public App { lv_label_set_text_fmt(uart_label, "UART: %s", configuration.uartName); auto* baud_label = lv_label_create(left_wrapper); - lv_label_set_text_fmt(baud_label, "Baud: %lu", configuration.baudRate); + lv_label_set_text_fmt(baud_label, "Baud: %u", configuration.baudRate); auto* model_label = lv_label_create(left_wrapper); if (configuration.model == hal::gps::GpsModel::Unknown) { diff --git a/Tactility/Source/app/i2csettings/I2cSettings.cpp b/Tactility/Source/app/i2csettings/I2cSettings.cpp index bd1690fb4..3dd55d0d9 100644 --- a/Tactility/Source/app/i2csettings/I2cSettings.cpp +++ b/Tactility/Source/app/i2csettings/I2cSettings.cpp @@ -66,7 +66,7 @@ static void show(lv_obj_t* parent, const hal::i2c::Configuration& configuration) // Frequency: if (configuration.config.mode == I2C_MODE_MASTER) { auto* frequency_label = lv_label_create(card); - lv_label_set_text_fmt(frequency_label, "Frequency: %lu Hz", configuration.config.master.clk_speed); + lv_label_set_text_fmt(frequency_label, "Frequency: %" PRIu32 " Hz", configuration.config.master.clk_speed); lv_obj_align_to(frequency_label, scl_pin_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); } } diff --git a/Tactility/Source/app/power/Power.cpp b/Tactility/Source/app/power/Power.cpp index ea4d3eee7..cf14aa501 100644 --- a/Tactility/Source/app/power/Power.cpp +++ b/Tactility/Source/app/power/Power.cpp @@ -114,7 +114,7 @@ class PowerApp : public App { lv_label_set_text_fmt(chargeStateLabel, "Charging: %s", charge_state); if (battery_voltage_set) { - lv_label_set_text_fmt(batteryVoltageLabel, "Battery voltage: %lu mV", battery_voltage); + lv_label_set_text_fmt(batteryVoltageLabel, "Battery voltage: %" PRIu32 " mV", battery_voltage); } else { lv_label_set_text_fmt(batteryVoltageLabel, "Battery voltage: N/A"); } @@ -126,7 +126,7 @@ class PowerApp : public App { } if (current_set) { - lv_label_set_text_fmt(currentLabel, "Current: %ld mAh", current); + lv_label_set_text_fmt(currentLabel, "Current: %" PRId32 " mAh", current); } else { lv_label_set_text_fmt(currentLabel, "Current: N/A"); } diff --git a/Tactility/Source/network/Url.cpp b/Tactility/Source/network/Url.cpp index 7cbdca858..3489f29cc 100644 --- a/Tactility/Source/network/Url.cpp +++ b/Tactility/Source/network/Url.cpp @@ -48,7 +48,7 @@ std::string urlEncode(const std::string& input) { } else if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') { result += c; } else { - sprintf(hex_buffer, "%%%02X", c); //%% means '%' literal, %02X means at least two digits, paddable with a leading zero + snprintf(hex_buffer, sizeof(hex_buffer), "%%%02X", c); //%% means '%' literal, %02X means at least two digits, paddable with a leading zero result += hex_buffer; } } @@ -69,7 +69,7 @@ std::string urlDecode(const std::string& input) { result += input[i]; } } else { - sscanf(input.substr(i + 1, 2).c_str(), "%x", &conversion_buffer); + sscanf(input.substr(i + 1, 2).c_str(), "%zx", &conversion_buffer); char c = static_cast(conversion_buffer); result += c; i = i + 2;