step 3 strike changes
This commit is contained in:
parent
0e7065f551
commit
df174d7d18
@ -150,7 +150,7 @@ void step3(void) {
|
|||||||
// ESP_LOGI(TAG, "puzzle 1 solved (keypad)!");
|
// ESP_LOGI(TAG, "puzzle 1 solved (keypad)!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strike("Switch State Changed");
|
strike("Switches Changed!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -214,14 +214,14 @@ void step3(void) {
|
|||||||
if ((button_state & 0b1) == 0b1) {
|
if ((button_state & 0b1) == 0b1) {
|
||||||
green_button_pressed++;
|
green_button_pressed++;
|
||||||
if ((green_button_pressed > 1) || !rfid_lit) {
|
if ((green_button_pressed > 1) || !rfid_lit) {
|
||||||
strike("Green button pressed too many times! (step 3, puzzle 2)");
|
strike("Too many times!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((button_state & 0b1000) == 0b1000) {
|
if ((button_state & 0b1000) == 0b1000) {
|
||||||
blue_button_pressed++;
|
blue_button_pressed++;
|
||||||
if ((blue_button_pressed > 1) || !lcd_lit) {
|
if ((blue_button_pressed > 1) || !lcd_lit) {
|
||||||
strike("Blue button pressed too many times! (step 3, puzzle 2)");
|
strike("Too many times!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ void step3(void) {
|
|||||||
if (get_touch_pressed()) {
|
if (get_touch_pressed()) {
|
||||||
fingerprint_sensor_pressed++;
|
fingerprint_sensor_pressed++;
|
||||||
if ((fingerprint_sensor_pressed > 2) || !speaker_lit) {
|
if ((fingerprint_sensor_pressed > 2) || !speaker_lit) {
|
||||||
strike("Fingerprint sensor pressed too many times! (step 3, puzzle 2)");
|
strike("Too many times!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,20 +239,20 @@ void step3(void) {
|
|||||||
switch (keypad_string.length()) {
|
switch (keypad_string.length()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
if (keypad_string != "1") {
|
if (keypad_string != "1") {
|
||||||
strike("1 was not pressed on Keypad! (step 3, puzzle 2)");
|
strike("Incorrect Keypad!");
|
||||||
wrong = true;
|
wrong = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
if (keypad_string != "12") {
|
if (keypad_string != "12") {
|
||||||
strike("12 was not pressed on Keypad! (step 3, puzzle 2)");
|
strike("Incorrect Keypad!");
|
||||||
wrong = true;
|
wrong = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
strike("keypad length was more than 2! (step 3, puzzle 2)");
|
strike("Incorrect Keypad!");
|
||||||
wrong = true;
|
wrong = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ void step3(void) {
|
|||||||
}
|
}
|
||||||
if (get_flipped_up_switch(&switch1) || get_flipped_up_switch(&switch2)) {
|
if (get_flipped_up_switch(&switch1) || get_flipped_up_switch(&switch2)) {
|
||||||
if (!tft_lit) {
|
if (!tft_lit) {
|
||||||
strike("Switch 1 or 2 were flipped up! (step 3, puzzle 2)");
|
strike("Incorrect Switches");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ void step3(void) {
|
|||||||
solved_puzzles++;
|
solved_puzzles++;
|
||||||
solved_correctly = true;
|
solved_correctly = true;
|
||||||
} else {
|
} else {
|
||||||
strike("Final state was not correct! (step 3, puzzle 2)");
|
strike("Incorrect state!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -319,17 +319,17 @@ void step3(void) {
|
|||||||
|
|
||||||
if (buttons_pressed == 1) {
|
if (buttons_pressed == 1) {
|
||||||
if ((button_state >> tft_color) != 0b1) {
|
if ((button_state >> tft_color) != 0b1) {
|
||||||
strike("Wrong button pressed! (step 3, puzzle 3)");
|
strike("Wrong button!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (buttons_pressed == 2) {
|
} else if (buttons_pressed == 2) {
|
||||||
if ((button_state >> speaker_color) != 0b1) {
|
if ((button_state >> speaker_color) != 0b1) {
|
||||||
strike("Wrong button pressed! (step 3, puzzle 3)");
|
strike("Wrong button!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (buttons_pressed == 3) {
|
} else if (buttons_pressed == 3) {
|
||||||
if ((button_state >> s3_color) != 0b1) {
|
if ((button_state >> s3_color) != 0b1) {
|
||||||
strike("Wrong button pressed! (step 3, puzzle 3)");
|
strike("Wrong button!");
|
||||||
} else {
|
} else {
|
||||||
solved_puzzles++;
|
solved_puzzles++;
|
||||||
solved_correctly = true;
|
solved_correctly = true;
|
||||||
@ -339,7 +339,7 @@ void step3(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (get_module_time() <= 0) {
|
if (get_module_time() <= 0) {
|
||||||
strike("Ran out of time! (step 3, puzzle 3)");
|
strike("Ran out of time!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vTaskDelay(pdMS_TO_TICKS(10));
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
@ -440,7 +440,7 @@ void step3(void) {
|
|||||||
// check switch state
|
// check switch state
|
||||||
uint8_t switch_state = get_switch_state();
|
uint8_t switch_state = get_switch_state();
|
||||||
bool correct = true;
|
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_puzzles++;
|
||||||
solved_correctly = true;
|
solved_correctly = true;
|
||||||
} else {
|
} else {
|
||||||
strike("Wrong switch state! (step 3, puzzle 4)");
|
strike("Wrong switch state!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strike("Wrong button state! (step 3, puzzle 4)");
|
strike("Wrong button state!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ void step3(void) {
|
|||||||
if (((button_state >> i) & 0b1) == 0b1) {
|
if (((button_state >> i) & 0b1) == 0b1) {
|
||||||
buttons_pressed[i]++;
|
buttons_pressed[i]++;
|
||||||
if (buttons_pressed[i] > indicator_numbers[i]) {
|
if (buttons_pressed[i] > indicator_numbers[i]) {
|
||||||
strike("Button pressed too many times! (step 3, puzzle 5)");
|
strike("Too many times!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ void step3(void) {
|
|||||||
// check for correct button presses
|
// check for correct button presses
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (buttons_pressed == indicator_numbers) {
|
if (buttons_pressed == indicator_numbers) {
|
||||||
strike("Wrong button state! (step 3, puzzle 5)");
|
strike("Wrong button state!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ void step3(void) {
|
|||||||
// check for correct switch states
|
// check for correct switch states
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (((switch_state >> i) & 0b1) == (indicator_numbers[i] & 0b1)) {
|
if (((switch_state >> i) & 0b1) == (indicator_numbers[i] & 0b1)) {
|
||||||
strike("Wrong switch state! (step 3, puzzle 5)");
|
strike("Wrong switch state!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -595,13 +595,22 @@ void step3(void) {
|
|||||||
led_strip_refresh(leds);
|
led_strip_refresh(leds);
|
||||||
}
|
}
|
||||||
} else if (button_colors[i] != CORRECT_COLORS[i]) {
|
} else if (button_colors[i] != CORRECT_COLORS[i]) {
|
||||||
strike("Paused the button at the wrong time!");
|
strike("Wrong time!");
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
buttons_cycling[i] = false;
|
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)) {
|
if ((xTaskGetTickCount() - lastCycleTime) >= pdMS_TO_TICKS(500)) {
|
||||||
ESP_LOGI(TAG, "Cycling LEDs");
|
ESP_LOGI(TAG, "Cycling LEDs");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user