#include "SEG_DISPLAY\SEG_DISPLAY.h"
#include "GPIO_USER\GpioUser.h"

#define Clr_Bit(p, b) (p) &= (~(1u << (b)))
#define Set_Bit(p, b) (p) |= (1u << (b))
#define Bit_Is_Set(p, b) ((p) & (1u << (b)))
#define Bit_Is_Clr(p, b) (!((p) & (1u << (b))))

/*数字显示数组*/ /*0,     1     2    3      4        5     6      7      8     9  */
const uint8_t SEG_DISPLAY_NUMBER0[] = {0x3Fu, 0x06u, 0x5Bu, 0x4Fu, 0x66u, 0x6Du, 0x7Du, 0x07u, 0x7Fu, 0x6Fu};
const uint8_t SEG_UNDISPLAY_NUMBER0[] = {0x00u, 0x06u, 0x5Bu, 0x4Fu, 0x66u, 0x6Du, 0x7Du, 0x07u, 0x7Fu, 0x6Fu};
uint8_t SOC_charge_seg_Flag = 0;
uint8_t checkself_seg_Flag = 0;
/**@brief 边框线显示函数
 * @param[in]  m_Flag           是否显示     -1 显示 -0 不显示
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */

_Fun_Res SEG_SET_Frame(uint8_t m_Flag)
{
		_Fun_Res m_Res = EX_ERR;
    if (m_Flag == 1)
    {
        /*边框*/
        IC2_SEG040 = IC_SEG_ON;
        IC2_SEG140 = IC_SEG_ON;
        IC1_SEG086 = IC_SEG_ON;
				m_Res = EX_OK;
    }
    else
    {
        /*边框*/
        IC2_SEG040 = IC_SEG_OFF;
        IC2_SEG140 = IC_SEG_OFF;
        IC1_SEG086 = IC_SEG_OFF;
				m_Res = EX_OK;
    }
		return m_Res;
}

/**@brief 指示灯显示函数
 * @param[in]  m_Flag           是否显示     -1 显示 -0 不显示
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */

_Fun_Res SEG_SET_LED_STS(uint8_t LED_NUM, uint8_t m_Flag)
{
    _Fun_Res m_Res;
    uint8_t Flag;
    uint8_t Num;
    if (m_Flag == 0u)
    {
        Flag = IC_SEG_OFF;
    }
    else
    {
        Flag = IC_SEG_ON;
    }
    Num = LED_NUM;
    switch (Num)
    {
    case SEG_LED_Recharge:
        IC1_SEG150 = Flag;
        break;
    case SEG_LED_Engine_Failure:
        IC1_SEG156 = Flag;
        break;
    case SEG_LED_Battery_Failure:
        IC1_SEG155 = Flag;
        break;
    case SEG_LED_Oil_press_Warning:
        IC1_SEG154 = Flag;
        break;
    case SEG_LED_System_Light:
        IC1_SEG153 = Flag;
        break;
    case SEG_LED_Power_Battery_Failure:
        IC1_SEG152 = Flag;
        break;
    case SEG_LED_Chloramine:
        IC1_SEG151 = Flag;
        break;
    case SEG_LED_Cutter_Overload:
        IC1_SEG139 = Flag;
        break;
    case SEG_LED_Seat_Detection:
        IC1_SEG142 = Flag;
        break;
    case SEG_LED_Key_Access:
        IC1_SEG140 = Flag;
        break;
    case SEG_LED_Ready:
        IC1_SEG141 = Flag;
        break;
    case SEG_LED_Cutter_Head_switch:
        IC1_SEG119 = Flag;
        break;
    case SEG_LED_engine_Burn:
        IC1_SEG056 = Flag;
        break;
    case SEG_LED_External_Discharge:
        IC1_SEG057 = Flag;
        break;
    case SEG_LED_bluetooth:
        IC1_SEG055 = Flag;
        break;
    case SEG_LED_Distance_Light:
        IC1_SEG085 = Flag;
        break;
    case SEG_LED_Cruise_Control:
        IC1_SEG084 = Flag;
        break;
    case SEG_LED_HHT_Charger:
        IC2_SEG093 = Flag;
        break;
    case SEG_LED_Fuel_Oil:
        IC2_SEG105 = Flag;
        break;
    default:
        break;
    }

    m_Res = EX_OK;
    return m_Res;
}

/**@brief 刀盘显示函数
 * @param[in]  m_Flag           是否显示     -1 显示 -0 不显示
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_Cutterhead(uint8_t m_Flag, uint8_t LED_NUM, uint8_t checkself)
{
    _Fun_Res m_Res;
    uint8_t m8 = 0;
    if (m_Flag)
    {
        if (checkself == 1)
        {
            IC1_SEG118 = IC_SEG_ON;
            IC1_SEG073 = IC_SEG_ON;
            IC1_SEG074 = IC_SEG_ON;
            IC1_SEG079 = IC_SEG_ON;
            IC1_SEG117 = IC_SEG_ON;
            IC1_SEG083 = IC_SEG_ON;
            IC1_SEG116 = IC_SEG_ON;
            m8 = SEG_DISPLAY_NUMBER0[LED_NUM];
            if (Bit_Is_Set(m8, 0))
            {
                IC1_SEG075 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG075 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC1_SEG082 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG082 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC1_SEG081 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG081 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC1_SEG080 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG080 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC1_SEG078 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG078 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC1_SEG076 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG076 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC1_SEG077 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG077 = IC_SEG_OFF;
            }
        }
        else
        {
            IC1_SEG118 = IC_SEG_ON;
            IC1_SEG073 = IC_SEG_ON;
            IC1_SEG074 = IC_SEG_ON;
            IC1_SEG079 = IC_SEG_ON;
            IC1_SEG083 = IC_SEG_ON;
            IC1_SEG116 = IC_SEG_ON;
            if (LED_NUM == 1)
            {
                IC1_SEG117 = IC_SEG_ON;
                IC1_SEG075 = IC_SEG_OFF;
                IC1_SEG082 = IC_SEG_ON;
                IC1_SEG081 = IC_SEG_ON;
                IC1_SEG080 = IC_SEG_OFF;
                IC1_SEG078 = IC_SEG_OFF;
                IC1_SEG076 = IC_SEG_OFF;
                IC1_SEG077 = IC_SEG_OFF;
            }
            else if (LED_NUM == 2)
            {
                IC1_SEG117 = IC_SEG_ON;
                IC1_SEG075 = IC_SEG_ON;
                IC1_SEG082 = IC_SEG_ON;
                IC1_SEG081 = IC_SEG_OFF;
                IC1_SEG080 = IC_SEG_ON;
                IC1_SEG078 = IC_SEG_ON;
                IC1_SEG076 = IC_SEG_OFF;
                IC1_SEG077 = IC_SEG_ON;
            }
            else if (LED_NUM == 3)
            {
                IC1_SEG117 = IC_SEG_ON;
                IC1_SEG075 = IC_SEG_ON;
                IC1_SEG082 = IC_SEG_ON;
                IC1_SEG081 = IC_SEG_ON;
                IC1_SEG080 = IC_SEG_ON;
                IC1_SEG078 = IC_SEG_OFF;
                IC1_SEG076 = IC_SEG_OFF;
                IC1_SEG077 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG117 = IC_SEG_OFF;
                IC1_SEG075 = IC_SEG_OFF;
                IC1_SEG082 = IC_SEG_OFF;
                IC1_SEG081 = IC_SEG_OFF;
                IC1_SEG080 = IC_SEG_OFF;
                IC1_SEG078 = IC_SEG_OFF;
                IC1_SEG076 = IC_SEG_OFF;
                IC1_SEG077 = IC_SEG_OFF;

                IC1_SEG118 = IC_SEG_OFF;
                IC1_SEG073 = IC_SEG_OFF;
                IC1_SEG074 = IC_SEG_OFF;
                IC1_SEG079 = IC_SEG_OFF;
                IC1_SEG083 = IC_SEG_OFF;
                IC1_SEG116 = IC_SEG_OFF;
            }
        }
    }
    else
    {
        IC1_SEG075 = IC_SEG_OFF;
        IC1_SEG082 = IC_SEG_OFF;
        IC1_SEG081 = IC_SEG_OFF;
        IC1_SEG080 = IC_SEG_OFF;
        IC1_SEG078 = IC_SEG_OFF;
        IC1_SEG076 = IC_SEG_OFF;
        IC1_SEG077 = IC_SEG_OFF;
        IC1_SEG118 = IC_SEG_OFF;
        IC1_SEG073 = IC_SEG_OFF;
        IC1_SEG074 = IC_SEG_OFF;
        IC1_SEG079 = IC_SEG_OFF;
        IC1_SEG117 = IC_SEG_OFF;
        IC1_SEG083 = IC_SEG_OFF;
        IC1_SEG116 = IC_SEG_OFF;
    }

    m_Res = EX_OK;
    return m_Res;
}

/**@brief 挡位显示函数
* @param[in]  m_Gear_Flag     挡位符号是否显示     -1 显示 -0 不显示
* @param[in]  m_Gear          符号             Gear_P = 0,  //P
                                               Gear_R,      //R
                                               Gear_N,      //N
                                               Gear_D,      //D

* @return  函数执行结果
* - EX_OK      		上报成功
* - EX_ERR        	上报失败
*/

_Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag, uint8_t m_Gear, uint8_t checkself)
{
    /*挡位符号*/
    uint8_t m8 = 0;
		_Fun_Res Res = EX_ERR;
    if (m_Gear_Flag == 1u)
    {
        IC2_SEG094 = IC_SEG_ON;
        IC2_SEG095 = IC_SEG_ON;
        IC2_SEG149 = IC_SEG_ON;
        IC2_SEG145 = IC_SEG_ON;
        IC2_SEG141 = IC_SEG_ON;
        IC2_SEG104 = IC_SEG_ON;
        IC2_SEG103 = IC_SEG_ON;
        IC2_SEG098 = IC_SEG_ON;
        IC2_SEG150 = IC_SEG_ON;
        if (checkself == 1)
        {
            m8 = SEG_DISPLAY_NUMBER0[m_Gear];
            if (m_Gear == 8)
            {
                IC2_SEG096 = IC_SEG_ON;
                IC2_SEG142 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG096 = IC_SEG_OFF;
                IC2_SEG142 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG148 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG148 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG147 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG147 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG144 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG144 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG143 = IC_SEG_ON;
                IC2_SEG102 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG143 = IC_SEG_OFF;
                IC2_SEG102 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG100 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG100 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG097 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG097 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG101 = IC_SEG_ON;
                IC2_SEG099 = IC_SEG_ON;
                IC2_SEG146 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG101 = IC_SEG_OFF;
                IC2_SEG099 = IC_SEG_OFF;
                IC2_SEG146 = IC_SEG_OFF;
            }
						Res = EX_OK;
        }
        else
        {
            if (m_Gear == Gear_P)
            {
                IC2_SEG100 = IC_SEG_ON;
                IC2_SEG097 = IC_SEG_ON;
                IC2_SEG148 = IC_SEG_ON;
                IC2_SEG147 = IC_SEG_ON;
                IC2_SEG146 = IC_SEG_ON;
                IC2_SEG099 = IC_SEG_ON;
                IC2_SEG101 = IC_SEG_ON;

                IC2_SEG096 = IC_SEG_OFF;
                IC2_SEG142 = IC_SEG_OFF;
                IC2_SEG143 = IC_SEG_OFF;
                IC2_SEG144 = IC_SEG_OFF;
                IC2_SEG102 = IC_SEG_OFF;
            }
            else if (m_Gear == Gear_1)
            {
                IC2_SEG097 = IC_SEG_OFF;
                IC2_SEG148 = IC_SEG_OFF;
                IC2_SEG147 = IC_SEG_ON;
                IC2_SEG146 = IC_SEG_OFF;
                IC2_SEG099 = IC_SEG_OFF;
                IC2_SEG101 = IC_SEG_OFF;
                IC2_SEG100 = IC_SEG_OFF;
                IC2_SEG142 = IC_SEG_OFF;
                IC2_SEG143 = IC_SEG_OFF;

                IC2_SEG096 = IC_SEG_OFF;
                IC2_SEG144 = IC_SEG_ON;
                IC2_SEG102 = IC_SEG_OFF;
            }
            else if (m_Gear == Gear_2)
            {

                IC2_SEG097 = IC_SEG_OFF;
                IC2_SEG096 = IC_SEG_OFF;
                IC2_SEG142 = IC_SEG_OFF;
                IC2_SEG144 = IC_SEG_OFF;

                IC2_SEG100 = IC_SEG_ON;
                IC2_SEG101 = IC_SEG_ON;
                IC2_SEG099 = IC_SEG_ON;
                IC2_SEG146 = IC_SEG_ON;
                IC2_SEG147 = IC_SEG_ON;
                IC2_SEG148 = IC_SEG_ON;
                IC2_SEG102 = IC_SEG_ON;
                IC2_SEG143 = IC_SEG_ON;
            }
            else if (m_Gear == Gear_OFF)
            {
                IC2_SEG101 = IC_SEG_OFF;
                IC2_SEG099 = IC_SEG_OFF;
                IC2_SEG146 = IC_SEG_OFF;
                IC2_SEG097 = IC_SEG_OFF;
                IC2_SEG100 = IC_SEG_OFF;
                IC2_SEG143 = IC_SEG_OFF;
                IC2_SEG102 = IC_SEG_OFF;
                IC2_SEG144 = IC_SEG_OFF;
                IC2_SEG147 = IC_SEG_OFF;
                IC2_SEG148 = IC_SEG_OFF;

                IC2_SEG096 = IC_SEG_OFF;
                IC2_SEG142 = IC_SEG_OFF;
            }
        }
				Res = EX_OK;
    }
    else
    {
        IC2_SEG094 = IC_SEG_OFF;
        IC2_SEG095 = IC_SEG_OFF;
        IC2_SEG149 = IC_SEG_OFF;
        IC2_SEG145 = IC_SEG_OFF;
        IC2_SEG141 = IC_SEG_OFF;
        IC2_SEG104 = IC_SEG_OFF;
        IC2_SEG103 = IC_SEG_OFF;
        IC2_SEG098 = IC_SEG_OFF;
        IC2_SEG097 = IC_SEG_OFF;
        IC2_SEG148 = IC_SEG_OFF;
        IC2_SEG147 = IC_SEG_OFF;
        IC2_SEG144 = IC_SEG_OFF;
        IC2_SEG143 = IC_SEG_OFF;
        IC2_SEG102 = IC_SEG_OFF;
        IC2_SEG100 = IC_SEG_OFF;
        IC2_SEG101 = IC_SEG_OFF;
        IC2_SEG096 = IC_SEG_OFF;
        IC2_SEG099 = IC_SEG_OFF;
        IC2_SEG146 = IC_SEG_OFF;
        IC2_SEG142 = IC_SEG_OFF;
        IC2_SEG150 = IC_SEG_OFF;
				Res = EX_ERR;
    }
		return Res;
}
// /**@brief 燃油表盘显示函数
//  * @param[in]  m_Flag            段与数字是否显示     -1 显示 -0 不显示
//  * @param[in]  m_SEG             燃油表盘段数0<=m_SEG<=5
//  * @return  函数执行结果
//  * - EX_OK      		上报成功
//  * - EX_ERR        	上报失败
//  */
// _Fun_Res SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
// {
//     _Fun_Res m_Res;
//     // uint8_t  Num;
//     uint8_t m8;
//     if (m_Flag == 1u)
//     {
//         IC1_SEG052 = IC_SEG_GREY;
//         IC1_SEG051 = IC_SEG_GREY;
//         IC1_SEG050 = IC_SEG_GREY;
//         IC1_SEG049 = IC_SEG_GREY;
//         IC1_SEG048 = IC_SEG_GREY;
//         IC1_SEG047 = IC_SEG_GREY;
//         IC1_SEG046 = IC_SEG_GREY;
//         IC1_SEG045 = IC_SEG_GREY;

