增加腰托调节

This commit is contained in:
sunbeam 2025-04-11 10:46:09 +08:00
parent 9a143bd04b
commit 700888eb62
17 changed files with 448 additions and 146 deletions

View File

@ -25,8 +25,8 @@
<MemConfigValue>D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
</PlDriver>
<ArmDriver>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
<EnableCache>0</EnableCache>
</ArmDriver>
<DebugChecksum>
<Checksum>1315671368</Checksum>

View File

@ -120,6 +120,14 @@ BO_ 769 SCM_STATE: 8 SCM
SG_ MOTOR_HG_STATE : 0|2@1+ (1,0) [0|0] "" PANEL
BO_ 513 Panel_Key: 8 PANEL
SG_ KEY_TJ_ZD_R_PLUS : 46|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_ZD_R_MINUS : 47|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_ZD_L_PLUS : 44|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_ZD_L_MINUS : 45|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_KB_U_PLUS : 40|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_KB_U_MINUS : 41|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_KB_D_PLUS : 42|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_TJ_KB_D_MINUS : 43|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_ZY_U : 1|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_ZY_MSSG : 20|1@1+ (1,0) [0|0] "" SCM
SG_ KEY_ZY_HEAT : 17|1@1+ (1,0) [0|0] "" SCM
@ -248,6 +256,14 @@ VAL_ 769 MOTOR_TZ_STATE 3 "FAULT" 2 "ACT_CCW" 1 "ACT_CW" 0 "NO_ACT" ;
VAL_ 769 MOTOR_TT_STATE 3 "FAULT" 2 "ACT_CCW" 1 "ACT_CW" 0 "NO_ACT" ;
VAL_ 769 MOTOR_KB_STATE 3 "FAULT" 2 "ACT_CCW" 1 "ACT_CW" 0 "NO_ACT" ;
VAL_ 769 MOTOR_HG_STATE 3 "FAULT" 2 "ACT_CCW" 1 "ACT_CW" 0 "NO_ACT" ;
VAL_ 513 KEY_TJ_ZD_R_PLUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_ZD_R_MINUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_ZD_L_PLUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_ZD_L_MINUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_KB_U_PLUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_KB_U_MINUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_KB_D_PLUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_TJ_KB_D_MINUS 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_ZY_U 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_ZY_MSSG 1 "PRESSED" 0 "NOT_PRESS" ;
VAL_ 513 KEY_ZY_HEAT 1 "PRESSED" 0 "NOT_PRESS" ;

View File

@ -1,5 +1,5 @@
// Generator version : v3.1
// Generation time : 2024.12.17 14:33:44
// Generation time : 2025.04.01 15:44:06
// DBC filename : DMK-RP-01_CAN_V0.1.dbc
#pragma once

View File

