diff --git a/firmware/p417_SWTR.X/nbproject/Makefile-genesis.properties b/firmware/p417_SWTR.X/nbproject/Makefile-genesis.properties
index 0a6b572..a4a539e 100644
--- a/firmware/p417_SWTR.X/nbproject/Makefile-genesis.properties
+++ b/firmware/p417_SWTR.X/nbproject/Makefile-genesis.properties
@@ -1,5 +1,5 @@
#
-#Sat Aug 24 10:49:01 CST 2024
+#Sat Sep 14 09:55:06 CST 2024
mcal.com-microchip-mplab-nbide-toolchain-xc32-XC32LanguageToolchain.md5=1eaf555a844840d91945cb14109201c3
conf.ids=mcal
mcal.languagetoolchain.version=4.10
diff --git a/firmware/p417_SWTR.X/nbproject/private/private.xml b/firmware/p417_SWTR.X/nbproject/private/private.xml
index 7698751..b293abf 100644
--- a/firmware/p417_SWTR.X/nbproject/private/private.xml
+++ b/firmware/p417_SWTR.X/nbproject/private/private.xml
@@ -3,6 +3,8 @@
+ file:/F:/FCB_project/P417/CODE/20240727HW06/P417_SWTR/firmware/src/DiagnosticR/Sys_Diag_Detect/SysDiagDetect.c
+ file:/F:/FCB_project/P417/CODE/20240727HW06/P417_SWTR/firmware/src/TouchPanel/TouchPanel.c
file:/F:/FCB_project/P417/CODE/20240727HW06/P417_SWTR/firmware/src/main.c
diff --git a/firmware/src/DiagnosticR/Sys_Diag_Detect/SysDiagDetect.c b/firmware/src/DiagnosticR/Sys_Diag_Detect/SysDiagDetect.c
index b8834e2..47457b3 100644
--- a/firmware/src/DiagnosticR/Sys_Diag_Detect/SysDiagDetect.c
+++ b/firmware/src/DiagnosticR/Sys_Diag_Detect/SysDiagDetect.c
@@ -4,6 +4,7 @@
#include "RTE.h"
#include "forcedetect.h"
#include "forceSnsr.h"
+#include "Speaker.h"
uint8 Touch_Sensor_Fault = 0,Touch_Sensor_Fault_key=0,Touch_Sensor_Fault_pad=0;
static uint8 Bat_Rng = 0;
static void Battery_Volt_Diag_Task(void)
@@ -126,28 +127,9 @@ extern uint8_t Allow_Touch_flag;
static uint8 Vibra_Fault = 0;
static void Vibration_Diag_Task(void)
{
- // AD_data=voltage * 4096/3.3V normal:0-0.01(15) short: 0.15(185)-0.36(448) 0.6(742)-0.7(870) 0.95(1177)-1.05(1305) 1.27(1575)-1.39(1727) open:1.55(1921) - 1.72(2136)
-
Vibra_Fault = Get_Speaker_Fault();//Allow_Touch_flag;
InitMessage(SIG_DIAGCFAILRTOUCHPANSWTRVIBRATIONFLTSTS, &Vibra_Fault);
- /*
- if(LD_AD_Val>=0 && LD_AD_Val<=15) //normal
- {
- Vibra_Fault = Vibration_Normal;
- InitMessage(SIG_DIAGCFAILRTOUCHPANSWTRVIBRATIONFLTSTS, &Vibra_Fault);
- }
- else if((LD_AD_Val>=185 && LD_AD_Val<=448)||(LD_AD_Val>=742 && LD_AD_Val<=870)||(LD_AD_Val>=1177 && LD_AD_Val<=1305)||(LD_AD_Val>=1575 && LD_AD_Val<=1727))
- {
- Vibra_Fault = Vibration_Short;
- InitMessage(SIG_DIAGCFAILRTOUCHPANSWTRVIBRATIONFLTSTS, &Vibra_Fault);
- }
- else if(LD_AD_Val>=1921 && LD_AD_Val<=2136)
- {
- Vibra_Fault = Vibration_open;
- InitMessage(SIG_DIAGCFAILRTOUCHPANSWTRVIBRATIONFLTSTS, &Vibra_Fault);
- }
- */
}
void Sys_Diag_Detcet_Task(void)
diff --git a/firmware/src/DiagnosticR/UDS/UDS_CoreServices_CB.h b/firmware/src/DiagnosticR/UDS/UDS_CoreServices_CB.h
index 8afe2ab..afc4ebd 100644
--- a/firmware/src/DiagnosticR/UDS/UDS_CoreServices_CB.h
+++ b/firmware/src/DiagnosticR/UDS/UDS_CoreServices_CB.h
@@ -221,6 +221,8 @@ typedef unsigned char UI_8;
#define DID_PRESEE_SEN_SIGNAL ((UI_16)0x7021)
#define DID_PRESEE_SEN_PRE_VAL ((UI_16)0x7022)
+#define DID_RESET_SOURCE ((UI_16)0x7030)
+
/*--------------------------- Global variables ---------------------------- */
//#pragma push
diff --git a/firmware/src/DiagnosticR/UDS/UDS_DIDNvm.c b/firmware/src/DiagnosticR/UDS/UDS_DIDNvm.c
index b934592..cf923b5 100644
--- a/firmware/src/DiagnosticR/UDS/UDS_DIDNvm.c
+++ b/firmware/src/DiagnosticR/UDS/UDS_DIDNvm.c
@@ -78,8 +78,8 @@ typedef struct{
* Private variables
*/
const UI_8 NVM_DID_CD_VIN[DLC_DID_CD_VIN] = GAC_VIN_DEFAULT_VALUE;
-const UI_8 NVM_Reprogramming_Date_App[DLC_DID_REPROGRAMMING_DATE] = {0x20,0x24,0x08,0x19};
-const UI_8 NVM_DID_CD_SUPPLIER_ID[DLC_SYSTEM_SUPPLIER_ID] = {'2','4','0','8','1','9'};
+const UI_8 NVM_Reprogramming_Date_App[DLC_DID_REPROGRAMMING_DATE] = {0x20,0x24,0x09,0x14};
+const UI_8 NVM_DID_CD_SUPPLIER_ID[DLC_SYSTEM_SUPPLIER_ID] = {'2','4','0','9','1','4'};
const UI_8 NVM_Repair_Shop_Code[DLC_REPAIR_SHOP_CODE] = GAC_ECU_REPAIR_SHOP_CODE;
const UI_8 NVM_DID_CD_HW_VERSION[DLC_GAC_HW_VERSION] = {'H','W','0','6',0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20};
static uint8 RAM_DID_CD_VIN[DLC_DID_CD_VIN];
@@ -596,6 +596,16 @@ t_UDS_ERR Get_DID_Pre_Value(uint8 *data)
return ISO15765_3_POSITIVE_RESPONSE;
}
+t_UDS_ERR Get_DID_ResetSource(uint8 *data)
+{
+ uint8_t reset_source_buf[20];
+ SmartEE_Read(0x400,reset_source_buf,20);
+
+ memcpy(data,reset_source_buf,20);
+
+ return ISO15765_3_POSITIVE_RESPONSE;
+}
+
t_UDS_ERR Get_DID_Reprogramming_Date(uint8 *data)
{
//memcpy(data, RAM_DID_CD_REPROGRAMMING_DATE, sizeof(RAM_DID_CD_REPROGRAMMING_DATE));
diff --git a/firmware/src/DiagnosticR/UDS/UDS_DiDRead_CB.c b/firmware/src/DiagnosticR/UDS/UDS_DiDRead_CB.c
index 54a1532..f31b798 100644
--- a/firmware/src/DiagnosticR/UDS/UDS_DiDRead_CB.c
+++ b/firmware/src/DiagnosticR/UDS/UDS_DiDRead_CB.c
@@ -177,6 +177,7 @@ t_UDSReadDidSubCommands uds_did_read_commands[] =
{ DID_PRESEE_SEN_BASELINE , 2, UDS_DEFAULT_SESSION, Get_DID_PressSen_Baseline },
{ DID_PRESEE_SEN_SIGNAL , 2, UDS_DEFAULT_SESSION, Get_DID_PressSen_Signal },
{ DID_PRESEE_SEN_PRE_VAL , 2, UDS_DEFAULT_SESSION, Get_DID_Pre_Value },
+ {DID_RESET_SOURCE , 20, UDS_DEFAULT_SESSION , Get_DID_ResetSource },
{DID_FUN1, 2, UDS_DEFAULT_SESSION, Get_DID_Fun1},
{DID_FUN2, 2, UDS_DEFAULT_SESSION, Get_DID_Fun2},
diff --git a/firmware/src/DiagnosticR/UDS/UDS_Services_Common.h b/firmware/src/DiagnosticR/UDS/UDS_Services_Common.h
index eecb734..f578c4d 100644
--- a/firmware/src/DiagnosticR/UDS/UDS_Services_Common.h
+++ b/firmware/src/DiagnosticR/UDS/UDS_Services_Common.h
@@ -163,6 +163,7 @@ t_UDS_ERR Get_DID_TouchSen15_Signal(uint8 *data);
t_UDS_ERR Get_DID_PressSen_Baseline(uint8 *data);
t_UDS_ERR Get_DID_PressSen_Signal(uint8 *data);
t_UDS_ERR Get_DID_Pre_Value(uint8 *data);
+t_UDS_ERR Get_DID_ResetSource(uint8 *data);
t_UDS_ERR Get_DID_CD_SYSID_CALIRATION_DATE(uint8 *data);
t_UDS_ERR Set_DID_CD_CALIRATION_DATE(uint8 *data);
diff --git a/firmware/src/RTE/RTE.c b/firmware/src/RTE/RTE.c
index 066755e..9050e9d 100644
--- a/firmware/src/RTE/RTE.c
+++ b/firmware/src/RTE/RTE.c
@@ -143,8 +143,7 @@ uint8_t RTE_Get_TouchBoard_CRC(void)
uint8_t RTE_Get_SldVolCtrlSts(void) // 0 slip idle 1 decrease ,2 increase , 3 decrease double , 4 increase double ,5 decrease third, 6 increase third
{
- TP_SlideLevel_Enum UD_SlideLevel = TP_SlideLevel_NONE;
- return (uint8_t)UD_SlideLevel;
+ return 0;
}
uint8_t RTE_Get_TouchBoard_Up_Sts(void)
@@ -662,9 +661,9 @@ uint8_t RTE_Get_TouchBoard_XY_Touch_And_Below_1N(void) // 0 false 1 true
{
//满足防误触
Allow_Touch_counter++;
- if (Allow_Touch_counter >= 10)//40ms
+ if (Allow_Touch_counter >= 15)//60ms
{
- Allow_Touch_counter = 10;
+ Allow_Touch_counter = 15;
Allow_Touch_flag = 0;
}
}
@@ -754,13 +753,18 @@ uint8_t RTE_Get_CAN_ActvnOfSteerWhlIllmn(void)
return rtn_data;
}
// LED Day/Night Mode switch
+extern uint8_t Msg30_timeout_flag;
uint8_t RTE_Get_CAN_TwliBriSts(void)
{
// uint8_t temp = 0;
rtn_data = 0;
(void)ReceiveMessage(SIG_TWLIBRISTS, &rtn_data);
-
+ if (Msg30_timeout_flag == 1)
+ {
+ rtn_data = 0;
+ }
+
return rtn_data;
}
@@ -1228,7 +1232,17 @@ void RTE_Set_All_UB(void)
InitMessage(SIG_SWTRPARTNOCMPL_UB, &UbInitValue);
InitMessage(SIG_SWTRSERNO_UB, &UbInitValue);
}
+const uint16_t max_on_time_arr[16] = {
+ // 0 1 2 3 4 5 6 7
+ 10,10,10,10,10,50,50,50,
+ 50,50,50,50,50,50,50,50,
+};
+const uint16_t low_baseline_reset_arr[16] = {
+ // 0 1 2 3 4 5 6 7
+ 40,40,40,40,40,40,40,40,
+ 40,40,40,40,40,40,40,40,
+};
#if 1
void RTE_Set_All_Test_Value(void) // 2ms
{
@@ -1237,6 +1251,7 @@ void RTE_Set_All_Test_Value(void) // 2ms
uint16_t Press_signal, Press_preload;
uint8_t i,frccdata[8]={0};
static uint32_t Press_reset_counter[16], Press_repeat_counter[16], baseline_error_counter, baseline_error_repeat_counter;
+ static uint32_t low_baseline_reset_counter[16];
Press_baseline = Get_forcedetect_basline_value();
Press_signal = Get_forcedetect_force_value();
Press_preload = Get_forcedetect_preload_value();
@@ -1254,13 +1269,13 @@ void RTE_Set_All_Test_Value(void) // 2ms
if (get_sensor_node_signal(i) > (get_sensor_node_reference(i) + qtlib_key_configs_set1[i].channel_threshold))
{
Press_reset_counter[i]++;
- if (Press_reset_counter[i] > 25000) // 50s = 50000 ms
+ if (Press_reset_counter[i] >= (500 * max_on_time_arr[i])) //
{
if (Press_repeat_counter[i] == 0)
{
Press_repeat_counter[i] = 55000;
Press_reset_counter[i] = 0;
- // update_sensor_node_reference(i,get_sensor_node_signal(i));
+ calibrate_node(i);
}
else
{
@@ -1277,6 +1292,21 @@ void RTE_Set_All_Test_Value(void) // 2ms
{
Press_repeat_counter[i]--;
}
+
+ if (get_sensor_node_signal(i) + low_baseline_reset_arr[i] < get_sensor_node_reference(i))
+ {
+ low_baseline_reset_counter[i]++;
+ if (low_baseline_reset_counter[i] > 250)
+ {
+ low_baseline_reset_counter[i] = 0;
+ calibrate_node(i);
+ }
+
+ }
+ else
+ {
+ low_baseline_reset_counter[i] = 0;
+ }
}
for (i = 0; i < 15; i++)
@@ -1483,8 +1513,11 @@ void RTE_Set_All_Test_Value(void) // 2ms
g16_DiagTouchPressSenRes[2][1] = Press_signal;
g16_DiagTouchPressSenRes[2][2] = Press_preload;
- uint16_t vol_test_sig = (uint16_t)k_vol_touch_Sts;
- InitMessage(SIG_SWTRSENSOR16_SIGNAL, &vol_test_sig);
+ uint16_t contact_size = get_scroller_contact_size(0);
+ InitMessage(SIG_SWTRSENSOR16_SIGNAL, &contact_size);
+
+ uint16_t position = get_scroller_position(0);
+ InitMessage(SIG_SWTRSENSOR16_BASELINE, &position);
}
#endif
\ No newline at end of file
diff --git a/firmware/src/TouchPanel/TouchPanel.c b/firmware/src/TouchPanel/TouchPanel.c
index 0315644..75659b0 100644
--- a/firmware/src/TouchPanel/TouchPanel.c
+++ b/firmware/src/TouchPanel/TouchPanel.c
@@ -22,11 +22,10 @@
#include "SysDiagDetect.h"
// #define PRESS_DEBUG
-static uint16 sensor_signal[DEF_NUM_CHANNELS] = {0};
-static uint16 sensor_reference[DEF_NUM_CHANNELS] = {0};
+
static TouchButtons_type key_status[BTN_MAX_CH_NUM - 5U] = {0};
-static TouchSurface_type TouchSurface;
-static TouchScroller_type TouchScroller;
+
+
static Buttons_SignalType Buttons_Signal[BTN_MAX_CH_NUM] = {BUTTON_RELEASE};
TouchSurface_Convert_type Surface_Convert;
@@ -66,6 +65,48 @@ uint8 Surface_Button = 0xff;
#define BTN_LEFT_DEFAULT 261
#define BTN_RIGHT_DEFAULT 372
#define BTN_CONFIRM_DEFAULT 303
+
+struct Point
+{
+ float x;
+ float y;
+};
+
+struct Point Point_Up[4] = {
+ {76, 0},
+ {255, 41},
+ {206, 87},
+ {135, 87},
+};
+
+struct Point Point_Down[4] = {
+ {135, 169},
+ {206, 169},
+ {255, 199},
+ {106, 255},
+};
+
+struct Point Point_Left[4] = {
+ {76, 21},
+ {135, 87},
+ {135, 169},
+ {96, 255},
+};
+
+struct Point Point_Right[4] = {
+ {206, 87},
+ {255, 48},
+ {255, 183},
+ {206, 169},
+};
+struct Point Point_Confirm[4] = {
+ {140, 92},
+ {206, 92},
+ {206, 164},
+ {140, 164},
+};
+
+
// force Trig threshold
static uint16 Button0_GetVoice1_Trig_Threshold(void)
{
@@ -417,8 +458,6 @@ void TouchPanel_init(void)
uint8 index;
// touch_init();
uint8_t eedata[5];
- LIB_Mem_MemSet(&TouchSurface, 0x00U, sizeof(TouchSurface_type));
- LIB_Mem_MemSet(&TouchScroller, 0x00U, sizeof(TouchScroller_type));
LIB_Mem_MemSet(&Surface_Convert, 0x00U, sizeof(TouchSurface_Convert_type));
SmartEE_Read(0x780, eedata, 3);
@@ -447,8 +486,6 @@ void TouchPanel_init(void)
TouchPanel_PressRawData = 0;
for (index = 0; index < DEF_NUM_CHANNELS; index++)
{
- sensor_signal[index] = 0x00;
- sensor_reference[index] = 0x00;
if (index < (BTN_MAX_CH_NUM - 5u))
{
key_status[index].status = 0x00;
@@ -473,29 +510,9 @@ void GetSurface_Position(uint8 *x, uint8 *y)
}
}
-void GetScroller_Position(uint8 *x, uint8 *y)
-{
- if (x != NULL_PTR)
- {
- *x = TouchScroller.x_position;
- }
- if (y != NULL_PTR)
- {
- *y = TouchScroller.y_position;
- }
-}
-TP_SlideDirection_Enum TouchPanel_SlideEventRead(void)
-{
- TP_SlideDirection_Enum Dir = TP_SlideDirection_NONE;
- return Dir;
-}
-TP_SlideLevel_Enum TouchPanel_SlideUpDownLevelRead(void)
-{
- TP_SlideLevel_Enum SlideLevel = TP_SlideLevel_NONE;
- return SlideLevel;
-}
+
Buttons_SignalType TouchPanel_BtnSignalRead(Buttons_ChType ChId)
{
@@ -536,16 +553,6 @@ boolean TouchButton_is_TouchActive(Buttons_ChType BtId)
return ret;
}
-boolean TouchScroller_is_TouchActive(void)
-{
- boolean ret = FALSE;
- if (TouchPanel_ScrollerStatus & TOUCH_ACTIVE)
- {
- ret = TRUE;
- }
-
- return ret;
-}
Buttons_SignalType TouchSurface_XY_StsRead(void)
{
@@ -597,27 +604,20 @@ static PanelPress_LevelType TouchPanel_PressCheck(void)
Backup_Force_Value_Pad = Touch_Sensor_delta05 + Touch_Sensor_delta06 + Touch_Sensor_delta07 + Touch_Sensor_delta08 + Touch_Sensor_delta09 +
+Touch_Sensor_delta10 + Touch_Sensor_delta11 + Touch_Sensor_delta12 + Touch_Sensor_delta13 + Touch_Sensor_delta14;
Backup_Force_Value_Button = Touch_Sensor_delta00 + Touch_Sensor_delta01 + Touch_Sensor_delta02 + Touch_Sensor_delta03 + Touch_Sensor_delta04;
- // float32 PressNValueTable[3][2] = {
- // {1.21f, 1.73f},
- // {0.5f, 3.0f},
- // {1.0f, 1.8f}
- // };
+
if (CurrentPosition != 0xff)
{
tempForcePress = g_Trig_Threshold;
tempForceRelease = g_Release_Threshold;
}
- // else
- //{
- // return PANEL_PRESS_LEVEL0;
- //}
+
if (Last_PressLevel > PANEL_PRESS_LEVEL2)
{
Last_PressLevel = PANEL_PRESS_LEVEL0;
}
- ////if(TRUE == GET_TouchPanel_is_Press())
+
temp_RawData = (0xfff & Get_forcedetect_force_value());
if (SPEAKER_UPDATE_CYCLE == Get_Speaker_Main_State())
{
@@ -647,81 +647,30 @@ static PanelPress_LevelType TouchPanel_PressCheck(void)
if (Force_Sens_Err == 0)
{
if (FilterValue <= ((float32)tempForceRelease / (float32)0xF2))
- { //< 1.5N
- // ForceHcount = 0;
- // ForceMcount = 0;
- // ForceLcount++;
+ {
P_force_Reach2_flag = 0;
- // if(ForceLcount > 40)
- //{
- // ForceLcount = 40;
-
ret_Press = PANEL_PRESS_LEVEL0;
-
- //}
Vibra_force_level = PANEL_PRESS_LEVEL0;
}
else if (FilterValue >= ((float32)tempForceRelease / (float32)0xF2) &&
FilterValue < ((float32)tempForcePress / (float32)0xF2))
- { // 1.5N~3N
-
- // ForceHcount = 0;
- // ForceMcount++;
- // ForceLcount = 0;
- // if(ForceMcount > 40)
- // {
- // ForceMcount = 40;
+ {
if (P_force_Reach2_flag == 1)
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
ret_Press = PANEL_PRESS_LEVEL2;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
}
else
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL1;
ret_Press = PANEL_PRESS_LEVEL1;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
}
}
else
- { //>=3
- // ForceHcount++;
- // ForceMcount = 0;
- // ForceLcount = 0;
+ {
P_force_Reach2_flag = 1;
- // if(ForceHcount > 40)
- // {
- // ForceHcount = 40;
-
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
ret_Press = PANEL_PRESS_LEVEL2;
-
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
}
}
@@ -730,162 +679,63 @@ static PanelPress_LevelType TouchPanel_PressCheck(void)
if (CurrentPosition <= 3) // Button
{
if (Backup_Force_Value_Button <= 35)
- { //< 1.5N
- // ForceHcount = 0;
- // ForceMcount = 0;
- // ForceLcount++;
+ {
P_force_Reach2_flag = 0;
- // if(ForceLcount > 40)
- //{
- // ForceLcount = 40;
-
ret_Press = PANEL_PRESS_LEVEL0;
-
- //}
Vibra_force_level = PANEL_PRESS_LEVEL0;
}
else if (Backup_Force_Value_Button > 35 &&
Backup_Force_Value_Button < 70)
- { // 1.5N~3N
-
- // ForceHcount = 0;
- // ForceMcount++;
- // ForceLcount = 0;
- // if(ForceMcount > 40)
- // {
- // ForceMcount = 40;
+ {
if (P_force_Reach2_flag == 1)
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
ret_Press = PANEL_PRESS_LEVEL2;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
+
}
else
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL1;
ret_Press = PANEL_PRESS_LEVEL1;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
+
}
}
else
- { //>=3
- // ForceHcount++;
- // ForceMcount = 0;
- // ForceLcount = 0;
+ {
P_force_Reach2_flag = 1;
- // if(ForceHcount > 40)
- // {
- // ForceHcount = 40;
-
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
ret_Press = PANEL_PRESS_LEVEL2;
-
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
}
}
else // Pad
{
if (Backup_Force_Value_Pad <= 100)
- { //< 1.5N
- // ForceHcount = 0;
- // ForceMcount = 0;
- // ForceLcount++;
+ {
P_force_Reach2_flag = 0;
- // if(ForceLcount > 40)
- //{
- // ForceLcount = 40;
-
ret_Press = PANEL_PRESS_LEVEL0;
-
- //}
Vibra_force_level = PANEL_PRESS_LEVEL0;
}
else if (Backup_Force_Value_Pad > 100 &&
Backup_Force_Value_Pad < 200)
- { // 1.5N~3N
-
- // ForceHcount = 0;
- // ForceMcount++;
- // ForceLcount = 0;
- // if(ForceMcount > 40)
- // {
- // ForceMcount = 40;
+ {
if (P_force_Reach2_flag == 1)
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
ret_Press = PANEL_PRESS_LEVEL2;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
}
else
{
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
-
Vibra_force_level = PANEL_PRESS_LEVEL1;
ret_Press = PANEL_PRESS_LEVEL1;
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
+
}
}
else
- { //>=3
- // ForceHcount++;
- // ForceMcount = 0;
- // ForceLcount = 0;
+ {
P_force_Reach2_flag = 1;
- // if(ForceHcount > 40)
- // {
- // ForceHcount = 40;
-
- // if(TOUCH_SCREEN_CONTACT_AREA_INVALID_NUM > get_contact_size())
- //{
ret_Press = PANEL_PRESS_LEVEL2;
-
- //}
- // else
- //{
- // ret_Press = PANEL_PRESS_LEVEL0;
- // Vibra_force_level=PANEL_PRESS_LEVEL0;
- //}
-
Vibra_force_level = PANEL_PRESS_LEVEL2;
}
}
@@ -893,28 +743,7 @@ static PanelPress_LevelType TouchPanel_PressCheck(void)
LastRawData = RawData;
Last_PressLevel = ret_Press;
-#ifdef PRESS_DEBUG
- {
- uint8 data[8] = {0};
- uint8 data2[8] = {0};
- uint16 g_sss = TouchScroller.y_position;
- data[0] = ((GET_TouchPanel_is_Press()) << 2);
- data[1] = ret_Press;
- // data[5] =(uint8)(TouchPanel_PressRawData & 0xff) ;
- // data[4] =(uint8)(( TouchPanel_PressRawData &0xff00)>>8);
- data[5] = (uint8)(g_sss & 0xff);
- data[4] = (uint8)((g_sss & 0xff00) >> 8);
- CanTx(0, true, 0x111, 8, data);
-
- data2[0] = key_status[0].status;
- data2[1] = key_status[1].status;
- data2[2] = key_status[2].status;
- data2[3] = key_status[3].status;
- data2[4] = key_status[4].status;
- CanTx(0, true, 0x222, 8, data2);
- }
-#endif
return ret_Press;
}
@@ -969,20 +798,12 @@ static Buttons_SignalType TouchSurface_BntCheck(Buttons_ChType ChId, TouchPanel_
switch (TouchPanel_PressLevel)
{
case PANEL_PRESS_LEVEL0:
- // PB_force_Reach2_flag = 0;
BSignal = BUTTON_TOUCH;
case PANEL_PRESS_LEVEL1:
- // if(PB_force_Reach2_flag == 1)
- //{
- // BSignal = BUTTON_TOUCH_AND_PRESS;
- // }
- // else
- //{
BSignal = BUTTON_TOUCH;
// }
break;
case PANEL_PRESS_LEVEL2:
- // PB_force_Reach2_flag = 1;
BSignal = BUTTON_TOUCH_AND_PRESS;
break;
default:
@@ -1006,8 +827,7 @@ static Buttons_SignalType TouchButton_BntCheck(Buttons_ChType ChId)
{
key_status[ChId].status = get_sensor_state(ChId);
if (QTM_KEY_STATE_DETECT == (key_status[ChId].status))
- { // KEY_TOUCHED_MASK
- // Touch detect
+ {
key_status[ChId].RunCycle++;
if (TP_RUNNING_ERROR_CYCLE <= key_status[ChId].RunCycle)
{
@@ -1019,20 +839,12 @@ static Buttons_SignalType TouchButton_BntCheck(Buttons_ChType ChId)
switch (TouchPanel_PressLevel)
{
case PANEL_PRESS_LEVEL0:
- // TB_force_Reach2_flag = 0;
BSignal = BUTTON_TOUCH;
case PANEL_PRESS_LEVEL1:
- // if(TB_force_Reach2_flag == 1)
- //{
- // BSignal = BUTTON_TOUCH_AND_PRESS;
- // }
- // else
- //{
BSignal = BUTTON_TOUCH;
- //}
+
break;
case PANEL_PRESS_LEVEL2:
- // TB_force_Reach2_flag = 1;
BSignal = BUTTON_TOUCH_AND_PRESS;
break;
default:
@@ -1049,37 +861,10 @@ static Buttons_SignalType TouchButton_BntCheck(Buttons_ChType ChId)
return BSignal;
}
-static float32 GetSlide_Angle(float32 dx, float32 dy)
-{
- return (atan2(dy, dx) * 180 / PI);
-}
-
-/**************************************************************/
-// x X(y)
-// ^ ^
-// | mapping |
-// | =======> |
-// | |
-// y <----------|(0,0) X(-y)<-------|(0,0)
-/*************************************************************/
-static void CheckSlide_Level(TP_SlideDirection_Enum SlideDir, uint8 AbsX, uint8 AbsY)
-{
-
-}
-static TP_SlideDirection_Enum GetSlide_Direction(uint8 startX, uint8 startY, uint8 endX, uint8 endY)
-{
- TP_SlideDirection_Enum result = TP_SlideDirection_NONE;
-
- return result;
-}
-struct Point
-{
- float x;
- float y;
-};
+
// 判断一个点是否在三角形内部
uint8_t point_in_triangle(struct Point p, struct Point p1, struct Point p2, struct Point p3)
@@ -1146,84 +931,14 @@ static void TouchPanel_XY_Convert(uint8 origin_x, uint8 origin_y)
Surface_Convert.convert_y = convert_y; // KalmanFilter(convert_y, 0);
}
-extern void CanTx(t_can_handler can_handler, bool notif, uint32_t idtp, uint16_t len, t_can_data can_data);
-// static uint16_t touch_delay = 500;
-extern uint8_t Allow_Touch_flag;
-void TouchPanel_MainFunction(void)
+void Surface_CurrentPosition_Process(void)
{
- uint8 index;
- uint8 x1, y1, x2, y2, Temp_x, Temp_y;
-
- uint8 voice_temp, voice_x, voice_y; // by kailong
uint8 pad_trig_x, pad_trig_y;
-
- uint8 count = 0;
-
-
- touch_process();
-
- // add by kailong
- if (get_scroller_state(0) & TOUCH_ACTIVE)
- {
- voice_y = get_scroller_position(0x00);
- if (voice_y >= 10 && voice_y <= 73)
- {
-
- CurrentPosition = 1;
- }
- if (voice_y >= 103 && voice_y <= 160)
- {
- CurrentPosition = 2;
- }
- if (voice_y >= 190 && voice_y <= 250)
- {
- CurrentPosition = 3;
- }
- }
- else
- {
- }
-
if ((TouchPanel_SurfaceStatus & TOUCH_ACTIVE) == 1)
{
struct Point Current_XY;
- struct Point Point_Up[4] = {
- {76, 0},
- {255, 41},
- {206, 87},
- {135, 87},
- };
-
- struct Point Point_Down[4] = {
- {135, 169},
- {206, 169},
- {255, 199},
- {106, 255},
- };
-
- struct Point Point_Left[4] = {
- {76, 21},
- {135, 87},
- {135, 169},
- {96, 255},
- };
-
- struct Point Point_Right[4] = {
- {206, 87},
- {255, 48},
- {255, 183},
- {206, 169},
- };
-
-#if 1
- struct Point Point_Confirm[4] = {
- {140, 92},
- {206, 92},
- {206, 164},
- {140, 164},
- };
-#endif
+
// point_in_quadrilateral(Current_XY,Point_Up[0],Point_Up[1],Point_Up[2],Point_Up[3])
GetSurface_Position(&pad_trig_x, &pad_trig_y);
@@ -1232,50 +947,35 @@ void TouchPanel_MainFunction(void)
if (point_in_quadrilateral(Current_XY, Point_Up[0], Point_Up[1], Point_Up[2], Point_Up[3]))
{
- // if(CurrentPosition == 0xff)
- //{
CurrentPosition = 4;
K_Vibra_Trig = 1;
Surface_Button = 1;
- // }
}
else if (point_in_quadrilateral(Current_XY, Point_Down[0], Point_Down[1], Point_Down[2], Point_Down[3]))
{
- // if(CurrentPosition == 0xff)
- //{
CurrentPosition = 5;
K_Vibra_Trig = 1;
Surface_Button = 2;
- //}
}
else if (point_in_quadrilateral(Current_XY, Point_Left[0], Point_Left[1], Point_Left[2], Point_Left[3]))
{
- // if(CurrentPosition == 0xff)
- //{
CurrentPosition = 6;
K_Vibra_Trig = 1;
Surface_Button = 3;
- //}
}
else if (point_in_quadrilateral(Current_XY, Point_Right[0], Point_Right[1], Point_Right[2], Point_Right[3]))
{
- // if(CurrentPosition == 0xff)
- //{
CurrentPosition = 7;
K_Vibra_Trig = 1;
Surface_Button = 4;
- //}
}
else if (point_in_quadrilateral(Current_XY, Point_Confirm[0], Point_Confirm[1], Point_Confirm[2], Point_Confirm[3]))
- // else if(((pad_trig_x>= 150) && (pad_trig_x<= 196)) && ((pad_trig_y>= 102) && (pad_trig_y<= 158)))
{
- // if(CurrentPosition == 0xff)
- //{
+
CurrentPosition = 8;
K_Vibra_Trig = 1;
Surface_Button = 5;
- //}
}
}
else
@@ -1284,9 +984,10 @@ void TouchPanel_MainFunction(void)
K_Vibra_Trig = 0;
Surface_Button = 0;
}
+}
- // volatile uint8 g_Trig_Threshold=0;
- // volatile uint8 g_Release_Threshold=0;
+void Threshold_Select_Process(void)
+{
switch (CurrentPosition)
{
case 1:
@@ -1324,25 +1025,41 @@ void TouchPanel_MainFunction(void)
default:
break;
}
+}
- TouchPanel_PressLevel = TouchPanel_PressCheck();
-
- k_voice_touch_Sts = BUTTON_RELEASE;
- k_vol_touch_Sts = BUTTON_RELEASE;
- k_menu_touch_Sts = BUTTON_RELEASE;
- voice_temp = get_scroller_state(0);
- if (voice_temp & TOUCH_ACTIVE)
+void touch_Position_pro(void)
+{
+ uint8 voice_y; // by kailong
+ if (get_scroller_state(0) & TOUCH_ACTIVE)
{
voice_y = get_scroller_position(0x00);
+ if (voice_y >= 10 && voice_y <= 73)
+ {
+ CurrentPosition = 1;
+ }
+ if (voice_y >= 95 && voice_y <= 168)
+ {
+ CurrentPosition = 2;
+ }
+ if (voice_y >= 190 && voice_y <= 250)
+ {
+ CurrentPosition = 3;
+ }
}
else
{
- voice_y = 0x00;
+ voice_y = 0;
+ Surface_CurrentPosition_Process();
}
- GetSurface_Position(&voice_x, NULL_PTR);
- if (voice_y >= 10 && voice_y <= 73)
- {
+}
+void SliderData_process(void)
+{
+ k_voice_touch_Sts = BUTTON_RELEASE;
+ k_vol_touch_Sts = BUTTON_RELEASE;
+ k_menu_touch_Sts = BUTTON_RELEASE;
+ if (CurrentPosition == 1)
+ {
switch (TouchPanel_PressLevel)
{
case PANEL_PRESS_LEVEL0:
@@ -1358,7 +1075,7 @@ void TouchPanel_MainFunction(void)
break;
}
}
- else if (voice_y >= 103 && voice_y <= 160)
+ else if (CurrentPosition == 2)
{
switch (TouchPanel_PressLevel)
@@ -1376,9 +1093,8 @@ void TouchPanel_MainFunction(void)
break;
}
}
- else if (voice_y >= 190 && voice_y <= 250)
+ else if (CurrentPosition == 3)
{
-
switch (TouchPanel_PressLevel)
{
case PANEL_PRESS_LEVEL0:
@@ -1394,27 +1110,25 @@ void TouchPanel_MainFunction(void)
break;
}
}
+}
+
+extern void CanTx(t_can_handler can_handler, bool notif, uint32_t idtp, uint16_t len, t_can_data can_data);
+// static uint16_t touch_delay = 500;
+extern uint8_t Allow_Touch_flag;
+void TouchPanel_MainFunction(void)
+{
+ uint8 index;
+ uint8 Temp_x, Temp_y;
+ uint8 count = 0;
+
+ touch_process();
// add by kailong
-
+ TouchPanel_PressLevel = TouchPanel_PressCheck();
if (measurement_done_touch == 1)
{
// process touch data
- for (index = 0; index < DEF_NUM_CHANNELS; index++)
- {
- sensor_signal[index] = get_sensor_node_signal(index);
- sensor_reference[index] = get_sensor_node_reference(index);
- }
- TouchScroller.x_position = 0x00;
- TouchPanel_ScrollerStatus = get_scroller_state(0);
- if (TouchPanel_ScrollerStatus & TOUCH_ACTIVE)
- {
- TouchScroller.y_position = get_scroller_position(0x00);
- }
- else
- {
- TouchScroller.y_position = 0x00;
- }
+
TouchPanel_SurfaceStatus = get_surface_status();
if (TouchPanel_SurfaceStatus & TOUCH_ACTIVE)
{
@@ -1430,253 +1144,27 @@ void TouchPanel_MainFunction(void)
Surface_Convert.convert_y = 0x00;
}
+ touch_Position_pro();
+ Threshold_Select_Process();
+
- switch (CurrentPosition)
+ SliderData_process();
+
+ for (index = 0; index < BTN_MAX_CH_NUM; index++)
{
- case 1:
- {
- Buttons_Signal[BTN_VOICE1] = TouchButton_BntCheck(BTN_VOICE1);
- if (Buttons_Signal[BTN_VOICE1] >= BUTTON_TOUCH)
+ if (index < (BTN_MAX_CH_NUM - 5U))
{
- break;
+ Buttons_Signal[index] = TouchButton_BntCheck(index);
}
else
{
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
+ Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
+ }
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 2:
- {
- Buttons_Signal[BTN_VOL1] = TouchButton_BntCheck(BTN_VOL1);
- if (Buttons_Signal[BTN_VOL1] >= BUTTON_TOUCH)
+ if (Buttons_Signal[index] < BUTTON_TOUCH)
{
- break;
+ count++;
}
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 3:
- {
- Buttons_Signal[BTN_MENU1] = TouchButton_BntCheck(BTN_MENU1);
- if (Buttons_Signal[BTN_MENU1] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 4:
- {
- Buttons_Signal[BTN_UP] = TouchSurface_BntCheck(BTN_UP, 1);
- if (Buttons_Signal[BTN_UP] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 5:
- {
- Buttons_Signal[BTN_DOWN] = TouchSurface_BntCheck(BTN_DOWN, 1);
- if (Buttons_Signal[BTN_DOWN] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 6:
- {
- Buttons_Signal[BTN_LEFT] = TouchSurface_BntCheck(BTN_LEFT, 1);
- if (Buttons_Signal[BTN_LEFT] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 7:
- {
- Buttons_Signal[BTN_RIGHT] = TouchSurface_BntCheck(BTN_RIGHT, 1);
- if (Buttons_Signal[BTN_RIGHT] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- case 8:
- {
- Buttons_Signal[BTN_CONFIRM] = TouchSurface_BntCheck(BTN_CONFIRM, 1);
- if (Buttons_Signal[BTN_CONFIRM] >= BUTTON_TOUCH)
- {
- break;
- }
- else
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- }
- break;
- }
- default:
- {
- for (index = 0; index < BTN_MAX_CH_NUM; index++)
- {
- if (index < (BTN_MAX_CH_NUM - 5U))
- {
- Buttons_Signal[index] = TouchButton_BntCheck(index);
- }
- else
- {
- Buttons_Signal[index] = TouchSurface_BntCheck(index, 1);
- }
-
- if (Buttons_Signal[index] < BUTTON_TOUCH)
- {
- count++;
- }
- }
- break;
- }
}
if (count == 10)
diff --git a/firmware/src/TouchPanel/TouchPanel.h b/firmware/src/TouchPanel/TouchPanel.h
index 8008240..32daced 100644
--- a/firmware/src/TouchPanel/TouchPanel.h
+++ b/firmware/src/TouchPanel/TouchPanel.h
@@ -31,32 +31,8 @@ extern uint16 Below1P5N_vibra_req;
-typedef enum
-{
- TP_SlideDirection_NONE = 0,
- TP_SlideDirection_ShortUP,
- TP_SlideDirection_LongUP,
- TP_SlideDirection_ShortDOWN,
- TP_SlideDirection_LongDOWN,
- TP_SlideDirection_ShortLEFT,
- TP_SlideDirection_LongLEFT,
- TP_SlideDirection_ShortRIGHT,
- TP_SlideDirection_LongRIGHT
-} TP_SlideDirection_Enum;
-/*0 slip idle 1 decrease ,2 increase , 3 decrease double , 4 increase double ,5 decrease third, 6 increase third*/
-typedef enum
-{
- TP_SlideLevel_NONE = 0,
- TP_SlideLevel1_DOWN,
- TP_SlideLevel1_UP,
- TP_SlideLevel2_DOWN,
- TP_SlideLevel2_UP,
- TP_SlideLevel3_DOWN,
- TP_SlideLevel3_UP
-} TP_SlideLevel_Enum;
-
typedef enum{
TOUCH_PANEL_NONE_EVENT = 0,
@@ -81,26 +57,6 @@ typedef enum{
-typedef struct{
- boolean Event;
- uint32 keep_cycle;
- TP_SlideDirection_Enum Direction;
- uint8 UpDown_SlideDistance;
- TP_SlideLevel_Enum UpDown_SlideLevel;
-}TouchSlideEvent_type;
-
-typedef struct{
- uint8 x_position;
- uint8 y_position;
- uint8 origin_x_pos;
- uint8 origin_y_pos;
- uint8 end_x_pos;
- uint8 end_y_pos;
-
- TouchPanel_EventType Event;
- uint32 CheckCycle;
- uint32 TouchCycle;
-}TouchSurface_type;
typedef struct{
uint8 x_position;
@@ -153,18 +109,17 @@ extern volatile uint8 k_voice_touch_Sts,k_menu_touch_Sts,k_vol_touch_Sts;
extern volatile uint8 Vibra_force_level;
extern volatile uint8 last_Vibra_force_level;
-extern uint8 Vibra_PressCheck(void);
void TouchPanel_init(void);
void GetSurface_Position(uint8 *x, uint8 *y);
-void GetScroller_Position(uint8 *x, uint8 *y);
+
Buttons_SignalType TouchPanel_BtnSignalRead(Buttons_ChType ChId);
void TouchPanel_MainFunction(void);
-TP_SlideDirection_Enum TouchPanel_SlideEventRead(void);
+
Buttons_SignalType TouchSurface_XY_StsRead(void);
-TP_SlideLevel_Enum TouchPanel_SlideUpDownLevelRead(void);
+
PanelPress_LevelType TouchPanel_PressLevelRead(void);
boolean TouchSurface_is_TouchActive(void);
boolean TouchButton_is_TouchActive(Buttons_ChType BtId);
-boolean TouchScroller_is_TouchActive(void);
+
#endif
\ No newline at end of file
diff --git a/firmware/src/config/mcal/touch/touch.c b/firmware/src/config/mcal/touch/touch.c
index fcbe106..2ab01db 100644
--- a/firmware/src/config/mcal/touch/touch.c
+++ b/firmware/src/config/mcal/touch/touch.c
@@ -451,11 +451,18 @@ uint16_t get_scroller_position(uint16_t sensor_node)
return (qtm_scroller_control1.qtm_scroller_data[sensor_node].position);
}
+uint16_t get_scroller_contact_size(uint16_t sensor_node)
+{
+ return (qtm_scroller_control1.qtm_scroller_data[sensor_node].contact_size);
+}
+
uint8_t get_surface_status(void)
{
return (qtm_surface_cs_control1.qtm_surface_contact_data->qt_surface_status);
}
+
+
uint16_t get_surface_position(uint8_t ver_or_hor)
{
uint16_t temp_pos = 0;
diff --git a/firmware/src/config/mcal/touch/touch.h b/firmware/src/config/mcal/touch/touch.h
index 9c6c327..ebaa3cd 100644
--- a/firmware/src/config/mcal/touch/touch.h
+++ b/firmware/src/config/mcal/touch/touch.h
@@ -291,7 +291,7 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
* Range: 0 to 255.
* Default value: 5.
*/
-#define DEF_ANTI_TCH_DET_INT 50u
+#define DEF_ANTI_TCH_DET_INT 0u
/* Threshold beyond with automatic sensor recalibration is initiated.
* Range: RECAL_100/ RECAL_50 / RECAL_25 / RECAL_12_5 / RECAL_6_25 / MAX_RECAL
@@ -332,7 +332,7 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
* Range: 0-255
* Default value: 0
*/
-#define DEF_MAX_ON_DURATION 250u
+#define DEF_MAX_ON_DURATION 0u
/**********************************************************/
/***************** Slider/Wheel Parameters ****************/
@@ -353,7 +353,7 @@ SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
#define SCROLLER_0_PARAMS \
{ \
(uint8_t)SCROLLER_TYPE_SLIDER, 0u, 5u, \
- SCROLLER_RESOL_DEADBAND((uint8_t)SCR_RESOL_8_BIT, (uint8_t)SCR_DB_NONE),(uint8_t)8,70\
+ SCROLLER_RESOL_DEADBAND((uint8_t)SCR_RESOL_8_BIT, (uint8_t)SCR_DB_NONE),(uint8_t)3,70\
}
/**********************************************************/
diff --git a/firmware/src/config/mcal/touch/touch_api_ptc.h b/firmware/src/config/mcal/touch/touch_api_ptc.h
index a8d4dd8..ecc3285 100644
--- a/firmware/src/config/mcal/touch/touch_api_ptc.h
+++ b/firmware/src/config/mcal/touch/touch_api_ptc.h
@@ -71,6 +71,7 @@ void update_sensor_state(uint16_t sensor_node, uint8_t new_state);
void calibrate_node(uint16_t sensor_node);
uint8_t get_scroller_state(uint16_t sensor_node);
uint16_t get_scroller_position(uint16_t sensor_node);
+uint16_t get_scroller_contact_size(uint16_t sensor_node);
#define HOR_POS 0u
#define VER_POS 1u
uint8_t get_surface_status(void);
diff --git a/firmware/src/main.c b/firmware/src/main.c
index ef73c43..1464dca 100644
--- a/firmware/src/main.c
+++ b/firmware/src/main.c
@@ -195,14 +195,15 @@ void CanTx(t_can_handler can_handler, bool notif, uint32_t idtp, uint16_t len, t
;
}
}
+uint8_t Msg30_timeout_flag = 0;
void IhuPrivateDHUCanFr01_CALLBACK(void)
{
- ;
+ Msg30_timeout_flag = 0;
}
void IhuPrivateDHUCanFr01_Timeout_CALLBACK(void)
{
- ;
+ Msg30_timeout_flag = 1;
}
// *****************************************************************************
@@ -214,6 +215,7 @@ static uint32_t status = 0;
uint8_t g_SBC_STATUS[8] = {0};
void GetResetSource(void)
{
+ uint8_t reset_source_buf[25];
g_SBC_STATUS[0] = (uint8_t)sbc_read_reg(SBC_SUP_STAT_2);
g_SBC_STATUS[1] = (uint8_t)sbc_read_reg(SBC_SUP_STAT_1);
g_SBC_STATUS[2] = (uint8_t)sbc_read_reg(SBC_DEV_STAT);
@@ -223,6 +225,21 @@ void GetResetSource(void)
g_SBC_STATUS[6] = 0x00;
g_SBC_STATUS[7] = 0x00;
CanTx(0, true, 0x421, 8, g_SBC_STATUS);
+ if (g_SBC_STATUS[1] == 0x80 && g_SBC_STATUS[3] == 0x01)
+ {
+ //正常上电
+ }
+ else
+ {
+ //异常复位
+ SmartEE_Read(0x400,reset_source_buf,20);
+ reset_source_buf[20] = g_SBC_STATUS[0];
+ reset_source_buf[21] = g_SBC_STATUS[1];
+ reset_source_buf[22] = g_SBC_STATUS[2];
+ reset_source_buf[23] = g_SBC_STATUS[3];
+ reset_source_buf[24] = g_SBC_STATUS[4];
+ SmartEE_Write(0x400,&reset_source_buf[5],20);
+ }
}
int main(void)