#include "main.h"


void Lcd_AchSetting_Display(void);
void Lcd_Ach150M_Display(void);
void Lcd_AchWifi_Display(void);
void Lcd_Ach30G_Display(void);
void Lcd_BchSetting_Display(void);
void Lcd_Bch150M_Display(void);
void Lcd_BchWifi_Display(void);
void Lcd_Bch30G_Display(void);
void LCD_150M_ValueChange_Display(Layer_t layer,float* data,float offset);
void LCD_Wifi_ValueChange_Display(Layer_t layer,float* data,float offset);
void LCD_30G_ValueChange_Display(Layer_t layer,float* data,float offset);

////////////////////////////////////////////////////////////////////////////////////////////
void LCD_Wifi_Freq_Select_Display(Layer_t layer,float* db_value);
void LCD_30G_Freq_Select_Display(Layer_t layer,float* db_value);

float Ach_150M_Value = 0;

float Ach_Wifi_2_4GHz_Value = 0;
float Ach_Wifi_5_8GHz_Value = 0;

float Ach_30G_28_28_5_Value = 0;
float Ach_30G_28_5_29_Value = 0;
float Ach_30G_29_29_5_Value = 0;
float Ach_30G_29_5_30_Value = 0;

float Bch_150M_Value = 0;
float Bch_Wifi_2_4GHz_Value = 0;
float Bch_Wifi_5_8GHz_Value = 0;

float Bch_30G_28_28_5_Value = 0;
float Bch_30G_28_5_29_Value = 0;
float Bch_30G_29_29_5_Value = 0;
float Bch_30G_29_5_30_Value = 0;

uint8_t Button_Data_Occur = 0;

typedef struct{
	uint16_t RW_PIN;
	uint16_t RS;
	uint16_t E;
	uint16_t Reset;
	uint16_t DB0;
	uint16_t DB1;
	uint16_t DB2;
	uint16_t DB3;
	uint16_t DB4;
	uint16_t DB5;
	uint16_t DB6;
	uint16_t DB7;
	GPIO_TypeDef * RW_PIN_Port;
	GPIO_TypeDef * RS_Port;
	GPIO_TypeDef * E_Port;
	GPIO_TypeDef * DB0_Port;
	GPIO_TypeDef * DB1_Port;
	GPIO_TypeDef * DB2_Port;
	GPIO_TypeDef * DB3_Port;
	GPIO_TypeDef * DB4_Port;
	GPIO_TypeDef * DB5_Port;
	GPIO_TypeDef * DB6_Port;
	GPIO_TypeDef * DB7_Port;
}lcd_Pin_st;
uint8_t LCD_Button_Read(void){
    uint8_t ret;
    uint8_t temp = 0;
    
    for(uint8_t i = 0; i < 5; i++){
        if(switchcnt[i] == 1){
            return true;
        }
    }    
    return false;    
}

void ButtonDataSet(uint8_t val){
    Button_Data_Occur = val;
}
uint8_t ButtonDataGet(void){
    return Button_Data_Occur;
}

void LCD_M68_DataWrite_COMMAND_Init(void){
	LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0x0C);

////////////////////////////////AAAAAAAAAAAAAAAAAA///////////////////////////////////////
    Ach_150M_Value = Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_150M);

    Ach_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI2_4Ghz_QPC6614_1);
    Ach_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI2_4Ghz_QPC6614_2);
    Ach_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI2_4Ghz_QPC6614_3);
    Ach_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI2_4Ghz_QPC6614_4);    
    Ach_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI5_8Ghz_QPC6614_1);
    Ach_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI5_8Ghz_QPC6614_2);
    Ach_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI5_8Ghz_QPC6614_3);
    Ach_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_A_CH_WIFI5_8Ghz_QPC6614_4);    

    Ach_30G_28_28_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_28_5_HMC939_1);
    Ach_30G_28_28_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_28_5_HMC939_2);
    Ach_30G_28_28_5_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_28_5_ADRF5720_1);

    Ach_30G_28_5_29_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_5_29_HMC939_1);
    Ach_30G_28_5_29_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_5_29_HMC939_2);
    Ach_30G_28_5_29_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_28_5_29_ADRF5720_1);

    Ach_30G_29_29_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_29_5_HMC939_1);
    Ach_30G_29_29_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_29_5_HMC939_2);
    Ach_30G_29_29_5_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_29_5_ADRF5720_1);

    Ach_30G_29_5_30_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_5_30_HMC939_1);
    Ach_30G_29_5_30_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_5_30_HMC939_2);
    Ach_30G_29_5_30_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_A_CH_30G_29_5_30_ADRF5720_1);

