update game results
This commit is contained in:
@@ -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!");
|
||||
}
|
||||
|
||||
@@ -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, ®, 1, (100 / portTICK_PERIOD_MS)));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user