#include "common_include.h"

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

void R485_Send_0x41(void)
{
    memset(R485_ID41h.Msg, 0, 64);
    switch (HJ_OtherKeyCurrent.count)
    {
    case 0:
        break;
    case  1:
        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.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  2:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.EleHeadlightFunctionSettings = 0x1; // 自动大灯
        R485_ID41h.Sig.IOTRealTime_Hour = 0xB;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0xB;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  3:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x186;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x2C; //电量
        R485_ID41h.Sig.VehicleStatus = 0x3;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x1;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0x16;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0x16;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  4:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0x240;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        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 = 21;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  5:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  6:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  7:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;
    case  8:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;  
    case  9:
        R485_ID41h.Sig.ICMCalculatesVehicleSpeed = 0xC3;   //速度 = (X * 0.512 * 3.14 * 1.05) / 30
        R485_ID41h.Sig.TotalBatterySOC = 0x1E; //电量
        R485_ID41h.Sig.VehicleStatus = 0x1;   //整车状态
        R485_ID41h.Sig.SpeedGear = 0x3;     //挡位
        //功率暂空一会做
        R485_ID41h.Sig.IOTRealTime_Hour = 0;    //时间：时
        R485_ID41h.Sig.IOTRealTime_Minute = 0;  //时间：分
        R485_ID41h.Sig.IOTRealTime_Second = 0;  //时间：秒
        break;  
    case  10:
        
        break;
    default:
        break;
    }
    R485_Send(0x41, R485_ID41h.Msg, sizeof(R485_ID41h.Msg));

}

void R485_Send_0x42(void)
{
    memset(R485_ID42h.Msg, 0, 64);
    R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
}