/////////////////////////////////BBBBBBBBBBBBBBBBB///////////////////////////////////////
    Bch_150M_Value = Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_150M);
    Bch_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI2_4Ghz_QPC6614_1);
    Bch_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI2_4Ghz_QPC6614_2);
    Bch_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI2_4Ghz_QPC6614_3);
    Bch_Wifi_2_4GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI2_4Ghz_QPC6614_4);    
    Bch_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI5_8Ghz_QPC6614_1);
    Bch_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI5_8Ghz_QPC6614_2);
    Bch_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI5_8Ghz_QPC6614_3);
    Bch_Wifi_5_8GHz_Value += Atten_QPC6614_TraceValue_Func(Atten_Setting.ATT_B_CH_WIFI5_8Ghz_QPC6614_4);    

    Bch_30G_28_28_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_28_5_HMC939_1);
    Bch_30G_28_28_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_28_5_HMC939_2);
    Bch_30G_28_28_5_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_28_5_ADRF5720_1);

    Bch_30G_28_5_29_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_5_29_HMC939_1);
    Bch_30G_28_5_29_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_5_29_HMC939_2);
    Bch_30G_28_5_29_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_28_5_29_ADRF5720_1);

    Bch_30G_29_29_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_29_5_HMC939_1);
    Bch_30G_29_29_5_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_29_5_HMC939_2);
    Bch_30G_29_29_5_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_29_5_ADRF5720_1);

    Bch_30G_29_5_30_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_5_30_HMC939_1);
    Bch_30G_29_5_30_Value += Atten_HMC939_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_5_30_HMC939_2);
    Bch_30G_29_5_30_Value += Atten_ADRF5720_TraceValue_Func(Atten_Setting.ATT_B_CH_30G_29_5_30_ADRF5720_1);
    
}
void LCD_M68_DataWrite_COMMAND_Cusor_ON(void){
	LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0x0F);
}
void LCD_M68_DataWrite_COMMAND_Cusor_OFF(void){
	LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0x0C);
}

void LCD_M68_DataWrite_Clear(void){
    LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0x01);
}
void LCD_M68_DataWrite_LineChage(LCD_line_t line){
    if(line == First_Line)
        LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0x80);
    else
        LCD_M68_DataWrite_COMMAND2(Line_default,Instruction_CMD,0xC0);
}

