#include "R485_Communication_Matrix.h"
#include "Barcode_Scanner.h"
#include "string.h"
uint8_t barcode_Msg[64];
uint8_t barcode_Msg1[64];
uint8_t name1 = 0;
uint8_t name2 = 0;
uint32_t R485_Send_0x40(void)
{
    memset(R485_ID40h.Msg, 0xFF, 64);
    uint32_t u32sendendflag = 0;
    // R485_ID40h.Sig.AlarmStatus = 0; // 报警器报警状态
    switch (MENU_CHECK_STEP)
    {
    case  0:
        break;
    case  1:
        break;
    case  2:
        break;
    case  3:
    // memset(R485_ID40h.Msg, 0, 64);
        break;
    case  4:
        break;
    case  5:
        break;
    case  6:
        break;
    case  7:
        break;  
    case  8:
        break;  
    case  9:
        
        break;
    default:
        break;
    }
    u32sendendflag = R485_Send(0x40, R485_ID40h.Msg, sizeof(R485_ID40h.Msg));
    return u32sendendflag;
}

uint32_t R485_Send_0x41(void)
{
                    /**************0.437*********** */
                /*wtemp *= 9177l;
                wtemp /= 100;
                wtemp *= 157;
                wtemp /= 1000;*/
    uint32_t u32sendendflag = 0;
    memset(R485_ID41h.Msg, 0xFF, 64);
    R485_ID41h.Sig.VehicleStatus = 0x2;
    R485_ID41h.Sig.MetricImperialSetting = 0;
    R485_ID41h.Sig.CartMode = 0;
    R485_ID41h.Sig.ReverseMode = 0;
    R485_ID41h.Sig.RecuperationStatusFeedback = 0;
    R485_ID41h.Sig.EngineSymbolIndicatior = 0;
    // R485_ID41h.Sig.AlarmStatus = 0; // 报警器报警状态
    R485_ID41h.Sig.IOTRealTime_Year = 0x1; //时间：年
    R485_ID41h.Sig.IOTRealTime_Month = 0x1; //时间：月
    R485_ID41h.Sig.IOTRealTime_Day = 0x1;   //时间：日
    switch (MENU_CHECK_STEP)
    {
    case 0:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航

        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x0; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x2;     //挡位
        
        

        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒

        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    case  1:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航


        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x2; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x4;     //挡位
        
        R485_ID41h.Sig.TotalBatteryVoltage = 0x6D;   //总电池电压

        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒


        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    case  2:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航



    
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x50;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30  11km
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        
        R485_ID41h.Sig.TotalBatteryVoltage = 0x5A;   //总电池电压

        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.IOTRealTime_Hour = 0xB;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0xB;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒


        R485_ID41h.Sig.CartMode = 0;
        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    case  3:
        if(clearOdoFlag == 1)
        {
            R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
            R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
            R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
            R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
            R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
            R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
            R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
            R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
            R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
            R485_ID41h.Sig.CruiseMode = 0x0;    //巡航


            R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xFFFE;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 22km
            R485_ID41h.Sig.TotalBatterySOC = 0x2C; //电量
            R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
            R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
            
            R485_ID41h.Sig.TotalBatteryVoltage = 0x5E;   //总电池电压

            R485_ID41h.Sig.IOTRealTime_Hour = 0x16;    //时间：时
            R485_ID41h.Sig.IOTRealTime_Minute = 0x16;  //时间：分
            R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒


            R485_ID41h.Sig.HandlebarFaultIndicator = 0;
            R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
            R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
            R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
            R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
            R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
            R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
            R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
            R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
            R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
            R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
            R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
            R485_ID41h.Sig.MCUCommunicationStatus = 0;
            R485_ID41h.Sig.ALMCommunicationStatus = 0;
            R485_ID41h.Sig.ICMCommunicationStatus = 0;
            R485_ID41h.Sig.BrakeLeverFault = 0;
            R485_ID41h.Sig.PhaseLossFault = 0;
            R485_ID41h.Sig.MCUOverTempProtection = 0;
            R485_ID41h.Sig.MotorOvertempProtection = 0;
            R485_ID41h.Sig.RotorLocked = 0;
        }
        else
        {
             R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航


        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xA1;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 22km
        R485_ID41h.Sig.TotalBatterySOC = 0x2C; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        
        R485_ID41h.Sig.TotalBatteryVoltage = 0x4B;   //总电池电压

        R485_ID41h.Sig.IOTRealTime_Hour = 0x16;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x16;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒


        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        }
       
        break;
    case  4:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航




        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xF1;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 33km
        R485_ID41h.Sig.TotalBatterySOC = 0x42; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        

        R485_ID41h.Sig.IOTRealTime_Hour = 0xD;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x21;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x1;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x1;    //巡航


        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        
        break;
    case  5:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x0; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航

        R485_ID41h.Sig.RecuperationStatusFeedback = 0x1;    //能量回收设置
        R485_ID41h.Sig.TotalBatteryVoltage = 0x2A;   //总电池电压

        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x140;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 44km
        R485_ID41h.Sig.TotalBatterySOC = 0x58; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0xE;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x2C;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x1;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x0;   //座桶开关


        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        
        break;
    case  6:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航


        R485_ID41h.Sig.RecuperationStatusFeedback = 0x1;    //能量回收设置
        R485_ID41h.Sig.TotalBatteryVoltage = 0xC8;   //总电池电压

        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x192;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 55km
        R485_ID41h.Sig.TotalBatterySOC = 0x6E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做

        R485_ID41h.Sig.IOTRealTime_Hour = 0xF;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x37;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        R485_ID41h.Sig.CushionSensorStatus = 0x0;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x1;    //陡坡缓降


        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    case  7:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x1;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航

        R485_ID41h.Sig.RecuperationStatusFeedback = 0x1;    //能量回收设置
        R485_ID41h.Sig.TotalBatteryVoltage = 0xFF;   //总电池电压


        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x1E0;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30  66km
        R485_ID41h.Sig.TotalBatterySOC = 0x84; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x10;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x6;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        // R485_ID41h.Sig.SlopePattern = 0x1;   //跛行

        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    case  8:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航


        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x22F;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30  77km
        R485_ID41h.Sig.TotalBatterySOC = 0x9A; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x11;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x7;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒

        R485_ID41h.Sig.HandlebarFaultIndicator = 0x1;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 1;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;

        break;  
    case  9:

        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航

        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x282;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
        R485_ID41h.Sig.TotalBatterySOC = 0xB0; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x12;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x8;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        R485_ID41h.Sig.ChargeState = 0x1;   //充电状态
        

        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;  
    case  10:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x300;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
        R485_ID41h.Sig.TotalBatterySOC = 0xC6; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x13;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x9;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒

        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x1;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x1;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x1;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x1;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x0;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x1;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x1;    //巡航

        R485_ID41h.Sig.HandlebarFaultIndicator = 1;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 1;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
         case  11:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x300;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
        R485_ID41h.Sig.TotalBatterySOC = 0xC8; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x13;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x9;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒

        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x1;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x1;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x1;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x1;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x0;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x1;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x1;    //巡航

        R485_ID41h.Sig.HandlebarFaultIndicator = 1;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    default:
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x0; // 自动大灯
        R485_ID41h.Sig.ChargeState = 0x0;   //充电状态
        R485_ID41h.Sig.SlopePattern = 0x0;   //跛行
        R485_ID41h.Sig.CushionSensorStatus = 0x1;   //坐垫压力
        R485_ID41h.Sig.SlopeDescentFunctionStatus = 0x0;    //陡坡缓降
        R485_ID41h.Sig.TCSActivation = 0x1; //TCS激活
        R485_ID41h.Sig.TCSFunctionalStatus = 0x0;   //TCS状态
        R485_ID41h.Sig.ElectronicCushionStatus = 0x1;   //座桶开关
        R485_ID41h.Sig.SupportSwitchSignalFeedback = 0x0;   //边撑
        R485_ID41h.Sig.CruiseMode = 0x0;    //巡航

        R485_ID41h.Sig.HandlebarFaultIndicator = 0;
        R485_ID41h.Sig.UUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.UDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.VUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.VDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.WUpBridgeArmMosFault = 0;
        R485_ID41h.Sig.WDownBridgeArmMosFault = 0;
        R485_ID41h.Sig.MCUFaultStateU_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateV_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStateW_PhaseHallFault = 0;
        R485_ID41h.Sig.MCUFaultStatus_HandlebarFault = 0;
        R485_ID41h.Sig.BMS_0CommunicationStatus = 0;
        R485_ID41h.Sig.MCUCommunicationStatus = 0;
        R485_ID41h.Sig.ALMCommunicationStatus = 0;
        R485_ID41h.Sig.ICMCommunicationStatus = 0;
        R485_ID41h.Sig.BrakeLeverFault = 0;
        R485_ID41h.Sig.PhaseLossFault = 0;
        R485_ID41h.Sig.MCUOverTempProtection = 0;
        R485_ID41h.Sig.MotorOvertempProtection = 0;
        R485_ID41h.Sig.RotorLocked = 0;
        break;
    }
    u32sendendflag = R485_Send(0x41, R485_ID41h.Msg, sizeof(R485_ID41h.Msg));
    return u32sendendflag;
}

