aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-09-25 05:24:49 -0600
committerSelene ToyKeeper2020-09-25 05:24:49 -0600
commit8c6d367195af771e509c2b19433958e69ecf6036 (patch)
tree161210292a17c5f07b680360a09fb98be2c8bde2
parentreduced ROM 4 bytes by rearranging thermal_config_save() logic a bit (diff)
downloadanduril-8c6d367195af771e509c2b19433958e69ecf6036.tar.gz
anduril-8c6d367195af771e509c2b19433958e69ecf6036.tar.bz2
anduril-8c6d367195af771e509c2b19433958e69ecf6036.zip
reduced ROM size by ~58 to ~88 bytes by making lookup tables const
patch by SammysHP and Grumsel: https://gist.github.com/SammysHP/48347a770995921444a6e91b187cb55b http://budgetlightforum.com/comment/1699350#comment-1699350
-rw-r--r--spaghetti-monster/anduril/aux-leds.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/spaghetti-monster/anduril/aux-leds.c b/spaghetti-monster/anduril/aux-leds.c
index 7c0ab10..c819bd7 100644
--- a/spaghetti-monster/anduril/aux-leds.c
+++ b/spaghetti-monster/anduril/aux-leds.c
@@ -32,8 +32,8 @@ void indicator_blink(uint8_t arg) {
#ifdef USE_FANCIER_BLINKING_INDICATOR
// fancy blink, set off/low/high levels here:
- uint8_t seq[] = {0, 1, 2, 1, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0};
+ static const uint8_t seq[] = {0, 1, 2, 1, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0};
indicator_led(seq[arg & 15]);
#else // basic blink, 1/8th duty cycle
@@ -51,7 +51,7 @@ void indicator_blink(uint8_t arg) {
#if defined(USE_AUX_RGB_LEDS) && defined(TICK_DURING_STANDBY)
uint8_t voltage_to_rgb() {
- uint8_t levels[] = {
+ static const uint8_t levels[] = {
// voltage, color
0, 0, // 0, R
33, 1, // 1, R+G
@@ -131,8 +131,8 @@ void rgb_led_update(uint8_t mode, uint8_t arg) {
// pick a brightness from the animation sequence
if (pattern == 3) {
// uses an odd length to avoid lining up with rainbow loop
- uint8_t animation[] = {2, 1, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+ static const uint8_t animation[] = {2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1};
frame = (frame + 1) % sizeof(animation);
pattern = animation[frame];
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.