aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-07-30 18:31:50 -0600
committerSelene ToyKeeper2020-07-30 18:31:50 -0600
commitd1259b707920506f0c73d2ed4991915c54963944 (patch)
treea9d00a998c6b3f0b9628ad5c7eb2921f6b5b236c /spaghetti-monster
parentfixed bug: 4H from lockout to ramp would immediately activate the sunset timer (diff)
downloadanduril-d1259b707920506f0c73d2ed4991915c54963944.tar.gz
anduril-d1259b707920506f0c73d2ed4991915c54963944.tar.bz2
anduril-d1259b707920506f0c73d2ed4991915c54963944.zip
made ramping "bump" the sunset timer up a little if it's near the deadline
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/sunset-timer.c8
-rw-r--r--spaghetti-monster/anduril/sunset-timer.h6
2 files changed, 11 insertions, 3 deletions
diff --git a/spaghetti-monster/anduril/sunset-timer.c b/spaghetti-monster/anduril/sunset-timer.c
index 4c91723..7340ff1 100644
--- a/spaghetti-monster/anduril/sunset-timer.c
+++ b/spaghetti-monster/anduril/sunset-timer.c
@@ -30,6 +30,14 @@ uint8_t sunset_timer_state(Event event, uint16_t arg) {
sunset_ticks = 0;
return MISCHIEF_MANAGED;
}
+ // hold: maybe "bump" the timer if it's active and almost expired
+ else if (event == EV_hold) {
+ // ramping up should "bump" the timer to extend the deadline a bit
+ if ((sunset_timer > 0) && (sunset_timer < 4)) {
+ sunset_timer = 3;
+ sunset_timer_peak = 3;
+ }
+ }
// 4H: add 10m to timer, per second, until released
else if (event == EV_click4_hold) {
if (0 == (arg % TICKS_PER_SECOND)) {
diff --git a/spaghetti-monster/anduril/sunset-timer.h b/spaghetti-monster/anduril/sunset-timer.h
index 2e39e5d..d197f0e 100644
--- a/spaghetti-monster/anduril/sunset-timer.h
+++ b/spaghetti-monster/anduril/sunset-timer.h
@@ -26,9 +26,9 @@
#define TICKS_PER_MINUTE (TICKS_PER_SECOND*60)
// automatic shutoff timer
-uint8_t sunset_timer = 0;
-uint8_t sunset_timer_peak = 0;
-uint16_t sunset_ticks = 0;
+uint8_t sunset_timer = 0; // minutes remaining in countdown
+uint8_t sunset_timer_peak = 0; // total minutes in countdown
+uint16_t sunset_ticks = 0; // counts from 0 to TICKS_PER_MINUTE, then repeats
uint8_t sunset_timer_state(Event event, uint16_t arg);
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.