//         IC1_SEG053 = IC_SEG_ON;
//         IC1_SEG105 = IC_SEG_ON;
//         IC1_SEG044 = IC_SEG_ON;
//         switch (m_SEG)
//         {
//         case 8u:
//             IC1_SEG045 = IC_SEG_ON;
//         case 7u:
//             IC1_SEG046 = IC_SEG_ON;
//         case 6u:
//             IC1_SEG047 = IC_SEG_ON;
//         case 5u:
//             IC1_SEG048 = IC_SEG_ON;
//         case 4u:
//             IC1_SEG049 = IC_SEG_ON;
//         case 3u:
//             IC1_SEG050 = IC_SEG_ON;
//         case 2u:
//             IC1_SEG051 = IC_SEG_ON;
//         case 1u:
//             IC1_SEG052 = IC_SEG_ON;
//         case 0u:
//             break;
//         default:
//             break;
//         }
//     }

//     else
//     {
//         IC2_SEG052 = IC_SEG_OFF;
//         IC2_SEG051 = IC_SEG_OFF;
//         IC2_SEG050 = IC_SEG_OFF;
//         IC2_SEG049 = IC_SEG_OFF;
//         IC2_SEG048 = IC_SEG_OFF;
//         IC2_SEG047 = IC_SEG_OFF;
//         IC2_SEG046 = IC_SEG_OFF;
//         IC2_SEG045 = IC_SEG_OFF;
//     }
//     m_Res = EX_OK;

//     return m_Res;
// }

