diff --git a/APP/app_log.c b/APP/app_log.c index c92c9cd..050c742 100644 --- a/APP/app_log.c +++ b/APP/app_log.c @@ -297,6 +297,12 @@ uint8_t app_log_try_command(const char *cmd) app_log_flash_start(size); return 1U; } + /* flash all → W25Q128 @ 0x0(tone+UI 合成 ALL.res) */ + if (strncmp(cmd, "flash all ", 10) == 0) { + uint32_t size = (uint32_t)strtoul(cmd + 10, NULL, 10); + app_log_flash_start_at(0U, size, "FLASH_ALL_GO", "FLASH_ALL_OK\n"); + return 1U; + } if (strncmp(cmd, "flash haitian ", 14) == 0) { uint32_t size = (uint32_t)strtoul(cmd + 14, NULL, 10); app_log_flash_start_at(FLASH_ADDR_SONG_HAITIAN, size, @@ -500,7 +506,7 @@ uint8_t app_log_try_command(const char *cmd) return 1U; } if (strncmp(cmd, "tone pick", 9) == 0) { - /* tone pick uni → 万能;默认仍测专业+本地曲目 */ + /* tone pick uni → 万能;tone pick free → 普通+节奏;默认专业+本地曲目 */ if (cmd[9] == ' ' && (cmd[10] == 'u' || cmd[10] == 'U')) { mGuiData[GUI_TAB_INDEX].Current = 0; mGuiData[GUI_AUTOBAND_SW].Current = 0; @@ -514,6 +520,22 @@ uint8_t app_log_try_command(const char *cmd) SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "TONE_PICK_UNI_DONE\n"); return 1U; } + if (cmd[9] == ' ' && (cmd[10] == 'f' || cmd[10] == 'F' || cmd[10] == 'n' || cmd[10] == 'N')) { + /* 普通模式 + 节奏类型(1.bin);模拟已按指板 */ + unsigned idx = ParamGuiData[SONG_MODE_PARAM].Current; + mGuiData[GUI_TAB_INDEX].Current = 2; + mGuiData[GUI_AUTOBAND_SW].Current = 0; + UI_ApplyToneAddress(); + AutoBandTop1_Stop(); + StartFlag = 0; + (void)App_Auto_LoadPresetFromFlash((int)idx); + if (!(cmd[11] == ' ' && (cmd[12] == 'k' || cmd[12] == 'K'))) + KEY_ID_1629 = 1; + PressFlag = 1; + Pick_Handle(); + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "TONE_PICK_FREE_DONE\n"); + return 1U; + } /* 模拟专业+本地曲目拨片;chord pick keep → 保留已注入的 KEY_ID */ mGuiData[GUI_TAB_INDEX].Current = 1; mGuiData[GUI_AUTOBAND_SW].Current = 1; @@ -593,24 +615,28 @@ uint8_t app_log_try_command(const char *cmd) return 1U; } if (strncmp(cmd, "ui boot", 7) == 0) { + /* 先 ACK:全屏 Logo 绘制很慢,避免 HIL/主机超时误判 */ + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_BOOT_OK\n"); LCD_BLK_Set(); LCD_WR_PIC_FROM_FLASH(0, 0, UI0902_BOOT_LOGO_W, UI0902_BOOT_LOGO_H, UI0902_BOOT_LOGO_ADDR); - SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_BOOT_OK\n"); return 1U; } if (strncmp(cmd, "ui charge", 9) == 0) { uint8_t peek[4]; + W25Q128_Read(peek, UI0902_CHARGE_SCREEN_ADDR, 4); + /* 先 ACK(peek 很快);再铺色/画图,避免卡在 LCD SPI 时主机无响应 */ + if (peek[0] != 0xFF || peek[1] != 0xFF) + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_CHARGE_OK\n"); + else + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_CHARGE_EMPTY\n"); LCD_BLK_Set(); LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR); - W25Q128_Read(peek, UI0902_CHARGE_SCREEN_ADDR, 4); if (peek[0] != 0xFF || peek[1] != 0xFF) { LCD_WR_PIC_FROM_FLASH(0, 0, UI0902_CHARGE_SCREEN_W, UI0902_CHARGE_SCREEN_H, UI0902_CHARGE_SCREEN_ADDR); - SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_CHARGE_OK\n"); } else { Draw_Charging_Icon(120, 150, 2, 0x3D7F); - SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "UI_CHARGE_EMPTY\n"); } { const char *s = "50"; diff --git a/Global/Global.c b/Global/Global.c index 06656e9..9069b4a 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -318,7 +318,13 @@ void Power_Key_IsrTick(void) { static uint16_t isr_hold_ms = 0; static uint8_t isr_fired = 0; - flag_status st = BSP_GetPowerKey(); + flag_status st; + + /* RTT/USB 烧 ExtFlash 期间禁止软关机,避免长按/粘键打断 FLASH_ACK */ + if (app_log_flash_busy()) + return; + + st = BSP_GetPowerKey(); if (st == KEY_PRESS_LEVEL) { @@ -917,7 +923,7 @@ void Pick_Handle() } /* 左手未触发和弦板(或落在拍速/停止键)时:拨片默认发当前调一级大和弦伴奏; - * 普通模式除外——必须左手按住指板再拨,不做一级兜底 */ + * 普通模式除外——必须左手按住指板再拨,不做一级兜底(说明书需求) */ if (mGuiData[GUI_TAB_INDEX].Current != 2 && (chord_id == 0 || chord_id == 22 || chord_id == 23)) { @@ -964,20 +970,35 @@ void Pick_Handle() break; case 2: - /* 普通:左手按住指板 + 拨片起奏当前和弦;松手由 TM1629 停 */ + /* 普通:左手按住指板 + 拨片起奏;松手由 TM1629 停。 + * 节奏用 piece;本地曲目用 StartWithNote */ if (PressFlag == 0 || chord_id == 0 || chord_id > 21) - break; /* 未按指板:不响、不兜底一级 */ + { + LOG_I("pick", "normal skip press=%u chord=%u (need fretboard)", + (unsigned)PressFlag, (unsigned)chord_id); + break; + } StartFlag = 1; - AutoBandTop1_Stop(); - AutoBandTop1_SetLoopMode(0,1); - AutoBandTop1_SetRunVar(mGuiData[GUI_PLAY_SECTION].Current); - /* 起调必须用 0x3C+移调;勿用和弦音区 MIDI(如 48),否则本地曲目起奏异常 */ - midi = 0x3C + mGuiData[GUI_TRANSPOSE].Current; - AutoBandTop1_StartWithNote(midi); - AutoBandTop1_StartWithNotes(midi_note_buff, note_cnt); if (mGuiData[GUI_AUTOBAND_SW].Current) + { + AutoBandTop1_Stop(); + AutoBandTop1_SetLoopMode(0,1); + AutoBandTop1_SetRunVar(mGuiData[GUI_PLAY_SECTION].Current); + midi = 0x3C + mGuiData[GUI_TRANSPOSE].Current; + AutoBandTop1_StartWithNote(midi); + AutoBandTop1_StartWithNotes(midi_note_buff, note_cnt); LOG_I("pick", "local/normal root=%u name=%s", midi, AutoBandTop1_GetPresetName() ? AutoBandTop1_GetPresetName() : "?"); + } + else + { + AutoBandTop1_SetPiecePlayMode(1, 0, 1920); + AutoBandTop1_StartWithNotes(midi_note_buff, note_cnt); + AutoBandTop1_SetLoopMode(0, 1); + LOG_I("pick", "normal/rhythm piece name=%s notes=%u chord=%u", + AutoBandTop1_GetPresetName() ? AutoBandTop1_GetPresetName() : "?", + (unsigned)note_cnt, (unsigned)chord_id); + } break; case 1: