From 12a5a59bf1be63a8814029a0728fbe94c5fdd69d Mon Sep 17 00:00:00 2001 From: zvecr Date: Fri, 29 Apr 2022 00:35:20 +0100 Subject: [PATCH 1/2] Remove ARM pgm_read_word workaround --- quantum/rgblight/rgblight.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index cc856a0e8686..61112cdb888f 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -559,12 +559,8 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w // static gradient uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; bool direction = (delta % 2) == 0; -# ifdef __AVR__ - // probably due to how pgm_read_word is defined for ARM, but the ARM compiler really hates this line + uint8_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]); -# else - uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2]; -# endif for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds; if (direction) { From ee8b8753ee37fec2e8e2bd664c69d808253f8b92 Mon Sep 17 00:00:00 2001 From: zvecr Date: Fri, 29 Apr 2022 01:17:20 +0100 Subject: [PATCH 2/2] Use correct progmem API to avoid compiler issues --- quantum/rgblight/rgblight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 61112cdb888f..e5d3a98bea5e 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -560,7 +560,7 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; bool direction = (delta % 2) == 0; - uint8_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]); + uint8_t range = pgm_read_byte(&RGBLED_GRADIENT_RANGES[delta / 2]); for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds; if (direction) {