step 5 fixes

This commit is contained in:
Drake Marino 2024-08-14 22:52:27 -05:00
parent 7b8e38844a
commit 23b7ffa7f7
2 changed files with 203 additions and 278 deletions

View File

@ -42,6 +42,126 @@ std::vector<int> unique_values(std::vector<int>& input_options, int num) {
return output_vec; return output_vec;
} }
bool submit_0(int green_indicators) {
uint8_t state = get_switch_state();
uint8_t flipped_state = 0;
flipped_state |= (state & 0b1) << 3;
flipped_state |= (state & 0b10) << 1;
flipped_state |= (state & 0b100) >> 1;
flipped_state |= (state & 0b1000) >> 3;
if (flipped_state == green_indicators) {
return true;
} else {
strike("Incorrect Switches");
return false;
}
}
bool submit_1(int num_indicators, std::string pressed_keys, uint8_t starting_switch_state) {
if (num_indicators < 18) {
if (get_switch_state() == 0b1111) {
if (pressed_keys == "") {
return true;
} else {
strike("Incorrect keypad!");
return false;
}
} else {
strike("Incorrect switches!");
return false;
}
} else {
if (starting_switch_state == get_switch_state()) {
if (pressed_keys == "ADCB") {
return true;
} else {
strike("Incorrect keypad!");
return false;
}
} else {
strike("Switches changed!");
return false;
}
}
}
bool submit_2(bool* lit_leds, int green_pressed, int blue_pressed, int fingerprint_pressed, std::string keypad_string) {
uint8_t switch_state = get_switch_state() & 0b11;
bool rfid_correct = (lit_leds[0] && (green_pressed == 1)) || (!lit_leds[0] && (green_pressed == 0));
bool lcd_correct = (lit_leds[1] && (blue_pressed == 1)) || (!lit_leds[1] && (blue_pressed == 0));
bool speaker_correct = (lit_leds[2] && (fingerprint_pressed == 2)) || (!lit_leds[2] && (fingerprint_pressed == 0));
bool keypad_correct = (lit_leds[3] && (keypad_string == "12")) || (!lit_leds[3] && (keypad_string == ""));
bool tft_correct = (lit_leds[4] && (switch_state == 0b11)) || !lit_leds[4];
if (rfid_correct && lcd_correct && speaker_correct && keypad_correct && tft_correct) {
return true;
} else {
strike("Incorrect state!");
return false;
}
}
bool submit_4(int* button_colors, int* switch_colors, uint8_t initial_switch_state) {
if (button_colors[0] == 0 && button_colors[1] == 1 && button_colors[2] == 2 && button_colors[3] == 3) {
uint8_t switch_state = get_switch_state();
bool correct = true;
for (int i = 0; i < 4; i++) {
if (switch_colors[i] == 2) {
if ((((switch_state ^ initial_switch_state) >> i) & 0b1) != 1) {
correct = false;
break;
}
} else {
if (((switch_state >> i) & 0b1) != (switch_colors[i] & 0b1)) {
correct = false;
break;
}
}
}
if (correct) {
return true;
}
strike("Incorrect switches!");
return false;
} else {
strike("Incorrect buttons!");
return false;
}
}
bool submit_5(std::array<int, 4> indicator_numbers, std::array<int, 4> buttons_pressed) {
for (int i = 0; i < 4; i++) {
if (buttons_pressed == indicator_numbers) {
strike("Wrong button state!");
return false;
}
}
uint8_t switch_state = get_switch_state();
for (int i = 0; i < 4; i++) {
if (((switch_state >> i) & 0b1) == (indicator_numbers[i] & 0b1)) {
strike("Wrong switch state!");
return false;
}
}
return true;
}
bool submit_6(bool* buttons_cycling, bool button_turned_on, int led_off) {
for (int i = 0; i < sizeof(buttons_cycling); i++) {
if ((buttons_cycling[i] == true) || (button_turned_on == false && led_off != -1)) {
strike("Incorrect!");
return false;
}
}
return true;
}
void step5(void) { void step5(void) {
StarCodeHandler star_codes[] = { StarCodeHandler star_codes[] = {
{ {
@ -82,11 +202,11 @@ void step5(void) {
int solved_puzzles = 0; int solved_puzzles = 0;
while (solved_puzzles < TIMES_TO_SOLVE) { while (solved_puzzles < TIMES_TO_SOLVE) {
lcd_set_cursor(&lcd, 1, 1); lcd_set_cursor(&lcd, 1, 1);
bool solved_correctly = false;
int puzzle = puzzle_dist(gen); int puzzle = puzzle_dist(gen);
// int puzzle = 6; // int puzzle = 6;
bool solved_correctly = false;
switch (puzzle) { switch (puzzle) {
case 0: { case 0: {
lcd_print(&lcd, "Clear"); lcd_print(&lcd, "Clear");
@ -110,20 +230,16 @@ void step5(void) {
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
// wait for time // wait for time
KeypadKey key;
while (1) { while (1) {
if (get_module_time() <= 0) { if (get_pressed_keypad(&key)) {
uint8_t state = get_switch_state(); if (char_of_keypad_key(key) == '#') {
uint8_t flipped_state = 0; solved_correctly = submit_0(green_indicators);
flipped_state |= (state & 0x01) << 3; break;
flipped_state |= (state & 0x02) << 1;
flipped_state |= (state & 0x04) >> 1;
flipped_state |= (state & 0x08) >> 3;
if (flipped_state == green_indicators) {
solved_puzzles++;
} else {
strike("Incorrect Switches");
} }
}
if (get_module_time() <= 0) {
solved_correctly = submit_0(green_indicators);
break; break;
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
@ -145,111 +261,78 @@ void step5(void) {
const int INDICATOR_BLUE[6] = {0, 10, 0, 0, 5, 5}; const int INDICATOR_BLUE[6] = {0, 10, 0, 0, 5, 5};
set_unique_leds_random_color(indicator_options, indicators_num, INDICATOR_RED, INDICATOR_BLUE, INDICATOR_GREEN); set_unique_leds_random_color(indicator_options, indicators_num, INDICATOR_RED, INDICATOR_BLUE, INDICATOR_GREEN);
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
// ESP_LOGI(TAG, "puzzle 1 LEDs set (%i leds)", indicators_num);
if (indicators_num < 18) { uint8_t starting_switch_state = get_switch_state();
while (1) { std::string pressed_keys;
if (get_module_time() <= 0) {
if (get_switch_state() == 0b1111) { KeypadKey key;
solved_puzzles++; while (1) {
// ESP_LOGI(TAG, "puzzle 1 solved (switches)!"); if (get_pressed_keypad(&key)) {
} else { char keypad_char = char_of_keypad_key(key);
strike("Switch State Changed"); if (keypad_char == '#') {
} solved_correctly = submit_1(indicators_num, pressed_keys, starting_switch_state);
break; break;
} } else {
vTaskDelay(pdMS_TO_TICKS(10));
}
} else {
uint8_t starting_switch_state = get_switch_state();
KeypadKey key;
std::string pressed_keys;
while (1) {
if (get_pressed_keypad(&key)) {
pressed_keys += char_of_keypad_key(key); pressed_keys += char_of_keypad_key(key);
// ESP_LOGI(TAG, "key %c pressed", char_of_keypad_key(key));
} }
if (get_module_time() <= 0) {
if (starting_switch_state == get_switch_state()) {
if (pressed_keys == "ADCB") {
solved_puzzles++;
solved_correctly = true;
// ESP_LOGI(TAG, "puzzle 1 solved (keypad)!");
}
} else {
strike("Switches Changed!");
}
break;
}
vTaskDelay(pdMS_TO_TICKS(10));
} }
if (get_module_time() <= 0) {
solved_correctly = submit_1(indicators_num, pressed_keys, starting_switch_state);
break;
}
vTaskDelay(pdMS_TO_TICKS(10));
} }
break; break;
} }
case 2: { case 2: {
set_module_time(25000); set_module_time(25000);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> lit_led_dist(0, 1); std::map<int, int> idx_to_led_map = {
bool rfid_lit = lit_led_dist(gen); {0, 10},
bool lcd_lit = lit_led_dist(gen); {1, 12},
bool speaker_lit = lit_led_dist(gen); {2, 9},
bool keypad_lit = lit_led_dist(gen); {3, 11},
bool tft_lit = lit_led_dist(gen); {4, 6},
};
if (rfid_lit) { std::uniform_int_distribution<> lit_led_dist(0, 1);
int color = led_color_dist(gen);
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 10, INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color])); // rfid, lcd, speaker, keypad, tft
} bool lit_leds[5] = {static_cast<bool>(lit_led_dist(gen)), static_cast<bool>(lit_led_dist(gen)), static_cast<bool>(lit_led_dist(gen)), static_cast<bool>(lit_led_dist(gen)), static_cast<bool>(lit_led_dist(gen))};
if (lcd_lit) {
int color = led_color_dist(gen); for (int i = 0; i < 5; i++) {
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 12, INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color])); if (lit_leds[i]) {
} int color = led_color_dist(gen);
if (speaker_lit) { ESP_ERROR_CHECK(led_strip_set_pixel(leds, idx_to_led_map[i], INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color]));
int color = led_color_dist(gen); }
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 9, INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color]));
}
if (keypad_lit) {
int color = led_color_dist(gen);
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 11, INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color]));
}
if (tft_lit) {
int color = led_color_dist(gen);
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 6, INDICATOR_RED[color], INDICATOR_GREEN[color], INDICATOR_BLUE[color]));
} }
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
int green_button_pressed = 0; int green_button_pressed = 0;
// ESP_LOGI(TAG, "green pressed: %i", green_button_pressed);
int blue_button_pressed = 0; int blue_button_pressed = 0;
int fingerprint_sensor_pressed = 0; int fingerprint_sensor_pressed = 0;
std::string keypad_string; std::string keypad_string;
ButtonKey button;
KeypadKey key; KeypadKey key;
SwitchKey switch1 = s1; ButtonKey button;
SwitchKey switch2 = s2;
while (1) { while (1) {
// add if strike when wrong instead of at the end
if (get_pressed_button(&button)) { if (get_pressed_button(&button)) {
uint8_t button_state = get_button_state(); uint8_t button_state = get_button_state();
// ESP_LOGI(TAG, "Button pressed! (%i)", button_state());
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) || !lit_leds[0]) {
strike("Too many times!"); 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) || !lit_leds[1]) {
strike("Too many times!"); strike("Too many times!");
break; break;
} }
@ -257,58 +340,22 @@ void step5(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) || !lit_leds[2]) {
strike("Too many times!"); strike("Too many times!");
break; break;
} }
} }
if (get_pressed_keypad(&key)) { if (get_pressed_keypad(&key)) {
bool wrong = false; char keypad_char = char_of_keypad_key(key);
keypad_string += char_of_keypad_key(key); if (keypad_char == '#') {
switch (keypad_string.length()) { solved_correctly = submit_2(lit_leds, green_button_pressed, blue_button_pressed, fingerprint_sensor_pressed, keypad_string);
case 1: {
if (keypad_string != "1") {
strike("Incorrect Keypad!");
wrong = true;
}
break;
}
case 2: {
if (keypad_string != "12") {
strike("Incorrect Keypad!");
wrong = true;
}
break;
}
default: {
strike("Incorrect Keypad!");
wrong = true;
break;
}
}
if (wrong) {
break;
}
}
if (get_flipped_up_switch(&switch1) || get_flipped_up_switch(&switch2)) {
if (!tft_lit) {
strike("Incorrect Switches");
break; break;
} else {
keypad_string += char_of_keypad_key(key);
} }
} }
if (get_module_time() <= 0) { if (get_module_time() <= 0) {
bool rfid_correct = !(rfid_lit && (green_button_pressed != 1)); solved_correctly = submit_2(lit_leds, green_button_pressed, blue_button_pressed, fingerprint_sensor_pressed, keypad_string);
bool lcd_correct = !(lcd_lit && (blue_button_pressed != 1));
bool speaker_correct = !(speaker_lit && (fingerprint_sensor_pressed != 2));
bool keypad_correct = !(keypad_lit && (keypad_string != "12"));
bool tft_correct = !(tft_lit && ((get_switch_state() & 0b11) != 0b11));
if (rfid_correct && lcd_correct && speaker_correct && keypad_correct && tft_correct) {
solved_puzzles++;
solved_correctly = true;
} else {
strike("Incorrect state!");
}
break; break;
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
@ -334,7 +381,6 @@ void step5(void) {
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 6, COLOR_RED[tft_color], COLOR_GREEN[tft_color], COLOR_BLUE[tft_color])); ESP_ERROR_CHECK(led_strip_set_pixel(leds, 6, COLOR_RED[tft_color], COLOR_GREEN[tft_color], COLOR_BLUE[tft_color]));
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 9, COLOR_RED[speaker_color], COLOR_GREEN[speaker_color], COLOR_BLUE[speaker_color])); ESP_ERROR_CHECK(led_strip_set_pixel(leds, 9, COLOR_RED[speaker_color], COLOR_GREEN[speaker_color], COLOR_BLUE[speaker_color]));
ESP_ERROR_CHECK(led_strip_set_pixel(leds, 14, COLOR_RED[s3_color], COLOR_GREEN[s3_color], COLOR_BLUE[s3_color])); ESP_ERROR_CHECK(led_strip_set_pixel(leds, 14, COLOR_RED[s3_color], COLOR_GREEN[s3_color], COLOR_BLUE[s3_color]));
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
int buttons_pressed = 0; int buttons_pressed = 0;
@ -360,7 +406,6 @@ void step5(void) {
if ((button_state >> s3_color) != 0b1) { if ((button_state >> s3_color) != 0b1) {
strike("Wrong button!"); strike("Wrong button!");
} else { } else {
solved_puzzles++;
solved_correctly = true; solved_correctly = true;
} }
break; break;
@ -373,9 +418,6 @@ void step5(void) {
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
} }
break; break;
} }
case 4: { case 4: {
@ -410,7 +452,7 @@ void step5(void) {
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
ButtonKey button; ButtonKey button;
SwitchKey switch_key; KeypadKey key;
uint8_t starting_switch_state = get_switch_state(); uint8_t starting_switch_state = get_switch_state();
while (1) { while (1) {
@ -428,101 +470,14 @@ void step5(void) {
} }
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
if (button_colors[0] == 0 && button_colors[1] == 1 && button_colors[2] == 2 && button_colors[3] == 3) {
// check switch state
uint8_t switch_state = get_switch_state();
bool correct = true;
for (int i = 0; i < 4; i++) {
if (switch_colors[i] == 2) {
if ((((switch_state ^ starting_switch_state) >> i) & 0b1) != 1) {
correct = false;
break;
}
} else {
if (((switch_state >> i) & 0b1) != (switch_colors[i] & 0b1)) {
correct = false;
break;
}
}
}
if (correct) {
solved_puzzles++;
solved_correctly = true;
break;
}
}
} }
if (get_flipped_switch(&switch_key)) { get_pressed_keypad(&key);
if (button_colors[0] == 0 && button_colors[1] == 1 && button_colors[2] == 2 && button_colors[3] == 3) { if (get_module_time() <= 0 || char_of_keypad_key(key) == '#') {
// check switch state solved_correctly = submit_4(button_colors, switch_colors, starting_switch_state);
uint8_t switch_state = get_switch_state();
bool correct = true;
for (int i = 0; i < 4; i++) {
if (switch_colors[i] == 2) {
if ((((switch_state ^ starting_switch_state) >> i) & 0b1) != 1) {
correct = false;
break;
}
} else {
if (((switch_state >> i) & 0b1) != (switch_colors[i] & 0b1)) {
correct = false;
break;
}
}
}
if (correct) {
solved_puzzles++;
solved_correctly = true;
break;
}
}
}
if (get_module_time() <= 0) {
// check button state
if (button_colors[0] == 0 && button_colors[1] == 1 && button_colors[2] == 2 && button_colors[3] == 3) {
// 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);
for (int i = 0; i < 4; i++) {
if (switch_colors[i] == 2) {
// ESP_LOGI(TAG, "color yellow triggered: %i", (((switch_state ^ starting_switch_state) >> i) & 0b1));
if ((((switch_state ^ starting_switch_state) >> i) & 0b1) != 1) {
correct = false;
break;
}
} else {
// ESP_LOGI(TAG, "color green or red triggered: %i != %i", ((switch_state >> i) & 0b1), (switch_colors[i] & 0b1));
if (((switch_state >> i) & 0b1) != (switch_colors[i] & 0b1)) {
correct = false;
break;
}
}
}
if (correct) {
solved_puzzles++;
solved_correctly = true;
} else {
strike("Wrong switch state!");
}
} else {
strike("Wrong button state!");
}
break; break;
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
} }
break; break;
} }
case 5: { case 5: {
@ -543,12 +498,11 @@ void step5(void) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
set_unique_leds(indicator_options, indicator_numbers[i], INDICATOR_RED[i], INDICATOR_GREEN[i], INDICATOR_BLUE[i]); set_unique_leds(indicator_options, indicator_numbers[i], INDICATOR_RED[i], INDICATOR_GREEN[i], INDICATOR_BLUE[i]);
} }
ESP_ERROR_CHECK(led_strip_refresh(leds)); ESP_ERROR_CHECK(led_strip_refresh(leds));
std::array<int, 4> buttons_pressed = {0, 0, 0, 0}; std::array<int, 4> buttons_pressed = {0, 0, 0, 0};
ButtonKey button; ButtonKey button;
KeypadKey key;
while (1) { while (1) {
if (get_pressed_button(&button)) { if (get_pressed_button(&button)) {
@ -564,27 +518,9 @@ void step5(void) {
} }
} }
} }
if (get_module_time() <= 0) { get_pressed_keypad(&key);
// check for correct button presses if (get_module_time() <= 0 || char_of_keypad_key(key) == '#') {
for (int i = 0; i < 4; i++) { solved_correctly = submit_5(indicator_numbers, buttons_pressed);
if (buttons_pressed == indicator_numbers) {
strike("Wrong button state!");
break;
}
}
uint8_t switch_state = get_switch_state();
// 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!");
break;
}
}
solved_puzzles++;
solved_correctly = true;
break; break;
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
@ -628,6 +564,7 @@ void step5(void) {
bool button_turned_on = false; bool button_turned_on = false;
ButtonKey button; ButtonKey button;
KeypadKey key;
std::uniform_int_distribution<> led_turn_on_dist(0, 3); std::uniform_int_distribution<> led_turn_on_dist(0, 3);
while (1) { while (1) {
@ -637,7 +574,10 @@ void step5(void) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (((button_state >> i) & 0b1) == 0b1) { if (((button_state >> i) & 0b1) == 0b1) {
if (button_colors[i] == -1) { if (button_colors[i] == -1) {
if (led_turn_on_dist(gen) == 0) { if (button_turned_on) {
strike("Pressed after on!");
break;
} else if (led_turn_on_dist(gen) == 0) {
button_turned_on = true; button_turned_on = true;
led_strip_set_pixel(leds, (20 - i), COLORS_RED[CORRECT_COLORS[i]], COLORS_GREEN[CORRECT_COLORS[i]], COLORS_BLUE[CORRECT_COLORS[i]]); led_strip_set_pixel(leds, (20 - i), COLORS_RED[CORRECT_COLORS[i]], COLORS_GREEN[CORRECT_COLORS[i]], COLORS_BLUE[CORRECT_COLORS[i]]);
led_strip_refresh(leds); led_strip_refresh(leds);
@ -650,22 +590,8 @@ void step5(void) {
} }
} }
} }
bool success = true;
for (int i = 0; i < sizeof(buttons_cycling); i++) {
if ((buttons_cycling[i] == true) || (button_turned_on == false && led_off != -1)) {
success = false;
break;
}
}
if (success) {
solved_puzzles++;
solved_correctly = true;
break;
}
} }
if ((xTaskGetTickCount() - lastCycleTime) >= pdMS_TO_TICKS(500)) { if ((xTaskGetTickCount() - lastCycleTime) >= pdMS_TO_TICKS(500)) {
ESP_LOGI(TAG, "Cycling LEDs");
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (buttons_cycling[i]) { if (buttons_cycling[i]) {
button_colors[i]++; button_colors[i]++;
@ -679,19 +605,9 @@ void step5(void) {
lastCycleTime = xTaskGetTickCount(); lastCycleTime = xTaskGetTickCount();
} }
if (get_module_time() <= 0) { get_pressed_keypad(&key);
bool success = true; if (get_module_time() <= 0 || char_of_keypad_key(key) == '#') {
for (int i = 0; i < sizeof(buttons_cycling); i++) { solved_correctly = submit_6(buttons_cycling, button_turned_on, led_off);
if ((buttons_cycling[i] == true) || (button_turned_on == false && led_off != -1)) {
strike("Ran out of time!");
success = false;
break;
}
}
if (success) {
solved_puzzles++;
solved_correctly = true;
}
break; break;
} }
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
@ -775,9 +691,6 @@ void step5(void) {
lcd_set_cursor(&lcd, 1, 2); lcd_set_cursor(&lcd, 1, 2);
lcd_print(&lcd, display_expression.c_str()); lcd_print(&lcd, display_expression.c_str());
// ESP_LOGI(TAG, "Display expression: %s", display_expression.c_str());
// ESP_LOGI(TAG, "Solved expression answer: %i", static_cast<int>(expression_answer));
// set LEDs // set LEDs
// blue, red, green, yellow // blue, red, green, yellow
@ -941,7 +854,6 @@ void step5(void) {
} }
if (!failed) { if (!failed) {
solved_puzzles++;
solved_correctly = true; solved_correctly = true;
} }
} }
@ -950,6 +862,7 @@ void step5(void) {
} }
stop_module_timer(); stop_module_timer();
if (solved_correctly) { if (solved_correctly) {
solved_puzzles++;
play_raw(MOUNT_POINT "/correct.pcm"); play_raw(MOUNT_POINT "/correct.pcm");
vTaskDelay(pdMS_TO_TICKS(500)); vTaskDelay(pdMS_TO_TICKS(500));
solved_correctly = false; solved_correctly = false;

View File

@ -1,6 +1,6 @@
# #
# Automatically generated file. DO NOT EDIT. # Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) 5.2.1 Project Configuration # Espressif IoT Development Framework (ESP-IDF) 5.2.2 Project Configuration
# #
CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000
CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 CONFIG_SOC_MPU_REGIONS_MAX_NUM=8
@ -331,6 +331,7 @@ CONFIG_SOC_WIFI_WAPI_SUPPORT=y
CONFIG_SOC_WIFI_CSI_SUPPORT=y CONFIG_SOC_WIFI_CSI_SUPPORT=y
CONFIG_SOC_WIFI_MESH_SUPPORT=y CONFIG_SOC_WIFI_MESH_SUPPORT=y
CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y
CONFIG_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND=y
CONFIG_SOC_BLE_SUPPORTED=y CONFIG_SOC_BLE_SUPPORTED=y
CONFIG_SOC_BLE_MESH_SUPPORTED=y CONFIG_SOC_BLE_MESH_SUPPORTED=y
CONFIG_SOC_BLE_50_SUPPORTED=y CONFIG_SOC_BLE_50_SUPPORTED=y
@ -435,6 +436,7 @@ CONFIG_ESP_ROM_HAS_RETARGETABLE_LOCKING=y
CONFIG_ESP_ROM_USB_OTG_NUM=3 CONFIG_ESP_ROM_USB_OTG_NUM=3
CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=4 CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=4
CONFIG_ESP_ROM_HAS_ERASE_0_REGION_BUG=y CONFIG_ESP_ROM_HAS_ERASE_0_REGION_BUG=y
CONFIG_ESP_ROM_HAS_ENCRYPTED_WRITES_USING_LEGACY_DRV=y
CONFIG_ESP_ROM_GET_CLK_FREQ=y CONFIG_ESP_ROM_GET_CLK_FREQ=y
CONFIG_ESP_ROM_HAS_HAL_WDT=y CONFIG_ESP_ROM_HAS_HAL_WDT=y
CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y
@ -557,6 +559,7 @@ CONFIG_APPTRACE_LOCK_ENABLE=y
# Bluetooth # Bluetooth
# #
# CONFIG_BT_ENABLED is not set # CONFIG_BT_ENABLED is not set
CONFIG_BT_ALARM_MAX_NUM=50
# end of Bluetooth # end of Bluetooth
# #
@ -744,7 +747,10 @@ CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
# #
# GDB Stub # GDB Stub
# #
CONFIG_ESP_GDBSTUB_ENABLED=y
# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set # CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set
CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y
CONFIG_ESP_GDBSTUB_MAX_TASKS=32
# end of GDB Stub # end of GDB Stub
# #
@ -909,6 +915,7 @@ CONFIG_ESP_PHY_RF_CAL_PARTIAL=y
# CONFIG_ESP_PHY_RF_CAL_NONE is not set # CONFIG_ESP_PHY_RF_CAL_NONE is not set
# CONFIG_ESP_PHY_RF_CAL_FULL is not set # CONFIG_ESP_PHY_RF_CAL_FULL is not set
CONFIG_ESP_PHY_CALIBRATION_MODE=0 CONFIG_ESP_PHY_CALIBRATION_MODE=0
# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set
# end of PHY # end of PHY
# #
@ -1206,6 +1213,7 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set
# end of Kernel # end of Kernel
# #
@ -1493,7 +1501,9 @@ CONFIG_MBEDTLS_CMAC_C=y
CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_AES=y
CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_AES_USE_INTERRUPT=y
CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0
# CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER is not set
CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_MPI=y
# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set
CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y
CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0
CONFIG_MBEDTLS_HARDWARE_SHA=y CONFIG_MBEDTLS_HARDWARE_SHA=y
@ -1580,7 +1590,7 @@ CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM=y
# CONFIG_MBEDTLS_CHACHA20_C is not set # CONFIG_MBEDTLS_CHACHA20_C is not set
# CONFIG_MBEDTLS_HKDF_C is not set # CONFIG_MBEDTLS_HKDF_C is not set
# CONFIG_MBEDTLS_THREADING_C is not set # CONFIG_MBEDTLS_THREADING_C is not set
# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set CONFIG_MBEDTLS_ERROR_STRINGS=y
# end of mbedTLS # end of mbedTLS
# #
@ -2225,6 +2235,8 @@ CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
# CONFIG_EVENT_LOOP_PROFILING is not set # CONFIG_EVENT_LOOP_PROFILING is not set
CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_ISR=y
CONFIG_POST_EVENTS_FROM_IRAM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y
CONFIG_GDBSTUB_SUPPORT_TASKS=y
CONFIG_GDBSTUB_MAX_TASKS=32
# CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_OTA_ALLOW_HTTP is not set
# CONFIG_ESP_SYSTEM_PD_FLASH is not set # CONFIG_ESP_SYSTEM_PD_FLASH is not set
CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000 CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000