This commit is contained in:
Mitchell Marino 2024-08-11 23:18:41 -05:00
parent 5534cd733e
commit a7b22343fe
5 changed files with 8 additions and 4 deletions

View File

@ -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, &reg, 1, (100 / portTICK_PERIOD_MS)));
}

View File

@ -6,6 +6,7 @@
#include <driver/gpio.h>
#include <esp_log.h>
#include "drivers/char_lcd.h"
#include "drivers/game_timer.h"
#define WIRES_PIN_DELTA GPIO_NUM_2
#define WIRES_I2C_NUM I2C_NUM_1

View File

@ -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();

View File

@ -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();

View File

@ -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));
}
}