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:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user