/**@brief 电量表盘1SOC显示函数
 * @param[in]  m_Flag            段与数字是否显示     -1 显示 -0 不显示
 * @param[in]  m_SEG             车速表盘段数0<=m_SEG<=10
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_EleDial_1SOC(uint8_t m_Flag, uint8_t m_SEG)
{
    _Fun_Res m_Res;
    uint8_t Num;
    uint8_t m8;
    if (m_Flag == 1u)
    {
        IC1_SEG136 = IC_SEG_GREY;
        IC1_SEG137 = IC_SEG_GREY;
        IC1_SEG138 = IC_SEG_GREY;
        IC1_SEG143 = IC_SEG_GREY;
        IC1_SEG144 = IC_SEG_GREY;
        IC1_SEG145 = IC_SEG_GREY;
        IC1_SEG146 = IC_SEG_GREY;
        IC1_SEG147 = IC_SEG_GREY;
        IC1_SEG148 = IC_SEG_GREY;
        IC1_SEG135 = IC_SEG_GREY;
        // 小电池
        IC1_SEG121 = IC_SEG_ON;
        IC1_SEG122 = IC_SEG_ON;

        if (m_SEG == 1 && Common_GetIgnOnTime() >= 3000 && SOC_charge_seg_Flag != 1)
        {
            if (FLASH_SYNC_1Hz)
            {
                IC1_SEG135 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG135 = IC_SEG_GREY;
            }
        }
        else
        {
            switch (m_SEG)
            {

            case 10u:
                IC1_SEG136 = IC_SEG_ON;
            case 9u:
                IC1_SEG137 = IC_SEG_ON;
            case 8u:
                IC1_SEG138 = IC_SEG_ON;
            case 7u:
                IC1_SEG143 = IC_SEG_ON;
            case 6u:
                IC1_SEG144 = IC_SEG_ON;
            case 5u:
                IC1_SEG145 = IC_SEG_ON;
            case 4u:
                IC1_SEG146 = IC_SEG_ON;
            case 3u:
                IC1_SEG147 = IC_SEG_ON;
            case 2u:
                IC1_SEG148 = IC_SEG_ON;
            case 1u:
                IC1_SEG135 = IC_SEG_ON;
            case 0u:
                break;
            default:
                break;
            }
        }
    }
    else
    {

        IC1_SEG136 = IC_SEG_OFF;
        IC1_SEG137 = IC_SEG_OFF;
        IC1_SEG138 = IC_SEG_OFF;
        IC1_SEG143 = IC_SEG_OFF;
        IC1_SEG144 = IC_SEG_OFF;
        IC1_SEG145 = IC_SEG_OFF;
        IC1_SEG146 = IC_SEG_OFF;
        IC1_SEG147 = IC_SEG_OFF;
        IC1_SEG148 = IC_SEG_OFF;
        IC1_SEG135 = IC_SEG_OFF;
        // 小电池
        IC1_SEG121 = IC_SEG_OFF;
        IC1_SEG122 = IC_SEG_OFF;
    }

    return m_Res;
}

/**@brief 电量表盘2SOC显示函数
 * @param[in]  m_Flag            段与数字是否显示     -1 显示 -0 不显示
 * @param[in]  m_SEG             车速表盘段数0<=m_SEG<=10
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_EleDial_2SOC(uint8_t m_Flag, uint8_t m_SEG)
{
    _Fun_Res m_Res;
    uint8_t Num;
    uint8_t m8;
    if (m_Flag == 1u)
    {
        IC1_SEG124 = IC_SEG_ON;
        IC1_SEG123 = IC_SEG_ON;
        IC1_SEG134 = IC_SEG_GREY;
        IC1_SEG125 = IC_SEG_GREY;
        IC1_SEG126 = IC_SEG_GREY;
        IC1_SEG127 = IC_SEG_GREY;
        IC1_SEG128 = IC_SEG_GREY;
        IC1_SEG129 = IC_SEG_GREY;
        IC1_SEG130 = IC_SEG_GREY;
        IC1_SEG131 = IC_SEG_GREY;
        IC1_SEG132 = IC_SEG_GREY;
        IC1_SEG133 = IC_SEG_GREY;
        IC1_SEG134 = IC_SEG_GREY;

        if (m_SEG == 1 && Common_GetIgnOnTime() >= 3000 && SOC_charge_seg_Flag != 1)
        {
            if (FLASH_SYNC_1Hz)
            {
                IC1_SEG134 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG134 = IC_SEG_GREY;
            }
        }
        else
        {
            switch (m_SEG)
            {

            case 10u:
                IC1_SEG125 = IC_SEG_ON;
            case 9u:
                IC1_SEG126 = IC_SEG_ON;
            case 8u:
                IC1_SEG127 = IC_SEG_ON;
            case 7u:
                IC1_SEG128 = IC_SEG_ON;
            case 6u:
                IC1_SEG129 = IC_SEG_ON;
            case 5u:
                IC1_SEG130 = IC_SEG_ON;
            case 4u:
                IC1_SEG131 = IC_SEG_ON;
            case 3u:
                IC1_SEG132 = IC_SEG_ON;
            case 2u:
                IC1_SEG133 = IC_SEG_ON;
            case 1u:
                IC1_SEG134 = IC_SEG_ON;
            case 0u:
                break;
            default:
                break;
            }
        }
    }
    else
    {
        IC1_SEG134 = IC_SEG_OFF;
        IC1_SEG125 = IC_SEG_OFF;
        IC1_SEG126 = IC_SEG_OFF;
        IC1_SEG127 = IC_SEG_OFF;
        IC1_SEG128 = IC_SEG_OFF;
        IC1_SEG129 = IC_SEG_OFF;
        IC1_SEG130 = IC_SEG_OFF;
        IC1_SEG131 = IC_SEG_OFF;
        IC1_SEG132 = IC_SEG_OFF;
        IC1_SEG133 = IC_SEG_OFF;
        IC1_SEG134 = IC_SEG_OFF;
        // 小电池
        IC1_SEG124 = IC_SEG_OFF;
        IC1_SEG123 = IC_SEG_OFF;
    }

    return m_Res;
}
/**@brief 电量表盘2SOC显示函数
 * @param[in]  m_Flag            段与数字是否显示     -1 显示 -0 不显示
 * @param[in]  m_NUM             车速表盘段数0<=m_SEG<=10
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_EleDial_AllSOC(uint8_t m_Flag, uint16_t m_NUM)
{
    _Fun_Res m_Res;
    uint8_t Num;
    uint8_t m8;
    if (m_Flag == 1u)
    {
        IC1_SEG054 = IC_SEG_ON;
        /*百位*/
        if (m_NUM >= 100)
        {
            IC1_SEG072 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG072 = IC_SEG_OFF;
        }
        Num = (m_NUM / 10u) % 10u;
        if (m_NUM > 10)
        {
            m8 = SEG_DISPLAY_NUMBER0[Num];
        }
        else
        {
            m8 = SEG_UNDISPLAY_NUMBER0[Num];
        }
        if (Bit_Is_Set(m8, 0))
        {
            IC1_SEG069 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG069 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 1))
        {
            IC1_SEG068 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG068 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 2))
        {
            IC1_SEG066 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG066 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 3))
        {
            IC1_SEG065 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG065 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 5))
        {
            IC1_SEG070 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG070 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 4))
        {
            IC1_SEG071 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG071 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 6))
        {
            IC1_SEG067 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG067 = IC_SEG_OFF;
        }
        /*个位*/
        Num = m_NUM % 10u;
        m8 = SEG_DISPLAY_NUMBER0[Num];
        if (Bit_Is_Set(m8, 0))
        {
            IC1_SEG060 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG060 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 1))
        {
            IC1_SEG059 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG059 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 2))
        {
            IC1_SEG058 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG058 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 3))
        {
            IC1_SEG064 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG064 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 5))
        {
            IC1_SEG061 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG061 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 4))
        {
            IC1_SEG063 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG063 = IC_SEG_OFF;
        }
        if (Bit_Is_Set(m8, 6))
        {
            IC1_SEG062 = IC_SEG_ON;
        }
        else
        {
            IC1_SEG062 = IC_SEG_OFF;
        }
    }
    else
    {
        IC1_SEG072 = IC_SEG_OFF;
        IC1_SEG071 = IC_SEG_OFF;
        IC1_SEG070 = IC_SEG_OFF;
        IC1_SEG069 = IC_SEG_OFF;
        IC1_SEG068 = IC_SEG_OFF;
        IC1_SEG067 = IC_SEG_OFF;
        IC1_SEG066 = IC_SEG_OFF;
        IC1_SEG065 = IC_SEG_OFF;
        IC1_SEG064 = IC_SEG_OFF;
        IC1_SEG063 = IC_SEG_OFF;
        IC1_SEG062 = IC_SEG_OFF;
        IC1_SEG061 = IC_SEG_OFF;
        IC1_SEG060 = IC_SEG_OFF;
        IC1_SEG059 = IC_SEG_OFF;
        IC1_SEG058 = IC_SEG_OFF;
        IC1_SEG054 = IC_SEG_OFF;
    }

    return m_Res;
}
/**@brief 故障码显示
 * @param[in]  m_Flag            车速是否显示     -1 显示 -0 不显示
 * @param[in]  m_NUM             车速数据      0<=m_NUM<=299
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_Fault_Code(uint8_t m_Flag, uint16_t m_NUM)
{
    _Fun_Res m_Res;
    uint16_t Num;
    uint8_t m8;
    if ((m_Flag > 3u) || (m_NUM > 9999u))
    {
        m_Res = EX_ERR;
    }
    else
    {
        if (m_Flag == 1u)
        {
            IC1_SEG087 = IC_SEG_ON;
            IC1_SEG094 = IC_SEG_ON;
            IC1_SEG093 = IC_SEG_ON;
            IC1_SEG091 = IC_SEG_ON;
            IC1_SEG090 = IC_SEG_ON;
            IC1_SEG089 = IC_SEG_ON;
            IC1_SEG088 = IC_SEG_ON;
            IC1_SEG092 = IC_SEG_ON;
            IC1_SEG101 = IC_SEG_ON;
            IC1_SEG100 = IC_SEG_ON;
            IC1_SEG098 = IC_SEG_ON;
            IC1_SEG097 = IC_SEG_ON;
            IC1_SEG096 = IC_SEG_ON;
            IC1_SEG095 = IC_SEG_ON;
            IC1_SEG099 = IC_SEG_ON;
            IC1_SEG108 = IC_SEG_ON;
            IC1_SEG107 = IC_SEG_ON;
            IC1_SEG105 = IC_SEG_ON;
            IC1_SEG104 = IC_SEG_ON;
            IC1_SEG103 = IC_SEG_ON;
            IC1_SEG102 = IC_SEG_ON;
            IC1_SEG106 = IC_SEG_ON;
            IC1_SEG115 = IC_SEG_ON;
            IC1_SEG114 = IC_SEG_ON;
            IC1_SEG113 = IC_SEG_ON;
            IC1_SEG112 = IC_SEG_ON;
            IC1_SEG111 = IC_SEG_ON;
            IC1_SEG109 = IC_SEG_ON;
            IC1_SEG110 = IC_SEG_ON;

            /*千位*/
            Num = (m_NUM / 1000u) % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];

            if (Bit_Is_Set(m8, 0))
            {
                IC1_SEG094 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG094 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC1_SEG093 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG093 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC1_SEG091 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG091 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC1_SEG090 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG090 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC1_SEG088 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG088 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC1_SEG089 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG089 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC1_SEG092 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG092 = IC_SEG_OFF;
            }
            /*百位*/
            Num = (m_NUM / 100u) % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];

            if (Bit_Is_Set(m8, 0))
            {
                IC1_SEG101 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG101 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC1_SEG100 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG100 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC1_SEG098 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG098 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC1_SEG097 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG097 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC1_SEG095 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG095 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC1_SEG096 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG096 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC1_SEG099 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG099 = IC_SEG_OFF;
            }
            /*十位*/
            Num = (m_NUM / 10u) % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC1_SEG108 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG108 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC1_SEG107 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG107 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC1_SEG105 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG105 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC1_SEG104 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG104 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC1_SEG102 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG102 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC1_SEG103 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG103 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC1_SEG106 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG106 = IC_SEG_OFF;
            }
            /*个位*/
            Num = m_NUM % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC1_SEG115 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG115 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC1_SEG114 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG114 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC1_SEG113 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG113 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC1_SEG112 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG112 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC1_SEG109 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG109 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC1_SEG111 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG111 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC1_SEG110 = IC_SEG_ON;
            }
            else
            {
                IC1_SEG110 = IC_SEG_OFF;
            }
        }
        else
        {

            IC1_SEG074 = IC_SEG_OFF;
            IC1_SEG114 = IC_SEG_OFF;
            IC1_SEG115 = IC_SEG_OFF;
            IC1_SEG116 = IC_SEG_OFF;
            IC1_SEG101 = IC_SEG_OFF;

            IC1_SEG082 = IC_SEG_OFF;
            IC1_SEG083 = IC_SEG_OFF;
            IC1_SEG084 = IC_SEG_OFF;
            IC1_SEG085 = IC_SEG_OFF;
            // IC1_SEG086 = IC_SEG_OFF;
            IC1_SEG087 = IC_SEG_OFF;
            IC1_SEG088 = IC_SEG_OFF;
            IC1_SEG089 = IC_SEG_OFF;
            IC1_SEG090 = IC_SEG_OFF;
            IC1_SEG091 = IC_SEG_OFF;
            IC1_SEG092 = IC_SEG_OFF;
            IC1_SEG093 = IC_SEG_OFF;
            IC1_SEG094 = IC_SEG_OFF;
            IC1_SEG095 = IC_SEG_OFF;
            IC1_SEG096 = IC_SEG_OFF;
            IC1_SEG097 = IC_SEG_OFF;
            IC1_SEG098 = IC_SEG_OFF;
            IC1_SEG099 = IC_SEG_OFF;
            IC1_SEG100 = IC_SEG_OFF;
            IC1_SEG102 = IC_SEG_OFF;
            IC1_SEG103 = IC_SEG_OFF;
            IC1_SEG104 = IC_SEG_OFF;
            IC1_SEG105 = IC_SEG_OFF;
            IC1_SEG106 = IC_SEG_OFF;
            IC1_SEG107 = IC_SEG_OFF;
            IC1_SEG108 = IC_SEG_OFF;
            IC1_SEG109 = IC_SEG_OFF;
            IC1_SEG110 = IC_SEG_OFF;
        }

        m_Res = EX_OK;
    }
    return m_Res;
}

