Commit bb6a922c authored by hu's avatar hu

调整时间显示溢出问题。

parent fa5f01c5
...@@ -603,8 +603,15 @@ void GUI_Time_Dispaly(uint8_t Mode) ...@@ -603,8 +603,15 @@ void GUI_Time_Dispaly(uint8_t Mode)
if (CanStatus == CAN_SIG_NORMAL) if (CanStatus == CAN_SIG_NORMAL)
{ {
Time_Minutes = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Minutes(); Time_Minutes = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Minutes();
if (Time_Minutes > 59)
{
Time_Minutes = 0;
}
Time_Hours = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Hours(); Time_Hours = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Hours();
if (Time_Hours > 23)
{
Time_Hours = 0;
}
GUI_Translate_Display(Time_Sprite, Nb_21_maohao, 396u, 45u, GUI_BLENDMODE_SRC_OVER); /*显示冒号*/ GUI_Translate_Display(Time_Sprite, Nb_21_maohao, 396u, 45u, GUI_BLENDMODE_SRC_OVER); /*显示冒号*/
GUI_General_Digit_Display(Time_Sprite, Time_Minutes, CN_RC_Nb_21_0, 2u, 0u, GUI_DISP_Minutes, 37, GUI_BLENDMODE_SRC_OVER); /*显示分钟*/ GUI_General_Digit_Display(Time_Sprite, Time_Minutes, CN_RC_Nb_21_0, 2u, 0u, GUI_DISP_Minutes, 37, GUI_BLENDMODE_SRC_OVER); /*显示分钟*/
...@@ -658,8 +665,58 @@ void GUI_Data_Dispaly(uint8_t Mode) ...@@ -658,8 +665,58 @@ void GUI_Data_Dispaly(uint8_t Mode)
Year = (uint16_t)Get_ID_18FEE64A_Sig_TBOX_Year(); Year = (uint16_t)Get_ID_18FEE64A_Sig_TBOX_Year();
Year = (Year & 0xFF) + 1985u; Year = (Year & 0xFF) + 1985u;
Month = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Month(); Month = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Month();
if (Month > 12)
{
Month = 12;
}
Date = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Day(); Date = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Day();
Date = Date / 4u; Date = Date / 4u;
switch (Month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if (Date > 31)
{
Date = 31;
}
break;
case 4:
case 6:
case 9:
case 11:
if (Date > 30)
{
Date = 30;
}
break;
case 2:
if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0))
{
if (Date > 29)
{
Date = 29;
}
}
else
{
if (Date > 28)
{
Date = 28;
}
}
break;
default:
break;
}
Week = Cal_RTC_Week(Year, Month, Date); Week = Cal_RTC_Week(Year, Month, Date);
if (CanStatus == CAN_SIG_NORMAL) if (CanStatus == CAN_SIG_NORMAL)
...@@ -2281,12 +2338,71 @@ void GUI_Year_Month_Data_Display(uint8_t Mode) ...@@ -2281,12 +2338,71 @@ void GUI_Year_Month_Data_Display(uint8_t Mode)
Year = (uint16_t)Get_ID_18FEE64A_Sig_TBOX_Year(); Year = (uint16_t)Get_ID_18FEE64A_Sig_TBOX_Year();
Year = (Year & 0xFF) + 1985u; Year = (Year & 0xFF) + 1985u;
Month = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Month(); Month = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Month();
if (Month > 12)
{
Month = 12;
}
Date = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Day(); Date = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Day();
Date = Date / 4u; Date = Date / 4u;
switch (Month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
if (Date > 31)
{
Date = 31;
}
break;
case 4:
case 6:
case 9:
case 11:
if (Date > 30)
{
Date = 30;
}
break;
case 2:
if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0))
{
if (Date > 29)
{
Date = 29;
}
}
else
{
if (Date > 28)
{
Date = 28;
}
}
break;
default:
break;
}
Week = Cal_RTC_Week(Year, Month, Date); Week = Cal_RTC_Week(Year, Month, Date);
Time_Hours = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Hours(); Time_Hours = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Hours();
if (Time_Hours > 23)
{
Time_Hours = 0;
}
Time_Minutes = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Minutes(); Time_Minutes = (uint8_t)Get_ID_18FEE64A_Sig_TBOX_Minutes();
if (Time_Minutes > 59)
{
Time_Minutes = 0;
}
CanStatus = CAN_MSG_Status(ID_CanMsg18FEE64A_Msg_Count); CanStatus = CAN_MSG_Status(ID_CanMsg18FEE64A_Msg_Count);
......
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