feat: add button-activated field network diagnostics

This commit is contained in:
chenjintao
2026-10-20 14:12:28 +08:00
parent b2c78208bf
commit 8bff1f569e
8 changed files with 406 additions and 24 deletions
@@ -3,7 +3,8 @@
#include "ql_rtos.h"
#include "ql_gpio.h"
#include "ql_uart.h"
#include "app_inc.h"
#include "app_inc.h"
#include "net_diag.h"
#define KEY_PIN_WAKEUP_MIC GPIO_PIN_NO_53
#define KEY_PIN_ALARM GPIO_PIN_NO_84
@@ -121,7 +122,7 @@ static void key_thread_entry(void *parameter)
unsigned char level = 0;
unsigned char volume = 0;
unsigned char pre_key_press_mic_counter = 0;
unsigned char pre_key_press_alarm_counter = 0;
unsigned char pre_key_press_alarm_counter = 0;
PIN_LEVEL_E value;
while (1)
@@ -209,30 +210,20 @@ static void key_thread_entry(void *parameter)
if(value!=PIN_LEVEL_LOW){//up
key_press_alarm_status = 0;
if(ql_rtos_get_systicks() - key_press_alarm_time > KEY_LONG_PRESS_3S){
build_alarm();
}
else if(ql_rtos_get_systicks() - key_press_alarm_time > KEY_WAIT_TIME){
if(!vad_audio_is_recording()&&key_start_leave==0&&get_mqtt_connect_status()==1){
key_start_leave = 1;
build_leave_to_parent();
}else{
key_start_leave = 0;
app_play_tips_file(2);
}
}
/* GPIO84 is diagnostic-only; long holds have no action. */
{
u32 held = (u32)(ql_rtos_get_systicks() - key_press_alarm_time);
if (held > KEY_WAIT_TIME && held < KEY_LONG_PRESS_3S)
net_diag_start();
}
key_press_alarm_time = ql_rtos_get_systicks();
key_press_alarm_counter = 0;
pre_key_press_mic_counter = 0;
pre_key_press_alarm_counter = 0;
}else{ //一直按着
if(key_press_alarm_status==0){
key_press_alarm_status = 1;//表示已经按下了
//先停掉音频播放线程
if(key_start_leave==0&&!vad_audio_is_recording()){
stop_player_func();
}
}
}
}
}