// /**@brief 续航里程显示函数

// * @param[in]  m_Flag           续航里程是否显示     -2 显示---km  -1 显示  -0 不显示
// * @param[in]  m_NUM            续航里程数值   0<=m_NUM<=999
// * @return  函数执行结果
// * - EX_OK      		上报成功
// * - EX_ERR        	上报失败
// */
// _Fun_Res SEG_SET_DTE_NUM(uint8_t m_Flag, uint16_t m_NUM)
// {
//     _Fun_Res m_Res;
//     uint16_t Num;
//     uint8_t m8;
//     if ((m_Flag > 2u) || (m_NUM > 999u))
//     {
//         m_Res = EX_ERR;
//     }
//     else
//     {
//         if (m_Flag == 1u)
//         {
//             IC1_SEG099 = IC_SEG_ON;
//             IC1_SEG065 = IC_SEG_ON;
//             /*百位*/
//             Num = m_NUM / 100u;
//             m8 = SEG_UNDISPLAY_NUMBER0[Num];
//             if (Bit_Is_Set(m8, 0))
//             {
//                 IC1_SEG050 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG050 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 1))
//             {
//                 IC1_SEG049 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG049 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 2))
//             {
//                 IC1_SEG047 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG047 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 3))
//             {
//                 IC1_SEG046 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG046 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 5))
//             {
//                 IC1_SEG045 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG045 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 4))
//             {
//                 IC1_SEG044 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG044 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 6))
//             {
//                 IC1_SEG048 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG048 = IC_SEG_OFF;
//             }
//             /*十位*/
//             Num = (m_NUM / 10u) % 10u;
//             if (m_NUM >= 100u)
//             {
//                 m8 = SEG_DISPLAY_NUMBER0[Num];
//             }
//             else
//             {
//                 m8 = SEG_UNDISPLAY_NUMBER0[Num];
//             }

//             if (Bit_Is_Set(m8, 0))
//             {
//                 IC1_SEG057 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG057 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 1))
//             {
//                 IC1_SEG056 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG056 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 2))
//             {
//                 IC1_SEG054 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG054 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 3))
//             {
//                 IC1_SEG053 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG053 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 5))
//             {
//                 IC1_SEG052 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG052 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 4))
//             {
//                 IC1_SEG051 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG051 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 6))
//             {
//                 IC1_SEG055 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG055 = IC_SEG_OFF;
//             }
//             /*个位*/
//             Num = m_NUM % 10u;
//             m8 = SEG_DISPLAY_NUMBER0[Num];
//             if (Bit_Is_Set(m8, 0))
//             {
//                 IC1_SEG064 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG064 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 1))
//             {
//                 IC1_SEG063 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG063 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 2))
//             {
//                 IC1_SEG061 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG061 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 3))
//             {
//                 IC1_SEG060 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG060 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 5))
//             {
//                 IC1_SEG059 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG059 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 4))
//             {
//                 IC1_SEG058 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG058 = IC_SEG_OFF;
//             }
//             if (Bit_Is_Set(m8, 6))
//             {
//                 IC1_SEG062 = IC_SEG_ON;
//             }
//             else
//             {
//                 IC1_SEG062 = IC_SEG_OFF;
//             }
//         }
//         else if (m_Flag == 2u)
//         {
//             IC1_SEG099 = IC_SEG_ON;
//             IC1_SEG065 = IC_SEG_ON;

