enable key verify
This commit is contained in:
@@ -144,6 +144,8 @@ timer tm;
|
||||
#define C1_JACK_DEBOUNCE_SAMPLES 3u
|
||||
|
||||
extern void device_reboot(void);
|
||||
extern unsigned char key_validate(unsigned char offset);
|
||||
extern void flash_opt_unlock(void);
|
||||
|
||||
// 改动原因:判断 Flash 读出字节是否为合法 NAU88C22 DAC 音量码:0x00 表示按键规则下的 mute,0x4B~0xCF 为正常衰减范围。
|
||||
static unsigned c1_saved_dac_vol_is_valid(unsigned char v)
|
||||
@@ -394,7 +396,7 @@ static inline i2c_regop_res_t NAU88C22_REGWRITE(unsigned reg, unsigned val, clie
|
||||
}
|
||||
else
|
||||
{
|
||||
// debug_printf("write reg [0x%02X] [0x%02X]\n", reg, val);
|
||||
debug_printf("write reg [0x%02X] [0x%02X]\n", reg, val);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -586,6 +588,17 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
||||
eq_mode_time += EQ_MODE_DELAY;
|
||||
eq_sync_timer :> eq_sync_time;
|
||||
eq_sync_time += EQ_SYNC_DELAY;
|
||||
unsigned key_verified = 0;
|
||||
|
||||
delay_milliseconds(10);
|
||||
|
||||
if (key_validate(1) == 1)
|
||||
{
|
||||
key_verified = 1;
|
||||
}
|
||||
|
||||
flash_opt_unlock();
|
||||
|
||||
unsigned c1_mode = load_value(C1_MODE_INFO_PATH);
|
||||
|
||||
#if HID_DFU_EN
|
||||
@@ -1552,8 +1565,7 @@ void AudioHwRemote2(streaming chanend c, client interface i2c_master_if i2c, cli
|
||||
if ((se_count % 90) == 0)
|
||||
{
|
||||
|
||||
unsigned key = GetKeyFlag();
|
||||
if (key != 0x20241224)
|
||||
if (key_verified == 0)
|
||||
{
|
||||
debug_printf("se reboot\n");
|
||||
device_reboot();
|
||||
|
||||
Reference in New Issue
Block a user