diff --git a/APP/app_log.c b/APP/app_log.c index 050c742..656e071 100644 --- a/APP/app_log.c +++ b/APP/app_log.c @@ -578,6 +578,85 @@ uint8_t app_log_try_command(const char *cmd) app_tm1617_inject_key((uint8_t)key); return 1U; } + /* 测试注入:midi on [vel] / midi off + * 直通 Dream(与硅胶弦同一 SendNoteOn/Off 路径),供麦测音高校准 */ + if (strncmp(cmd, "midi on ", 8) == 0 && cmd[8] != '\0') { + char *endp = NULL; + unsigned note = (unsigned)strtoul(cmd + 8, &endp, 10); + unsigned vel = 100; + char line[48]; + if (endp == cmd + 8 || note > 127U) { + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "MIDI_ON_BAD\n"); + return 1U; + } + while (*endp == ' ') + endp++; + if (*endp != '\0') { + vel = (unsigned)strtoul(endp, NULL, 10); + if (vel > 127U) + vel = 127U; + } + SendNoteOnMidiEvent((uint8_t)note, (uint8_t)vel); + snprintf(line, sizeof(line), "MIDI_ON_OK note=%u vel=%u\n", note, vel); + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, line); + return 1U; + } + if (strncmp(cmd, "midi off ", 9) == 0 && cmd[9] != '\0') { + unsigned note = (unsigned)strtoul(cmd + 9, NULL, 10); + char line[40]; + if (note > 127U) { + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "MIDI_OFF_BAD\n"); + return 1U; + } + SendNoteOffMidiEvent((uint8_t)note, 0); + snprintf(line, sizeof(line), "MIDI_OFF_OK note=%u\n", note); + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, line); + return 1U; + } + /* 测试注入:拨弦 string <1..6> [vel|off] + * 按当前 USE_MIDI 发与硅胶 N 弦相同的 NoteOn/Off(须先 chord key 装载) */ + if (strncmp(cmd, "string ", 7) == 0 && cmd[7] != '\0') { + char *endp = NULL; + unsigned s = (unsigned)strtoul(cmd + 7, &endp, 10); + unsigned vel = 100; + uint8_t note = 0; + char line[56]; + int do_off = 0; + + if (endp == cmd + 7 || s < 1U || s > 6U) { + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, "STRING_BAD\n"); + return 1U; + } + while (*endp == ' ') + endp++; + if (*endp != '\0') { + if (endp[0] == 'o' || endp[0] == 'O') + do_off = 1; + else { + vel = (unsigned)strtoul(endp, NULL, 10); + if (vel > 127U) + vel = 127U; + } + } + switch (s) { + case 1: note = USE_MIDI.Midi_1; break; + case 2: note = USE_MIDI.Midi_2; break; + case 3: note = USE_MIDI.Midi_3; break; + case 4: note = USE_MIDI.Midi_4; break; + case 5: note = USE_MIDI.Midi_5; break; + default: note = USE_MIDI.Midi_6; break; + } + if (do_off) { + SendNoteOffMidiEvent(note, 0); + snprintf(line, sizeof(line), "STRING_OFF_OK s=%u note=%u\n", s, (unsigned)note); + } else { + SendNoteOnMidiEvent(note, (uint8_t)vel); + snprintf(line, sizeof(line), + "STRING_OK s=%u note=%u vel=%u\n", s, (unsigned)note, vel); + } + SEGGER_RTT_WriteString(APP_LOG_RTT_CHANNEL, line); + return 1U; + } /* 测试注入:adc key N on|off(0~3;1=独立尾奏键,与万能第4键同路径) */ if (strncmp(cmd, "adc key ", 8) == 0 && cmd[8] != '\0') { unsigned idx = (unsigned)strtoul(cmd + 8, NULL, 10); diff --git a/Global/Global.c b/Global/Global.c index c25f1da..8431341 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -101,7 +101,7 @@ int16_t MIC_VOL_MAP[11]= {-9000,-7000,-5000,-3000,-1000,1000,3000,5000,7000,9000 uint8_t TOUCH_AREA_NUM = (sizeof(Touch_Areas)/sizeof(Touch_AreaTypeDef)); -const uint8_t Version[3] = {0,2,16}; /* major.minor.patch — 0.2.16: stop accomp on mode/song switch; restore green LEDs; default I chord on boot/preamble */ +const uint8_t Version[3] = {0,2,17}; /* major.minor.patch — 0.2.17: Type-C charge battery icon; BLE timbre/style UI sync via UI task; RTT midi/string inject */ uint8_t Led = 8; bool PressFlag = 0; diff --git a/tools/publish_k1_release.py b/tools/publish_k1_release.py index 3fda3d5..5dd9677 100644 --- a/tools/publish_k1_release.py +++ b/tools/publish_k1_release.py @@ -38,7 +38,7 @@ TONE_HDR = PROJ / "project" / "inc" / "ExtFlash_Tone_Addr.h" IAP_DIR = REPO / "升级" / "MCU主控升级" OUT_ROOT = REPO / "tools" / "out" -FW_VER = "0.2.16" +FW_VER = "0.2.17" UI0902_RES_BASE = 0x00100000 BOOT_FLASH_ADDR = 0x08000000 APP_FLASH_ADDR = 0x08008000