#include "GUI_VC66_ADAS.h"
#include "Data_ADAS.h"



/*************************************/
uint8_t zh_processed_value_L = 0u;

/********************************/




/*ZH:*/

/*ADAS显示*/
void Gui_Display_ADAS(void)
{
    static uint8_t last_value_M = 0u;//记录上一次的值。
    uint8_t current_value_M = 0u;//本次获取的值。
    uint8_t processed_value_M = 0u;//经过处理的值。

    static uint8_t last_value_L= 0u;//记录上一次的值。
    uint8_t current_value_L = 0u;//本次获取的值。
    uint8_t processed_value_L = 0u;//经过处理的值。

    static uint8_t last_value_R = 0u;//记录上一次的值。
    uint8_t current_value_R = 0u;//本次获取的值。
    uint8_t processed_value_R = 0u;//经过处理的值。

    //刷文字“ADAS”：
    GUI_General_Display(ADAS_Sprite, CN_ADAS_wenzi, GUI_BLENDMODE_SRC_OVER);
    //刷4个绿色的边框框角：
    GUI_General_Display(ADAS_Sprite, CN_jiao1, GUI_BLENDMODE_SRC_OVER);
    GUI_General_Display(ADAS_Sprite, CN_jiao2, GUI_BLENDMODE_SRC_OVER);
    GUI_General_Display(ADAS_Sprite, CN_jiao3, GUI_BLENDMODE_SRC_OVER);
    GUI_General_Display(ADAS_Sprite, CN_jiao4, GUI_BLENDMODE_SRC_OVER);

/********************************************************/
    current_value_M = Gui_Get_WorkshopScope_DisplayMode();
    
    if (current_value_M <= 3u)
    {
        processed_value_M = current_value_M;
        last_value_M = current_value_M;
    }
    else
    {
        processed_value_M = last_value_M;
    }
/********************************************************/
    switch (processed_value_M)
    {
        case 0u:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);//向缓存放入等数量的空图
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 1u:{
                    GUI_General_Display(ADAS_Sprite, CN_che_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road4_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road3_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road2_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road1_shanshuo, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 2u:{
                    GUI_General_Display(ADAS_Sprite, CN_che_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road4, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road3, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road2, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road1, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 3u:{
                    GUI_General_Display(ADAS_Sprite, CN_che, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road4, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road3, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road2, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, CN_Road1, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        default:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);//向缓存放入等数量的空图
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;
    }


/****************************************************/
    current_value_L = Gui_Get_LDWS_Left_DisplayMode();
    
    if (current_value_L <= 4u)
    {
        processed_value_L = current_value_L;
        last_value_L = current_value_L;
    }
    else
    {
        processed_value_L = last_value_L;
    }
/****************************************************/





zh_processed_value_L = processed_value_L;






    switch (processed_value_L)
    {
        case 0u:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);//向缓存放入等数量的空图
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 1u:{
                    if (FLASH_SYNC_1Hz)//1Hz闪烁
                    {
                        GUI_General_Display(ADAS_Sprite, CN_LeftRoad_shanshuo, GUI_BLENDMODE_SRC_OVER);
                        GUI_General_Display(ADAS_Sprite, CN_RightRoad_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    }
                    else
                    {
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);//向缓存放入等数量的空图
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    }

                }
                break;

        case 2u:{
                    GUI_General_Display(ADAS_Sprite, CN_LeftRoad_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 3u:{
                    GUI_General_Display(ADAS_Sprite, CN_LeftRoad, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 4u:{
                    if (FLASH_SYNC_2Hz)//2.5Hz闪烁
                    {
                        
                        GUI_General_Display(ADAS_Sprite, CN_LeftRoad, GUI_BLENDMODE_SRC_OVER);
                        GUI_General_Display(ADAS_Sprite, CN_tanhao1, GUI_BLENDMODE_SRC_OVER);
                    }
                    else
                    {
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    }
                }
                break;

        default:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;
    }


/*************************************************/
current_value_R = Gui_Get_LDWS_Right_DisplayMode();
    
    if (current_value_R <= 4u)
    {
        processed_value_R = current_value_R;
        last_value_R = current_value_R;
    }
    else
    {
        processed_value_R = last_value_R;
    }

/*************************************************/
    switch (processed_value_R)
    {
        case 0u:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 1u:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 2u:{
                    GUI_General_Display(ADAS_Sprite, CN_RightRoad_shanshuo, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 3u:{
                    GUI_General_Display(ADAS_Sprite, CN_RightRoad, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;

        case 4u:{
                    if (FLASH_SYNC_2Hz)//2.5Hz闪烁
                    {
                        
                        GUI_General_Display(ADAS_Sprite, CN_RightRoad, GUI_BLENDMODE_SRC_OVER);
                        GUI_General_Display(ADAS_Sprite, CN_tanhao2, GUI_BLENDMODE_SRC_OVER);
                    }
                    else
                    {
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                        GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    }
                }
                break;

        default:{
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                    GUI_General_Display(ADAS_Sprite, SpriteSize, GUI_BLENDMODE_SRC_OVER);
                }
                break;
    }


}

