Commit aa8f3c5a authored by 李俭双's avatar 李俭双

🐞 fix:规范变更,TCS开关存储到EE记忆

parent 15ec1ef6
...@@ -11,11 +11,17 @@ uint8_t PageType = 0; ...@@ -11,11 +11,17 @@ uint8_t PageType = 0;
uint8_t PageMenu = 0; uint8_t PageMenu = 0;
uint8_t Hour_Set = 0; uint8_t Hour_Set = 0;
uint8_t Minute_Set = 0; uint8_t Minute_Set = 0;
RTC_TimeTypeDef RTC_TimeStruct; RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct; RTC_DateTypeDef RTC_DateStruct;
RTC_CounterTypeDef counter_val; RTC_CounterTypeDef counter_val;
void Data_TCS_Set_OnOff(uint32_t u32Data)
{
uint32_t u32Data1[1u] = {0};
u32Data1[0u] = u32Data;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, u32Data1, 1u);
}
void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
{ {
switch (enKeyEvent) switch (enKeyEvent)
...@@ -50,10 +56,12 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode ...@@ -50,10 +56,12 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
if(Get_Dis_Tcs_Val() == 0) if(Get_Dis_Tcs_Val() == 0)
{ {
MenuData.Tcs_Val = 1;//on MenuData.Tcs_Val = 1;//on
Data_TCS_Set_OnOff(MenuData.Tcs_Val);
} }
else else
{ {
MenuData.Tcs_Val = 0;//off MenuData.Tcs_Val = 0;//off
Data_TCS_Set_OnOff(MenuData.Tcs_Val);
} }
} }
...@@ -410,14 +418,18 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM ...@@ -410,14 +418,18 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM
void MenuData_Unit_Init(void) void MenuData_Unit_Init(void)
{ {
uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
MenuData.KM_Unit = 0; MenuData.KM_Unit = 0;
MenuData.Tpms_Unit = 0; MenuData.Tpms_Unit = 0;
MenuData.Tcs_Val = 1; MenuData.Tcs_Val = TCS[0];
} }
void MenuData_TCS_Init(void) void MenuData_TCS_Init(void)
{ {
MenuData.Tcs_Val = 1; uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
MenuData.Tcs_Val = TCS[0];
PageType = Page_Menu; PageType = Page_Menu;
Hour_Set = 0; Hour_Set = 0;
Minute_Set = 0; Minute_Set = 0;
......
...@@ -19,7 +19,7 @@ typedef struct ...@@ -19,7 +19,7 @@ typedef struct
uint8_t Dis_Minute; uint8_t Dis_Minute;
uint8_t KM_Unit; // 0 km, 1 mile uint8_t KM_Unit; // 0 km, 1 mile
uint8_t Tpms_Unit;// 0 bar, 1 psi uint8_t Tpms_Unit;// 0 bar, 1 psi
uint8_t Tcs_Val; // 0 off, 1 on uint32_t Tcs_Val; // 0 off, 1 on
}_Menu_Data; }_Menu_Data;
typedef enum typedef enum
...@@ -46,6 +46,7 @@ typedef enum ...@@ -46,6 +46,7 @@ typedef enum
extern uint8_t PageType; extern uint8_t PageType;
extern uint8_t ClearODO_Flag; extern uint8_t ClearODO_Flag;
extern _Menu_Data MenuData;
extern RTC_CounterTypeDef counter_val; extern RTC_CounterTypeDef counter_val;
extern void Key_KL30_Init_EXample(void); extern void Key_KL30_Init_EXample(void);
extern void Key_Wakeup_Init_EXample(void); extern void Key_Wakeup_Init_EXample(void);
...@@ -71,4 +72,5 @@ void Key_Check_Service(void); ...@@ -71,4 +72,5 @@ void Key_Check_Service(void);
void MenuData_Unit_Init(void); void MenuData_Unit_Init(void);
void Maintain_Reset_Service(void); void Maintain_Reset_Service(void);
void MenuData_TCS_Init(void); void MenuData_TCS_Init(void);
void Data_TCS_Set_OnOff(uint32_t u32Data);
#endif #endif
...@@ -53,7 +53,7 @@ typedef enum ...@@ -53,7 +53,7 @@ typedef enum
EM_TRIP_BLOCK, /**< 小计里程 */ EM_TRIP_BLOCK, /**< 小计里程 */
EM_Maintenance_BLOCK, /**< 保养里程 */ EM_Maintenance_BLOCK, /**< 保养里程 */
EM_Maintenance_Firstflg, /**< 保养标志 */ EM_Maintenance_Firstflg, /**< 保养标志 */
EM_ENGODO_BLOCK, /**< 发动机总里程 */ EM_MenuData_Tcs_Val, /**< TCS开关标志 */
} Data_EEPROM_Enum_t; } Data_EEPROM_Enum_t;
typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len); typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len);
......
...@@ -18,6 +18,7 @@ extern uint32_t NVM_User_Settings_Service; ...@@ -18,6 +18,7 @@ extern uint32_t NVM_User_Settings_Service;
#define EEPROM_BLOCK_05 80 #define EEPROM_BLOCK_05 80
#define EEPROM_BLOCK_06 96 #define EEPROM_BLOCK_06 96
#define EEPROM_BLOCK_07 112 #define EEPROM_BLOCK_07 112
#define EEPROM_BLOCK_08 128
uint32_t Milleage_InitFlag = 0U; uint32_t Milleage_InitFlag = 0U;
...@@ -110,6 +111,13 @@ void Data_User_Mileage_KL30Init(void) ...@@ -110,6 +111,13 @@ void Data_User_Mileage_KL30Init(void)
Data_User_EEPROM_Write(EM_Maintenance_BLOCK, &NVM_User_Settings_Service, 1u); Data_User_EEPROM_Write(EM_Maintenance_BLOCK, &NVM_User_Settings_Service, 1u);
} }
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
if (TempBuf[0u] == 0xFFFFFFFF)
{
MenuData.Tcs_Val = 1;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
}
Milleage_InitFlag = 0X5AA53AA3UL; Milleage_InitFlag = 0X5AA53AA3UL;
} }
...@@ -134,7 +142,6 @@ void Data_User_Mileage_WakeupInit(void) ...@@ -134,7 +142,6 @@ void Data_User_Mileage_WakeupInit(void)
uint32_t Get_MileageInit_Status(void) uint32_t Get_MileageInit_Status(void)
{ {
return Milleage_InitFlag; return Milleage_InitFlag;
} }
...@@ -163,6 +170,9 @@ uint32_t Get_MileageInit_Status(void) ...@@ -163,6 +170,9 @@ uint32_t Get_MileageInit_Status(void)
case EM_Maintenance_Firstflg: case EM_Maintenance_Firstflg:
eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4); eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
break; break;
case EM_MenuData_Tcs_Val:
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
default: default:
break; break;
...@@ -205,7 +215,9 @@ uint32_t Get_MileageInit_Status(void) ...@@ -205,7 +215,9 @@ uint32_t Get_MileageInit_Status(void)
case EM_Maintenance_Firstflg: case EM_Maintenance_Firstflg:
eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4); eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
break; break;
case EM_MenuData_Tcs_Val:
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
default: default:
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment