aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-03-16 03:17:14 -0600
committerSelene ToyKeeper2020-03-16 03:17:14 -0600
commit84f9a0c9daf991b23d665a5dffdb3b76e6753491 (patch)
tree40828ea70c3b3a34f276de4d3f5537f64275ed6a /spaghetti-monster
parentdeleted commented-out WDT code from previous revision (diff)
downloadanduril-84f9a0c9daf991b23d665a5dffdb3b76e6753491.tar.gz
anduril-84f9a0c9daf991b23d665a5dffdb3b76e6753491.tar.bz2
anduril-84f9a0c9daf991b23d665a5dffdb3b76e6753491.zip
increased blink speed slightly, and added a library function to blink out 16-bit numbers
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/fsm-misc.c28
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;
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.