spectrum
This commit is contained in:
parent
dd224fc223
commit
f6a63d8c5a
@ -15,6 +15,7 @@
|
||||
#define END_LAMP_IDX 2
|
||||
#define COLOR_AMOUNT 3
|
||||
enum color_pin {RED, GREEN, BLUE};
|
||||
enum color_spectrum {pr, pg, mr, pb, mg};
|
||||
|
||||
static unsigned long cur_time;
|
||||
static unsigned long prev_time;
|
||||
@ -23,7 +24,7 @@ short green_state;
|
||||
short red_state;
|
||||
short blue_state;
|
||||
enum color_pin pin;
|
||||
enum color_pin spectrum_state;
|
||||
enum color_spectrum spectrum_state;
|
||||
static int lamp_idx;
|
||||
static int n_loops;
|
||||
|
||||
@ -65,9 +66,10 @@ int PrgTic
|
||||
// }
|
||||
if(cur_time-prev_time>=wait)
|
||||
{
|
||||
prev_time = cur_time;
|
||||
update_lights(p_ta_array);
|
||||
spectrum();
|
||||
}
|
||||
update_lights(p_ta_array);
|
||||
return RC;
|
||||
}
|
||||
|
||||
@ -75,17 +77,20 @@ void spectrum()
|
||||
{
|
||||
switch(spectrum_state)
|
||||
{
|
||||
case RED:
|
||||
--blue_state;
|
||||
case pr:
|
||||
if(++red_state>LIGHT_MAX) {++spectrum_state;}
|
||||
break;
|
||||
case GREEN:
|
||||
--red_state;
|
||||
case pg:
|
||||
if(++green_state>LIGHT_MAX) {++spectrum_state;}
|
||||
break;
|
||||
case BLUE:
|
||||
--green_state;
|
||||
if(++blue_state>LIGHT_MAX) {spectrum_state = 0;}
|
||||
case mr:
|
||||
if(--red_state<LIGHT_MIN) {++spectrum_state;}
|
||||
break;
|
||||
case pb:
|
||||
if(++blue_state>LIGHT_MAX) {++spectrum_state;}
|
||||
break;
|
||||
case mg:
|
||||
if(--green_state>LIGHT_MIN) {spectrum_state = 0;}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user