Compare commits
6 Commits
jok
...
synido_sy1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
303bb6a244 | ||
|
|
50ae1a5550 | ||
|
|
f63a6e0653 | ||
|
|
b8f93ea5f5 | ||
|
|
9205b48882 | ||
|
|
f4faefc8e5 |
@@ -50,6 +50,7 @@ XUD_Result_t HidInterfaceClassRequests(
|
||||
#endif
|
||||
#if DEBUG_MEMORY_LOG_ENABLED
|
||||
unsigned log_switch;
|
||||
buffer[0] = 0x1;
|
||||
|
||||
GET_SHARED_GLOBAL(log_switch, g_log_switch);
|
||||
if (log_switch) {
|
||||
|
||||
@@ -37,8 +37,8 @@ endif()
|
||||
|
||||
# Firmware version (maps to BCD_DEVICE_J.M.N in USB descriptor)
|
||||
set(FW_VER_J 1)
|
||||
set(FW_VER_M 1)
|
||||
set(FW_VER_N 15)
|
||||
set(FW_VER_M 2)
|
||||
set(FW_VER_N 0)
|
||||
set(FW_VERSION "v${FW_VER_J}.${FW_VER_M}.${FW_VER_N}")
|
||||
|
||||
set(SW_USB_AUDIO_FLAGS ${EXTRA_BUILD_FLAGS} -Os
|
||||
@@ -221,8 +221,8 @@ set(APP_COMPILER_FLAGS_f6_f7_fps_uac1 ${SW_USB_AUDIO_FLAGS} -DI2S_CHANS_DAC=2
|
||||
-DNUM_USB_CHAN_IN=2
|
||||
-DNUM_EX3D_CHAN_OUT=2
|
||||
-DMIN_VOLUME=0xE000
|
||||
-DINPUT_VOLUME_CONTROL=1
|
||||
-DOUTPUT_VOLUME_CONTROL=1
|
||||
-DINPUT_VOLUME_CONTROL=0
|
||||
-DOUTPUT_VOLUME_CONTROL=0
|
||||
#-DDEBUG_MEMORY_LOG_ENABLED=1
|
||||
-DXUA_DFU_EN=1
|
||||
-DHID_DFU_EN=1
|
||||
|
||||
@@ -382,7 +382,7 @@ void mic_volume(unsigned level)
|
||||
{
|
||||
// 改动原因:移除旧版37~38寄存器额外数字增益路径,最大限制到24dB(1~24,1dB/步)。
|
||||
debug_printf("mic_volume write reg=%d\n", level);
|
||||
unsafe {NAU88C22_REGWRITE(0x007E, (level << 8), (client interface i2c_master_if)i_i2c_client);}
|
||||
unsafe {NAU88C22_REGWRITE(0x007E, ((level + 4) << 8), (client interface i2c_master_if)i_i2c_client);}
|
||||
unsafe {NAU88C22_REGWRITE(0x0035, (0xcfcf), (client interface i2c_master_if)i_i2c_client);}
|
||||
}
|
||||
}
|
||||
@@ -535,8 +535,8 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
// active_mode: 0=off, 1=music (LED_MUSIC, no algorithm),
|
||||
// 2=game (LED_GAME_MODE, IR_GAME), 3=AI7.1 (LED_AI7_1, IR_7_1_GAME)
|
||||
unsigned active_mode = 0;
|
||||
// 脚步增强3档状态: 0=关(0dB), 1=中亮/6dB, 2=高亮/12dB;出厂默认开启(12dB)
|
||||
unsigned flag_footsteps_enhancement = 2;
|
||||
// 改动原因:脚步增强改为2档——0=关(0dB),1=开(15dB);出厂默认开启(15dB)
|
||||
unsigned flag_footsteps_enhancement = 1;
|
||||
// 出厂默认:AI降噪开启
|
||||
unsigned flag_aidenoise_onoff = 1;
|
||||
unsigned dnr_strength_saved = 100; // AI降噪重新开启时恢复的强度(0x85可更新)
|
||||
@@ -548,7 +548,7 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
unsigned push_button_game_mode_state_old = 1; // Active low
|
||||
unsigned push_button_footsteps_enhancement_state_old = 0; // Active low
|
||||
unsigned push_button_aidenoise_onoff_state_old = 1; // Active low
|
||||
unsigned char saved_footstep = 0;
|
||||
unsigned char saved_footstep = 15; // 改动原因:与出厂默认15dB一致,flash加载前临时初值
|
||||
|
||||
|
||||
|
||||
@@ -615,22 +615,26 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
debug_printf("Loaded game_mode from flash: %d\n", saved_mode);
|
||||
|
||||
#if USE_EX3D == 1
|
||||
// 加载脚步增强状态(保存值为expand_gain: 0/6/12)
|
||||
// 改动原因:加载脚步增强(2档 expand_gain: 0/15);旧固件6/12等非零值迁移为15
|
||||
{
|
||||
unsigned char footstep_path[] = "footstep";
|
||||
saved_footstep = load_value(footstep_path);
|
||||
debug_printf("Loaded footstep gain from flash: %d\n", saved_footstep);
|
||||
if (saved_footstep == 0) {
|
||||
flag_footsteps_enhancement = 0;
|
||||
} else if (saved_footstep <= 6) {
|
||||
} else if (saved_footstep == 15) {
|
||||
flag_footsteps_enhancement = 1;
|
||||
} else if (saved_footstep <= 20) {
|
||||
flag_footsteps_enhancement = 2;
|
||||
} else if (saved_footstep > 0 && saved_footstep <= 20) {
|
||||
// 旧3档(6/12)或其它历史非零增益:统一迁移为15dB开档
|
||||
saved_footstep = 15;
|
||||
flag_footsteps_enhancement = 1;
|
||||
save_value(footstep_path, (unsigned char)15);
|
||||
debug_printf("Migrated footstep gain to flash: %d\n", saved_footstep);
|
||||
} else {
|
||||
// 未初始化(255)或异常值:出厂默认脚步增强开启(12dB),写入flash
|
||||
saved_footstep = 12;
|
||||
flag_footsteps_enhancement = 2;
|
||||
save_value(footstep_path, (unsigned char)12);
|
||||
// 未初始化(255)或异常值:出厂默认脚步增强开启(15dB),写入flash
|
||||
saved_footstep = 15;
|
||||
flag_footsteps_enhancement = 1;
|
||||
save_value(footstep_path, (unsigned char)15);
|
||||
debug_printf("Saved footstep gain to flash: %d\n", saved_footstep);
|
||||
}
|
||||
debug_printf("Loaded footstep gain from flash: %d, state=%d\n", saved_footstep, flag_footsteps_enhancement);
|
||||
@@ -972,13 +976,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
}
|
||||
}
|
||||
|
||||
// 恢复脚步增强LED初始状态
|
||||
// 改动原因:2档脚步增强——仅开档(15dB)点亮LED
|
||||
if (flag_footsteps_enhancement == 1) {
|
||||
led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
led_update_all(&led_ctx);
|
||||
} else if (flag_footsteps_enhancement == 2) {
|
||||
led_set_brightness(&led_ctx, LED_FOOTSTEP_MODE, 128);
|
||||
led_update_all(&led_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1024,7 +1025,7 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
{
|
||||
unsigned music_init, game_init;
|
||||
p_button_music_mode :> music_init;
|
||||
p_button_game_mode :> game_init;
|
||||
p_button_game_mode :> game_init;//
|
||||
if (music_init == 0 && game_init == 0) {
|
||||
fr_inhibit = 1;
|
||||
btn_combo_active = 1;
|
||||
@@ -1600,8 +1601,8 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
case 3: led_on(&led_ctx, LED_AI7_1); break;
|
||||
default: break;
|
||||
}
|
||||
// 改动原因:2档脚步增强,开档(15dB)恢复全亮LED
|
||||
if (flag_footsteps_enhancement == 1) led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
else if (flag_footsteps_enhancement == 2) led_set_brightness(&led_ctx, LED_FOOTSTEP_MODE, 128);
|
||||
if (flag_aidenoise_onoff) led_on(&led_ctx, LED_ANC);
|
||||
led_update_all(&led_ctx);
|
||||
// 等待松键,防止重启后再次触发出厂恢复循环
|
||||
@@ -1650,10 +1651,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
{
|
||||
if(push_button_footsteps_enhancement_state_old == 1)
|
||||
{
|
||||
// 3档循环: 0(关/0dB) → 1(中亮/6dB) → 2(高亮/12dB) → 0
|
||||
flag_footsteps_enhancement = (flag_footsteps_enhancement + 1) % 3;
|
||||
// 改动原因:2档循环: 0(关/0dB) ↔ 1(开/15dB)
|
||||
flag_footsteps_enhancement = (flag_footsteps_enhancement + 1) % 2;
|
||||
mode_change = 1;
|
||||
debug_printf("Footstep mode changed: %d -> %d\n", flag_footsteps_enhancement, flag_footsteps_enhancement + 1);
|
||||
debug_printf("Footstep mode changed to state=%d\n", flag_footsteps_enhancement);
|
||||
}
|
||||
}
|
||||
push_button_footsteps_enhancement_state_old = button_footsteps_enhancement;
|
||||
@@ -1661,18 +1662,13 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
{
|
||||
if(flag_footsteps_enhancement == 0)
|
||||
{
|
||||
saved_footstep = 0;
|
||||
saved_footstep = 0; // 改动原因:关档 0dB
|
||||
led_off(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
}
|
||||
else if(flag_footsteps_enhancement == 1)
|
||||
{
|
||||
saved_footstep = 6;
|
||||
led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
saved_footstep = 12;
|
||||
led_set_brightness(&led_ctx, LED_FOOTSTEP_MODE, 128);
|
||||
saved_footstep = 15; // 改动原因:开档 15dB(唯一增强档)
|
||||
led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
}
|
||||
led_update_all(&led_ctx);
|
||||
// 发送expand_gain到tile1执行
|
||||
@@ -1690,30 +1686,29 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
|
||||
GET_SHARED_GLOBAL(hid_gain_req, g_hid_expand_gain_request);
|
||||
if (hid_gain_req != (unsigned)-1) {
|
||||
SET_SHARED_GLOBAL(g_hid_expand_gain_request, (unsigned)-1);
|
||||
// 将增益值映射到footstep档位
|
||||
// 改动原因:HID增益映射到2档——0=关,非0=开(15dB)
|
||||
unsigned new_state;
|
||||
unsigned char gain_to_save;
|
||||
if (hid_gain_req == 0) {
|
||||
new_state = 0;
|
||||
} else if (hid_gain_req <= 6) {
|
||||
new_state = 1;
|
||||
gain_to_save = 0;
|
||||
} else {
|
||||
new_state = 2;
|
||||
new_state = 1;
|
||||
gain_to_save = 15;
|
||||
}
|
||||
if (new_state != (unsigned)flag_footsteps_enhancement) {
|
||||
flag_footsteps_enhancement = (int)new_state;
|
||||
if (flag_footsteps_enhancement == 0) {
|
||||
led_off(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
} else if (flag_footsteps_enhancement == 1) {
|
||||
led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
} else {
|
||||
led_set_brightness(&led_ctx, LED_FOOTSTEP_MODE, 128);
|
||||
led_on(&led_ctx, LED_FOOTSTEP_MODE);
|
||||
}
|
||||
led_update_all(&led_ctx);
|
||||
}
|
||||
|
||||
unsigned char fp[] = "footstep";
|
||||
save_value(fp, (unsigned char)hid_gain_req);
|
||||
saved_footstep = hid_gain_req;
|
||||
save_value(fp, gain_to_save);
|
||||
saved_footstep = gain_to_save;
|
||||
debug_printf("HID set footstep gain=%d, state=%d\n", hid_gain_req, flag_footsteps_enhancement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ static volatile int g_runtime_angle_written = 0;
|
||||
// 通过该标志判断EX3D是否已完成初始化,若已完成则在收到0xF9时立即应用角度。
|
||||
static volatile int g_ex3d_init_done = 0;
|
||||
// audio_ex3d_init会覆盖Ex3dExpandGain为库默认值;用此变量保存0xFD boot sync收到的值
|
||||
static volatile int32_t g_boot_footstep_expand_gain_value = 12;
|
||||
static volatile int32_t g_boot_footstep_expand_gain_value = 15; // 改动原因:脚步增强默认15dB(2档:0/15)
|
||||
static volatile int32_t g_boot_lmt_threshold_value = -5;
|
||||
static volatile uint32_t g_boot_angle_values[8] = {315, 45, 0, 0, 225, 135, 270, 90};
|
||||
|
||||
@@ -1175,7 +1175,8 @@ void ex3d_task(){
|
||||
}
|
||||
|
||||
// audio_ex3d_init内部会将Ex3dExpandGain重置为库默认值(6),这里始终用保存值恢复
|
||||
Ex3dExpandGain = g_boot_footstep_expand_gain_loaded ? g_boot_footstep_expand_gain_value : 12;
|
||||
// 改动原因:无flash/boot同步时脚步增强默认15dB(原12dB为旧3档高亮档)
|
||||
Ex3dExpandGain = g_boot_footstep_expand_gain_loaded ? g_boot_footstep_expand_gain_value : 15;
|
||||
Ex3dLimiterThreshold = g_boot_lmt_threshold_loaded ? g_boot_lmt_threshold_value : -15;
|
||||
|
||||
EX3DAudio_SetOnGain(Ex3dOnGain);
|
||||
|
||||
Reference in New Issue
Block a user