BRIGHT_BOTTOM = -5, /* ... then down to bottom */
BRIGHT_MAX = 85, /* Bright values are constrained for computations */
BRIGHT_MIN = 1, /* ... by min and max. */
- BRIGHT_INIT = 42, /* later, get from eeprom */
- CBRIGHT_VARIANCE = 20, /* brightness range for candle flicker */
+ BRIGHT_INIT = 42, /* Initial value is replaced by value from eeprom */
+ CBRIGHT_VARIANCE = 20, /* Brightness range for candle flicker */
STD_FADE = 16, /* Fade time in 32.768 ms units */
STD_INCOLOR = 29491, /* Time in color when MODE_CYCLE, in 32.768 ms units */
PARTY_MIN = 8, /* Min party fade and incolor units */
btn_pben();
}
+/* Event on to off, either by switch or auto-off timer */
void turnOff()
{
- /* Event on to off, either by switch or auto-off timer */
tmr_stop(TMR_CFG);
tmr_stop(TMR_CANDLE);
tmr_stop(TMR_INCOLOR);
}
}
+/* The button is being held. Change the color magnitude. */
void pb_held()
{
- /* The button has been held. Change the color magnitude. */
if (bright_up) {
if (bright == BRIGHT_TOP)
bright_up = 0;
while ((tid = task_get(block)) >= 0) {
switch (tid) {
- case TASK_BTN_PB: /* pushbutton state change */
+ case TASK_BTN_PB:
pb_task();
break;
- case TASK_BTN_RS: /* rocker switch state change */
+ case TASK_BTN_RS:
rs_task();
break;
- case TASK_BTN_PB_HELD: /* pushbutton is being held down */
+ case TASK_BTN_PB_HELD:
pb_held_task();
break;
- case TASK_FADE: /* fade timer has fired */
+ case TASK_FADE:
fade_task();
break;
- case TASK_INCOLOR: /* in-color timer has fired */
+ case TASK_INCOLOR:
start_fade();
break;
- case TASK_CANDLE: /* periodic adjustment for candle flicker */
+ case TASK_CANDLE:
candle_task();
break;
- case TASK_TMR32: /* auto on/off event */
+ case TASK_TMR32:
auto_offon_task();
break;
- case TASK_CFG: /* Save config to EEPROM event */
+ case TASK_CFG:
cfg_write();
break;
}