From 5adce05f84fb1404d4c68bd326dbee70bce2ef8e Mon Sep 17 00:00:00 2001 From: true Date: Fri, 2 Aug 2024 19:39:01 -0700 Subject: [PATCH] fix the phosphoric fade effect on program 4 --- firmware/retro_tech_fw/user/src/led_rgbprog.c | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/firmware/retro_tech_fw/user/src/led_rgbprog.c b/firmware/retro_tech_fw/user/src/led_rgbprog.c index 5ad45e2..a43fca5 100644 --- a/firmware/retro_tech_fw/user/src/led_rgbprog.c +++ b/firmware/retro_tech_fw/user/src/led_rgbprog.c @@ -404,27 +404,20 @@ void led_rgb_4_typing(uint8_t preview, uint8_t tick) // set rgb colors as appropriate for (i = 0; i < 9; i++) { - if (i < typing_idx || ((i == typing_idx) && (typing_flash_state))) { - // these are on - rgb[i][0] = typing[color][0]; - rgb[i][1] = typing[color][1]; - rgb[i][2] = typing[color][2]; - } + for (j = 0; j < 3; j++) { + if ((i < typing_idx) || ((i == typing_idx) && typing_flash_state)) { + // these are on + rgb[i][j] = typing[color][j]; + } - if (i > typing_idx || ((i == typing_idx) && (!typing_flash_state))) { - // these are idle - rgb[i][0] = idle_glow[0]; - rgb[i][1] = idle_glow[1]; - rgb[i][2] = idle_glow[2]; - } + if (i > typing_idx) { // || ((i == typing_idx) && !typing_flash_state)) { + // these are idle + rgb[i][j] = idle_glow[j]; + } - // flashing cursor fadeout - if (i == typing_idx && typing_flash_state) { - if (typing_flash_delay <= 8) { - w = 8 - typing_flash_delay; - rgb[i][0] >>= w; if (rgb[i][0] < idle_glow[0]) rgb[i][0] = idle_glow[0]; - rgb[i][1] >>= w; if (rgb[i][1] < idle_glow[1]) rgb[i][1] = idle_glow[1]; - rgb[i][2] >>= w; if (rgb[i][2] < idle_glow[2]) rgb[i][2] = idle_glow[2]; + // flashing cursor fadeout + if ((i == typing_idx) && !typing_flash_state) { + if (rgb[i][j] > 32) rgb[i][j] -= 32; else rgb[i][j] = 0; update = 1; } }