uint8_t LCD_Str_Filter(uint8_t* str){
    uint8_t len = 0;
    uint8_t temp_str[32] = {0,};
    while (str[len] != NULL)               // 자른 문자열이 나오지 않을 때까지 반복
    {
        len++;
    }
    return len;
}
void LCD_M68_DataWrite_COMMAND(LCD_line_t line,uint8_t cmd,uint8_t* data){
    uint8_t len = 0;
    lcd_Pin_st lcdset;
	uint16_t temp_Pinbuf[8]={0,};
	GPIO_TypeDef* temp_Portbuf[8]={0,};
    lcdset.RW_PIN = GPIO_PIN_12;//pd
    lcdset.RS     = GPIO_PIN_11;//pd
    lcdset.E      = GPIO_PIN_13;//pd
    lcdset.DB0    = GPIO_PIN_14;//pd
    lcdset.DB1	  = GPIO_PIN_15;//pd
    lcdset.DB2	  = GPIO_PIN_2;//pg
    lcdset.DB3	  = GPIO_PIN_3;//pg
    lcdset.DB5	  = GPIO_PIN_4;//pg
    lcdset.DB4    = GPIO_PIN_5;//pg
    lcdset.DB6	  = GPIO_PIN_6;//pg
    lcdset.DB7	  = GPIO_PIN_7;//pg
    len = LCD_Str_Filter(&data[0]);
    for(uint8_t i = 0; i < len; i++){
        if(line != Line_default)
            LCD_M68_DataWrite_LineChage(line); // Line feed
        if(line == Second_Line)
           line = Line_default;

    	HAL_GPIO_WritePin(GPIOD, lcdset.E|lcdset.RS|lcdset.RW_PIN|lcdset.DB0|lcdset.DB1  , GPIO_PIN_RESET); 		
    	HAL_GPIO_WritePin(GPIOG, lcdset.DB2|lcdset.DB3|lcdset.DB4|lcdset.DB5|lcdset.DB6|lcdset.DB7, GPIO_PIN_RESET);
    	//PIN Init

    	if(cmd == Instruction_CMD){
    		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_RESET);  // Init Instruction CMD  
    	}else{
    		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_SET);		//Init Data CMD
    	}

    	memcpy(&temp_Pinbuf[0] ,&lcdset.DB0     ,8);
    	memcpy(&temp_Portbuf[0],&lcdset.DB0_Port,8);
    	
        HAL_GPIO_WritePin(GPIOD, lcdset.E  , GPIO_PIN_SET);  	
    	if(data[i] & 0x01)
    		HAL_GPIO_WritePin(GPIOD, lcdset.DB0, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOD, lcdset.DB0, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x02)
    		HAL_GPIO_WritePin(GPIOD, lcdset.DB1, GPIO_PIN_SET);
    	else 
    		HAL_GPIO_WritePin(GPIOD, lcdset.DB1, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x04)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB2, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB2, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x08)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB3, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB3, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x10)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB4, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB4, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x20)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB5, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB5, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x40)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB6, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB6, GPIO_PIN_RESET);
    	
    	if(data[i] & 0x80)
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB7, GPIO_PIN_SET);
    	else
    		HAL_GPIO_WritePin(GPIOG, lcdset.DB7, GPIO_PIN_RESET);
    								
    		
    	HAL_GPIO_WritePin(GPIOD, lcdset.E  , GPIO_PIN_RESET);  		//Init E Line
    	if(cmd == Instruction_CMD){
    		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_SET);		//Init Data CMD
    	}else{
    		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_RESET);  // Init Instruction CMD  
    	}
    }
}
void LCD_M68_DataWrite_COMMAND2(LCD_line_t line,uint8_t cmd,uint8_t data){
    lcd_Pin_st lcdset;
	uint16_t temp_Pinbuf[8]={0,};
	GPIO_TypeDef* temp_Portbuf[8]={0,};
    lcdset.RW_PIN = GPIO_PIN_12;//pd
    lcdset.RS     = GPIO_PIN_11;//pd
    lcdset.E      = GPIO_PIN_13;//pd
    lcdset.DB0    = GPIO_PIN_14;//pd
    lcdset.DB1	  = GPIO_PIN_15;//pd
    lcdset.DB2	  = GPIO_PIN_2;//pg
    lcdset.DB3	  = GPIO_PIN_3;//pg
    lcdset.DB5	  = GPIO_PIN_4;//pg
    lcdset.DB4    = GPIO_PIN_5;//pg
    lcdset.DB6	  = GPIO_PIN_6;//pg
    lcdset.DB7	  = GPIO_PIN_7;//pg

    if(line != Line_default)
        LCD_M68_DataWrite_LineChage(line); // Line feed

	HAL_GPIO_WritePin(GPIOD, lcdset.E|lcdset.RS|lcdset.RW_PIN|lcdset.DB0|lcdset.DB1  , GPIO_PIN_RESET); 		
	HAL_GPIO_WritePin(GPIOG, lcdset.DB2|lcdset.DB3|lcdset.DB4|lcdset.DB5|lcdset.DB6|lcdset.DB7, GPIO_PIN_RESET);
	//PIN Init

	if(cmd == Instruction_CMD){
		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_RESET);  // Init Instruction CMD  
	}else{
		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_SET);		//Init Data CMD
	}

	memcpy(&temp_Pinbuf[0] ,&lcdset.DB0     ,8);
	memcpy(&temp_Portbuf[0],&lcdset.DB0_Port,8);
	
    HAL_GPIO_WritePin(GPIOD, lcdset.E  , GPIO_PIN_SET);  	
	if(data & 0x01)
		HAL_GPIO_WritePin(GPIOD, lcdset.DB0, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOD, lcdset.DB0, GPIO_PIN_RESET);
	
	if(data & 0x02)
		HAL_GPIO_WritePin(GPIOD, lcdset.DB1, GPIO_PIN_SET);
	else 
		HAL_GPIO_WritePin(GPIOD, lcdset.DB1, GPIO_PIN_RESET);
	
	if(data & 0x04)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB2, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB2, GPIO_PIN_RESET);
	
	if(data & 0x08)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB3, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB3, GPIO_PIN_RESET);
	
	if(data & 0x10)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB4, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB4, GPIO_PIN_RESET);
	
	if(data & 0x20)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB5, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB5, GPIO_PIN_RESET);
	
	if(data & 0x40)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB6, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB6, GPIO_PIN_RESET);
	
	if(data & 0x80)
		HAL_GPIO_WritePin(GPIOG, lcdset.DB7, GPIO_PIN_SET);
	else
		HAL_GPIO_WritePin(GPIOG, lcdset.DB7, GPIO_PIN_RESET);
								
		
	HAL_GPIO_WritePin(GPIOD, lcdset.E  , GPIO_PIN_RESET);  		//Init E Line
	if(cmd == Instruction_CMD){
		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_SET);		//Init Data CMD
	}else{
		HAL_GPIO_WritePin(GPIOD, lcdset.RS , GPIO_PIN_RESET);  // Init Instruction CMD  
	}
}

