Add constants

This commit is contained in:
Mitchell Marino 2024-09-22 22:05:08 -05:00
parent 7d2ddcbbdd
commit 06dbb8155e
2 changed files with 23 additions and 11 deletions

View File

@ -4,6 +4,8 @@
#define THREE_SECOND_TIME 90'000 #define THREE_SECOND_TIME 90'000
#define SIX_SECOND_TIME 75'000 #define SIX_SECOND_TIME 75'000
#define TIMES_TO_COMPLETE 4
__attribute__((unused)) __attribute__((unused))
static const char *TAG = "step3"; static const char *TAG = "step3";
@ -73,7 +75,7 @@ void step3(void) {
int len = sizeof(star_codes)/sizeof(StarCodeHandler); int len = sizeof(star_codes)/sizeof(StarCodeHandler);
do_star_codes(star_codes, len); do_star_codes(star_codes, len);
while (times < 4) { while (times < TIMES_TO_COMPLETE) {
tone = tone_dist(gen); tone = tone_dist(gen);
// tone = 2; // tone = 2;
while (get_pressed_button(nullptr)) vTaskDelay(pdMS_TO_TICKS(10)); while (get_pressed_button(nullptr)) vTaskDelay(pdMS_TO_TICKS(10));

View File

@ -1,9 +1,19 @@
#include "step5.h" #include "step5.h"
#define TIME_CLEAR 30'000
#define TIME_PLANK 40'000
#define TIME_EMPTY 40'000
#define TIME_NOTHING 25'000
#define TIME_BLINK 35'000
#define TIME_UMMM 35'000
#define TIME_BLANK 40'000
#define TIME_WHAT 60'000
#define TIME_PLINK 40'000
__attribute__((unused)) __attribute__((unused))
static const char *TAG = "step5"; static const char *TAG = "step5";
static const int TIMES_TO_SOLVE = 9; static const int TIMES_TO_SOLVE = 9;
static std::random_device rd; static std::random_device rd;
static std::mt19937 gen(rd()); static std::mt19937 gen(rd());
@ -216,7 +226,7 @@ void step5(void) {
switch (puzzle) { switch (puzzle) {
case 0: { case 0: {
lcd_print(&lcd, "Clear"); lcd_print(&lcd, "Clear");
set_module_time(30000); set_module_time(TIME_CLEAR);
start_module_timer(); start_module_timer();
std::vector<int> indicator_options = all_leds; std::vector<int> indicator_options = all_leds;
@ -249,7 +259,7 @@ void step5(void) {
} }
case 1: { case 1: {
lcd_print(&lcd, "Blank"); lcd_print(&lcd, "Blank");
set_module_time(40000); set_module_time(TIME_BLANK);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> on_indicators_dist(16, 21); std::uniform_int_distribution<> on_indicators_dist(16, 21);
@ -286,7 +296,7 @@ void step5(void) {
break; break;
} }
case 2: { case 2: {
set_module_time(40000); set_module_time(TIME_EMPTY);
start_module_timer(); start_module_timer();
std::map<int, int> idx_to_led_map = { std::map<int, int> idx_to_led_map = {
@ -366,7 +376,7 @@ void step5(void) {
} }
case 3: { case 3: {
lcd_print(&lcd, "Nothing"); lcd_print(&lcd, "Nothing");
set_module_time(25000); set_module_time(TIME_NOTHING);
start_module_timer(); start_module_timer();
const int COLOR_RED[5] = {0, 20, 10, 0}; const int COLOR_RED[5] = {0, 20, 10, 0};
@ -422,7 +432,7 @@ void step5(void) {
} }
case 4: { case 4: {
lcd_print(&lcd, "Blink"); lcd_print(&lcd, "Blink");
set_module_time(35000); set_module_time(TIME_BLINK);
start_module_timer(); start_module_timer();
// buttons // buttons
@ -481,7 +491,7 @@ void step5(void) {
} }
case 5: { case 5: {
lcd_print(&lcd, "Ummm"); lcd_print(&lcd, "Ummm");
set_module_time(35000); set_module_time(TIME_UMMM);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> indicator_number_dist(0, 5); std::uniform_int_distribution<> indicator_number_dist(0, 5);
@ -534,7 +544,7 @@ void step5(void) {
} }
case 6: { case 6: {
lcd_print(&lcd, "Plank"); lcd_print(&lcd, "Plank");
set_module_time(40000); set_module_time(TIME_PLANK);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> led_color_dist(0, 5); std::uniform_int_distribution<> led_color_dist(0, 5);
@ -624,7 +634,7 @@ void step5(void) {
} }
case 7: { case 7: {
lcd_print(&lcd, "What"); lcd_print(&lcd, "What");
set_module_time(55000); set_module_time(TIME_WHAT);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> math_number_dist(1, 9); std::uniform_int_distribution<> math_number_dist(1, 9);
@ -777,7 +787,7 @@ void step5(void) {
} }
case 8: { case 8: {
lcd_print(&lcd, "Plink"); lcd_print(&lcd, "Plink");
set_module_time(40000); set_module_time(TIME_PLINK);
start_module_timer(); start_module_timer();
std::uniform_int_distribution<> indicator_number_dist(0, 4); std::uniform_int_distribution<> indicator_number_dist(0, 4);