#include "common_include.h"

void R485_Send_0x40(void)
{
    memset(R485_ID40h.Msg, 0xFF, 64);
    switch (HJ_OtherKeyCurrent.count)
    {
    case  0:
        break;
    case  1:
        break;
    case  2:
        break;
    case  3:
        break;
    case  4:
        break;
    case  5:
        break;
    case  6:
        break;
    case  7:
        break;  
    case  8:
        break;  
    case  9:
        
        break;
    default:
        break;
    }
    R485_Send(0x40, R485_ID40h.Msg, sizeof(R485_ID40h.Msg));
}

void R485_Send_0x41(void)
{
                    /**************0.437*********** */
                /*wtemp *= 9177l;
                wtemp /= 100;
                wtemp *= 157;
                wtemp /= 1000;*/
    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;
    
    switch (HJ_OtherKeyCurrent.count)
    {
    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 = 0x0;   //整车状态
        // 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 = 0x2;     //挡位
        
        R485_ID41h.Sig.TotalBatteryVoltage = 0x4B;   //总电池电压

        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 = 0x46;   //速度 = (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 = 0x4B;   //总电池电压

        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
        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:
        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 = 0x95;   //速度 = (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 = 0xE2;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 33km
        R485_ID41h.Sig.TotalBatterySOC = 0x42; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x0;     //挡位
        //功率暂空一会做
        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.ICMCalculatesVehicleSpeed = 0x12F;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 44km
        R485_ID41h.Sig.TotalBatterySOC = 0x58; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x0;     //挡位
        //功率暂空一会做
        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.ICMCalculatesVehicleSpeed = 0x17A;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 55km
        R485_ID41h.Sig.TotalBatterySOC = 0x6E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        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 = 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 = 0x1C4;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30  66km
        R485_ID41h.Sig.TotalBatterySOC = 0x84; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        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 = 0x210;   //速度 = (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 = 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  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 = 0x25F;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
        R485_ID41h.Sig.TotalBatterySOC = 0xB0; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0;     //挡位
        //功率暂空一会做
        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 = 0x12;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x8;  //时间：分
        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;
    }
    R485_Send(0x41, R485_ID41h.Msg, sizeof(R485_ID41h.Msg));

}

void R485_Send_0x42(void)
{
    memset(R485_ID42h.Msg, 0xFF, 64);
    R485_ID42h.Sig.TPower = 0;        //T动力状态
    R485_ID42h.Sig.TotalBatteryCurrent = 0; 
        switch (HJ_OtherKeyCurrent.count)
    {
    case  0:
        
        break;
    case  1:
        R485_ID42h.Sig.TotalBatteryCurrent = 0x34;  //母线电流
        break;
    case  2:
        R485_ID42h.Sig.TotalBatteryCurrent = 0x96;  //母线电流
        break;
    case  3:
        R485_ID42h.Sig.TotalBatteryCurrent = 0xFA;  //母线电流
        break;
    case  4:
        // R485_ID42h.Sig.TotalBatteryCurrent = 0x46;
        R485_ID42h.Sig.SuperTPower = 0x0;   //超级T动力模式
        R485_ID42h.Sig.TPower = 0x1;        //T动力状态
        break;
    case  5:
        break;
    case  6:
        break;
    case  7:
        break;  
    case  8:
        break;  
    case  9:
        
        break;
    default:
        break;
    }
    R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
}