Layer_t Curr_Layer =Menu_Layer; 

void Layer_Set(Layer_t layer){
    Curr_Layer = layer;

}
Layer_t Layer_Get(void){
    return Curr_Layer;
}
Layer_t prev_layer = 0xff;

void Character_Lcd_chMenu(AttenButton_t button){
    static uint8_t initialize = 0;
    static uint8_t temp_button = 0xFF;
    Layer_t temp_Layer = Layer_Get();
   
    if(initialize == 0){
        switch(button){
            case Power_On :
                LCD_M68_DataWrite_Clear();
                LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"Channel Setting");
                LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,"press any Button");    

                break;
            default:
                Lcd_AchSetting_Display();
                initialize = 1;
                break;
        }
    }else{
        if(button == Button_MENU || button == Button_ESC){
            Lcd_AchSetting_Display();
        }else{
            switch(temp_Layer){
                case AChSetting_Layer:
                    if(button == Button_DOWN){
                        Lcd_BchSetting_Display();
                    }
                    else if(button == Button_ENTER){
                        Lcd_Ach150M_Display();
                    }                
                    break;
                case BChSetting_Layer:
                    if(button == Button_UP){
                        Lcd_AchSetting_Display();
                    }  
                    else if(button == Button_ENTER){
                        Lcd_Bch150M_Display();
                    }                
                    break;

/////////////////////////////////////////////////////////////////////////////////////////////////////////                    
                case AChSetting_150M_Layer:
                    if(button == Button_DOWN){
                        Lcd_AchWifi_Display();
                    }
                    else if(button == Button_ENTER){
                        LCD_150M_ValueChange_Display(AChSetting_Change150M_Layer,&Ach_150M_Value,0);
                    }
                    break;

                    
                case AChSetting_WIFI_Layer:
                    if(button == Button_DOWN){
                        Lcd_Ach30G_Display();
                    }
                    else if(button == Button_UP){
                         Lcd_Ach150M_Display();
                    }else if (button == Button_ENTER){
                        LCD_Wifi_Freq_Select_Display(AChSetting_SelectWIFI2_4GHz_Layer,&Ach_Wifi_2_4GHz_Value);
                    }
                    break;

                    
                case AChSetting_30GHz_Layer:
                    if(button == Button_UP){
                        Lcd_AchWifi_Display();
                    }else if (button == Button_ENTER){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_28_5_Layer,&Ach_30G_28_28_5_Value);
                    }
                    break;

                    
                case BChSetting_150M_Layer:
                    if(button == Button_DOWN){
                        Lcd_BchWifi_Display();
                    }else if (button == Button_ENTER){
                         LCD_150M_ValueChange_Display(BChSetting_Change150M_Layer,&Bch_150M_Value,0);
                    }
                    break;
                    
                case BChSetting_WIFI_Layer:
                    if(button == Button_DOWN){
                        Lcd_Bch30G_Display();
                    }
                    else if(button == Button_UP){
                         Lcd_Bch150M_Display();
                    }else if (button == Button_ENTER){
                        LCD_Wifi_Freq_Select_Display(BChSetting_SelectWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value);
                    }
                    break;
                case BChSetting_30GHz_Layer:
                    if(button == Button_UP){
                         Lcd_BchWifi_Display();
                    }else if (button == Button_ENTER){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_28_5_Layer,&Bch_30G_28_28_5_Value);
                    }
                    break;
/////////////////////////////////////////////////////////////////////////////////////////////////////////                    

                case AChSetting_SelectWIFI2_4GHz_Layer:    
                    if(button == Button_DOWN){
                        LCD_Wifi_Freq_Select_Display(AChSetting_SelectWIFI5_8GHz_Layer,&Ach_Wifi_5_8GHz_Value);
                    }
                    else if (button == Button_ENTER){
                        LCD_Wifi_ValueChange_Display(AChSetting_ChangeWIFI2_4GHz_Layer,&Ach_Wifi_2_4GHz_Value,0);
                    }

                    break;
                case AChSetting_SelectWIFI5_8GHz_Layer:     
                    if(button == Button_UP){
                        LCD_Wifi_Freq_Select_Display(AChSetting_SelectWIFI2_4GHz_Layer,&Ach_Wifi_2_4GHz_Value);
                    }else if (button == Button_ENTER){
                        LCD_Wifi_ValueChange_Display(AChSetting_ChangeWIFI5_8GHz_Layer,&Ach_Wifi_5_8GHz_Value,0);
                    }
                    break;

                    
                case AChSetting_Select30GHz28_28_5_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_5_29_Layer,&Ach_30G_28_5_29_Value);
                    }
                    else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(AChSetting_Change30GHz28_28_5_Layer,&Ach_30G_28_28_5_Value,0);
                    }
                    break;
                case AChSetting_Select30GHz28_5_29_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz29_29_5_Layer,&Ach_30G_29_29_5_Value);
                    }
                    else if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_28_5_Layer,&Ach_30G_28_28_5_Value);
                        
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(AChSetting_Change30GHz28_5_29_Layer,&Ach_30G_28_5_29_Value,0);
                        
                    }
                    break;
                case AChSetting_Select30GHz29_29_5_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz29_5_30_Layer,&Ach_30G_29_5_30_Value);
                    }
                    else if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_5_29_Layer,&Ach_30G_28_5_29_Value);
                        
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(AChSetting_Change30GHz29_29_5_Layer,&Ach_30G_29_29_5_Value,0);
                    }
                    break;
                case AChSetting_Select30GHz29_5_30_Layer:   
                    if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz29_29_5_Layer,&Ach_30G_29_29_5_Value);
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(AChSetting_Change30GHz29_5_30_Layer,&Ach_30G_29_5_30_Value,0);
                    }
                    break;
                    
                case BChSetting_SelectWIFI2_4GHz_Layer:    
                    if(button == Button_DOWN){
                        LCD_Wifi_Freq_Select_Display(BChSetting_SelectWIFI5_8GHz_Layer,&Bch_Wifi_5_8GHz_Value);
                    }
                    else if (button == Button_ENTER){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value,0);
                    }
                
                    break;
                case BChSetting_SelectWIFI5_8GHz_Layer:     
                    if(button == Button_UP){
                        LCD_Wifi_Freq_Select_Display(BChSetting_SelectWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value);
                    }else if (button == Button_ENTER){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI5_8GHz_Layer,&Bch_Wifi_5_8GHz_Value,0);
                    }
                    break;
                
                    
                case BChSetting_Select30GHz28_28_5_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_5_29_Layer,&Bch_30G_28_5_29_Value);
                    }
                    else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(BChSetting_Change30GHz28_28_5_Layer,&Bch_30G_28_28_5_Value,0);
                    }
                    break;
                case BChSetting_Select30GHz28_5_29_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz29_29_5_Layer,&Bch_30G_29_29_5_Value);
                    }
                    else if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_28_5_Layer,&Bch_30G_28_28_5_Value);
                        
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(BChSetting_Change30GHz28_5_29_Layer,&Bch_30G_28_5_29_Value,0);
                        
                    }
                    break;
                case BChSetting_Select30GHz29_29_5_Layer:   
                    if(button == Button_DOWN){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz29_5_30_Layer,&Bch_30G_29_5_30_Value);
                    }
                    else if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_5_29_Layer,&Bch_30G_28_5_29_Value);
                        
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(BChSetting_Change30GHz29_29_5_Layer,&Bch_30G_29_29_5_Value,0);
                    }
                    break;
                case BChSetting_Select30GHz29_5_30_Layer:   
                    if(button == Button_UP){
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz29_29_5_Layer,&Bch_30G_29_29_5_Value);
                    }else if (button == Button_ENTER){
                        LCD_30G_ValueChange_Display(BChSetting_Change30GHz29_5_30_Layer,&Bch_30G_29_5_30_Value,0);
                    }
                    break;
