mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
Use PROGMEM_STRING_TABLE for the edge mode names
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "pulse_counter_sensor.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/progmem.h"
|
||||
|
||||
#ifdef HAS_PCNT
|
||||
#include <driver/gpio.h>
|
||||
@@ -11,8 +12,7 @@ namespace esphome::pulse_counter {
|
||||
|
||||
ESPHOME_LOG_TAG(TAG, "pulse_counter");
|
||||
|
||||
// Only passed to %s log arguments, which read flash directly on ESP8266
|
||||
static const char EDGE_MODE_TO_STRING[][10] PROGMEM = {"DISABLE", "INCREMENT", "DECREMENT"};
|
||||
PROGMEM_STRING_TABLE(EdgeModeStrings, "DISABLE", "INCREMENT", "DECREMENT");
|
||||
|
||||
#ifdef HAS_PCNT
|
||||
PulseCounterStorageBase *get_storage(bool hw_pcnt) {
|
||||
@@ -187,8 +187,9 @@ void PulseCounterSensor::dump_config() {
|
||||
" Rising Edge: %s\n"
|
||||
" Falling Edge: %s\n"
|
||||
" Filtering pulses shorter than %" PRIu32 " µs",
|
||||
EDGE_MODE_TO_STRING[this->storage_.rising_edge_mode],
|
||||
EDGE_MODE_TO_STRING[this->storage_.falling_edge_mode], this->storage_.filter_us);
|
||||
LOG_STR_ARG(EdgeModeStrings::get_log_str(this->storage_.rising_edge_mode, 0)),
|
||||
LOG_STR_ARG(EdgeModeStrings::get_log_str(this->storage_.falling_edge_mode, 0)),
|
||||
this->storage_.filter_us);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user