aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/config-mode.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/spaghetti-monster/anduril/config-mode.c b/spaghetti-monster/anduril/config-mode.c
index f5bfbc2..f62924a 100644
--- a/spaghetti-monster/anduril/config-mode.c
+++ b/spaghetti-monster/anduril/config-mode.c
@@ -42,16 +42,14 @@ uint8_t config_state_base(Event event, uint16_t arg,
uint8_t num_config_steps,
void (*savefunc)(uint8_t step, uint8_t value)) {
static uint8_t config_step;
- static uint8_t config_state_done;
if (event == EV_enter_state) {
config_step = 0;
- config_state_done = 0;
set_level(0);
// if button isn't held, configure first menu item
if (! button_last_state) {
+ config_step ++;
push_state(number_entry_state, 0);
}
- return MISCHIEF_MANAGED;
}
// if initial "hold" event still active
@@ -79,16 +77,13 @@ uint8_t config_state_base(Event event, uint16_t arg,
// button release: activate number entry for one menu item
else if ((event & B_CLICK_FLAGS) == B_ANY_HOLD_RELEASE) {
- // let user know we noticed what they did
- set_level(0);
-
// ask the user for a number, if they selected a menu item
- if (config_step <= num_config_steps) {
+ if (config_step && config_step <= num_config_steps) {
push_state(number_entry_state, 0);
}
// exit after falling out of end of menu
else {
- config_state_done = 1;
+ pop_state();
}
}
@@ -98,13 +93,6 @@ uint8_t config_state_base(Event event, uint16_t arg,
savefunc(config_step, number_entry_value);
// make changes persist in eeprom
save_config();
- config_state_done = 1;
- return MISCHIEF_MANAGED;
- }
-
- // all finished
- else if (config_state_done) {
- config_state_done = 0; // ensure this only happens once
pop_state();
}
@@ -118,7 +106,7 @@ uint8_t number_entry_state(Event event, uint16_t arg) {
if (event == EV_enter_state) {
number_entry_value = 0;
entry_step = 0;
- return MISCHIEF_MANAGED;
+ set_level(0); // initial pause should be dark
}
// advance through the process:
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.