/////////////////////////////////////////////////////////////////////////////////////////////////////////                    
                case AChSetting_Change150M_Layer:  
                    if(button == Button_UP){
                        LCD_150M_ValueChange_Display(temp_Layer,&Ach_150M_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        LCD_150M_ValueChange_Display(temp_Layer,&Ach_150M_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_150M_DataSet(Ach_150M_Value,ATT_A_CH_150M);
                        Lcd_Ach150M_Display();
                    }
                    break;
                case AChSetting_ChangeWIFI2_4GHz_Layer: 
                    if(button == Button_UP){
                        LCD_Wifi_ValueChange_Display(temp_Layer,&Ach_Wifi_2_4GHz_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        LCD_Wifi_ValueChange_Display(temp_Layer,&Ach_Wifi_2_4GHz_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_Wifi_DataSet(Ach_Wifi_2_4GHz_Value,ATT_A_CH_WIFI2_4Ghz);
                        LCD_Wifi_Freq_Select_Display(AChSetting_SelectWIFI2_4GHz_Layer,&Ach_Wifi_2_4GHz_Value);
                    }
                    break;                    
                case AChSetting_ChangeWIFI5_8GHz_Layer: 
                    if(button == Button_UP){
                        LCD_Wifi_ValueChange_Display(temp_Layer,&Ach_Wifi_5_8GHz_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        LCD_Wifi_ValueChange_Display(temp_Layer,&Ach_Wifi_5_8GHz_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_Wifi_DataSet(Ach_Wifi_5_8GHz_Value,ATT_A_CH_WIFI5_8Ghz);
                         LCD_Wifi_Freq_Select_Display(AChSetting_SelectWIFI5_8GHz_Layer,&Ach_Wifi_5_8GHz_Value);
                    }
                    break;
                case AChSetting_Change30GHz28_28_5_Layer:  
                    if(button == Button_UP){
                        if(Ach_30G_28_28_5_Value < 60)
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_28_5_Value,1);
                        else
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_28_5_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        if(Ach_30G_28_28_5_Value < 60)                        
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_28_5_Value,-1);
                        else
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_28_5_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Ach_30G_28_28_5_Value,ATT_A_CH_30G_28_28_5);
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_28_5_Layer,&Ach_30G_28_28_5_Value);
                    }
                    break;
                case AChSetting_Change30GHz28_5_29_Layer:  
                    if(button == Button_UP){
                         if(Ach_30G_28_5_29_Value < 60)
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_5_29_Value,1);
                         else
                            LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_5_29_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        if(Ach_30G_28_5_29_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_5_29_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_28_5_29_Value,-0.5);

                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Ach_30G_28_5_29_Value,ATT_A_CH_30G_28_5_29);
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz28_5_29_Layer,&Ach_30G_28_5_29_Value);
                    }
                    break;
                case AChSetting_Change30GHz29_29_5_Layer:  
                    if(button == Button_UP){
                        if(Ach_30G_29_29_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_29_5_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_29_5_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        if(Ach_30G_29_29_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_29_5_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_29_5_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Ach_30G_29_29_5_Value,ATT_A_CH_30G_29_29_5);
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz29_29_5_Layer,&Ach_30G_29_29_5_Value);
                    }
                    break;
                case AChSetting_Change30GHz29_5_30_Layer:  
                    if(button == Button_UP){
                        if(Ach_30G_29_5_30_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_5_30_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_5_30_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        if(Ach_30G_29_5_30_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_5_30_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Ach_30G_29_5_30_Value,-0.5);

                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Ach_30G_29_5_30_Value,ATT_A_CH_30G_29_5_30);
                        LCD_30G_Freq_Select_Display(AChSetting_Select30GHz29_5_30_Layer,&Ach_30G_29_5_30_Value);
                    }
                    break;                    

                case BChSetting_Change150M_Layer:  
                    if(button == Button_UP)
                        LCD_150M_ValueChange_Display(BChSetting_Change150M_Layer,&Bch_150M_Value,0.5);
                    else if(button == Button_DOWN)
                        LCD_150M_ValueChange_Display(BChSetting_Change150M_Layer,&Bch_150M_Value,-0.5);
                    else if(button == Button_ENTER){
                        Atten_150M_DataSet(Bch_150M_Value,ATT_B_CH_150M);
                        Lcd_Bch150M_Display();
                    }
                    break;
                case BChSetting_ChangeWIFI2_4GHz_Layer: 
                    if(button == Button_UP){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_Wifi_DataSet(Bch_Wifi_2_4GHz_Value,ATT_B_CH_WIFI2_4Ghz);
                        LCD_Wifi_Freq_Select_Display(BChSetting_SelectWIFI2_4GHz_Layer,&Bch_Wifi_2_4GHz_Value);
                    }
                    break;                    
                case BChSetting_ChangeWIFI5_8GHz_Layer: 
                    if(button == Button_UP){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI5_8GHz_Layer,&Bch_Wifi_5_8GHz_Value,0.5);
                    }
                    else if(button == Button_DOWN){
                        LCD_Wifi_ValueChange_Display(BChSetting_ChangeWIFI5_8GHz_Layer,&Bch_Wifi_5_8GHz_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_Wifi_DataSet(Bch_Wifi_5_8GHz_Value,ATT_B_CH_WIFI5_8Ghz);
                        LCD_Wifi_Freq_Select_Display(BChSetting_SelectWIFI5_8GHz_Layer,&Bch_Wifi_5_8GHz_Value);
                    }
                    break; 

                case BChSetting_Change30GHz28_28_5_Layer:  
                    if(button == Button_UP){
                        if(Bch_30G_28_28_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_28_5_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_28_5_Value,0.5);

                    }
                    else if(button == Button_DOWN){
                        if(Bch_30G_28_28_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_28_5_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_28_5_Value,-0.5);

                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Bch_30G_28_28_5_Value,ATT_B_CH_30G_28_28_5);
                         LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_28_5_Layer,&Bch_30G_28_28_5_Value);
                    }
                    break;     
                case BChSetting_Change30GHz28_5_29_Layer:  
                    if(button == Button_UP){
                        if(Bch_30G_28_5_29_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_5_29_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_5_29_Value,0.5);

                    }
                    else if(button == Button_DOWN){
                        if(Bch_30G_28_5_29_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_5_29_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_28_5_29_Value,-0.5);

                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Bch_30G_28_5_29_Value,ATT_B_CH_30G_28_5_29);
                         LCD_30G_Freq_Select_Display(BChSetting_Select30GHz28_5_29_Layer,&Bch_30G_28_5_29_Value);
                    }
                    break;    
                case BChSetting_Change30GHz29_29_5_Layer:  
                    if(button == Button_UP){
                        if(Bch_30G_29_29_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_29_5_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_29_5_Value,0.5);

                    }
                    else if(button == Button_DOWN){
                        if(Bch_30G_29_29_5_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_29_5_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_29_5_Value,-0.5);

                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Bch_30G_29_29_5_Value,ATT_B_CH_30G_29_29_5);
                         LCD_30G_Freq_Select_Display(BChSetting_Select30GHz29_29_5_Layer,&Bch_30G_29_29_5_Value);
                    }
                    break;    
                case BChSetting_Change30GHz29_5_30_Layer:  
                    if(button == Button_UP){
                        if(Bch_30G_29_5_30_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_5_30_Value,1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_5_30_Value,0.5);

                    }
                    else if(button == Button_DOWN){
                        if(Bch_30G_29_5_30_Value < 60)
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_5_30_Value,-1);
                        else
                           LCD_30G_ValueChange_Display(temp_Layer,&Bch_30G_29_5_30_Value,-0.5);
                    }
                    else if(button == Button_ENTER){
                        Atten_30G_DataSet(Bch_30G_29_5_30_Value,ATT_B_CH_30G_29_5_30);
                        LCD_30G_Freq_Select_Display(BChSetting_Select30GHz29_5_30_Layer,&Bch_30G_29_5_30_Value);
                    }
                    break;    


