Declare the flash tables static constexpr

This commit is contained in:
J. Nick Koston
2026-10-13 18:41:12 -10:00
parent e7277dab05
commit bd4bc21057
+9 -9
View File
@@ -5,16 +5,16 @@
namespace esphome::sx126x {
ESPHOME_LOG_TAG(TAG, "sx126x");
static const uint16_t RAMP[8] PROGMEM = {10, 20, 40, 80, 200, 800, 1700, 3400};
static constexpr uint16_t RAMP[8] PROGMEM = {10, 20, 40, 80, 200, 800, 1700, 3400};
// Aligned 32 bit loads from flash are safe on ESP8266, so this table is read directly
static const uint32_t BW_HZ[31] PROGMEM = {4800, 5800, 7300, 9700, 11700, 14600, 19500, 23400,
29300, 39000, 46900, 58600, 78200, 93800, 117300, 156200,
187200, 234300, 312000, 373600, 467000, 7810, 10420, 15630,
20830, 31250, 41670, 62500, 125000, 250000, 500000};
static const uint8_t BW_LORA[10] PROGMEM = {LORA_BW_7810, LORA_BW_10420, LORA_BW_15630, LORA_BW_20830,
LORA_BW_31250, LORA_BW_41670, LORA_BW_62500, LORA_BW_125000,
LORA_BW_250000, LORA_BW_500000};
static const uint8_t BW_FSK[21] PROGMEM = {
static constexpr uint32_t BW_HZ[31] PROGMEM = {4800, 5800, 7300, 9700, 11700, 14600, 19500, 23400,
29300, 39000, 46900, 58600, 78200, 93800, 117300, 156200,
187200, 234300, 312000, 373600, 467000, 7810, 10420, 15630,
20830, 31250, 41670, 62500, 125000, 250000, 500000};
static constexpr uint8_t BW_LORA[10] PROGMEM = {LORA_BW_7810, LORA_BW_10420, LORA_BW_15630, LORA_BW_20830,
LORA_BW_31250, LORA_BW_41670, LORA_BW_62500, LORA_BW_125000,
LORA_BW_250000, LORA_BW_500000};
static constexpr uint8_t BW_FSK[21] PROGMEM = {
FSK_BW_4800, FSK_BW_5800, FSK_BW_7300, FSK_BW_9700, FSK_BW_11700, FSK_BW_14600, FSK_BW_19500,
FSK_BW_23400, FSK_BW_29300, FSK_BW_39000, FSK_BW_46900, FSK_BW_58600, FSK_BW_78200, FSK_BW_93800,
FSK_BW_117300, FSK_BW_156200, FSK_BW_187200, FSK_BW_234300, FSK_BW_312000, FSK_BW_373600, FSK_BW_467000};