diff options
author | Elwin <elwinhammer@gmail.com> | 2024-06-24 14:15:14 +0200 |
---|---|---|
committer | Elwin <elwinhammer@gmail.com> | 2024-06-24 14:15:14 +0200 |
commit | 0624733a1b4a5c79763a1a0b2f3c53e94fe486be (patch) | |
tree | 76ab09c0632e40fa1b5f7bcffb9236285ad8d57d /puzzle/vault | |
parent | 8f1fd935e69c5e303466b2be80bff77f556dead5 (diff) |
Corrected pbdrv impl.
Diffstat (limited to 'puzzle/vault')
-rw-r--r-- | puzzle/vault/main.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/puzzle/vault/main.cpp b/puzzle/vault/main.cpp index 1a70076..2e4cafc 100644 --- a/puzzle/vault/main.cpp +++ b/puzzle/vault/main.cpp @@ -88,12 +88,10 @@ void check_button_press() { if (strcmp(keyPress, validButtons[currentLevel]) == 0) { currentLevel++; if (currentLevel >= TOTAL_LEVELS) { - puzzleState = PB_GS_SOLVED; + pb_hook_mod_state_write(PB_GS_SOLVED); Serial.println("Puzzle solved!"); display.showNumberDec(currentLevel + 1, true); digitalWrite(SOLVED_PIN, HIGH); - } else { - puzzleState = PB_GS_PLAYING; } } else { currentLevel = 0; @@ -149,14 +147,19 @@ void display_code_for_level(int level) { } +pb_global_state_t pb_hook_mod_state_read() { + return puzzleState; +} + +void pb_hook_mod_state_write(pb_global_state_t state) { + puzzleState = state; +} + void setup() { Serial.begin(115200); pinMode(SOLVED_PIN, OUTPUT); digitalWrite(SOLVED_PIN, LOW); - display.setBrightness(0x0f); - - puzzleState = pb_hook_mod_state_read(); - + display.setBrightness(0x0f); initialize_system(); } @@ -181,5 +184,4 @@ void loop() { blink_display(1); break; } - puzzleState = pb_hook_mod_state_read(); }
\ No newline at end of file |