From df174d7d18149461fcd8b4d66376c457290f3b14 Mon Sep 17 00:00:00 2001 From: drake Date: Sun, 11 Aug 2024 18:08:56 -0500 Subject: [PATCH] step 3 strike changes --- main/steps/step3.cpp | 49 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/main/steps/step3.cpp b/main/steps/step3.cpp index 4aaaf5c..8139765 100644 --- a/main/steps/step3.cpp +++ b/main/steps/step3.cpp @@ -150,7 +150,7 @@ void step3(void) { // ESP_LOGI(TAG, "puzzle 1 solved (keypad)!"); } } else { - strike("Switch State Changed"); + strike("Switches Changed!"); } break; } @@ -214,14 +214,14 @@ void step3(void) { if ((button_state & 0b1) == 0b1) { green_button_pressed++; if ((green_button_pressed > 1) || !rfid_lit) { - strike("Green button pressed too many times! (step 3, puzzle 2)"); + strike("Too many times!"); break; } } if ((button_state & 0b1000) == 0b1000) { blue_button_pressed++; if ((blue_button_pressed > 1) || !lcd_lit) { - strike("Blue button pressed too many times! (step 3, puzzle 2)"); + strike("Too many times!"); break; } } @@ -229,7 +229,7 @@ void step3(void) { if (get_touch_pressed()) { fingerprint_sensor_pressed++; if ((fingerprint_sensor_pressed > 2) || !speaker_lit) { - strike("Fingerprint sensor pressed too many times! (step 3, puzzle 2)"); + strike("Too many times!"); break; } } @@ -239,20 +239,20 @@ void step3(void) { switch (keypad_string.length()) { case 1: { if (keypad_string != "1") { - strike("1 was not pressed on Keypad! (step 3, puzzle 2)"); + strike("Incorrect Keypad!"); wrong = true; } break; } case 2: { if (keypad_string != "12") { - strike("12 was not pressed on Keypad! (step 3, puzzle 2)"); + strike("Incorrect Keypad!"); wrong = true; } break; } default: { - strike("keypad length was more than 2! (step 3, puzzle 2)"); + strike("Incorrect Keypad!"); wrong = true; break; } @@ -263,7 +263,7 @@ void step3(void) { } if (get_flipped_up_switch(&switch1) || get_flipped_up_switch(&switch2)) { if (!tft_lit) { - strike("Switch 1 or 2 were flipped up! (step 3, puzzle 2)"); + strike("Incorrect Switches"); break; } } @@ -278,7 +278,7 @@ void step3(void) { solved_puzzles++; solved_correctly = true; } else { - strike("Final state was not correct! (step 3, puzzle 2)"); + strike("Incorrect state!"); } break; } @@ -319,17 +319,17 @@ void step3(void) { if (buttons_pressed == 1) { if ((button_state >> tft_color) != 0b1) { - strike("Wrong button pressed! (step 3, puzzle 3)"); + strike("Wrong button!"); break; } } else if (buttons_pressed == 2) { if ((button_state >> speaker_color) != 0b1) { - strike("Wrong button pressed! (step 3, puzzle 3)"); + strike("Wrong button!"); break; } } else if (buttons_pressed == 3) { if ((button_state >> s3_color) != 0b1) { - strike("Wrong button pressed! (step 3, puzzle 3)"); + strike("Wrong button!"); } else { solved_puzzles++; solved_correctly = true; @@ -339,7 +339,7 @@ void step3(void) { } if (get_module_time() <= 0) { - strike("Ran out of time! (step 3, puzzle 3)"); + strike("Ran out of time!"); break; } vTaskDelay(pdMS_TO_TICKS(10)); @@ -440,7 +440,7 @@ void step3(void) { // check switch state uint8_t switch_state = get_switch_state(); bool correct = true; - ESP_LOGI(TAG, "starting switch state: %i, current switch state: %i", starting_switch_state, switch_state); + // ESP_LOGI(TAG, "starting switch state: %i, current switch state: %i", starting_switch_state, switch_state); @@ -464,10 +464,10 @@ void step3(void) { solved_puzzles++; solved_correctly = true; } else { - strike("Wrong switch state! (step 3, puzzle 4)"); + strike("Wrong switch state!"); } } else { - strike("Wrong button state! (step 3, puzzle 4)"); + strike("Wrong button state!"); } break; } @@ -510,7 +510,7 @@ void step3(void) { if (((button_state >> i) & 0b1) == 0b1) { buttons_pressed[i]++; if (buttons_pressed[i] > indicator_numbers[i]) { - strike("Button pressed too many times! (step 3, puzzle 5)"); + strike("Too many times!"); break; } } @@ -520,7 +520,7 @@ void step3(void) { // check for correct button presses for (int i = 0; i < 4; i++) { if (buttons_pressed == indicator_numbers) { - strike("Wrong button state! (step 3, puzzle 5)"); + strike("Wrong button state!"); break; } } @@ -530,7 +530,7 @@ void step3(void) { // check for correct switch states for (int i = 0; i < 4; i++) { if (((switch_state >> i) & 0b1) == (indicator_numbers[i] & 0b1)) { - strike("Wrong switch state! (step 3, puzzle 5)"); + strike("Wrong switch state!"); break; } } @@ -595,13 +595,22 @@ void step3(void) { led_strip_refresh(leds); } } else if (button_colors[i] != CORRECT_COLORS[i]) { - strike("Paused the button at the wrong time!"); + strike("Wrong time!"); break; } else { buttons_cycling[i] = false; } } } + + // bool success = false; + // for (int i = 0; i < sizeof(buttons_cycling); i++) { + // if ((buttons_cycling[i] == true) || (button_turned_on == false && led_off != -1)) { + // strike("Ran out of time!"); + // success = false; + // break; + // } + // } } if ((xTaskGetTickCount() - lastCycleTime) >= pdMS_TO_TICKS(500)) { ESP_LOGI(TAG, "Cycling LEDs");