X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=main.c;h=6eaf3d77159fdcfe566e85dbf2f7b2ec06a77aa1;hb=f7fae2bd36a4187bc5b0954253466844c2f4ee2b;hp=0ca9cdc69c1983806c766eecfb6a3293f75b5d6c;hpb=9d4c7bd6457fefe258ee2163b0338dda515d2365;p=rgblamp.git diff --git a/main.c b/main.c index 0ca9cdc..6eaf3d7 100644 --- a/main.c +++ b/main.c @@ -109,8 +109,8 @@ enum { 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 */ @@ -272,9 +272,9 @@ void turnOn() 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); @@ -304,9 +304,9 @@ void pb_clicked() } } +/* 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; @@ -444,28 +444,28 @@ void user_tasks(unsigned char block) 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; }