From 97821f3b2162aaba2e9b7867ed5c03afca4ee7e9 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Tue, 8 Oct 2019 21:05:00 +0300 Subject: [PATCH] lights(xxx): help 2.3.0 string deduplication ...2.6.0+ does this all by itself --- code/espurna/config/progmem.h | 6 ++++++ code/espurna/light.ino | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/espurna/config/progmem.h b/code/espurna/config/progmem.h index 1b8aaa35..3a53b2aa 100644 --- a/code/espurna/config/progmem.h +++ b/code/espurna/config/progmem.h @@ -2,6 +2,12 @@ // PROGMEM definitions //-------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------- +// Various strings +//-------------------------------------------------------------------------------- + +PROGMEM const char pstr_unknown[] = "UNKNOWN"; + //-------------------------------------------------------------------------------- // Reset reasons //-------------------------------------------------------------------------------- diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 149a90c0..81cfd89a 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -196,7 +196,7 @@ void _lightApplyBrightnessColor() { } String lightDesc(unsigned char id) { - if (id >= _light_channel.size()) return F("UNKNOWN"); + if (id >= _light_channel.size()) return FPSTR(pstr_unknown); const char tag = pgm_read_byte(&_light_channel_desc[_light_channel.size() - 1][id]); switch (tag) { @@ -208,7 +208,7 @@ String lightDesc(unsigned char id) { default: break; } - return F("UNKNOWN"); + return FPSTR(pstr_unknown); } // -----------------------------------------------------------------------------