added alpha slash slash programs
This commit is contained in:
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static uint32_t s[8] = {0};
|
static uint32_t s[8] = {0};
|
||||||
//static uint32_t t[8] = {0};
|
static uint32_t t[8] = {0};
|
||||||
//static uint32_t l[8] = {0};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -136,3 +135,181 @@ void lp_ribbon_twinkle(uint8_t idle, uint8_t max, uint8_t thresh_lo, uint8_t thr
|
|||||||
|
|
||||||
matrix_flag_update();
|
matrix_flag_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lp_aii_init()
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
t[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// also clear LEDs
|
||||||
|
for (int i = 0; i < sizeof(led_set.a); i++) {
|
||||||
|
led_set.a[i] = 0;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < sizeof(led_set.ii_lf); i++) {
|
||||||
|
led_set.ii_lf[i] = 0;
|
||||||
|
led_set.ii_rt[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_flag_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void lp_aii_filldown(uint16_t prewait, uint16_t downrate, uint16_t postwait, uint8_t setrate, uint8_t max)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
0: state
|
||||||
|
1: timeout
|
||||||
|
2: index or setrate >>= 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint32_t i;
|
||||||
|
uint32_t x;
|
||||||
|
|
||||||
|
if (setrate == 1)
|
||||||
|
setrate = 2;
|
||||||
|
|
||||||
|
switch (t[0]) {
|
||||||
|
case 0: // timeout before start
|
||||||
|
case 2: { // timeout after set
|
||||||
|
if (!t[1]) {
|
||||||
|
t[0]++;
|
||||||
|
t[2] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
t[1]--;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1: { // fill down
|
||||||
|
// rate delay
|
||||||
|
if (!t[1]) {
|
||||||
|
t[1] = downrate;
|
||||||
|
} else {
|
||||||
|
t[1]--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = t[2]++;
|
||||||
|
|
||||||
|
// done filling?
|
||||||
|
if (x > 10) {
|
||||||
|
t[0]++;
|
||||||
|
t[1] = postwait;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i <= x; i++) {
|
||||||
|
led_set.a[9 + i] += setrate;
|
||||||
|
if (led_set.a[9 + i] > max)
|
||||||
|
led_set.a[9 + i] = max;
|
||||||
|
|
||||||
|
led_set.a[9 - i] += setrate;
|
||||||
|
if (led_set.a[9 - i] > max)
|
||||||
|
led_set.a[9 - i] = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 3: { // fade out
|
||||||
|
x = 0;
|
||||||
|
t[2] = setrate >>= 1;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(led_set.a); i++) {
|
||||||
|
if (led_set.a[i] < setrate) {
|
||||||
|
led_set.a[i] = 0;
|
||||||
|
} else {
|
||||||
|
led_set.a[i] -= setrate;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all blank?
|
||||||
|
if (!x) {
|
||||||
|
t[0] = 0;
|
||||||
|
t[1] = prewait;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
led_set.ii_lf[i] = led_set.ii_rt[i] = led_set.a[i + 12];
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_flag_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void lp_aii_bounce(uint8_t rate, uint8_t set, uint8_t faderate, uint8_t fadeamt)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
0: direction
|
||||||
|
1: rate timeout
|
||||||
|
2: faderate timeout
|
||||||
|
3: index
|
||||||
|
4: changedir timeout
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint8_t *a;
|
||||||
|
uint32_t i;
|
||||||
|
uint32_t x;
|
||||||
|
|
||||||
|
if (!t[1]) {
|
||||||
|
if (t[4]) {
|
||||||
|
t[4]--;
|
||||||
|
if (t[4]) {
|
||||||
|
goto fadeout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t[1] = rate;
|
||||||
|
t[3]++;
|
||||||
|
|
||||||
|
if (t[3] >= 19) {
|
||||||
|
t[0] ^= 1;
|
||||||
|
t[3] = 0;
|
||||||
|
t[4] = rate << 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t[0]) {
|
||||||
|
x = 18 - t[3];
|
||||||
|
} else {
|
||||||
|
x = t[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
led_set.a[x] = set;
|
||||||
|
|
||||||
|
if (t[3] >= 3) {
|
||||||
|
if (t[3] <= 7) {
|
||||||
|
led_set.ii_lf[7 - t[3]] = set >> 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t[3] >= 13) {
|
||||||
|
if (t[3] <= 17) {
|
||||||
|
led_set.ii_rt[t[3] - 13] = set >> 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t[1]--;
|
||||||
|
|
||||||
|
fadeout:
|
||||||
|
if (!t[2]) {
|
||||||
|
t[2] = faderate;
|
||||||
|
|
||||||
|
a = (uint8_t *)&led_set.a;
|
||||||
|
for (i = 0; i < (sizeof(led_set.a) + sizeof(led_set.ii_lf) + sizeof(led_set.ii_rt)); i++) {
|
||||||
|
if (*a <= fadeamt) {
|
||||||
|
*a = 0;
|
||||||
|
} else {
|
||||||
|
*a -= fadeamt;
|
||||||
|
}
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t[2]--;
|
||||||
|
}
|
||||||
@@ -11,6 +11,10 @@ void lp_ribbon_init();
|
|||||||
void lp_ribbon_upward(uint16_t wait, uint16_t rate, uint8_t fade);
|
void lp_ribbon_upward(uint16_t wait, uint16_t rate, uint8_t fade);
|
||||||
void lp_ribbon_twinkle(uint8_t idle, uint8_t max, uint8_t thresh_lo, uint8_t thresh_hi);
|
void lp_ribbon_twinkle(uint8_t idle, uint8_t max, uint8_t thresh_lo, uint8_t thresh_hi);
|
||||||
|
|
||||||
|
void lp_aii_init();
|
||||||
|
void lp_aii_filldown(uint16_t prewait, uint16_t downrate, uint16_t postwait, uint8_t setrate, uint8_t max);
|
||||||
|
void lp_aii_bounce(uint8_t rate, uint8_t set, uint8_t faderate, uint8_t fadeamt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __APP_LED_LEDPROG_H */
|
#endif /* __APP_LED_LEDPROG_H */
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const LedMap led_map = {
|
|||||||
34, 46, 58, 11, 23, 35, 47, 59, 12
|
34, 46, 58, 11, 23, 35, 47, 59, 12
|
||||||
},
|
},
|
||||||
.ii_lf = { // "//" left one
|
.ii_lf = { // "//" left one
|
||||||
61, 62, 63, 64, 44
|
67, 70, 71, 72, 44 // 61, 62, 63, 64, 44
|
||||||
},
|
},
|
||||||
.ii_rt = { // "//" right one
|
.ii_rt = { // "//" right one
|
||||||
60, 48, 36, 24, 56
|
60, 48, 36, 24, 56
|
||||||
|
|||||||
@@ -13,8 +13,7 @@
|
|||||||
static uint32_t brt = 28;
|
static uint32_t brt = 28;
|
||||||
|
|
||||||
uint8_t ribbon_prog = 0;
|
uint8_t ribbon_prog = 0;
|
||||||
uint8_t a_prog = 0;
|
uint8_t aii_prog = 0;
|
||||||
uint8_t ii_prog = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -55,15 +54,18 @@ static void prog_set(uint8_t idx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: { // big crater
|
case 6: { // big crater
|
||||||
lp_ribbon_init();
|
aii_prog = 1;
|
||||||
|
lp_aii_init();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: { // next to big crater
|
case 7: { // next to big crater
|
||||||
lp_ribbon_init();
|
aii_prog = 2;
|
||||||
|
lp_aii_init();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: { // bottom crater
|
case 8: { // bottom crater
|
||||||
lp_ribbon_init();
|
aii_prog = 0;
|
||||||
|
lp_aii_init();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: { // trio right
|
case 9: { // trio right
|
||||||
@@ -107,8 +109,22 @@ void tempui_lp_runprog()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
lp_ribbon_twinkle(3, 0x7f, 0x1f, 0xfd);
|
lp_ribbon_twinkle(3, 0x5f, 0x1f, 0xfd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (aii_prog) {
|
||||||
|
case 0: {
|
||||||
|
// do nothing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
lp_aii_filldown(800, 14, 1200, 3, 0x60);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
lp_aii_bounce(7, 0x3f, 2, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user