DisplaySch_user.c 6.43 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10
#include "DisplaySch_user.h"
#include "Common_Interface.h"
#include "DispSch.h"
#include "Popup_Scheduler.h"
#include "Popup_List.h"
#include "Key.h"
#include "CAN_Lib.h"
#include "GUI.h"
#include "Services_ODO_User.h"        /*清空总计里程函数*/
#include "Menu.h"
hu's avatar
hu committed
11
#include "jcua.h"
hu's avatar
hu committed
12 13 14 15 16 17 18 19 20 21

uint32_t EnterTimer [ 10 ];
uint8_t  UE_EN [ Display_MAX ];
#pragma alignvar(8)
#pragma ghs section bss = default
uint8_t             Mem [ 32 ];
#pragma ghs section bss = default

#pragma ghs section  bss = ".myNonInitArea"
UE_CtrlInfo_Struct_t UE_CtrlInfo;
hu's avatar
hu committed
22
uint8_t BG_display_flag;
hu's avatar
hu committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
#pragma ghs section  bss = default

uint32_t       HMI_StartAnimationFrameCnt;

static void switch_branch(void);

uint8_t Get_Pwr(void)
{
    return Common_Get_IG_Sts( );
}
uint32_t Get_IG_ON(void)
{
    return Common_GetIgnOnTime( );
}
uint32_t Get_IG_Off(void)
{
    return Common_GetIgnOffTime( );
}

static const DispSch_Attr_st loc [] =
{
    {&UE_EN [ Display_StartAnimation ], UE_IGN_ON, Display_StartAnimation, (( void * )0), Display_StartAnimationEnter, Display_StartAnimationService, Display_StartAnimationExit},
    {&UE_EN [ Display_Menu ], UE_IGN_ON, Display_Menu, (( void * )0), (( void * )0), Display_MenuService, (( void * )0)},
    {&UE_EN [ Display_Alarm ], UE_IGN_ON, Display_Alarm, (( void * )0), (( void * )0), Display_AlarmService, (( void * )0)},
};

void DispSch_TotalInit(void)
{
    uint8_t        i;
    DispSch_Ext_st m_st;
    m_st.Get_Power        = Get_Pwr;
    m_st.Get_IG_ON_Timer  = Get_IG_ON;
    m_st.Get_IG_OFF_Timer = Get_IG_Off;
    m_st.Get_IG_OFF_Timer = Get_IG_Off;
    m_st.TotalSize        = Display_MAX;
    DispSch_Init(Mem, loc, &m_st, 0u);
    for ( i = 0u; i < Display_MAX; i++ )
    {
        UE_EN [ i ] = UE_Disable;
    }
}

void DisplayServices(void)
{
    uint32_t PowerOnTimer;
    uint32_t PowerOFFTimer;
    uint8_t  PowerStatus;
    uint16_t popupID = 0xFFFFu;

    PowerStatus      = Common_Get_IG_Sts( );
    PowerOnTimer     = Common_GetIgnOnTime( );
    PowerOFFTimer    = Common_GetIgnOffTime( );

    if ( (PowerOnTimer <= StartAnimationEnd) && (PowerOnTimer >= StartAnimationStart) )
    {
        UE_EN [ Display_StartAnimation ] = UE_Enable;
        UE_EN [ Display_Menu ]           = UE_Disable;
        UE_EN [ Display_Alarm ]          = UE_Disable;
    }
    else
    {
        //if (DisplayIdx < MENU_ITEM_PassWord_1)
        {
            popupID = Popup_Get_Current_Message( );
        }

        if ( popupID != 0xffffu )
        {
            UE_EN [ Display_Alarm ]         = UE_Enable;
        }
        else
        {
            UE_EN [ Display_Alarm ]          = UE_Disable;
            if ( PowerStatus == COMMON_POWER_ON )
            {
                UE_EN [ Display_Menu ] = UE_Enable;
            }
            else
            {
                UE_EN [ Display_Menu ] = UE_Disable;
            }
        }
    }
    DispSch_xxxMs_Logic(10u);
}

void Display_StartAnimationEnter(void)
{
    GUI_Display_background();
}

void Display_StartAnimationService(void)
{
    uint16_t m16_FrameCnt;

    HMI_StartAnimationFrameCnt++;
    m16_FrameCnt = HMI_StartAnimationFrameCnt;
    if ( (m16_FrameCnt % 3) == 0 )
    {
        loc_Disable_Window_App( );
        //GUI_Display_Animation_Frame(m16_FrameCnt / 3u);
        GUI_Display_background();
    }
}