@ -71,6 +71,14 @@ uint32_t Unpack_Panel_Key_CANmatrix(Panel_Key_t* _m, const uint8_t* _d, uint8_t
_m->KEY_MEMORY_SET = (uint8_t) ( ((_d[3] >> 3U) & (0x01U)) );
_m->KEY_ZY_FLAT = (uint8_t) ( (_d[4] & (0x01U)) );
_m->KEY_RESET = (uint8_t) ( ((_d[4] >> 1U) & (0x01U)) );
_m->KEY_TJ_KB_U_PLUS = (uint8_t) ( (_d[5] & (0x01U)) );
_m->KEY_TJ_KB_U_MINUS = (uint8_t) ( ((_d[5] >> 1U) & (0x01U)) );
_m->KEY_TJ_KB_D_PLUS = (uint8_t) ( ((_d[5] >> 2U) & (0x01U)) );
_m->KEY_TJ_KB_D_MINUS = (uint8_t) ( ((_d[5] >> 3U) & (0x01U)) );
_m->KEY_TJ_ZD_L_PLUS = (uint8_t) ( ((_d[5] >> 4U) & (0x01U)) );
_m->KEY_TJ_ZD_L_MINUS = (uint8_t) ( ((_d[5] >> 5U) & (0x01U)) );
_m->KEY_TJ_ZD_R_PLUS = (uint8_t) ( ((_d[5] >> 6U) & (0x01U)) );
_m->KEY_TJ_ZD_R_MINUS = (uint8_t) ( ((_d[5] >> 7U) & (0x01U)) );
#ifdef CANMATRIX_USE_DIAG_MONITORS
_m->mon1.dlc_error = (dlc_ < Panel_Key_DLC);
@ -94,6 +102,7 @@ uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, __CoderDbcCanFrame_t__* cfram
cframe->Data[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) );
cframe->Data[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) );
cframe->Data[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) );
cframe->Data[5] |= (uint8_t) ( (_m->KEY_TJ_KB_U_PLUS & (0x01U)) | ((_m->KEY_TJ_KB_U_MINUS & (0x01U)) << 1U) | ((_m->KEY_TJ_KB_D_PLUS & (0x01U)) << 2U) | ((_m->KEY_TJ_KB_D_MINUS & (0x01U)) << 3U) | ((_m->KEY_TJ_ZD_L_PLUS & (0x01U)) << 4U) | ((_m->KEY_TJ_ZD_L_MINUS & (0x01U)) << 5U) | ((_m->KEY_TJ_ZD_R_PLUS & (0x01U)) << 6U) | ((_m->KEY_TJ_ZD_R_MINUS & (0x01U)) << 7U) );
cframe->MsgId = (uint32_t) Panel_Key_CANID;
cframe->DLC = (uint8_t) Panel_Key_DLC;
@ -112,6 +121,7 @@ uint32_t Pack_Panel_Key_CANmatrix(Panel_Key_t* _m, uint8_t* _d, uint8_t* _len, u
_d[2] |= (uint8_t) ( (_m->KEY_ZY_FAN & (0x01U)) | ((_m->KEY_ZY_HEAT & (0x01U)) << 1U) | ((_m->KEY_ZY_MSSG & (0x01U)) << 4U) );
_d[3] |= (uint8_t) ( (_m->KEY_MEMORY_3 & (0x01U)) | ((_m->KEY_MEMORY_2 & (0x01U)) << 1U) | ((_m->KEY_MEMORY_1 & (0x01U)) << 2U) | ((_m->KEY_MEMORY_SET & (0x01U)) << 3U) );
_d[4] |= (uint8_t) ( (_m->KEY_ZY_FLAT & (0x01U)) | ((_m->KEY_RESET & (0x01U)) << 1U) );
_d[5] |= (uint8_t) ( (_m->KEY_TJ_KB_U_PLUS & (0x01U)) | ((_m->KEY_TJ_KB_U_MINUS & (0x01U)) << 1U) | ((_m->KEY_TJ_KB_D_PLUS & (0x01U)) << 2U) | ((_m->KEY_TJ_KB_D_MINUS & (0x01U)) << 3U) | ((_m->KEY_TJ_ZD_L_PLUS & (0x01U)) << 4U) | ((_m->KEY_TJ_ZD_L_MINUS & (0x01U)) << 5U) | ((_m->KEY_TJ_ZD_R_PLUS & (0x01U)) << 6U) | ((_m->KEY_TJ_ZD_R_MINUS & (0x01U)) << 7U) );
*_len = (uint8_t) Panel_Key_DLC;
*_ide = (uint8_t) Panel_Key_IDE;

View File

@ -281,6 +281,94 @@ extern "C" {
#endif
// Value tables for @KEY_TJ_KB_U_PLUS signal
#ifndef KEY_TJ_KB_U_PLUS_Panel_Key_PRESSED
#define KEY_TJ_KB_U_PLUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_KB_U_PLUS_Panel_Key_NOT_PRESS
#define KEY_TJ_KB_U_PLUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_KB_U_MINUS signal
#ifndef KEY_TJ_KB_U_MINUS_Panel_Key_PRESSED
#define KEY_TJ_KB_U_MINUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_KB_U_MINUS_Panel_Key_NOT_PRESS
#define KEY_TJ_KB_U_MINUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_KB_D_PLUS signal
#ifndef KEY_TJ_KB_D_PLUS_Panel_Key_PRESSED
#define KEY_TJ_KB_D_PLUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_KB_D_PLUS_Panel_Key_NOT_PRESS
#define KEY_TJ_KB_D_PLUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_KB_D_MINUS signal
#ifndef KEY_TJ_KB_D_MINUS_Panel_Key_PRESSED
#define KEY_TJ_KB_D_MINUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_KB_D_MINUS_Panel_Key_NOT_PRESS
#define KEY_TJ_KB_D_MINUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_ZD_L_PLUS signal
#ifndef KEY_TJ_ZD_L_PLUS_Panel_Key_PRESSED
#define KEY_TJ_ZD_L_PLUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_ZD_L_PLUS_Panel_Key_NOT_PRESS
#define KEY_TJ_ZD_L_PLUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_ZD_L_MINUS signal
#ifndef KEY_TJ_ZD_L_MINUS_Panel_Key_PRESSED
#define KEY_TJ_ZD_L_MINUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_ZD_L_MINUS_Panel_Key_NOT_PRESS
#define KEY_TJ_ZD_L_MINUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_ZD_R_PLUS signal
#ifndef KEY_TJ_ZD_R_PLUS_Panel_Key_PRESSED
#define KEY_TJ_ZD_R_PLUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_ZD_R_PLUS_Panel_Key_NOT_PRESS
#define KEY_TJ_ZD_R_PLUS_Panel_Key_NOT_PRESS (0)
#endif
// Value tables for @KEY_TJ_ZD_R_MINUS signal
#ifndef KEY_TJ_ZD_R_MINUS_Panel_Key_PRESSED
#define KEY_TJ_ZD_R_MINUS_Panel_Key_PRESSED (1)
#endif
#ifndef KEY_TJ_ZD_R_MINUS_Panel_Key_NOT_PRESS
#define KEY_TJ_ZD_R_MINUS_Panel_Key_NOT_PRESS (0)
#endif
typedef struct
{
#ifdef CANMATRIX_USE_BITS_SIGNAL
@ -369,6 +457,38 @@ typedef struct
// 0 : "NOT_PRESS"
uint8_t KEY_RESET : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_U_PLUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_U_MINUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_D_PLUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_D_MINUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_L_PLUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_L_MINUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_R_PLUS : 1; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_R_MINUS : 1; // Bits= 1
#else
// 1 : "PRESSED"
@ -455,6 +575,38 @@ typedef struct
// 0 : "NOT_PRESS"
uint8_t KEY_RESET; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_U_PLUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_U_MINUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_D_PLUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_KB_D_MINUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_L_PLUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_L_MINUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_R_PLUS; // Bits= 1
// 1 : "PRESSED"
// 0 : "NOT_PRESS"
uint8_t KEY_TJ_ZD_R_MINUS; // Bits= 1
#endif // CANMATRIX_USE_BITS_SIGNAL
#ifdef CANMATRIX_USE_DIAG_MONITORS

View File

@ -1,6 +1,6 @@
// Generator version : v3.1
// Generation time : 2024.12.07 08:59:44
// DBC filename : DMK-RP-01_CAN_V0.1_20241118.dbc
// Generation time : 2025.04.01 15:44:06
// DBC filename : DMK-RP-01_CAN_V0.1.dbc
#include "canmatrix-fmon.h"
#ifdef CANMATRIX_USE_DIAG_MONITORS

View File

@ -43,7 +43,7 @@ void FanHeatInit(void)
HeatDutyCounter = 0;
}
void FanHeatMainTaks(void)//10ms
void FanHeatMainTask(void)//10ms
{
if (getKeyPressFlag(KEY_HEAT) == KEY_PRESSED)
{

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* the functions
******************************************************************************/
void FanHeatMainTaks(void);
void FanHeatMainTask(void);
void FanHeatInit(void);

View File

@ -95,7 +95,7 @@ static uint8_t linFrameData[LIN_FRAME_NUM][LIN_DATA_SIZE];
static uint8_t linFrameDataBackup[LIN_DATA_SIZE];
static Lin_FrameInfoType linFrameInfoTab[LIN_FRAME_NUM] = {
{0x10, LIN_FRM_UNCD, 2, LIN_RES_PUB, &linFrameData[0][0], 0x00},
{0x10, LIN_FRM_UNCD, 4, LIN_RES_PUB, &linFrameData[0][0], 0x00},
{0x20, LIN_FRM_UNCD, 8, LIN_RES_SUB, &linFrameData[1][0], 0x00},
{0x21, LIN_FRM_UNCD, 8, LIN_RES_SUB, &linFrameData[2][0], 0x00},
{0x30, LIN_FRM_UNCD, 8, LIN_RES_SUB, &linFrameData[3][0], 0x00},
@ -371,7 +371,7 @@ void LinMasterRxIsrRoutine(void)
{
UartDrv_TxData(&mcu.uartDrv0, linTxData.data[linTxDataCnt]);
linTxDataCnt++;
if(linTxDataCnt >= linFrameInfoTab[gCurFrameIdx].frameLen)
if(linTxDataCnt >= linFrameInfoTab[gCurFrameIdx].frameLen && (linTxDataCnt < 4))
{
UartDrv_TxData(&mcu.uartDrv0, linTxData.checkSum);
linState = LIN_STATE_CHECKSUM;

View File

@ -15,32 +15,51 @@
******************************************************************************/
typedef struct
{
// Solenoid Valve 电磁阀
uint8_t SV1:1;
uint8_t SV2:1;
uint8_t SV3:1;
uint8_t SV4:1;
uint8_t SV5:1;
uint8_t SV6:1;
uint8_t SV7:1;
uint8_t SV8:1;
//坐垫
uint8_t ZD_R_MINUS:1;
uint8_t ZD_L0:1;
uint8_t ZD_L1:1;
uint8_t ZD_L2:1;
uint8_t ZD_R2:1;
uint8_t ZD_R_PLUS:1;
uint8_t ZD_L_PLUS:1;
uint8_t ZD_L_MINUS:1;
uint8_t SV9:1;
uint8_t SV10:1;
uint8_t SV11:1;
uint8_t SV12:1;
uint8_t SV13:1;
uint8_t SV14:1;
uint8_t ZD_R0:1;
uint8_t ZD_R1:1;
uint8_t ZD_REV1:1;
uint8_t ZD_REV2:1;
uint8_t ZD_REV3:1;
uint8_t ZD_REV4:1;
uint8_t AP:1;
uint8_t V2_12V:1;
uint8_t ZD_AP:1;
uint8_t ZD_V2_12V:1;
//靠背
uint8_t KB_D_PLUS:1;
uint8_t KB_U_PLUS:1;
uint8_t KB_D_MINUS:1;
uint8_t KB_U_MINUS:1;
uint8_t KB_L1:1;
uint8_t KB_L2:1;
uint8_t KB_L3:1;
uint8_t KB_L4:1;
uint8_t KB_R2:1;
uint8_t KB_R3:1;
uint8_t KB_R4:1;
uint8_t KB_L0:1;
uint8_t KB_R0:1;
uint8_t KB_R1:1;
uint8_t KB_REV1:1;
uint8_t KB_V2_12V:1;
}SM_CTRL_Type;
typedef union
{
uint8_t rawdata[2];
uint8_t rawdata[4];
SM_CTRL_Type msg;
}SM_CTRL_Data_Type;
typedef enum
@ -59,7 +78,8 @@ typedef enum
******************************************************************************/
SM_CTRL_Data_Type SM_CTRL_data;
static SM_state_Type SM_state,SM_last_state;
static uint8_t ZD_DATA_L[3]={0},ZD_DATA_R[3]={0},KB_DATA_L[5]={0},KB_DATA_R[5]={0};
static uint8_t SM_TJ_Req[4]={0};
/*******************************************************************************
* the const
******************************************************************************/
@ -74,158 +94,162 @@ static void UpdateLinMsg(SM_CTRL_Data_Type* data)
{
LIN_UpdateTxData(0,0,data->rawdata[0]);
LIN_UpdateTxData(0,1,data->rawdata[1]);
LIN_UpdateTxData(0,2,data->rawdata[2]);
LIN_UpdateTxData(0,3,data->rawdata[3]);
}
static void SM_OFF_task(void)
{
SM_CTRL_data.rawdata[0] = 0;
SM_CTRL_data.rawdata[1] = 0;
SM_CTRL_data.rawdata[2] = 0;
SM_CTRL_data.rawdata[3] = 0;
for (uint8_t i = 0; i < 4; i++)
{
if (SM_TJ_Req[i] == SM_TJ_ACT_Plus)
{
SM_CTRL_data.msg.ZD_AP = 1;
break;
}
}
if (SM_TJ_Req[SM_TJ_ZD_L]!=0 || SM_TJ_Req[SM_TJ_ZD_R]!=0 )
{
SM_CTRL_data.msg.ZD_V2_12V = 1;
}
else
{
SM_CTRL_data.msg.ZD_V2_12V = 0;
}
if (SM_TJ_Req[SM_TJ_KB_U]!=0 || SM_TJ_Req[SM_TJ_KB_D]!=0 )
{
SM_CTRL_data.msg.KB_V2_12V = 1;
}
else
{
SM_CTRL_data.msg.KB_V2_12V = 0;
}
SM_CTRL_data.msg.KB_U_PLUS = (SM_TJ_Req[SM_TJ_KB_U]==SM_TJ_ACT_Plus?1:0);
SM_CTRL_data.msg.KB_U_MINUS = (SM_TJ_Req[SM_TJ_KB_U]==SM_TJ_ACT_Minus?1:0);
SM_CTRL_data.msg.KB_D_PLUS = (SM_TJ_Req[SM_TJ_KB_D]==SM_TJ_ACT_Plus?1:0);
SM_CTRL_data.msg.KB_D_MINUS = (SM_TJ_Req[SM_TJ_KB_D]==SM_TJ_ACT_Minus?1:0);
SM_CTRL_data.msg.ZD_L_PLUS = (SM_TJ_Req[SM_TJ_ZD_L]==SM_TJ_ACT_Plus?1:0);
SM_CTRL_data.msg.ZD_L_MINUS = (SM_TJ_Req[SM_TJ_ZD_L]==SM_TJ_ACT_Minus?1:0);
SM_CTRL_data.msg.ZD_R_PLUS = (SM_TJ_Req[SM_TJ_ZD_R]==SM_TJ_ACT_Plus?1:0);
SM_CTRL_data.msg.ZD_R_MINUS = (SM_TJ_Req[SM_TJ_ZD_R]==SM_TJ_ACT_Minus?1:0);
UpdateLinMsg(&SM_CTRL_data);
SM_last_state=SM_state;
}
static void SM_RUN1_task(void)//50ms
{
static uint16_t run_counter;
static uint8_t runstate;
static uint8_t runstate,zd_run_state,kb_run_state;
if(SM_last_state!=SM_state)
{
runstate = 0;
run_counter = 0;
SM_last_state=SM_state;
zd_run_state = 0;
kb_run_state = 0;
}
switch (runstate)
run_counter++;
if (run_counter >= 100)
{
case 0:
SM_CTRL_data.rawdata[0] = 0x01;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
run_counter = 0;
zd_run_state++;
if (zd_run_state >= 3)
{
run_counter = 0;
runstate++;
zd_run_state = 0;
}
break;
case 1:
SM_CTRL_data.rawdata[0] = 0x02;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
kb_run_state++;
if (kb_run_state >= 5)
{
run_counter = 0;
runstate++;
kb_run_state = 0;
}
break;
case 2:
SM_CTRL_data.rawdata[0] = 0x04;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 3:
SM_CTRL_data.rawdata[0] = 0x08;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 4:
SM_CTRL_data.rawdata[0] = 0x10;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 5:
SM_CTRL_data.rawdata[0] = 0x20;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 6:
SM_CTRL_data.rawdata[0] = 0x40;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 7:
SM_CTRL_data.rawdata[0] = 0x80;
SM_CTRL_data.rawdata[1] = 0x00;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 8:
SM_CTRL_data.rawdata[0] = 0x00;
SM_CTRL_data.rawdata[1] = 0x01;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
case 9:
SM_CTRL_data.rawdata[0] = 0x00;
SM_CTRL_data.rawdata[1] = 0x02;
run_counter++;
if (run_counter > 60)
{
run_counter = 0;
runstate++;
}
break;
default:
runstate = 0;
break;
}
SM_CTRL_data.msg.V2_12V = 1;
SM_CTRL_data.msg.AP = 1;
for (uint8_t i = 0; i < 3; i++)
{
if (i == zd_run_state)
{
ZD_DATA_L[i] = 1;
ZD_DATA_R[i] = 1;
}
else
{
ZD_DATA_L[i] = 0;
ZD_DATA_R[i] = 0;
}
}
for (uint8_t i = 0; i < 5; i++)
{
if (i == kb_run_state)
{
KB_DATA_L[i] = 1;
KB_DATA_R[i] = 1;
}
else
{
KB_DATA_L[i] = 0;
KB_DATA_R[i] = 0;
}
}
#if 0
SM_CTRL_data.msg.ZD_L0 = ZD_DATA_L[0];
SM_CTRL_data.msg.ZD_L1 = ZD_DATA_L[1];
SM_CTRL_data.msg.ZD_L2 = ZD_DATA_L[2];
SM_CTRL_data.msg.ZD_R0 = ZD_DATA_R[0];
SM_CTRL_data.msg.ZD_R1 = ZD_DATA_R[1];
SM_CTRL_data.msg.ZD_R2 = ZD_DATA_R[2];
#endif
#if 1
SM_CTRL_data.msg.KB_L0 = KB_DATA_L[0];
SM_CTRL_data.msg.KB_L1 = KB_DATA_L[1];
SM_CTRL_data.msg.KB_L2 = KB_DATA_L[2];
SM_CTRL_data.msg.KB_L3 = KB_DATA_L[3];
SM_CTRL_data.msg.KB_L4 = KB_DATA_L[4];
SM_CTRL_data.msg.KB_R0 = KB_DATA_R[0];
SM_CTRL_data.msg.KB_R1 = KB_DATA_R[1];
SM_CTRL_data.msg.KB_R2 = KB_DATA_R[2];
SM_CTRL_data.msg.KB_R3 = KB_DATA_R[3];
SM_CTRL_data.msg.KB_R4 = KB_DATA_R[4];
SM_CTRL_data.msg.KB_V2_12V = 1;
#endif
SM_CTRL_data.msg.ZD_V2_12V = 1;
SM_CTRL_data.msg.ZD_AP = 1;
UpdateLinMsg(&SM_CTRL_data);
}
static void SM_RUN2_task(void)
{
static uint16_t run_counter;
static uint8_t runstate;
SM_CTRL_data.msg.V2_12V = 1;
SM_CTRL_data.msg.AP = 1;
//SM_CTRL_data.msg.V2_12V = 1;
//SM_CTRL_data.msg.AP = 1;
UpdateLinMsg(&SM_CTRL_data);
}
static void SM_RUN3_task(void)
{
static uint16_t run_counter;
static uint8_t runstate;
SM_CTRL_data.msg.V2_12V = 1;
SM_CTRL_data.msg.AP = 1;
//SM_CTRL_data.msg.V2_12V = 1;
//SM_CTRL_data.msg.AP = 1;
UpdateLinMsg(&SM_CTRL_data);
}
void SeatMassage_Init(void)
{
SM_CTRL_data.msg.SV1 = 1;
SM_CTRL_data.msg.AP = 1;
for (uint8_t i = 0; i < 4; i++)
{
SM_CTRL_data.rawdata[i] = 0;
}
UpdateLinMsg(&SM_CTRL_data);
}
void SeatMassage_task(void)
@ -286,6 +310,14 @@ void SeatMassage_ReqNext(void)
{
SM_state = SM_OFF;
}
}
}
void SeatMassage_TJ_Req(SM_TJ_ITEM_Type item,SM_TJ_ACT_Type act)
{
if (item >= SM_TJ_ITEM_NUM || act >= SM_TJ_ACT_NUM)
{
return;//error
}
SM_TJ_Req[item] = act;
}

View File

@ -15,8 +15,22 @@
/*******************************************************************************
* the typedefs
******************************************************************************/
typedef enum
{
SM_TJ_KB_U,
SM_TJ_KB_D,
SM_TJ_ZD_L,
SM_TJ_ZD_R,
SM_TJ_ITEM_NUM,
}SM_TJ_ITEM_Type;
typedef enum
{
SM_TJ_ACT_None,
SM_TJ_ACT_Plus,
SM_TJ_ACT_Minus,
SM_TJ_ACT_NUM,
}SM_TJ_ACT_Type;
/*******************************************************************************
* the globals
@ -32,6 +46,8 @@ void SeatMassage_ReqOFF(void);
void SeatMassage_ReqRun(uint8_t state);
void SeatMassage_task(void);
void SeatMassage_ReqNext(void);
void SeatMassage_TJ_Req(SM_TJ_ITEM_Type item,SM_TJ_ACT_Type act);
#endif

View File

@ -746,7 +746,7 @@ static uint16_t getOverCurrentTh(uint8_t ch)
return th;
}
void HallDetecte(void)
void HallDetect(void)
{
static uint8_t HallLastState[6],HallDelay[6];
uint8_t i,hallstate;

View File

@ -40,7 +40,7 @@ void setMotorTarget(uint8_t motorid,uint16_t target);
void StartAutoCal(void);
void StopAutoCal(void);
void CurrentDetect(void);
void HallDetecte(void);
void HallDetect(void);
void MotorMemoryGet(MOTOR_MEMORY_Type id);
void MotorMemorySet(MOTOR_MEMORY_Type id);

View File

@ -111,7 +111,7 @@ void appTask(void)
gSysTick1sCnt++;
MsgTask(&udsObj);
CurrentDetect();
HallDetecte();
HallDetect();
if (gSystick1msCnt % 5 == 0)
{
KeyScanTask();
@ -123,7 +123,7 @@ void appTask(void)
{
LIN_Master_task();
MotorCtrl_Maintask();
FanHeatMainTaks();
FanHeatMainTask();
}
if (gSystick1msCnt % 50 == 0)

View File

@ -51,7 +51,7 @@ __root const app_CfgInfoType app_info = {
.sAswHeader = ASW_HEAD_MASK,//0x00010400
.appBuildTime = __TIME__,//0x00010404
.appBuildDate = __DATE__,//0x00010410
.appSW_VERSION = "SW0101_20241220",
.appSW_VERSION = "SW0101_20250401",
.appSW_Debug = 0xff,//0x55为量产模式其它为debug模式
};

View File

@ -130,6 +130,22 @@ static uint8_t GetSigState(KEY_ID_type key_id)
return scm_canmatrix_rx.Panel_Key.KEY_RESET;
case KEY_SM:
return scm_canmatrix_rx.Panel_Key.KEY_ZY_MSSG;
case KEY_TJ_KB_U_PLUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_KB_U_PLUS;
case KEY_TJ_KB_U_MINUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_KB_U_MINUS;
case KEY_TJ_KB_D_PLUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_KB_D_PLUS;
case KEY_TJ_KB_D_MINUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_KB_D_MINUS;
case KEY_TJ_ZD_L_PLUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_ZD_L_PLUS;
case KEY_TJ_ZD_L_MINUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_ZD_L_MINUS;
case KEY_TJ_ZD_R_PLUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_ZD_R_PLUS;
case KEY_TJ_ZD_R_MINUS:
return scm_canmatrix_rx.Panel_Key.KEY_TJ_ZD_R_MINUS;
default:
return 0;
}
@ -268,8 +284,60 @@ void KeyProTask(void)//5ms
{
SeatMassage_ReqNext();
}
//座椅气垫调节
if (getKeyPressFlag(KEY_TJ_KB_U_PLUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_KB_U,SM_TJ_ACT_Plus);
}
if (getKeyPressFlag(KEY_TJ_KB_U_MINUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_KB_U,SM_TJ_ACT_Minus);
}
if (getKeyPressFlag(KEY_TJ_KB_D_PLUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_KB_D,SM_TJ_ACT_Plus);
}
if (getKeyPressFlag(KEY_TJ_KB_D_MINUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_KB_D,SM_TJ_ACT_Minus);
}
if (getKeyPressFlag(KEY_TJ_ZD_L_PLUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_ZD_L,SM_TJ_ACT_Plus);
}
if (getKeyPressFlag(KEY_TJ_ZD_L_MINUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_ZD_L,SM_TJ_ACT_Minus);
}
if (getKeyPressFlag(KEY_TJ_ZD_R_PLUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_ZD_R,SM_TJ_ACT_Plus);
}
if (getKeyPressFlag(KEY_TJ_ZD_R_MINUS) == KEY_PRESSED)
{
SeatMassage_TJ_Req(SM_TJ_ZD_R,SM_TJ_ACT_Minus);
}
if (getKeyReleaseFlag(KEY_TJ_KB_U_PLUS)==KEY_PRESSED || getKeyReleaseFlag(KEY_TJ_KB_U_MINUS)==KEY_PRESSED )
{
SeatMassage_TJ_Req(SM_TJ_KB_U,SM_TJ_ACT_None);
}
if (getKeyReleaseFlag(KEY_TJ_KB_D_PLUS)==KEY_PRESSED || getKeyReleaseFlag(KEY_TJ_KB_D_MINUS)==KEY_PRESSED )
{
SeatMassage_TJ_Req(SM_TJ_KB_D,SM_TJ_ACT_None);
}
if (getKeyReleaseFlag(KEY_TJ_ZD_L_PLUS)==KEY_PRESSED || getKeyReleaseFlag(KEY_TJ_ZD_L_MINUS)==KEY_PRESSED )
{
SeatMassage_TJ_Req(SM_TJ_ZD_L,SM_TJ_ACT_None);
}
if (getKeyReleaseFlag(KEY_TJ_ZD_R_PLUS)==KEY_PRESSED || getKeyReleaseFlag(KEY_TJ_ZD_R_MINUS)==KEY_PRESSED )
{
SeatMassage_TJ_Req(SM_TJ_ZD_R,SM_TJ_ACT_None);
}
}

View File

@ -27,6 +27,14 @@ typedef enum
KEY_MEMORY_3,
KEY_RESET,
KEY_SM,//seat massage
KEY_TJ_KB_U_PLUS,
KEY_TJ_KB_U_MINUS,
KEY_TJ_KB_D_PLUS,
KEY_TJ_KB_D_MINUS,
KEY_TJ_ZD_L_PLUS,
KEY_TJ_ZD_L_MINUS,
KEY_TJ_ZD_R_PLUS,
KEY_TJ_ZD_R_MINUS,
KEY_NUM,
}KEY_ID_type;