step 3 start
This commit is contained in:
parent
417ea02743
commit
fe9a4df7a9
@ -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();
|
||||
|
||||
@ -1,10 +1,51 @@
|
||||
#ifndef STEP_3_HPP
|
||||
#define STEP_3_HPP
|
||||
|
||||
#include <random>
|
||||
#include "../drivers/bottom_half.h"
|
||||
#include <iostream>
|
||||
#include "../drivers/game_timer.h"
|
||||
#include <set>
|
||||
|
||||
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<int> indicators;
|
||||
|
||||
while (indicators.size() < green_indicators) {
|
||||
indicators.insert(led_dist(gen));
|
||||
}
|
||||
|
||||
for (std::set<int>::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 */
|
||||
Loading…
Reference in New Issue
Block a user