void Display_StartAnimationExit(void)
{
    loc_Enable_Window_App( );
}

void Display_MenuService(void)
{
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    /*上短*/
    if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_SHORT_PRESS )
    {
        HMI_Clear_KEY_UP();
    }
    /*上长*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP == KEY_EVENT_LONG_PRESS )
    {
        HMI_Clear_KEY_UP();
    }
    /*下短*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_SHORT_PRESS )
    {
        HMI_Clear_KEY_DOWN();
    }
    /*下长*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN == KEY_EVENT_LONG_PRESS )
    {
        HMI_Clear_KEY_DOWN();
    }
    /*确认短*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SHORT_PRESS )
    {
        HMI_Clear_KEY_CONFIRM();
    }
    /*确认长*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_LONG_PRESS )
    {
        HMI_Clear_KEY_CONFIRM();
    }
    /*确认超长 30 S*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM == KEY_EVENT_SUPER_LONG_PRESS )
    {
        HMI_Clear_KEY_CONFIRM();
hu's avatar
hu committed
169

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
        /*TYW总计清零*/
        TYW_Data_ODO_Clear();
    }
    /*返回短*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_SHORT_PRESS )
    {
        HMI_Clear_KEY_CANCEL();
    }
    /*返回长*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL == KEY_EVENT_LONG_PRESS )
    {
        HMI_Clear_KEY_CANCEL();
    }
    /*MENU短*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_SHORT_PRESS )
    {
        HMI_Clear_KEY_MENU();
    }
    /*MENU长*/
    else if ( UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU == KEY_EVENT_LONG_PRESS )
    {
        HMI_Clear_KEY_MENU();
    }
    else
    {
        ;/*do nothing*/
    }
hu's avatar
hu committed
197 198 199 200 201 202 203 204
}
void Display_AlarmService(void)
{

}

void GUI_DisplayServices(void)
{
hu's avatar
hu committed
205
    if (BG_display_flag == 0)
hu's avatar
hu committed
206
    {
hu's avatar
hu committed
207
        BG_display_flag = 1;
hu's avatar
hu committed
208

hu's avatar
hu committed
209
        MenuInit();
hu's avatar
hu committed
210
    }
hu's avatar
hu committed
211
    else
hu's avatar
hu committed
212
    {
hu's avatar
hu committed
213 214 215
        if (bCurMenuIDX > _MN_DSP_LEVEPOPUP)
        {
            loc_Del_Sprite(ADAS_Sprite, Gear_Sprite);
hu's avatar
hu committed
216 217 218 219
            if (Common_Get_window_Sta() != 0u)
            {
                JCUA_Disable_window();
            }
hu's avatar
hu committed
220 221 222 223
        }
        else
        {
            loc_Del_Sprite(MENU_Sprite, MENU_Sprite);
hu's avatar
hu committed
224 225 226 227
            if (Common_Get_window_Sta() != 1u)
            {
                JCUA_Enable_window();
            }
hu's avatar
hu committed
228
        }
hu's avatar
hu committed
229

hu's avatar
hu committed
230 231
        MenuManage();
        //BG_display_flag = 0;
hu's avatar
hu committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
    }
}

void HMI_Set_KEY_UP(uint8_t u8KeyVal)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP = u8KeyVal;
}
void HMI_Set_KEY_DOWN(uint8_t u8KeyVal)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN = u8KeyVal;
}
void HMI_Set_KEY_CONFIRM(uint8_t u8KeyVal)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM = u8KeyVal;
}
void HMI_Set_KEY_CANCEL(uint8_t u8KeyVal)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL = u8KeyVal;
}
void HMI_Set_KEY_MENU(uint8_t u8KeyVal)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU = u8KeyVal;
}


void HMI_Clear_KEY_UP(void)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_UP = 0u;
}
void HMI_Clear_KEY_DOWN(void)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_DOWN = 0u;
}
void HMI_Clear_KEY_CONFIRM(void)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_CONFIRM = 0u;
}
void HMI_Clear_KEY_CANCEL(void)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_CANCEL = 0u;
}
void HMI_Clear_KEY_MENU(void)
{
    UE_CtrlInfo.HMI_KEYInfo.u8KEY_MENU = 0u;
}