//             IC1_SEG044 = IC_SEG_OFF;
//             IC1_SEG045 = IC_SEG_OFF;
//             IC1_SEG046 = IC_SEG_OFF;
//             IC1_SEG047 = IC_SEG_OFF;
//             IC1_SEG048 = IC_SEG_ON;
//             IC1_SEG049 = IC_SEG_OFF;
//             IC1_SEG050 = IC_SEG_OFF;
//             IC1_SEG051 = IC_SEG_OFF;
//             IC1_SEG052 = IC_SEG_OFF;
//             IC1_SEG053 = IC_SEG_OFF;
//             IC1_SEG054 = IC_SEG_OFF;
//             IC1_SEG055 = IC_SEG_ON;
//             IC1_SEG056 = IC_SEG_OFF;
//             IC1_SEG057 = IC_SEG_OFF;
//             IC1_SEG058 = IC_SEG_OFF;
//             IC1_SEG059 = IC_SEG_OFF;
//             IC1_SEG060 = IC_SEG_OFF;
//             IC1_SEG061 = IC_SEG_OFF;
//             IC1_SEG062 = IC_SEG_ON;
//             IC1_SEG063 = IC_SEG_OFF;
//             IC1_SEG064 = IC_SEG_OFF;
//         }

//         else
//         {
//             IC1_SEG099 = IC_SEG_OFF;
//             IC1_SEG065 = IC_SEG_OFF;

//             IC1_SEG044 = IC_SEG_OFF;
//             IC1_SEG045 = IC_SEG_OFF;
//             IC1_SEG046 = IC_SEG_OFF;
//             IC1_SEG047 = IC_SEG_OFF;
//             IC1_SEG048 = IC_SEG_OFF;
//             IC1_SEG049 = IC_SEG_OFF;
//             IC1_SEG050 = IC_SEG_OFF;
//             IC1_SEG051 = IC_SEG_OFF;
//             IC1_SEG052 = IC_SEG_OFF;
//             IC1_SEG053 = IC_SEG_OFF;
//             IC1_SEG054 = IC_SEG_OFF;
//             IC1_SEG055 = IC_SEG_OFF;
//             IC1_SEG056 = IC_SEG_OFF;
//             IC1_SEG057 = IC_SEG_OFF;
//             IC1_SEG058 = IC_SEG_OFF;
//             IC1_SEG059 = IC_SEG_OFF;
//             IC1_SEG060 = IC_SEG_OFF;
//             IC1_SEG061 = IC_SEG_OFF;
//             IC1_SEG062 = IC_SEG_OFF;
//             IC1_SEG063 = IC_SEG_OFF;
//             IC1_SEG064 = IC_SEG_OFF;
//         }

//         m_Res = EX_OK;
//     }
//     return m_Res;
// }

/**@brief 车速8字段显示函数
 * @param[in]  m_Flag            车速是否显示     -1 显示 -0 不显示
 * @param[in]  m_NUM             车速数据      0<=m_NUM<=299
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */

//_Fun_Res SEG_SET_VSpeed_NUM(uint8_t m_Flag, uint16_t m_NUM)
//{
//    _Fun_Res m_Res;
//    uint16_t Num;
//    uint8_t m8;
//    if (m_NUM > 9)
//    {
//        RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 1);
//    }
//    else
//    {
//        RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 0);
//    }

//    if (m_NUM > 99)
//    {
//        RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 1);
//    }
//    else
//    {
//        RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 0);
//    }

//    if ((m_Flag > 2u) || (m_NUM > 299u))
//    {
//        m_Res = EX_ERR;
//    }
//    else
//    {
//        if (m_Flag == 1u)
//        {
//            if (ClearODO_Flag == 1)
//            {
//                IC1_SEG059 = IC_SEG_ON;
//                IC1_SEG058 = IC_SEG_ON;
//                LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 100);
//                LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 100);
//            }
//            else
//            {
//                if (Common_GetIgnOnTime() < 3000)
//                {
//                    IC1_SEG059 = IC_SEG_ON;
//                    IC1_SEG058 = IC_SEG_ON;
//                    LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 100);
//                    LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 100);
//                }
//                else
//                {
//                    if ((Get_Dis_Unit() == 1))
//                    {
//                        IC1_SEG059 = IC_SEG_OFF;
//                        IC1_SEG058 = IC_SEG_ON;
//                        LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 100);
//                        LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 0);
//                    }
//                    else
//                    {
//                        IC1_SEG059 = IC_SEG_ON;
//                        IC1_SEG058 = IC_SEG_OFF;
//                        LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, 0);
//                        LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, 100);
//                    }
//                }
//            }

//            /*百位*/
//            Num = m_NUM / 100u;
//            if (Num == 1u)
//            {
//                IC1_SEG060 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG060 = IC_SEG_OFF;
//            }
//            /*十位*/
//            Num = (m_NUM / 10u) % 10u;
//            if (m_NUM >= 100u)
//            {
//                m8 = SEG_DISPLAY_NUMBER0[Num];
//            }
//            else
//            {
//                m8 = SEG_UNDISPLAY_NUMBER0[Num];
//            }

//            if (Bit_Is_Set(m8, 0))
//            {
//                IC1_SEG129 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG129 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 1))
//            {
//                IC1_SEG066 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG066 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 2))
//            {
//                IC1_SEG065 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG065 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 3))
//            {
//                IC1_SEG064 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG064 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 4))
//            {
//                IC1_SEG063 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG063 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 5))
//            {
//                IC1_SEG061 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG061 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 6))
//            {
//                IC1_SEG062 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG062 = IC_SEG_OFF;
//            }
//            /*个位*/
//            Num = m_NUM % 10u;
//            m8 = SEG_DISPLAY_NUMBER0[Num];
//            if (Bit_Is_Set(m8, 0))
//            {
//                IC1_SEG130 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG130 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 1))
//            {
//                IC1_SEG136 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG136 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 2))
//            {
//                IC1_SEG135 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG135 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 3))
//            {
//                IC1_SEG134 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG134 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 5))
//            {
//                IC1_SEG131 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG131 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 4))
//            {
//                IC1_SEG133 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG133 = IC_SEG_OFF;
//            }
//            if (Bit_Is_Set(m8, 6))
//            {
//                IC1_SEG132 = IC_SEG_ON;
//            }
//            else
//            {
//                IC1_SEG132 = IC_SEG_OFF;
//            }
//        }

//        else
//        {
//            IC1_SEG058 = IC_SEG_OFF;
//            IC1_SEG059 = IC_SEG_OFF;

//            IC1_SEG060 = IC_SEG_OFF;
//            IC1_SEG061 = IC_SEG_OFF;
//            IC1_SEG062 = IC_SEG_OFF;
//            IC1_SEG063 = IC_SEG_OFF;
//            IC1_SEG064 = IC_SEG_OFF;
//            IC1_SEG065 = IC_SEG_OFF;
//            IC1_SEG066 = IC_SEG_OFF;
//            IC1_SEG129 = IC_SEG_OFF;
//            IC1_SEG130 = IC_SEG_OFF;
//            IC1_SEG131 = IC_SEG_OFF;
//            IC1_SEG132 = IC_SEG_OFF;
//            IC1_SEG133 = IC_SEG_OFF;
//            IC1_SEG134 = IC_SEG_OFF;
//            IC1_SEG135 = IC_SEG_OFF;
//            IC1_SEG136 = IC_SEG_OFF;
//        }

//        m_Res = EX_OK;
//    }
//    return m_Res;
//}

/**@brief L8字段显示函数
 * @param[in]  m_Flag            车速是否显示     -2 L-  -1 显示 -0 不显示
 * @param[in]  m_NUM             车速数据      0<=m_NUM<=9
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */

