diff --git a/main/main.cpp b/main/main.cpp index bf9aac8..f4f6b40 100755 --- a/main/main.cpp +++ b/main/main.cpp @@ -19,9 +19,9 @@ #include "steps/step0.h" #include "steps/step1.h" #include "steps/step2.h" -#include "steps/step3.hpp" +#include "steps/step3.h" #include "steps/step4.h" -// #include "steps/step5.hpp" +#include "steps/step5.h" #include "steps/step6.h" static const char *TAG = "main"; @@ -43,14 +43,11 @@ extern "C" void app_main(void) { // create_demo_ui(); clean_bomb(); - // xTaskCreate(poster_child_task, "tick_lvgl", 4096, NULL, 5, NULL); - - - // step0(); - // set_game_time(30000); - // start_game_timer(); - // clean_bomb(); - // step1(); + step0(); + set_game_time(30000); + start_game_timer(); + clean_bomb(); + step1(); clean_bomb(); step2(); clean_bomb(); diff --git a/main/steps/step3.hpp b/main/steps/step3.hpp index bbfd282..c56207e 100644 --- a/main/steps/step3.hpp +++ b/main/steps/step3.hpp @@ -1,10 +1,51 @@ #ifndef STEP_3_HPP #define STEP_3_HPP +#include +#include "../drivers/bottom_half.h" +#include +#include "../drivers/game_timer.h" +#include + static const char *STEP3_TAG = "step3"; +std::random_device rd; +std::mt19937 gen(rd()); +std::uniform_int_distribution<> puzzle_dist(0, 7); +std::uniform_int_distribution<> puzzle_zero_dist(0, 15); +std::uniform_int_distribution<> led_dist(0, 20); + void step3(void) { - + set_module_time(3000); + + // int puzzle = puzzle_dist(gen); + int puzzle = 0; + switch (puzzle) { + case 0: + lcd_print(&lcd, "Clear"); + + int green_indicators = puzzle_zero_dist(gen); + std::set indicators; + + while (indicators.size() < green_indicators) { + indicators.insert(led_dist(gen)); + } + + for (std::set::iterator it = indicators.begin(); it != indicators.end(); it++) { + ESP_ERROR_CHECK(led_strip_set_pixel(leds, *it, 0, 60, 0)); + } + + while (1) { + if (get_module_time() <= 0) { + ESP_LOGI(STEP3_TAG, "switch state: %i", get_switch_state(0)); + // get_switch_state(); + } + vTaskDelay(pdMS_TO_TICKS(10)); + } + + + + } } #endif /* STEP_3_HPP */ \ No newline at end of file