update game results

This commit is contained in:
2025-03-26 21:11:52 -05:00
parent 7d43f9957a
commit 480445d31e
6 changed files with 131 additions and 28 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ void init_speaker(void) {
// start task
xTaskCreate(speaker_task, "play_audio", 4096, NULL, 5, NULL);
play_clip_wav(MOUNT_POINT "/startup.wav", true, false, 3, 0);
play_clip_wav(MOUNT_POINT "/startup.wav", true, false, 4, 0);
ESP_LOGI(TAG, "Speaker initialized!");
}
+9 -2
View File
@@ -1,10 +1,14 @@
#include "wires.h"
extern uint32_t current_step;
uint32_t total_strikes;
uint32_t step_strikes[N_STEPS] = {0};
uint32_t step_finish_times[N_STEPS] = {0};
static const char *TAG = "wires";
static const uint32_t STRIKE_TIME_PENALTY = 30'000;
const uint32_t STRIKE_TIME_PENALTY = 30'000;
static bool button_state;
static bool button_pressed;
@@ -83,7 +87,10 @@ void strike(const char* reason) {
ESP_LOGW("strike!", "%s", reason);
lcd_print(0, 3, reason);
time_penalty(STRIKE_TIME_PENALTY);
total_strikes += 1;
if (current_step > 0 && current_step <= N_STEPS) {
total_strikes += 1;
step_strikes[current_step - 1] += 1;
}
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)));
}
+5
View File
@@ -7,6 +7,7 @@
#include <esp_log.h>
#include "drivers/char_lcd.h"
#include "drivers/game_timer.h"
#include "main.h"
#define WIRES_PIN_DELTA GPIO_NUM_2
#define WIRES_I2C_NUM I2C_NUM_1
@@ -15,6 +16,10 @@
#define DELTA_BIT_WIRES 0
#define DELTA_BIT_BUTTON 1
extern const uint32_t STRIKE_TIME_PENALTY;
extern uint32_t step_strikes[N_STEPS];
extern uint32_t step_finish_times[N_STEPS];
extern uint32_t total_strikes;
void init_wires(void);