1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 01:32:19 +01:00

use PRIx macros for printing u32/i32 ints (#4671)

This fix compilation issues with the latest esp-idf.
This commit is contained in:
Jörg Thalheim
2023-04-10 23:20:02 +01:00
committed by GitHub
parent b56fa8c50a
commit 421ebcc8b2
9 changed files with 27 additions and 18 deletions

View File

@@ -2,6 +2,7 @@
#include "gpio.h"
#include "esphome/core/log.h"
#include <cinttypes>
namespace esphome {
namespace esp32 {
@@ -74,7 +75,7 @@ void ESP32InternalGPIOPin::attach_interrupt(void (*func)(void *), void *arg, gpi
std::string ESP32InternalGPIOPin::dump_summary() const {
char buffer[32];
snprintf(buffer, sizeof(buffer), "GPIO%u", static_cast<uint32_t>(pin_));
snprintf(buffer, sizeof(buffer), "GPIO%" PRIu32, static_cast<uint32_t>(pin_));
return buffer;
}

View File

@@ -5,6 +5,7 @@
#include "esphome/core/log.h"
#include <nvs_flash.h>
#include <cstring>
#include <cinttypes>
#include <vector>
#include <string>
@@ -101,7 +102,7 @@ class ESP32Preferences : public ESPPreferences {
pref->nvs_handle = nvs_handle;
uint32_t keyval = type;
pref->key = str_sprintf("%u", keyval);
pref->key = str_sprintf("%" PRIu32, keyval);
return ESPPreferenceObject(pref);
}