/////////////////////////////////////////////////////////////////////////////////////////////////////////                    
            }
        }
    }
}

void Lcd_AchSetting_Display(void)
{
    uint8_t temp_str[16]  = {0,};
    static float value = 0;
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();
    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"   A Channel   ");
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    sprintf(temp_str, "    Setting");    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(AChSetting_Layer);
}
void Lcd_Ach150M_Display(void){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  A Ch 150MHz ");
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    sprintf(temp_str, "    %05.2f    dB", Ach_150M_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(AChSetting_150M_Layer);

}
void Lcd_AchWifi_Display(void){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"   A Ch WIFI  ");
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    sprintf(temp_str, "    %05.2f    dB", Ach_Wifi_2_4GHz_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(AChSetting_WIFI_Layer);   

}


void Lcd_Ach30G_Display(void){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"   A Ch 30G");

    sprintf(temp_str, "    %05.2f    dB", Ach_30G_28_28_5_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(AChSetting_30GHz_Layer);  
}
void Lcd_BchSetting_Display(void)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();
    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  B Channel");
    sprintf(temp_str, "    Setting"); 
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(BChSetting_Layer);
}
void Lcd_Bch150M_Display(void)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  B Ch 150MHz ");
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);

    sprintf(temp_str, "    %05.2f    dB", Bch_150M_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(BChSetting_150M_Layer);
}
void Lcd_BchWifi_Display(void)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  B Ch WIFI  ");
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);

    sprintf(temp_str, "    %05.2f    dB", Bch_Wifi_2_4GHz_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(BChSetting_WIFI_Layer); 

}

