diff options
| author | Selene ToyKeeper | 2020-03-16 03:44:42 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-03-16 03:44:42 -0600 |
| commit | 2ac137648d6769ebf31eed9932bd868ca28c05e5 (patch) | |
| tree | 05f9e239c55c1d851af32cbf5ab711d1b5261cb9 /spaghetti-monster/fsm-misc.c | |
| parent | mention the maximum allowed temperature in the manual (diff) | |
| parent | fixed a few things in ramping-ui, rampingiosv3, and werner's UI (diff) | |
| download | anduril-2ac137648d6769ebf31eed9932bd868ca28c05e5.tar.gz anduril-2ac137648d6769ebf31eed9932bd868ca28c05e5.tar.bz2 anduril-2ac137648d6769ebf31eed9932bd868ca28c05e5.zip | |
merged adc-rework branch, which rewrote all ADC code (voltage, temperature, and everything touched by those)
and seems to greatly improve the thermal regulation
Diffstat (limited to 'spaghetti-monster/fsm-misc.c')
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 8da7b5b..152f047 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -46,19 +46,41 @@ uint8_t blink_digit(uint8_t num) { //StatePtr old_state = current_state; // "zero" digit gets a single short blink - uint8_t ontime = BLINK_SPEED * 2 / 10; + uint8_t ontime = BLINK_SPEED * 2 / 12; if (!num) { ontime = 8; num ++; } for (; num>0; num--) { set_level(BLINK_BRIGHTNESS); nice_delay_ms(ontime); set_level(0); - nice_delay_ms(BLINK_SPEED * 3 / 10); + nice_delay_ms(BLINK_SPEED * 3 / 12); } - return nice_delay_ms(BLINK_SPEED * 5 / 10); + return nice_delay_ms(BLINK_SPEED * 8 / 12); } #endif +#ifdef USE_BLINK_BIG_NUM +uint8_t blink_big_num(uint16_t num) { + uint16_t digits[] = { 10000, 1000, 100, 10, 1 }; + uint8_t started = 0; + for (uint8_t digit=0; digit<sizeof(digits)/sizeof(uint16_t); digit++) { + uint16_t scale = digits[digit]; + if (num >= scale) { + started = 1; + } + if (started) { + uint8_t digit = 0; + while (num >= scale) { + num -= scale; + digit ++; + } + if (! blink_digit(digit)) return 0; + } + } + + return nice_delay_ms(1000); +} +#endif #ifdef USE_BLINK_NUM uint8_t blink_num(uint8_t num) { //StatePtr old_state = current_state; |
