mirror of
https://github.com/mon/PocketVoltex.git
synced 2026-10-10 08:08:24 +03:00
Cleanups and memory improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "LEDPatterns.h"
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
static enum LEDMode animMode = NONE;
|
||||
static uint8_t frameCounter = 0;
|
||||
@@ -35,9 +36,6 @@ void led_frame(void) {
|
||||
|
||||
frameCounter = 0;
|
||||
|
||||
uint8_t followDir;
|
||||
RGBFader* follow;
|
||||
|
||||
switch(animMode) {
|
||||
case INIT_FLASH:
|
||||
if(flashDirection) {
|
||||
@@ -49,17 +47,19 @@ void led_frame(void) {
|
||||
} else {
|
||||
flash-=3;
|
||||
if(flash <= 0) {
|
||||
//animMode = NONE;
|
||||
led_anim_follower();
|
||||
flash = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t bright = ledLogCurve[flash];
|
||||
uint8_t bright = pgm_read_byte(&ledLogCurve[flash]);
|
||||
led_set_all(bright, bright/2, 0);
|
||||
break;
|
||||
case FOLLOWER:
|
||||
/*for(uint8_t led = 0; led < LED_COUNT; led++) {
|
||||
for(uint8_t led = 0; led < LED_COUNT; led++) {
|
||||
uint8_t followDir;
|
||||
RGBFader* follow;
|
||||
|
||||
follow = followers + led;
|
||||
followDir = follow->direction;
|
||||
for(uint8_t i = 0; i < 3; i++) {
|
||||
@@ -79,7 +79,7 @@ void led_frame(void) {
|
||||
followDir >>= 1;
|
||||
}
|
||||
led_set(led, follow->value[0], follow->value[1], follow->value[2]);
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
case BREATHE:
|
||||
default:
|
||||
@@ -150,7 +150,7 @@ void led_anim_flash(void) {
|
||||
|
||||
void led_anim_follower(void) {
|
||||
// Generated by FollowerGen.py
|
||||
static const uint8_t followStart[][4] = {
|
||||
static uint8_t PROGMEM followStart[][4] = {
|
||||
{63, 0, 0, 0b010},
|
||||
{40, 0, 23, 0b001},
|
||||
{39, 24, 0, 0b010},
|
||||
@@ -164,8 +164,8 @@ void led_anim_follower(void) {
|
||||
|
||||
for(uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
for(uint8_t j = 0; j < 3; j++) {
|
||||
followers[i].value[j] = followStart[i][j];
|
||||
followers[i].value[j] = pgm_read_byte(&followStart[i][j]);
|
||||
}
|
||||
followers[i].direction = followStart[i][3];
|
||||
followers[i].direction = pgm_read_byte(&followStart[i][3]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user