void Lcd_Bch30G_Display(void)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();
    LCD_M68_DataWrite_Clear();
    LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
    LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"   B Ch 30G");

    sprintf(temp_str, "    %05.2f    dB", Bch_30G_28_28_5_Value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(BChSetting_30GHz_Layer); 
}
void LCD_150M_ValueChange_Display(Layer_t layer,float* data,float offset){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_ON();
    *data += offset;
    if(*data > 30){
        *data = 30;
        return;
    }else if (*data < 0){
        *data = 0;
        return;
    }
    sprintf(temp_str, "    %05.2f    dB", *data);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    
     Layer_Set(layer);

}

void LCD_Wifi_ValueChange_Display(Layer_t layer,float* data,float offset){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_ON();
    *data += offset;
    if(*data > 120){
        *data = 120;
        return;
    }else if (*data < 0){
        *data = 0;
        return;
    }

    sprintf(temp_str, "    %05.2f    dB", *data);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(layer);
}
void LCD_30G_ValueChange_Display(Layer_t layer,float* data,float offset){
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_ON();
    *data += offset;
    if(*data > 90){
        *data = 90;
        return;
    }else if (*data < 0){
        *data = 0;
        return;
    }

    sprintf(temp_str, "    %05.2f    dB", *data);   
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(layer);
}

