From a7b22343fe2f1dfcf2eb29e6ed39b2726b940967 Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Sun, 11 Aug 2024 23:18:41 -0500 Subject: [PATCH] tweaks --- main/drivers/wires.cpp | 3 +++ main/drivers/wires.h | 1 + main/main.cpp | 2 +- main/steps/step2.cpp | 2 +- main/steps/step4.cpp | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/main/drivers/wires.cpp b/main/drivers/wires.cpp index 43fe524..bc775e2 100644 --- a/main/drivers/wires.cpp +++ b/main/drivers/wires.cpp @@ -2,6 +2,8 @@ static const char *TAG = "wires"; +static const uint32_t STRIKE_TIME_PENALTY = 30'000; + static bool button_state; static bool button_pressed; static bool button_released; @@ -79,6 +81,7 @@ void strike(char* reason) { ESP_LOGW("strike!", "%s", reason); lcd_set_cursor(&lcd, 0, 3); lcd_print(&lcd, reason); + set_game_time(get_game_time() - STRIKE_TIME_PENALTY); uint8_t reg = 6; ESP_ERROR_CHECK_WITHOUT_ABORT(i2c_master_write_to_device(WIRES_I2C_NUM, WIRES_I2C_ADDR, ®, 1, (100 / portTICK_PERIOD_MS))); } diff --git a/main/drivers/wires.h b/main/drivers/wires.h index 065bc69..67531d5 100644 --- a/main/drivers/wires.h +++ b/main/drivers/wires.h @@ -6,6 +6,7 @@ #include #include #include "drivers/char_lcd.h" +#include "drivers/game_timer.h" #define WIRES_PIN_DELTA GPIO_NUM_2 #define WIRES_I2C_NUM I2C_NUM_1 diff --git a/main/main.cpp b/main/main.cpp index d3a4a42..67fb6b3 100755 --- a/main/main.cpp +++ b/main/main.cpp @@ -44,7 +44,7 @@ extern "C" void app_main(void) { clean_bomb(); step0(); - set_game_time(60*60*1000 + 1000); + set_game_time(initial_game_time + 1000); start_game_timer(); clean_bomb(); if (skip_to_step <= 1) step1(); diff --git a/main/steps/step2.cpp b/main/steps/step2.cpp index 3e7661f..62c10b5 100644 --- a/main/steps/step2.cpp +++ b/main/steps/step2.cpp @@ -327,7 +327,7 @@ void step2(void) { complete(); while (!play_game(4*60*1000, 4)) fail(); complete(); - while (!play_game(8*60*1000, 8)) fail(); + while (!play_game(6*60*1000, 8)) fail(); complete(); deinit_screen(); diff --git a/main/steps/step4.cpp b/main/steps/step4.cpp index a7fc306..37924df 100644 --- a/main/steps/step4.cpp +++ b/main/steps/step4.cpp @@ -62,7 +62,7 @@ static bool six_second(); void step4(void) { // start counting down module timer immediatly - set_module_time(20'000); + set_module_time(30'000); start_module_timer(); while (get_module_time() > 0) vTaskDelay(pdMS_TO_TICKS(100)); @@ -91,7 +91,7 @@ void step4(void) { clean_bomb(); play_raw(MOUNT_POINT "/correct.pcm"); } - vTaskDelay(pdMS_TO_TICKS(1000)); + vTaskDelay(pdMS_TO_TICKS(3000)); } }