WE HAVE A GOOD SPEAKER DRIVER!!!!
This commit is contained in:
@@ -264,7 +264,7 @@ static bool play_part(uint32_t time) {
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(80));
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void step2(void) {
|
||||
char c = char_of_keypad_key(key);
|
||||
// ESP_LOGI(TAG, "Pressed: %c", c);
|
||||
if (c == answer_char) {
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
solved_times++;
|
||||
if (solved_times < NUM_SOLVES) {
|
||||
clean_bomb();
|
||||
|
||||
@@ -13,12 +13,12 @@ static int tone = 0;
|
||||
static int times = 0;
|
||||
|
||||
static const char* TONE_FILES[] = {
|
||||
MOUNT_POINT "/low-1.pcm",
|
||||
MOUNT_POINT "/low-3.pcm",
|
||||
MOUNT_POINT "/low-6.pcm",
|
||||
MOUNT_POINT "/high-1.pcm",
|
||||
MOUNT_POINT "/high-3.pcm",
|
||||
MOUNT_POINT "/high-6.pcm",
|
||||
MOUNT_POINT "/low-1.wav",
|
||||
MOUNT_POINT "/low-3.wav",
|
||||
MOUNT_POINT "/low-6.wav",
|
||||
MOUNT_POINT "/high-1.wav",
|
||||
MOUNT_POINT "/high-3.wav",
|
||||
MOUNT_POINT "/high-6.wav",
|
||||
};
|
||||
|
||||
static const char* LCD_STRINGS[] = {
|
||||
@@ -80,8 +80,8 @@ void step3(void) {
|
||||
// tone = 2;
|
||||
while (get_button_pressed(nullptr)) vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
play_raw(MOUNT_POINT "/que.pcm");
|
||||
play_raw(TONE_FILES[tone]);
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
play_clip_wav(TONE_FILES[tone], false, false, 3, 0);
|
||||
|
||||
bool correct = false;
|
||||
switch (tone % 3) {
|
||||
@@ -98,7 +98,7 @@ void step3(void) {
|
||||
if (correct) {
|
||||
times++;
|
||||
clean_bomb();
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
} else {
|
||||
vTaskDelay(pdMS_TO_TICKS(1500));
|
||||
}
|
||||
|
||||
+14
-30
@@ -18,8 +18,8 @@ static lv_obj_t* line_clear_img;
|
||||
static lv_style_t game_over_style;
|
||||
static lv_obj_t* game_over_label;
|
||||
|
||||
static const void* LINE_CLEAR_SRC = (void*)"A:/sdcard/clear.bin";
|
||||
static const void* BACKGROUND_SRC = (void*)"A:/sdcard/bg.bin";
|
||||
static const void* LINE_CLEAR_SRC = (void*)"A:" MOUNT_POINT "/clear.bin";
|
||||
static const void* BACKGROUND_SRC = (void*)"A:" MOUNT_POINT "/bg.bin";
|
||||
// LV_IMG_DECLARE(background);
|
||||
// static const void* BACKGROUND_SRC = (void*)&background;
|
||||
|
||||
@@ -28,13 +28,13 @@ static bool playing_music = true;
|
||||
|
||||
static const char* PIECE_IMG_SRC[] = {
|
||||
NULL,
|
||||
"A:/sdcard/lb.bin",
|
||||
"A:/sdcard/db.bin",
|
||||
"A:/sdcard/orange.bin",
|
||||
"A:/sdcard/yellow.bin",
|
||||
"A:/sdcard/green.bin",
|
||||
"A:/sdcard/purple.bin",
|
||||
"A:/sdcard/red.bin",
|
||||
"A:" MOUNT_POINT "/lb.bin",
|
||||
"A:" MOUNT_POINT "/db.bin",
|
||||
"A:" MOUNT_POINT "/orange.bin",
|
||||
"A:" MOUNT_POINT "/yellow.bin",
|
||||
"A:" MOUNT_POINT "/green.bin",
|
||||
"A:" MOUNT_POINT "/purple.bin",
|
||||
"A:" MOUNT_POINT "/red.bin",
|
||||
};
|
||||
|
||||
static bool game = true;
|
||||
@@ -123,22 +123,8 @@ static int bdca(int i) { // [0,1,2,3] -> [ 0,+2,+1,-1]
|
||||
const int map[] = {0, 2, 1, -1};
|
||||
return map[i];
|
||||
}
|
||||
|
||||
static void music_task(void* arg) {
|
||||
stop_music = xQueueCreate(2, sizeof (uint8_t));
|
||||
if (stop_music == 0) {
|
||||
ESP_LOGW(TAG, "Could not create stop_music queue!");
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
while (playing_music) {
|
||||
play_raw_stop_queue(MOUNT_POINT "/tetris.pcm", stop_music);
|
||||
}
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
static void init_screen(void) {
|
||||
static void init_screen() {
|
||||
while (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdFALSE) vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
img = lv_img_create(lv_scr_act());
|
||||
@@ -176,19 +162,17 @@ static void init_screen(void) {
|
||||
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
|
||||
xTaskCreate(music_task, "music", 4096, NULL, 5, NULL);
|
||||
play_clip_wav(MOUNT_POINT "/tetris.wav", true, false, 3, 0);
|
||||
}
|
||||
|
||||
static void deinit_screen(void) {
|
||||
static void deinit_screen() {
|
||||
while (xSemaphoreTake(xGuiSemaphore, portMAX_DELAY) == pdFALSE) vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
xSemaphoreGive(xGuiSemaphore);
|
||||
|
||||
playing_music = false;
|
||||
uint8_t value = 0;
|
||||
if (!xQueueSend(stop_music, &value, pdMS_TO_TICKS(1000))) {
|
||||
ESP_LOGE(TAG, "Faild to send stop queue");
|
||||
if (!stop_clip(MOUNT_POINT "/tetris.wav", pdMS_TO_TICKS(1000))) {
|
||||
ESP_LOGW(TAG, "Can't stop, addicted to the shindig.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -878,7 +878,7 @@ void step5(void) {
|
||||
stop_module_timer();
|
||||
if (solved_correctly) {
|
||||
solved_puzzles++;
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
solved_correctly = false;
|
||||
} else {
|
||||
|
||||
@@ -22,7 +22,7 @@ void step6(void) {
|
||||
for (int i = 0; i < NUM_WIRES; i++) {
|
||||
if (just_cut_wires & (1<<i)) {
|
||||
if (solution[i]) {
|
||||
play_raw(MOUNT_POINT "/correct.pcm");
|
||||
play_clip_wav(MOUNT_POINT "/correct.wav", true, false, 3, 0);
|
||||
} else {
|
||||
strike("Cut wrong wire");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "wires_puzzle.h"
|
||||
|
||||
const static char* WIRES_FILE_PATH = "/sdcard/wires.txt";
|
||||
const static char* WIRES_FILE_PATH = MOUNT_POINT "/wires.txt";
|
||||
const static char* TAG = "wires_puzzle";
|
||||
|
||||
static int color_name_len[NUM_COLORS] = {
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <esp_random.h>
|
||||
#include <string.h>
|
||||
#include "esp_vfs_fat.h"
|
||||
#include "drivers/sd.h"
|
||||
|
||||
#define NUM_COLORS 6
|
||||
#define NUM_WIRES 8
|
||||
|
||||
Reference in New Issue
Block a user