_Fun_Res SEG_SET_L8_NUM(uint8_t m_Flag, uint8_t m_NUM)
{
    _Fun_Res m_Res;
    uint8_t Num;
    uint8_t m8;
    if ((m_Flag > 2u) || (m_NUM > 9u))
    {
        m_Res = EX_ERR;
    }
    else
    {
        if (m_Flag == 1u)
        {
            IC2_SEG051 = IC_SEG_ON;
            Num = m_NUM;
            m8 = SEG_DISPLAY_NUMBER0[Num];

            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG058 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG058 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG057 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG057 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG055 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG055 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG054 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG054 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG053 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG053 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG052 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG052 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG056 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG056 = IC_SEG_OFF;
            }
        }
        else if (m_Flag == 2u)
        {
            IC2_SEG051 = IC_SEG_ON;

            IC2_SEG052 = IC_SEG_OFF;
            IC2_SEG053 = IC_SEG_OFF;
            IC2_SEG054 = IC_SEG_OFF;
            IC2_SEG055 = IC_SEG_OFF;
            IC2_SEG056 = IC_SEG_ON;
            IC2_SEG057 = IC_SEG_OFF;
            IC2_SEG058 = IC_SEG_OFF;
        }
        else
        {

            IC2_SEG051 = IC_SEG_OFF;

            IC2_SEG052 = IC_SEG_OFF;
            IC2_SEG053 = IC_SEG_OFF;
            IC2_SEG054 = IC_SEG_OFF;
            IC2_SEG055 = IC_SEG_OFF;
            IC2_SEG056 = IC_SEG_OFF;
            IC2_SEG057 = IC_SEG_OFF;
            IC2_SEG058 = IC_SEG_OFF;
        }

        m_Res = EX_OK;
    }
    return m_Res;
}

/**@brief 单次时间显示函数
 * @param[in]  m_hour            小时
 * @param[in]  m_minute          分钟
 * @param[in]  m_icon            中间冒号是否显示 -1 显示 -0 不显示
 * @param[in]  m_Flag1           小时是否显示     -1 显示 -0 不显示
 * @param[in]  m_Flag2           分钟是否显示     -1 显示 -0 不显示
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_Clock(uint8_t m_hour, uint8_t m_minute, uint8_t m_icon, uint8_t m_Flag1, uint8_t m_Flag2)
{
    _Fun_Res m_Res;
    uint8_t Num;
    uint8_t m8;
    if ((m_hour >= 99u) || (m_minute >= 99u) || (m_icon > 1u) || (m_Flag1 > 1u) || (m_Flag2 > 1u))
    {
        m_Res = EX_ERR;
    }
    else
    {
        if (m_icon == 1u)
        {
            IC2_SEG084 = IC_SEG_ON;
        }
        else
        {
            IC2_SEG084 = IC_SEG_OFF;
        }
        if (m_Flag1 == 1u)
        {
            Num = m_hour / 10u; /*86104-11*/
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG036 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG036 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG035 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG035 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG079 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG079 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG078 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG078 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG037 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG037 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG039 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG039 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG038 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG038 = IC_SEG_OFF;
            }
            Num = m_hour % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG033 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG033 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG032 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG032 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG083 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG083 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG082 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG082 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG034 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG034 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG081 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG081 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG080 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG080 = IC_SEG_OFF;
            }
        }
        else
        {
            IC2_SEG036 = IC_SEG_OFF;
            IC2_SEG035 = IC_SEG_OFF;
            IC2_SEG079 = IC_SEG_OFF;
            IC2_SEG078 = IC_SEG_OFF;
            IC2_SEG039 = IC_SEG_OFF;
            IC2_SEG037 = IC_SEG_OFF;
            IC2_SEG038 = IC_SEG_OFF;
            IC2_SEG033 = IC_SEG_OFF;
            IC2_SEG032 = IC_SEG_OFF;
            IC2_SEG083 = IC_SEG_OFF;
            IC2_SEG082 = IC_SEG_OFF;
            IC2_SEG081 = IC_SEG_OFF;
            IC2_SEG034 = IC_SEG_OFF;
            IC2_SEG080 = IC_SEG_OFF;
        }
        if (m_Flag2 == 1u)
        {
            Num = m_minute / 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG030 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG030 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG029 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG029 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG088 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG088 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG087 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG087 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG031 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG031 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG086 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG086 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG085 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG085 = IC_SEG_OFF;
            }
            Num = m_minute % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG027 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG027 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG026 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG026 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG092 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG092 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG091 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG091 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG028 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG028 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG090 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG090 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG089 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG089 = IC_SEG_OFF;
            }
        }
        else
        {
            IC2_SEG030 = IC_SEG_OFF;
            IC2_SEG029 = IC_SEG_OFF;
            IC2_SEG088 = IC_SEG_OFF;
            IC2_SEG087 = IC_SEG_OFF;
            IC2_SEG086 = IC_SEG_OFF;
            IC2_SEG031 = IC_SEG_OFF;
            IC2_SEG085 = IC_SEG_OFF;
            IC2_SEG027 = IC_SEG_OFF;
            IC2_SEG026 = IC_SEG_OFF;
            IC2_SEG092 = IC_SEG_OFF;
            IC2_SEG091 = IC_SEG_OFF;
            IC2_SEG090 = IC_SEG_OFF;
            IC2_SEG028 = IC_SEG_OFF;
            IC2_SEG089 = IC_SEG_OFF;
        }
        m_Res = EX_OK;
    }
    return m_Res;
}

/**@brief 累计时间显示函数
 * @param[in]  m_hour            小时
 * @param[in]  m_Flag           是否显示     -1 显示 -0 不显示
 * @return  函数执行结果
 * - EX_OK      		上报成功
 * - EX_ERR        	上报失败
 */
