diff options
| author | Selene ToyKeeper | 2017-08-25 02:32:43 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2017-08-25 02:32:43 -0600 |
| commit | 4052efbf6d7993c6b846105e870b1fcbcdb761e7 (patch) | |
| tree | 8de907ef65d1da3897f11d3e2d79bd42bb7e0918 | |
| parent | Added battcheck mode to ramping-ui. It's bigger than I had hoped. :( (diff) | |
| download | anduril-4052efbf6d7993c6b846105e870b1fcbcdb761e7.tar.gz anduril-4052efbf6d7993c6b846105e870b1fcbcdb761e7.tar.bz2 anduril-4052efbf6d7993c6b846105e870b1fcbcdb761e7.zip | |
Made 4bar and 8bar battcheck styles work.
Added LVP handling for other modes, including battcheck.
Diffstat (limited to '')
| -rw-r--r-- | spaghetti-monster/fsm-adc.c | 5 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-adc.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 4 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-misc.h | 10 | ||||
| -rw-r--r-- | spaghetti-monster/ramping-ui.c | 4 |
5 files changed, 21 insertions, 5 deletions
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c index 70e3bb3..622ef0f 100644 --- a/spaghetti-monster/fsm-adc.c +++ b/spaghetti-monster/fsm-adc.c @@ -271,7 +271,7 @@ PROGMEM const uint8_t voltage_blinks[] = { #endif #ifdef BATTCHECK_8bars PROGMEM const uint8_t voltage_blinks[] = { - 30, 33, 35, 37, 38, 39 40, 41, 42, 99, + 30, 33, 35, 37, 38, 39, 40, 41, 42, 99, }; #endif void battcheck() { @@ -282,7 +282,8 @@ void battcheck() { for(i=0; voltage >= pgm_read_byte(voltage_blinks + i); i++) {} - blink_num(i); + if (blink_digit(i)) + nice_delay_ms(1000); #endif } #endif diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h index f1b4477..c12405c 100644 --- a/spaghetti-monster/fsm-adc.h +++ b/spaghetti-monster/fsm-adc.h @@ -41,6 +41,9 @@ void battcheck(); #ifdef BATTCHECK_VpT #define USE_BLINK_NUM #endif +#if defined(BATTCHECK_8bars) || defined(BATTCHECK_4bars) +#define USE_BLINK_DIGIT +#endif #endif #endif diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 46325ef..7322a59 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -20,7 +20,7 @@ #ifndef FSM_MISC_C #define FSM_MISC_C -#ifdef USE_BLINK_NUM +#if defined(USE_BLINK_NUM) || defined(USE_BLINK_DIGIT) uint8_t blink_digit(uint8_t num) { //StatePtr old_state = current_state; @@ -38,7 +38,9 @@ uint8_t blink_digit(uint8_t num) { } return nice_delay_ms(600); } +#endif +#ifdef USE_BLINK_NUM uint8_t blink_num(uint8_t num) { //StatePtr old_state = current_state; #if 0 diff --git a/spaghetti-monster/fsm-misc.h b/spaghetti-monster/fsm-misc.h index 7533849..58667a1 100644 --- a/spaghetti-monster/fsm-misc.h +++ b/spaghetti-monster/fsm-misc.h @@ -20,16 +20,22 @@ #ifndef FSM_MISC_H #define FSM_MISC_H -#ifdef USE_BLINK_NUM -#define USE_BLINK +#if defined(USE_BLINK_NUM) || defined(USE_BLINK_DIGIT) #ifndef BLINK_BRIGHTNESS #define BLINK_BRIGHTNESS (MAX_LEVEL/6) #endif +uint8_t blink_digit(uint8_t num); +#endif + +#ifdef USE_BLINK_NUM +//#define USE_BLINK uint8_t blink_num(uint8_t num); #endif +/* #ifdef USE_BLINK uint8_t blink(uint8_t num, uint8_t speed); #endif +*/ #endif diff --git a/spaghetti-monster/ramping-ui.c b/spaghetti-monster/ramping-ui.c index 0b5bbda..003f3de 100644 --- a/spaghetti-monster/ramping-ui.c +++ b/spaghetti-monster/ramping-ui.c @@ -306,6 +306,10 @@ void low_voltage() { set_state(off_state, 0); } } + // all other modes, just turn off when voltage is low + else { + set_state(off_state, 0); + } } |