////////////////////////////////////////////////////////////////////////////////////////////
void LCD_Wifi_Freq_Select_Display(Layer_t layer,float* db_value)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    if(layer == AChSetting_SelectWIFI2_4GHz_Layer || layer == BChSetting_SelectWIFI2_4GHz_Layer){
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"    2.4GHz     ");
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    }
    else if (layer == AChSetting_SelectWIFI5_8GHz_Layer || layer == BChSetting_SelectWIFI5_8GHz_Layer){
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"    5.8GHz     ");
    }

    sprintf(temp_str, "    %05.2f    dB", *db_value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(layer); 
}
void LCD_30G_Freq_Select_Display(Layer_t layer,float *db_value)
{
    uint8_t temp_str[16]  = {0,};
    LCD_M68_DataWrite_COMMAND_Cusor_OFF();

    LCD_M68_DataWrite_Clear();
    if(layer == AChSetting_Select30GHz28_28_5_Layer || layer == BChSetting_Select30GHz28_28_5_Layer){
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  28~28.5 GHz  ");
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    }
    else if(layer == AChSetting_Select30GHz28_5_29_Layer || layer == BChSetting_Select30GHz28_5_29_Layer){
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  28.5~29 GHz ");
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    }
    else if(layer == AChSetting_Select30GHz29_29_5_Layer || layer == BChSetting_Select30GHz29_29_5_Layer){
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  29~29.5 GHz ");
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x10);
    }
    else if(layer == AChSetting_Select30GHz29_5_30_Layer || layer == BChSetting_Select30GHz29_5_30_Layer){
        LCD_M68_DataWrite_COMMAND2(Line_default,Data_CMD,0x11);
        LCD_M68_DataWrite_COMMAND(Line_default,Data_CMD,"  29.5~30 GHz ");
    }

    sprintf(temp_str, "    %05.2f    dB", *db_value);    
    LCD_M68_DataWrite_COMMAND(Second_Line,Data_CMD,temp_str);
    Layer_Set(layer); 
}
////////////////////////////////////////////////////////////////////////////////////////////

