From 8d103176bc169ba8c32aa97ed99eb3891d6c0daf Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Fri, 22 Mar 2019 04:11:21 +0900 Subject: [PATCH] Revert "Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled." This reverts commit b61004e63e82cf5334cee4def4ba10cffa88885f. --- quantum/rgblight.c | 43 ------------------------------------- quantum/rgblight.h | 6 +----- util/breathing_table_calc.c | 25 --------------------- 3 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 util/breathing_table_calc.c diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 5552c3fc2d..5be6383be8 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -945,54 +945,11 @@ void rgblight_task(void) { __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; -#ifdef RGBLIGHT_EFFECT_BREATHE_USE_TABLE -__attribute__ ((weak)) -const uint8_t rgblight_effect_breathe_table[] PROGMEM = { - 0x22, 0x23, 0x25, 0x26, 0x28, 0x29, 0x2a, 0x2c, - 0x2d, 0x2f, 0x30, 0x32, 0x33, 0x35, 0x36, 0x38, - 0x3a, 0x3b, 0x3d, 0x3e, 0x40, 0x42, 0x43, 0x45, - 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50, 0x51, 0x53, - 0x55, 0x57, 0x59, 0x5a, 0x5c, 0x5e, 0x60, 0x62, - 0x64, 0x66, 0x68, 0x69, 0x6b, 0x6d, 0x6f, 0x71, - 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d, 0x7f, 0x81, - 0x83, 0x85, 0x87, 0x89, 0x8a, 0x8c, 0x8e, 0x90, - 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0x9f, - 0xa1, 0xa3, 0xa5, 0xa7, 0xa8, 0xaa, 0xac, 0xae, - 0xaf, 0xb1, 0xb3, 0xb4, 0xb6, 0xb8, 0xb9, 0xbb, - 0xbc, 0xbe, 0xbf, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, - 0xc7, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xd0, - 0xd1, 0xd2, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, - 0xd7, 0xd8, 0xd9, 0xd9, 0xda, 0xda, 0xdb, 0xdb, - 0xdb, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc, 0xdb, - 0xdb, 0xdb, 0xda, 0xda, 0xd9, 0xd9, 0xd8, 0xd7, - 0xd7, 0xd6, 0xd5, 0xd4, 0xd3, 0xd2, 0xd2, 0xd1, - 0xd0, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc7, - 0xc6, 0xc5, 0xc3, 0xc2, 0xc1, 0xbf, 0xbe, 0xbc, - 0xbb, 0xb9, 0xb8, 0xb6, 0xb4, 0xb3, 0xb1, 0xaf, - 0xae, 0xac, 0xaa, 0xa8, 0xa7, 0xa5, 0xa3, 0xa1, - 0x9f, 0x9e, 0x9c, 0x9a, 0x98, 0x96, 0x94, 0x92, - 0x90, 0x8e, 0x8c, 0x8a, 0x89, 0x87, 0x85, 0x83, - 0x81, 0x7f, 0x7d, 0x7b, 0x79, 0x77, 0x75, 0x73, - 0x71, 0x6f, 0x6d, 0x6b, 0x69, 0x68, 0x66, 0x64, - 0x62, 0x60, 0x5e, 0x5c, 0x5a, 0x59, 0x57, 0x55, - 0x53, 0x51, 0x50, 0x4e, 0x4c, 0x4a, 0x49, 0x47, - 0x45, 0x43, 0x42, 0x40, 0x3e, 0x3d, 0x3b, 0x3a, - 0x38, 0x36, 0x35, 0x33, 0x32, 0x30, 0x2f, 0x2d, - 0x2c, 0x2a, 0x29, 0x28, 0x26, 0x25, 0x23, 0x22 -}; -#endif - void rgblight_effect_breathing(animation_status_t *anim) { float val; // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ -#ifndef RGBLIGHT_EFFECT_BREATHE_USE_TABLE val = (exp(sin((anim->pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E)); -#else - val = pgm_read_byte(&rgblight_effect_breathe_table[anim->pos]); -#endif - rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); anim->pos = (anim->pos + 1) % 256; } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 4e855aafe2..dbf551b5a3 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -80,12 +80,8 @@ enum RGBLIGHT_EFFECT_MODE { #define RGBLIGHT_MODES (RGBLIGHT_MODE_last-1) -// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1-2.7 - #ifndef RGBLIGHT_EFFECT_BREATHE_CENTER -#define RGBLIGHT_EFFECT_BREATHE_USE_TABLE -// this is same effect #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 -// see TOP/util/breathing_table_calc.c +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1-2.7 #endif #ifndef RGBLIGHT_EFFECT_BREATHE_MAX diff --git a/util/breathing_table_calc.c b/util/breathing_table_calc.c deleted file mode 100644 index bfde33a471..0000000000 --- a/util/breathing_table_calc.c +++ /dev/null @@ -1,25 +0,0 @@ -// -// this is host program for quantum/rgblight.c:void rgblight_effect_breathing(); -// -#include -#include -#include - -#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 -#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 - -int main(void) { - int pos; - printf("#ifdef RGBLIGHT_EFFECT_BREATHE_USE_TABLE\n"); - printf("__attribute__ ((weak))\n"); - printf("const uint8_t rgblight_effect_breathe_table[] PROGMEM = {\n"); - for (pos = 0; pos < 256; pos ++ ) { - printf(" 0x%x%s",(uint8_t)( (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E))),pos==255?"":"," ); - if ((pos+1) % 8 == 0) - printf("\n"); - } - printf("};\n"); - printf("#endif\n"); - - return 0; -}