uint32_t R485_Send_0x42(void)
{
    LINE_OUT_NEG_09 = 1;
    memset(R485_ID42h.Msg, 0xFF, 64);
    uint32_t u32sendendflag = 0;
    R485_ID42h.Sig.TPower = 0;        //T动力状态
    R485_ID42h.Sig.TotalBatteryCurrent = 0; 
    R485_ID42h.Sig.BLE_MAC01 = name1;       //发送mac地址
    R485_ID42h.Sig.BLE_MAC02 = name2; 
    R485_ID42h.Sig.BLE_MAC03 = 0xA;
    R485_ID42h.Sig.BLE_MAC04 = 0xA;
    R485_ID42h.Sig.BLE_MAC05 = 0xA;
    R485_ID42h.Sig.BLE_MAC06 = 0xA; 
    switch (MENU_CHECK_STEP)
    {
    case  0:
        break;
    case  1:
        R485_ID42h.Sig.TotalBatteryCurrent = 0x44;  //母线电流
        break;
    case  2:
        R485_ID42h.Sig.TotalBatteryCurrent = 0x74;  //母线电流
        break;
    case  3:
        R485_ID42h.Sig.TotalBatteryCurrent = 0xFA;  //母线电流
        break;
    case  4:
        
        R485_ID42h.Sig.SuperTPower = 0x0;   //超级T动力模式
        R485_ID42h.Sig.TPower = 0x1;        //T动力状态
        break;
    case  5:
        // R485_ID42h.Sig.nenglainhuishou = 0x1;
        R485_ID42h.Sig.TotalBatteryCurrent = 0x17;
        break;
    case  6:
        // R485_ID42h.Sig.nenglainhuishou = 0x1;
        R485_ID42h.Sig.TotalBatteryCurrent = 0x14;
        break;
    case  7:
    R485_ID42h.Sig.nenglainhuishou = 0x1;
        R485_ID42h.Sig.TotalBatteryCurrent = 0x0;
        break;  
    case  8:
        break;  
    case  9:  
        break;
    case 10:
        break;
    case 11:
        break;
    case 12:

        break;
    case 13:
        break;
    case 14:
            R485_ID42h.Sig.PasswordUnlockCommand = 0x1;
        R485_ID42h.Sig.PasswordCanbeEnter = 0x2;
        break;
    default:
        break;
    }
    u32sendendflag = R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
    // LINE_OUT_NEG_09 = 0;
    // RS485_TX_finish = 1;
    return u32sendendflag;
}
uint32_t R485_Send_ble0x42(void)
{
    LINE_OUT_NEG_09 = 1;
    memset(R485_ID42h.Msg, 0xFF, 64);
    uint32_t u32sendendflag = 0;
    R485_ID42h.Sig.BLE_MAC01 = 0xAA;       //发送mac地址
    R485_ID42h.Sig.BLE_MAC02 = 0xBB; 
    R485_ID42h.Sig.BLE_MAC03 = 0xAA;
    R485_ID42h.Sig.BLE_MAC04 = 0xBB;
    R485_ID42h.Sig.BLE_MAC05 = 0xAA;
    R485_ID42h.Sig.BLE_MAC06 = 0xBB; 
    u32sendendflag = R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
    // LINE_OUT_NEG_09 = 0;
    // RS485_TX_finish = 1;
    return u32sendendflag;
}
uint8_t R485_zhenduan_Msg[64];
uint32_t R485_Send_0x47(void)
{
    uint8_t length;
    uint32_t u32sendendflag = 0;
    if(RS485_TX_finish == 0)
    {
        switch (zhenduansendStep)
        {
        case  0:
            length = 2;
            break;
        case 1:
            length = 2;
        break;
        case 2:
            length = 6;
            break;
        case 3:
            length = 37;
            break;
        case 5:
            break;
        case 6:
            length = 3;
            break;
        default:
            break;
        }
        
        switch (zhenduansendStep)
        {
        case  0:
            // R485_zhenduan_Msg[0] = 0x2;
            R485_zhenduan_Msg[0] = 0x10;
            R485_zhenduan_Msg[1] = 0x03;
            break;
        case 1:
            // R485_zhenduan_Msg[0] = 0x2;
            R485_zhenduan_Msg[0] = 0x27;
            R485_zhenduan_Msg[1] = 0x1;
        break;
        case 2:
            // R485_zhenduan_Msg[0] = 0x6;
            R485_zhenduan_Msg[0] = 0x27;
            R485_zhenduan_Msg[1] = 0x2;
            R485_zhenduan_Msg[2] = key_array[0];
            R485_zhenduan_Msg[3] = key_array[1];
            R485_zhenduan_Msg[4] = key_array[2];
            R485_zhenduan_Msg[5] = key_array[3];
            break;
        case 3:
            R485_zhenduan_Msg[0] = 0x2E;
            R485_zhenduan_Msg[1] = 0x50;
            R485_zhenduan_Msg[2] = 0x0;
            memcpy(R485_zhenduan_Msg+3,barcode_Msg,34);
            break;
        case 4:
            LINE_OUT_NEG_01 = 0;
            LINE_OUT_NEG_02 = 0;
            LINE_OUT_NEG_03 = 0;
            LINE_OUT_NEG_04 = 0;
            
        
            break;
        default:
            break;
        }
        RS485_TX_finish = 1;
        if(zhenduansendStep != 4)
        {
            u32sendendflag = R485_Send(0x47, R485_zhenduan_Msg, length);
        }
        
        RS485_send_time = 0;
        RS485_TX_finish = 1;
    }
    
    RS485_TX_finish = 1;
    return u32sendendflag;
}
uint8_t R485_0x80_msg[64];
uint32_t R485_Send_0x80(void)
{
    uint8_t length;
    uint32_t u32sendendflag = 0;
    memset(R485_0x80_msg,0xFF,sizeof(R485_0x80_msg));
    if(RS485_TX_finish == 0)
    {
        
        RS485_TX_finish = 1;
        u32sendendflag = R485_Send(0x80, R485_0x80_msg, sizeof(R485_0x80_msg));
        RS485_send_time = 0;
        RS485_TX_finish = 1;
    }
    
    RS485_TX_finish = 1;
    return u32sendendflag;
}
uint32_t R485_Send_0x45(void)
{
    uint8_t length;
    uint32_t u32sendendflag = 0;
    memset(R485_0x80_msg,0xFF,sizeof(R485_0x80_msg));
    if(RS485_TX_finish == 0)
    {
        
        RS485_TX_finish = 1;
        u32sendendflag = R485_Send(0x45, R485_0x80_msg, sizeof(R485_0x80_msg));
        RS485_send_time = 0;
        RS485_TX_finish = 1;
    }
    
    RS485_TX_finish = 1;
    return u32sendendflag;
}
uint8_t Send_Lineget_Msg[64];
uint8_t firstsec = 0;;
uint32_t R485_Send_Line_0x47(uint8_t n)
{
    uint8_t num = n;
    uint8_t length;
    uint32_t u32sendendflag = 0;
    if(RS485_TX_finish == 0)
    {
        switch (n)
        {
            case 0:
                Send_Lineget_Msg[0] = 0x22;
                Send_Lineget_Msg[1] = 0xF2;
                Send_Lineget_Msg[2] = 0x0;
                break;
            case 8:
                Send_Lineget_Msg[0] = 0x22;
                Send_Lineget_Msg[1] = 0xF2;
                Send_Lineget_Msg[2] = 0x01;
                break;
            case 2:
                if(firstsec == 0)
                {
                    Send_Lineget_Msg[0] = 0x22;
                    Send_Lineget_Msg[1] = 0xF2;
                    Send_Lineget_Msg[2] = 0x06;
                    firstsec = 1;
                }
                else
                {
                    Send_Lineget_Msg[0] = 0x22;
                    Send_Lineget_Msg[1] = 0xF2;
                    Send_Lineget_Msg[2] = 0x02;
                    firstsec = 0;
                }
                    break;
            case 3:
                if(firstsec == 0)
                {
                    Send_Lineget_Msg[0] = 0x22;
                    Send_Lineget_Msg[1] = 0xF2;
                    Send_Lineget_Msg[2] = 0x07;
                    firstsec = 1;
                }
                else
                {
                    Send_Lineget_Msg[0] = 0x22;
                    Send_Lineget_Msg[1] = 0xF2;
                    Send_Lineget_Msg[2] = 0x03;
                    firstsec = 0;
                }
                
                break;
            case 7:
                Send_Lineget_Msg[0] = 0x22;
                Send_Lineget_Msg[1] = 0xF2;
                Send_Lineget_Msg[2] = 0x04;
                break;
            case 1:
                Send_Lineget_Msg[0] = 0x22;
                Send_Lineget_Msg[1] = 0xF2;
                Send_Lineget_Msg[2] = 0x05;
                break;
            case 4:
                
                break;
            case 5:
                
                break;
            default:
            break;
                
        }
        RS485_TX_finish = 1;
        u32sendendflag = R485_Send(0x47, Send_Lineget_Msg, 3);
        RS485_send_time = 0;
        RS485_TX_finish = 1;
    }
    RS485_TX_finish = 1;
    return u32sendendflag;
}
uint8_t R485_zhenduan_Msg1[64];
uint32_t R485_Sendcheck_0x47(void)
{
    uint8_t length;
    uint32_t u32sendendflag = 0;
    if(RS485_TX_finish == 0)
    {

        R485_zhenduan_Msg1[0] = 0x22;
        R485_zhenduan_Msg1[1] = 0x50;
        R485_zhenduan_Msg1[2] = 0x0;
        u32sendendflag = R485_Send(0x47, R485_zhenduan_Msg1, 3);
        RS485_send_time = 0;
    
    }
    RS485_TX_finish = 1;
    return u32sendendflag;
}
uint8_t Send_Lineget_Msg[64];
uint32_t R485_Send_clear(void)
{
    // uint8_t length;
    // HJ_OtherKeyCurrent.count = 3;
    // uint32_t u32sendendflag = 0;
    // if(RS485_TX_finish == 0)
    // {
    //     if(RS485_send_time > 3000)
    //     {
    //     Port_SetPortPinLevel(1, 4, PortGpioHigh);
    //     Delay(10);
    //     RS485_TX_finish = 1;
    //     u32sendendflag = R485_Send(0x41, R485_ID41h.Msg, sizeof(R485_ID41h.Msg));
    //     RS485_send_time = 0;
    //     Delay(10);
    //     Port_SetPortPinLevel(1, 4, PortGpioLow);
    //     Delay(10);
    //     RS485_TX_finish = 1;
    //     }
    // }
    // RS485_TX_finish = 1;
    // Port_SetPortPinLevel(1, 4, PortGpioLow);
    // return u32sendendflag;
}