_Fun_Res SEG_SET_Clock_ALL(uint8_t m_Flag, uint32_t m_NUM)
{
    _Fun_Res m_Res;
    uint32_t Num;
    uint8_t m8;
    if ((m_Flag > 2u) || (m_NUM > 99999u))
    {
        m_Res = EX_ERR;
    }
    else
    {
        if (m_Flag == 1u)
        {
            IC2_SEG077 = IC_SEG_ON;

            Num = m_NUM / 10000u;
            if (m_NUM > 10000 || checkself_seg_Flag == 1)
            {
                m8 = SEG_DISPLAY_NUMBER0[Num];
            }
            else
            {
                m8 = SEG_UNDISPLAY_NUMBER0[Num];
            }

            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG047 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG047 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG046 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG046 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG044 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG044 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG043 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG043 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG042 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG042 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG041 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG041 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG045 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG045 = IC_SEG_OFF;
            }
            /*千位*/
            Num = (m_NUM / 1000u) % 10u;
            if (m_NUM > 1000 || checkself_seg_Flag == 1)
            {
                m8 = SEG_DISPLAY_NUMBER0[Num];
            }
            else
            {
                m8 = SEG_UNDISPLAY_NUMBER0[Num];
            }

            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG054 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG054 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG053 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG053 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG051 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG051 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG050 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG050 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG049 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG049 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG048 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG048 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG052 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG052 = IC_SEG_OFF;
            }
            /*百位*/
            Num = (m_NUM / 100u) % 10u;
            if (m_NUM > 100 || checkself_seg_Flag == 1)
            {
                m8 = SEG_DISPLAY_NUMBER0[Num];
            }
            else
            {
                m8 = SEG_UNDISPLAY_NUMBER0[Num];
            }

            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG061 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG061 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG060 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG060 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG058 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG058 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG057 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG057 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG056 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG056 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG055 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG055 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG059 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG059 = IC_SEG_OFF;
            }
            /*十位*/
            Num = (m_NUM / 10u) % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            IC2_SEG069 = IC_SEG_ON;

            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG068 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG068 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG067 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG067 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG066 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG066 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG065 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG065 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG064 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG064 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG062 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG062 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG063 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG063 = IC_SEG_OFF;
            }
            /*个位*/
            Num = m_NUM % 10u;
            m8 = SEG_DISPLAY_NUMBER0[Num];
            if (Bit_Is_Set(m8, 0))
            {
                IC2_SEG076 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG076 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 1))
            {
                IC2_SEG075 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG075 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 2))
            {
                IC2_SEG073 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG073 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 3))
            {
                IC2_SEG072 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG072 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 4))
            {
                IC2_SEG071 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG071 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 5))
            {
                IC2_SEG070 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG070 = IC_SEG_OFF;
            }
            if (Bit_Is_Set(m8, 6))
            {
                IC2_SEG074 = IC_SEG_ON;
            }
            else
            {
                IC2_SEG074 = IC_SEG_OFF;
            }
        }
        else
        {
            IC2_SEG041 = IC_SEG_OFF;
            IC2_SEG042 = IC_SEG_OFF;
            IC2_SEG043 = IC_SEG_OFF;
            IC2_SEG044 = IC_SEG_OFF;
            IC2_SEG045 = IC_SEG_OFF;
            IC2_SEG046 = IC_SEG_OFF;
            IC2_SEG047 = IC_SEG_OFF;
            IC2_SEG048 = IC_SEG_OFF;
            IC2_SEG049 = IC_SEG_OFF;
            IC2_SEG050 = IC_SEG_OFF;
            IC2_SEG051 = IC_SEG_OFF;
            IC2_SEG052 = IC_SEG_OFF;
            IC2_SEG053 = IC_SEG_OFF;
            IC2_SEG054 = IC_SEG_OFF;
            IC2_SEG055 = IC_SEG_OFF;
            IC2_SEG056 = IC_SEG_OFF;
            IC2_SEG057 = IC_SEG_OFF;
            IC2_SEG058 = IC_SEG_OFF;
            IC2_SEG059 = IC_SEG_OFF;
            IC2_SEG060 = IC_SEG_OFF;
            IC2_SEG061 = IC_SEG_OFF;
            IC2_SEG062 = IC_SEG_OFF;
            IC2_SEG063 = IC_SEG_OFF;
            IC2_SEG064 = IC_SEG_OFF;
            IC2_SEG065 = IC_SEG_OFF;
            IC2_SEG066 = IC_SEG_OFF;
            IC2_SEG067 = IC_SEG_OFF;
            IC2_SEG068 = IC_SEG_OFF;
            IC2_SEG069 = IC_SEG_OFF;
            IC2_SEG070 = IC_SEG_OFF;
            IC2_SEG071 = IC_SEG_OFF;
            IC2_SEG072 = IC_SEG_OFF;
            IC2_SEG073 = IC_SEG_OFF;
            IC2_SEG074 = IC_SEG_OFF;
            IC2_SEG075 = IC_SEG_OFF;
            IC2_SEG076 = IC_SEG_OFF;
            IC2_SEG077 = IC_SEG_OFF;
        }

        m_Res = EX_OK;
    }
    return m_Res;
}
// uint8_t check_SEG_step = 0;

///*仪表段码扫描函数*/
// void Check_SEG_Display(void)
//{
//     uint32_t a;

//    a = check_SEG_step / 25u;

//    SEG_SET_TRIP_NUM(1u, ((a * 1000u) + (a * 100u) + (a * 10u) + a));
//    SEG_SET_ODO_NUM(1u, ((a * 100000u) + (a * 10000u) + (a * 1000u) + (a * 100u) + (a * 10u) + a));
//    SEG_SET_VSpeed_NUM(1u, (100u + (a * 10u) + a));
//    SEG_SET_Clock(((a * 10u) + a), ((a * 10u) + a), 1u, 1u, 1u);

//    SEG_SET_LED_STS(0, 1);
//    SEG_SET_LED_STS(1, 1);
//    SEG_SET_LED_STS(2, 1);

//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, LED_ON);
//    LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, LED_ON);
//    RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 1);
//    RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 1);

//    SEG_Scan_SET_FuelDial();
//    SEG_Scan_SET_EspeedDial();
//
//}

uint8_t Checkself_SEG_step = 0;
uint8_t Checkself_SEG_step_count = 0;
uint16_t Buzzer_time = 0;
void Checkself_Init(void)
{
    Checkself_SEG_step = 0;
    Checkself_SEG_step_count = 0;
    checkself_seg_Flag = 0;
    Buzzer_time = 0;
}
uint8_t soc_all = 0;
void Checkself_SEG_Display(void)
{
    // uint16_t Fuel = 0;
    uint16_t Trip = 0;
    uint16_t hour = 0;
    uint16_t min = 0;

    soc_all = (Checkself_SEG_step / 1) * 11 + 100;
    uint32_t allhour = (Checkself_SEG_step / 1) * 11111;
    // Fuel = Checkself_SEG_step / 5u;
    // SEG_SET_FuelDial(1, Fuel);

    SEG_SET_EleDial_AllSOC(1, soc_all);
    SEG_SET_EleDial_2SOC(1, (Checkself_SEG_step / 1) + 1);
    SEG_SET_EleDial_1SOC(1, (Checkself_SEG_step / 1) + 1);
    SEG_SET_Clock_ALL(1, allhour);
    hour = (Checkself_SEG_step / 1) * 11;
    min = (Checkself_SEG_step / 1) * 11;
    SEG_SET_Clock(hour, min, 1, 1, 1);
    SEG_SET_GEAR(1, (Checkself_SEG_step / 1), 1);
    SEG_SET_Cutterhead(1, (Checkself_SEG_step / 1), 1);
    if (Checkself_SEG_step_count < 20)
    {
        Checkself_SEG_step_count++;
    }
    else
    {
        Checkself_SEG_step_count = 20;
    }

    if (Checkself_SEG_step_count < 10)
    {
        Checkself_SEG_step++;
    }
    else
    {
        if (Checkself_SEG_step == 0)
        {
            Checkself_SEG_step = 0;
            SEG_SET_EleDial_2SOC(1, 0);
            SEG_SET_EleDial_1SOC(1, 0);
        }
        else
        {
            Checkself_SEG_step--;
        }
    }

    // if (Checkself_SEG_step_count < 60)
    // {
    //     Checkself_SEG_step_count++;
    // }
    // else
    // {
    //     Checkself_SEG_step_count = 60;
    // }

    // if (Checkself_SEG_step_count < 30)
    // {
    //     Checkself_SEG_step++;
    // }
    // else
    // {
    //     if (Checkself_SEG_step == 0)
    //     {
    //         Checkself_SEG_step = 0;
    //         SEG_SET_EleDial_2SOC(1, 0);
    //         SEG_SET_EleDial_1SOC(1, 0);
    //     }
    //     else
    //     {
    //         Checkself_SEG_step--;
    //     }
    // }
}

