Restore TF card UI and speaker at 20% volume.

Keep calibrated SoftSPI touch mapping unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-17 18:43:11 +08:00
parent 7b5f984731
commit a1ab088d70
12 changed files with 581 additions and 62 deletions

20
include/audio_test.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <Arduino.h>
void audio_init();
void audio_set_enabled(bool on);
bool audio_is_enabled();
// 音量 0–100,默认 20
void audio_set_volume(uint8_t percent);
uint8_t audio_get_volume();
void audio_play_music();
void audio_stop();
bool audio_is_playing();
void audio_tick();
const char *audio_last_status();

View File

@@ -1,16 +1,23 @@
#pragma once
// CYD ESP32-2432S028R — 仅屏幕 + 触摸
// CYD ESP32-2432S028R
#define TFT_BL_PIN 21
// TF / microSD (VSPI;触摸用 SoftSPI,不抢总线)
#define SD_MISO 19
#define SD_MOSI 23
#define SD_SCK 18
#define SD_CS 5
#define SPEAKER_PIN 26
#define CYD_TOUCH_IRQ 36
#define CYD_TOUCH_MOSI 32
#define CYD_TOUCH_MISO 39
#define CYD_TOUCH_CLK 25
#define CYD_TOUCH_CS 33
// 物理竖屏;LVGL ROTATION_270 → 横屏 UI
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320
#define UI_HOR_RES 320

21
include/sd_info.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <Arduino.h>
struct SdCardInfo {
bool mounted;
bool present;
const char *type;
const char *filesystem;
uint64_t card_bytes;
uint64_t total_bytes;
uint64_t used_bytes;
uint64_t free_bytes;
uint32_t root_files;
String error;
};
bool sd_init();
void sd_deinit();
SdCardInfo sd_read_info();
String format_bytes(uint64_t bytes);

View File

@@ -1,6 +1,9 @@
#pragma once
#include "sd_info.h"
#include <stdint.h>
void ui_create();
void ui_update(const SdCardInfo &info);
void ui_refresh_audio_buttons();
void ui_set_touch_debug(int16_t lx, int16_t ly, bool down);