uint32_t R485_Send_0x70(void)
{
    // uint8_t num  = 0;
    // uint8_t length;
    // uint32_t u32sendendflag = 0;
    // if(RS485_TX_finish == 0)
    // {
    //     switch (n)
    //     {
    //         case 0:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x0;
    //             break;
    //         case 1:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x01;
    //             break;
    //         case 2:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x02;
    //             break;
    //         case 3:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x03;
    //             break;
    //         case 4:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x04;
    //             break;
    //         case 5:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x05;
    //             break;
    //         case 6:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x06;
    //             break;
    //         case 7:
    //             Send_Lineget_Msg[0] = 0x22;
    //             Send_Lineget_Msg[1] = 0xF2;
    //             Send_Lineget_Msg[2] = 0x07;
    //             break;
    //         default:
    //         break;
                
    //     }
    //     RS485_TX_finish = 1;
    //     u32sendendflag = R485_Send(0x47, Send_Lineget_Msg, 3);
    //     RS485_send_time = 0;
    //     Delay(10);
    //     Delay(10);
    //     RS485_TX_finish = 1;
    // }
    // RS485_TX_finish = 1;

    // return u32sendendflag;
}
uint32_t R485_SendMACaddress_0x42(void)
{
    uint8_t length;
    uint32_t u32sendendflag = 0;
    if(RS485_TX_finish == 0)
    {
        R485_ID42h.Sig.BLE_MAC01 = 0;
        R485_ID42h.Sig.BLE_MAC02 = 0;
        u32sendendflag = R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
        RS485_send_time = 0;
    
    }
    RS485_TX_finish = 1;
    return u32sendendflag;
}
