Add GPIO26 speaker beep and melody test.

Play audio on boot and every 12s via the onboard amp; show status on the LVGL UI and document pins.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-17 17:30:39 +08:00
parent 23956897fa
commit 82e1ace24f
8 changed files with 132 additions and 18 deletions

View File

@@ -12,6 +12,7 @@ static lv_obj_t *lbl_free;
static lv_obj_t *lbl_files;
static lv_obj_t *bar_usage;
static lv_obj_t *lbl_hint;
static lv_obj_t *lbl_audio;
static lv_obj_t *make_row(lv_obj_t *parent, const char *title, lv_obj_t **value_out) {
lv_obj_t *row = lv_obj_create(parent);
@@ -82,6 +83,8 @@ void ui_create() {
make_row(col, "Used", &lbl_used);
make_row(col, "Free", &lbl_free);
make_row(col, "Root files", &lbl_files);
make_row(col, "Speaker", &lbl_audio);
lv_label_set_text(lbl_audio, "GPIO26");
bar_usage = lv_bar_create(col);
lv_obj_set_width(bar_usage, LV_PCT(100));
@@ -144,7 +147,14 @@ void ui_update(const SdCardInfo &info) {
}
lv_bar_set_value(bar_usage, pct, LV_ANIM_ON);
char hint[40];
snprintf(hint, sizeof(hint), "Used %d%% | auto refresh", pct);
char hint[48];
snprintf(hint, sizeof(hint), "Used %d%% | SD+Audio", pct);
lv_label_set_text(lbl_hint, hint);
}
void ui_set_audio_status(const char *text) {
if (lbl_audio == nullptr || text == nullptr) {
return;
}
lv_label_set_text(lbl_audio, text);
}