--- /root/personal/work/tracker/V22_Master_original_20260408/AI-2/AI-2/Resource/ASProtocol.c 2026-04-01 23:58:44.000000000 +0800 +++ /root/personal/work/tracker/V22_Master/AI-2/AI-2/Resource/ASProtocol.c 2026-06-20 10:00:06.916278853 +0800 @@ -1,6268 +1,6810 @@ -#include "GlobalDefine.h" -#include "ASProtocol.h" -#include "BackupRegister.h" -#include "RtcLocalModule.h" -#include "os.h" -#include "MotorControl.h" -#include "log.h" -#include "math.h" -#include "Init.h" -#include -#include "ModbusFrame.h" -#include "gd32f30x.h" -#include -extern GlobalVariableDef GlobalVariable; -unsigned short us_tick = 0; -unsigned char uc_rtcFlag = 0; - -extern uint16_t WeaherState; - -extern float WeaherStateTime; -extern unsigned char WeaherStateTimeFlag; - - - - -static const uint8_t valid_mode[] = { //有效模式 - MAINTENANCE_MODE, - CLEAN_MODE, - ANGLE_CALIBRATION_MODE, - AUTO_MODE, - AUTO_RAIN_MODE, - AUTO_SNOW_MODE, - AUTO_WIND_MODE, -// 0x29, - AUTO_AI_MODE, - AUTO_FLOOD_MODE, - MANUAL_MODE, - MANUAL_EAST_MODE, - MANUAL_WEST_MODE, - 0x00, - 0xff, - 0xfe -}; - - -/*************************************************************************************************** - Private Variable -***************************************************************************************************/ -/*R-0, RW-1*/ -static void (* RWRegister[RWREGISTER_SUM])(unsigned char R_or_RW, unsigned short *value)={(void *)0}; -static void (* RWRegisterQ[5] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; -static void (* RWRegisterL[10] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; -static void (* RWRegisterSlave[200] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; - -/*************************************************************************************************** - Jump function -***************************************************************************************************/ - -static void RDeviceEdition(unsigned char R_or_RW, unsigned short *value ); -static void RWWorkMode1(unsigned char R_or_RW, unsigned short *value ); -static void RWWorkMode2(unsigned char R_or_RW, unsigned short *value ); -static void RWarningAndFault1(unsigned char R_or_RW, unsigned short *value ); -static void RWarningAndFault2(unsigned char R_or_RW, unsigned short *value ); -static void RDeviceType(unsigned char R_or_RW, unsigned short *value); -static void RWChannelEnable1(unsigned char R_or_RW, unsigned short *value); -static void RWChannelEnable2(unsigned char R_or_RW, unsigned short *value); - -static void RElevationAngle1(unsigned char R_or_RW, unsigned short *value); -static void RElevationAngle2(unsigned char R_or_RW, unsigned short *value); -static void RAzimuthAngle1(unsigned char R_or_RW, unsigned short *value); -static void RAzimuthAngle2(unsigned char R_or_RW, unsigned short *value); -static void RTargetAngle1(unsigned char R_or_RW, unsigned short *value); -static void RTargetAngle2(unsigned char R_or_RW, unsigned short *value); -static void RRealAngle1(unsigned char R_or_RW, unsigned short *value); -static void RRealAngle2(unsigned char R_or_RW, unsigned short *value); -static void RWTimeYear(unsigned char R_or_RW, unsigned short *value); -static void RWTimeMonth(unsigned char R_or_RW, unsigned short *value); -static void RWTimeDay(unsigned char R_or_RW, unsigned short *value); -static void RWTimeHour(unsigned char R_or_RW, unsigned short *value); -static void RWTimeMinute(unsigned char R_or_RW, unsigned short *value); -static void RWTimeSecond(unsigned char R_or_RW, unsigned short *value); -static void RWRemoteWindSpeed(unsigned char R_or_RW, unsigned short *value); -static void RWRemoteWindDirect(unsigned char R_or_RW, unsigned short *value); - -static void RWAIRemoteTarget(unsigned char R_or_RW, unsigned short *value); -static void RTemp(unsigned char R_or_RW, unsigned short *value); - -static void RMotorCurrent(unsigned char R_or_RW, unsigned short *value); -static void RWProtectCurrent1(unsigned char R_or_RW, unsigned short *value); -static void RWProtectCurrent2(unsigned char R_or_RW, unsigned short *value); -static void RWLongitude1(unsigned char R_or_RW, unsigned short *value); -static void RWLongitude2(unsigned char R_or_RW, unsigned short *value); -static void RWLatitude1(unsigned char R_or_RW, unsigned short *value); -static void RWLatitude2(unsigned char R_or_RW, unsigned short *value); -static void RWTimeZone1(unsigned char R_or_RW, unsigned short *value); -static void RWTimeZone2(unsigned char R_or_RW, unsigned short *value); -static void RWEWTracingAccuracy1(unsigned char R_or_RW, unsigned short *value); -static void RWEWTracingAccuracy2(unsigned char R_or_RW, unsigned short *value); -static void RPVBuckerVoltage(unsigned char R_or_RW, unsigned short *value); -static void RBatState(unsigned char R_or_RW, unsigned short *value); -static void RBatSOCTemp(unsigned char R_or_RW, unsigned short *value); -static void RBatVoltage(unsigned char R_or_RW, unsigned short *value); -static void RBatCurrent(unsigned char R_or_RW, unsigned short *value); - -static void RWComID(unsigned char R_or_RW, unsigned short *value); -static void RWPowerMode(unsigned char R_or_RW, unsigned short *value); -static void RWCleaningDockAngle(unsigned char R_or_RW, unsigned short *value); - -static void RWPVModuleWidth1(unsigned char R_or_RW, unsigned short *value); -static void RWPVModuleWidth2(unsigned char R_or_RW, unsigned short *value); -static void RWPostSpacing1(unsigned char R_or_RW, unsigned short *value); -static void RWPostSpacing2(unsigned char R_or_RW, unsigned short *value); -static void RWTerrainSlope1(unsigned char R_or_RW, unsigned short *value); -static void RWTerrainSlope2(unsigned char R_or_RW, unsigned short *value); - -static void RWUpWindSpeed(unsigned char R_or_RW, unsigned short *value); -static void RWUpStartTime(unsigned char R_or_RW, unsigned short *value); -static void RWLowWindSpeed(unsigned char R_or_RW, unsigned short *value); -static void RWLowStopTime(unsigned char R_or_RW, unsigned short *value); -static void RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value); -static void RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value); -static void RWWSoftLimitAngle1(unsigned char R_or_RW, unsigned short *value); -static void RWWSoftLimitAngle2(unsigned char R_or_RW, unsigned short *value); -static void RWBackAngle(unsigned char R_or_RW, unsigned short *value); -static void RWEWindProtectionAngle(unsigned char R_or_RW, unsigned short *value); -static void RWWWindProtectionAngle(unsigned char R_or_RW, unsigned short *value); - -//static void RWInstallPostion(unsigned char R_or_RW, unsigned short *value); -static void RWSouthNorthShiftAngle(unsigned char R_or_RW, unsigned short *value); -static void RWFacingWindStopFunction_Enable(unsigned char R_or_RW, unsigned short *value); -static void RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value); -static void RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value); - -static void RDeviceEdition(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.DeviceEdition; - } -} - -static void RWWorkMode1(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)+1) = *value; - Log_AddParamChange(1, *value, GlobalVariable.WorkMode.WorkMode >> 16); - } -} - -static void RWWorkMode2(unsigned char R_or_RW, unsigned short *value ) -{ - int i; - - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.WorkMode.WorkMode, GlobalVariable.WorkModeBuffer.WorkMode ); - if((GlobalVariable.Weather.RemoteWindSpeed == 20) - ||((GlobalVariable.WorkMode.WorkMode & 0x00ff) == MOTOR_ALARM_MODE) ) //如果高???速或者故障电机模式,不支持改模式,复位除??? - { - if(*value != 0xFF) - { - return; - } - } - *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)) = *value; - if((GlobalVariable.WorkMode.WorkMode & 0xffff) != *value) - { - Log_AddWorkModeChange(*value, GlobalVariable.WorkMode.WorkMode,LOG_WORK_MODE_RCV); - } - - for(i = 0; i < sizeof(valid_mode)/sizeof(valid_mode[0]); i++) - { - if(*value == valid_mode[i]) - { - break; - } - } - - - if(i >= sizeof(valid_mode)/sizeof(valid_mode[0])) - { - return; //非有效模式直接返??? - } - - if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFF) - { - NVIC_SystemReset(); - } - else if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFE)// - { - GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkMode.WorkMode; //如果收到通???箱停机模式,保持原模式,不响? -// MotorAllStop(); /* Stop */ -// GlobalVariable.WorkModeBuffer.WorkMode = AUTO_TRACKER_MODE; -// RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR外???时??? -// -// EXTI_InitTypeDef EXTI_InitStructure; -// NVIC_InitTypeDef NVIC_InitStructure; -// RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); //使能复用功能时钟 - - // //GPIOE.2 ??????线以及中???初???化配置 下降沿触??? LORA_RX : PA10 -// GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource10); -// -// EXTI_InitStructure.EXTI_Line=EXTI_Line10; //PA10 -// EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; -// EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; -// EXTI_InitStructure.EXTI_LineCmd = ENABLE; -// EXTI_Init(&EXTI_InitStructure); //根据EXTI_InitStruct???指定的参数初始化外???EXTI寄存??? - -// NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //使能按键WK_UP所在的外部??????通道 -// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //抢占优先???2??? -// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x03; //子优先级3 -// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能外部??????通道 -// NVIC_Init(&NVIC_InitStructure); -// -// IWDG_ReloadCounter(); -// IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); -// IWDG_SetPrescaler(IWDG_Prescaler_256); -// IWDG_SetReload(0xFFF); -// IWDG_ReloadCounter(); -// -// RTC_Local_Init(); -// -// us_tick = SysTick->CTRL; -// SysTick->CTRL = 0; -// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP模式 -// OS_ERR err; -// OSSchedLock(&err); -// while(1) -// { -// if(uc_rtcFlag==1) -// { -// uc_rtcFlag = 0; -// SysTick->CTRL = us_tick; -// SystemInit(); -// OS_CPU_SysTickInit(720000); -// IWDG_ReloadCounter(); -// RCC_LSICmd(ENABLE); -// RTC_WaitForSynchro(); -// RTC_Local_Init(); -// us_tick = SysTick->CTRL; -// SysTick->CTRL = 0; -// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP模式 -// } -// } - } - // else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) - // { - // GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; - // GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; - // } - // else - // { - // if ( GlobalVariable.ConfigPara.isMasterController == YES)//powerSlave:stay in manual mode - // { - - // if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0x00) - // { - // SetStopMotorToSlaves(); - // } - // GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; - // } - - else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) - { - GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; - GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; - } - else - { - if ( GlobalVariable.ConfigPara.isMasterController == YES) - { - //only masterController can change workMode,powerSlave:stay in manual mode - GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; - } - } - } -} - -//void EXTI15_10_IRQHandler(void) -//{ -// NVIC_SystemReset(); -//} - -static void RWarningAndFault1(unsigned char R_or_RW, unsigned short *value ) //High -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)+1); // - } -} -static void RWarningAndFault2(unsigned char R_or_RW, unsigned short *value )//low -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)); // - } -} - -static void RDeviceType(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.DeviceType; - } -} - -// 低位通道使能0到15通道 -static void RWChannelEnable1(uint8_t R_or_RW, uint16_t *value) -{ - uint32_t *cfg = &GlobalVariable.ConfigPara.ChannelEnable; - uint32_t *buf = &GlobalVariable.ConfigParaBuffer.ChannelEnable; - - if (R_or_RW == 0) // 读低16 bit - { - *value = (uint16_t)(*cfg & 0xFFFF); - } - else // 写低16 bit - { - // 写入低16bit到 buffer - *buf = (*buf & 0xFFFF0000) | (*value & 0xFFFF); - - if (GlobalVariable.ConfigPara.isMasterController == NO) - { - *cfg = 0x00000001; // 从控只允许通道 0 - } - else - { - // 更新配置:低16位 - *cfg = (*cfg & 0xFFFF0000) | (*value & 0xFFFF); - } - - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - -// 高位通道使能16-31通道 -static void RWChannelEnable2(uint8_t R_or_RW, uint16_t *value) -{ - uint32_t *cfg = &GlobalVariable.ConfigPara.ChannelEnable; - uint32_t *buf = &GlobalVariable.ConfigParaBuffer.ChannelEnable; - - if (R_or_RW == 0) // 读高16 bit - { - *value = (uint16_t)((*cfg >> 16) & 0xFFFF); - } - else // 写高16 bit - { - // 写入高16bit到 buffer - *buf = (*buf & 0x0000FFFF) | (((uint32_t)*value) << 16); - - if (GlobalVariable.ConfigPara.isMasterController == NO) - { - *cfg = 0x00000000; // 从控强制关闭全部通道 - } - else - { - uint16_t oldHigh = (uint16_t)((*cfg >> 16) & 0xFFFF); - uint16_t oldLow = (uint16_t)(*cfg & 0xFFFF); - - // 写日志 - Log_AddParamChange(6, *value, oldHigh); - Log_AddParamChange(29, *value, oldLow); - - // 更新配置:高16位 - *cfg = (*cfg & 0x0000FFFF) | (((uint32_t)*value) << 16); - - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - -// static void RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) -// { -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1); -// } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1) = *value; -// } -// } -// static void RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) -// { -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)); -// } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)) = *value; -// if((GlobalVariable.ConfigParaBuffer.ESoftLimitAngle > 29.9f ) -// && (GlobalVariable.ConfigParaBuffer.ESoftLimitAngle < 150.1f) ) -// { -// Log_AddParamChange(103, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1)); -// Log_AddParamChange(104, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle))); -// GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } - -// } -// } - - - - - - - - - - - - -static void RElevationAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.ElevationAngle)+1); - } -} -static void RElevationAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.ElevationAngle)); - } -} -static void RAzimuthAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.AzimuthAngle)+1); - } -} -static void RAzimuthAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.AzimuthAngle)); - } -} - -static void RTargetAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { -// *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)+1); - *value = GlobalVariable.WorkMode.Target * 100.0f; - } -} - - -static void RTargetAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)+1); - } -} -static void RTargetAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)); - } -} - - - -static void RRealAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Motor[0].ActualAngle * 100.0f; - } -} -static void RRealAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if (YES == GlobalVariable.ConfigPara.isMasterController) - { - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 1) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[1].ActualAngle * 100.0f; - } - } - } - else - { - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.Motor[0].ActualAngle)+1); - } - } - - -} -static void RRealAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if (YES == GlobalVariable.ConfigPara.isMasterController) - { - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 2) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[2].ActualAngle * 100.0f; - } - } - } - else - { - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.Motor[0].ActualAngle)); - } - } - -} -static void RRealAngle3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 3) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[3].ActualAngle * 100.0f; - } - } -} -static void RRealAngle4(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 4) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[4].ActualAngle * 100.0f; - } - } -} - -static void RRealAngle5(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 5) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[5].ActualAngle * 100.0f; - } - } -} -static void RRealAngle6(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 6) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[6].ActualAngle * 100.0f; - } - } -} - - -static void RRealAngle7(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 7) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[7].ActualAngle * 100.0f; - } - } -} -static void RRealAngle8(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 8) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[8].ActualAngle * 100.0f; - } - } -} -static void RRealAngle9(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 9) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[9].ActualAngle * 100.0f; - } - } -} -static void RRealAngle10(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 10) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[10].ActualAngle * 100.0f; - } - } -} -static void RRealAngle11(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 11) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[11].ActualAngle * 100.0f; - } - } -} -static void RRealAngle12(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 12) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[12].ActualAngle * 100.0f; - } - } -} -static void RRealAngle13(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 13) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[13].ActualAngle * 100.0f; - } - } -} -static void RRealAngle14(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 14) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[14].ActualAngle * 100.0f; - } - } -} -static void RRealAngle15(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 15) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[15].ActualAngle * 100.0f; - } - } -} -static void RRealAngle16(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 16) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[16].ActualAngle * 100.0f; - } - } -} - -static void RRealAngle17(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 17) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[17].ActualAngle * 100.0f; - } - } -} -static void RRealAngle18(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 18) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[18].ActualAngle * 100.0f; - } - } -} -static void RRealAngle19(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 19) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[19].ActualAngle * 100.0f; - } - } -} -static void RRealAngle20(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 20) & 0x01) == ENABLE) - { - *value = GlobalVariable.Motor[20].ActualAngle * 100.0f; - } - } -} - - - - - - -static void RWTimeYear(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Year; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); - //Log_AddParamChange(23, *value, GlobalVariable.TimeBuffer.Year); - GlobalVariable.TimeBuffer.Year = *value; - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} -static void RWTimeMonth(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Month; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Month, *value ); - //Log_AddParamChange(24, *value, GlobalVariable.TimeBuffer.Month); - GlobalVariable.TimeBuffer.Month = *value; - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} -static void RWTimeDay(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Day; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Day, *value ); - //Log_AddParamChange(25, *value, GlobalVariable.TimeBuffer.Day); - GlobalVariable.TimeBuffer.Day = *value; - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} -static void RWTimeHour(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Hour; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Hour, *value ); - //Log_AddParamChange(26, *value, GlobalVariable.TimeBuffer.Hour); - GlobalVariable.TimeBuffer.Hour = *value; - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} -static void RWTimeMinute(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Minute; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Minute, *value ); - //Log_AddParamChange(27, *value, GlobalVariable.TimeBuffer.Minute); - GlobalVariable.TimeBuffer.Minute = *value; - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} -static void RWTimeSecond(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Time.Second; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Second, *value ); - //Log_AddParamChange(28, *value, GlobalVariable.TimeBuffer.Second); - GlobalVariable.TimeBuffer.Second = *value; - BKPWriteRTCUpdateFlag(); - GlobalVariable.WriteFlag.TimeWrite = 1; - } -} - -static void RWRemoteWindDirect(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Weather.RemoteWindDirect; - } - else if(R_or_RW == 1) - { - Log_AddParamChange(31, *value, GlobalVariable.Weather.RemoteWindDirect); - GlobalVariable.Weather.RemoteWindDirect = *value; - } -} - -static void RWRemoteWindSpeed(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Weather.RemoteWindSpeed; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.Weather.RemoteWindSpeed, *value ); - - if(*value != GlobalVariable.Weather.RemoteWindSpeed) - { - if(20 == *value || 20 == GlobalVariable.Weather.RemoteWindSpeed) - { - Log_AddParamChange(33, *value, GlobalVariable.Weather.RemoteWindSpeed); - } - } - GlobalVariable.Weather.RemoteWindSpeed = *value; - } -} - -static void RWAIRemoteTarget(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)GlobalVariable.AIPara.AIRemoteAngle; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.AIPara.AIRemoteAngle, *value ); - Log_AddParamChange(34, *value, GlobalVariable.AIPara.AIRemoteAngle); - GlobalVariable.AIPara.AIRemoteAngle = (float)*value; - GlobalVariable.AIPara.AIModeDelayCount = 1; - } -} - -static void RTemp(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(unsigned short *)&GlobalVariable.Tmp.BoardTmp; - } -} - -static void RMotorCurrent(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (short)(GlobalVariable.Motor[0].Motorcurrent * 10); // - } -} -static void RMotorCurrent1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 1) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[1].Motorcurrent * 10); // - // *value = 3000; - } - } -} -static void RMotorCurrent2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 2) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[2].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 3) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[3].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent4(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 4) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[4].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent5(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 5) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[5].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent6(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 6) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[6].Motorcurrent * 10); // - } - } -} - -static void RMotorCurrent7(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 7) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[7].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent8(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 8) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[8].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent9(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 9) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[9].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent10(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 10) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[10].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent11(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 11) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[11].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent12(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 12) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[12].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent13(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 13) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[13].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent14(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 14) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[14].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent15(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 15) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[15].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent16(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 16) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[16].Motorcurrent * 10); // - } - } -} - -static void RMotorCurrent17(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 17) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[17].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent18(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 18) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[18].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent19(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 19) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[19].Motorcurrent * 10); // - } - } -} -static void RMotorCurrent20(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - if(((GlobalVariable.ConfigPara.ChannelEnable >> 20) & 0x01) == ENABLE) - { - *value = (short)(GlobalVariable.Motor[20].Motorcurrent * 10); // - } - } -} - - - - -static void RWProtectCurrent1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)+1) = *value; - } -} - -static void RWProtectCurrent2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)) = *value; - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValue, GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue ); - - if( (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue > 0.19f) && - (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue < 20.1f ) ) //???6.1放大???20.1限制 - { - Log_AddParamChange(43, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)+1)); - Log_AddParamChange(44, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue))); - GlobalVariable.ConfigPara.MotorOverCurrentValue = GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - - - GlobalVariable.SpecialCheck.MasterSetProCurrentToSlaveFlag = 1; - - - } - } -} - -/* Longitude */ -static void RWLongitude1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1) = *value; - } -} -static void RWLongitude2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)) = *value; - if(GlobalVariable.ConfigParaBuffer.Longitude >= -180.0 - &&GlobalVariable.ConfigParaBuffer.Longitude <= 180.0 ) - { - if(fabs(GlobalVariable.ConfigParaBuffer.Longitude - GlobalVariable.ConfigPara.Longitude) >= 0.1f ) //???7.8?????? - { - Log_AddParamChange(45, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1)); - Log_AddParamChange(46, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude))); - GlobalVariable.ConfigPara.Longitude = GlobalVariable.ConfigParaBuffer.Longitude; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } -} - -/* Latitude */ -static void RWLatitude1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1) = *value; - } -} -static void RWLatitude2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)) = *value; - if(GlobalVariable.ConfigParaBuffer.Latitude >= -90.0 - && GlobalVariable.ConfigParaBuffer.Latitude <= 90.0) - { - if(fabs(GlobalVariable.ConfigParaBuffer.Latitude - GlobalVariable.ConfigPara.Latitude) >= 0.1f )//???7.8?????? - { - Log_AddParamChange(47, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1)); - Log_AddParamChange(48, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude))); - GlobalVariable.ConfigPara.Latitude = GlobalVariable.ConfigParaBuffer.Latitude; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } -} -static void RWTimeZone1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1); - } - else if(R_or_RW == 1) - { -// Log_AddParamChange(49, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1) = *value; - } -} -static void RWTimeZone2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)) = *value; - if(GlobalVariable.ConfigParaBuffer.TimeZone >= -12.0 - && GlobalVariable.ConfigParaBuffer.TimeZone <= 12.0) - { - if(fabs(GlobalVariable.ConfigParaBuffer.TimeZone - GlobalVariable.ConfigPara.TimeZone) >= 0.5f ) - { - Log_AddParamChange(49, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); - Log_AddParamChange(50, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone))); - - GlobalVariable.ConfigPara.TimeZone = GlobalVariable.ConfigParaBuffer.TimeZone; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - - } - } -} -static void RWEWTracingAccuracy1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)+1) = *value; - } -} -static void RWEWTracingAccuracy2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)) = *value; - if(GlobalVariable.ConfigParaBuffer.EWTracingAccuracy >= 0.98 - && GlobalVariable.ConfigParaBuffer.EWTracingAccuracy <= 5.1) - { - Log_AddParamChange(51, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)+1)); - Log_AddParamChange(52, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy))); - GlobalVariable.ConfigPara.EWTracingAccuracy = GlobalVariable.ConfigParaBuffer.EWTracingAccuracy; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RPVBuckerVoltage(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.PowerPara.PVBuckerVoltage * 10); - } -} -static void RBatState(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = 0; - *value |= *(unsigned char*)(&GlobalVariable.PowerPara.ChargeState); - } -} -static void RBatSOCTemp(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = 0x00FF & (unsigned char)(GlobalVariable.PowerPara.BatterySOC*100); - *value = *value << 8; - *value &= 0xFF00; - *value |= ((signed char)(GlobalVariable.PowerPara.BatteryTemperature) & 0x00FF); - } -} -static void RBatVoltage(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.PowerPara.BatteryVoltage*10); - } -} -static void RBatCurrent(unsigned char R_or_RW, unsigned short *value) -{ - signed short temp = 0; - if(R_or_RW == 0) - { - temp = (signed short)(GlobalVariable.PowerPara.BatteryCurrent*100); - *value = *((unsigned short *)&temp); - } -} - -static void RVersion1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.FixePara.Version1); - } -} -static void RVersion2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.FixePara.Version2); - } -} - -static void RWComID(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID)); - } - else if(R_or_RW == 1) - { - if (GlobalVariable.ConfigPara.isMasterController == 1) - { - if(*value >= 1 && *value < 255) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(81, *value, GlobalVariable.ConfigPara.ComID); - GlobalVariable.ConfigPara.ComID =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - - } - - else if (GlobalVariable.ConfigPara.isMasterController == 0) - { - if(*value >= 2 && *value <=21) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(81, *value, GlobalVariable.ConfigPara.ComID); - GlobalVariable.ConfigPara.ComID =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - - - - - } -} -static void RWComID2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID2)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(112, *value, GlobalVariable.ConfigPara.ComID2); - GlobalVariable.ConfigPara.ComID2 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID3)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(113, *value, GlobalVariable.ConfigPara.ComID3); - GlobalVariable.ConfigPara.ComID3 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWComID4(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID4)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(131, *value, GlobalVariable.ConfigPara.ComID4); - GlobalVariable.ConfigPara.ComID4 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID5(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID5)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(132, *value, GlobalVariable.ConfigPara.ComID5); - GlobalVariable.ConfigPara.ComID5 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID6(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID6)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(133, *value, GlobalVariable.ConfigPara.ComID6); - GlobalVariable.ConfigPara.ComID6 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID7(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID7)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(134, *value, GlobalVariable.ConfigPara.ComID7); - GlobalVariable.ConfigPara.ComID7 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID8(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID8)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(135, *value, GlobalVariable.ConfigPara.ComID8); - GlobalVariable.ConfigPara.ComID8 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID9(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID9)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(136, *value, GlobalVariable.ConfigPara.ComID9); - GlobalVariable.ConfigPara.ComID9 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } -static void RWComID10(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID10)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(137, *value, GlobalVariable.ConfigPara.ComID10); - GlobalVariable.ConfigPara.ComID10 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - -} - -static void RWComID11(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID11)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(138, *value, GlobalVariable.ConfigPara.ComID11); - GlobalVariable.ConfigPara.ComID11 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWComID12(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID12)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(139, *value, GlobalVariable.ConfigPara.ComID12); - GlobalVariable.ConfigPara.ComID12 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID13(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID13)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(140, *value, GlobalVariable.ConfigPara.ComID13); - GlobalVariable.ConfigPara.ComID13 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID14(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID14)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(141, *value, GlobalVariable.ConfigPara.ComID14); - GlobalVariable.ConfigPara.ComID14 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID15(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID15)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(142, *value, GlobalVariable.ConfigPara.ComID15); - GlobalVariable.ConfigPara.ComID15 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID16(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID16)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(143, *value, GlobalVariable.ConfigPara.ComID16); - GlobalVariable.ConfigPara.ComID16 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID17(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID17)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ) - Log_AddParamChange(144, *value, GlobalVariable.ConfigPara.ComID17); - GlobalVariable.ConfigPara.ComID17 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID18(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID18)); - - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(145, *value, GlobalVariable.ConfigPara.ComID18); - GlobalVariable.ConfigPara.ComID18 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID19(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID19)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ) - Log_AddParamChange(146, *value, GlobalVariable.ConfigPara.ComID19); - GlobalVariable.ConfigPara.ComID19 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWComID20(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID20)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(147, *value, GlobalVariable.ConfigPara.ComID20); - GlobalVariable.ConfigPara.ComID20 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } - -static void RWComID21(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID21)); - } - else if(R_or_RW == 1) - { - if(*value >= 1 && *value < 255) - { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); - Log_AddParamChange(148, *value, GlobalVariable.ConfigPara.ComID21); - GlobalVariable.ConfigPara.ComID21 =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWEnableMasterController(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.isMasterController)); - } - else if(R_or_RW == 1) - { - if((*value) == NO) - { - if(( GlobalVariable.ConfigPara.ComID >= 2) && (GlobalVariable.ConfigPara.ComID <= 21)) - { - // - Log_AddParamChange(REG_SET_CONTROLER_ROLE, *value, GlobalVariable.ConfigPara.isMasterController); - GlobalVariable.ConfigPara.isMasterController =(unsigned char) *value; - FixedParaInit();//更换固件版本号,适配主从角色 - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - else if((*value) == YES) - { - if(( GlobalVariable.ConfigPara.ComID >= 1) && (GlobalVariable.ConfigPara.ComID < 255)) - { - - - Log_AddParamChange(REG_SET_CONTROLER_ROLE, *value, GlobalVariable.ConfigPara.isMasterController); - GlobalVariable.ConfigPara.isMasterController =(unsigned char) *value; - - FixedParaInit();//更换固件版本号,适配主从角色 - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } -} - -static void RWsubSlaveCount(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.subSlaveCount)); - } - else if(R_or_RW == 1) - { - if((*value >= 1) &&( *value )< 30) - { - Log_AddParamChange(REG_SUBSLAVE_COUNT, *value, GlobalVariable.ConfigPara.subSlaveCount); - GlobalVariable.ConfigPara.subSlaveCount =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - - -static void RWsubSlavePowerSupplyEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.subSlavePowerSupplyEnable)); - } - else if(R_or_RW == 1) - { - if((*value == YES) ||( *value ) == NO) - { - Log_AddParamChange(REG_SUBSLAVE_POWER_SUPPLY_ENABLE, *value, GlobalVariable.ConfigPara.subSlavePowerSupplyEnable); - GlobalVariable.ConfigPara.subSlavePowerSupplyEnable =(unsigned char) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - -/************************************************* - Function : RWPIDKP() - Description : PID KP - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -//static void RWPIDKP(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKp)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKp, *value ); -// GlobalVariable.ConfigPara.Pid_CurrKp =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -/************************************************* - Function : RWPIDKI() - Description : PID KI - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -//static void RWPIDKI(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKi)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKi, *value ); -// GlobalVariable.ConfigPara.Pid_CurrKi =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -/************************************************* - Function : RWPIDKD() - Description : PID KD - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -//static void RWPIDKD(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKd)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKd, *value ); -// GlobalVariable.ConfigPara.Pid_CurrKd =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -/************************************************* - Function : RWPIDSlope() - Description : PID Slope - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -//static void RWPIDSlope(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrSlope)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrSlope, *value ); -// GlobalVariable.ConfigPara.Pid_CurrSlope =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - - - -static void RWHeatEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable)); - } - else if(R_or_RW == 1) - { - if((*value == 0 )|| (*value == 1)) - { - Log_AddParamChange(107, *value, GlobalVariable.ConfigPara.HeatEnable); - GlobalVariable.ConfigPara.HeatEnable =(unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - -//static void RWMotorOverCurrentValueG1(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG1)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG1, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG1 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG1(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG1)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG1, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG1 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG2(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG2)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG2, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG2 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG2(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG2)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG2, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG2 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG3(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG3)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG3, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG3 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG3(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG3)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG3, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG3 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG4(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG4)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG4, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG4 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG4(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG4)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG4, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG4 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG5(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG5)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG5, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG5 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG5(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG5)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG5, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG5 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG6(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG6)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG6, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG6 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG6(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG6)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG6, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG6 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG7(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG7)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG7, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG7 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG7(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG7)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG7, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG7 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG8(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG8)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG8, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG8 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG8(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG8)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG8, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG8 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG9(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG9)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG9, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG9 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG9(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG9)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG9, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG9 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentValueG10(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG10)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG10, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentValueG10 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -//static void RWMotorOverCurrentTimeG10(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG10)); -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG10, *value ); -// GlobalVariable.ConfigPara.MotorOverCurrentTimeG10 =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -static void RWPowerMode(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.PowerMode; - } - else if(R_or_RW == 1) - { - if(*value <= 3) - { - Log_AddParamChange(82, *value, GlobalVariable.ConfigPara.PowerMode); - GlobalVariable.ConfigPara.PowerMode = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWCleaningDockAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.CleaningDockAngle; - } - else if(R_or_RW == 1) - { - if((*value >= 30) && (*value <= 150)) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.CleaningDockAngle, *value ); - Log_AddParamChange(84, *value, GlobalVariable.ConfigPara.CleaningDockAngle); - GlobalVariable.ConfigPara.CleaningDockAngle = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWMotorOrientation(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.MotorOrientation; - } - else if(R_or_RW == 1) - { - if(*value == 0 || *value == 1) //0:电机朝东; 1:电机朝??? - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOrientation, *value ); - Log_AddParamChange(85, *value, GlobalVariable.ConfigPara.MotorOrientation); - GlobalVariable.ConfigPara.MotorOrientation = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWRS485Enable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.RS485Enable; - } - else if(R_or_RW == 1) - { - if((*value == 0 )|| (*value == 1)) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.RS485Enable, *value ); - Log_AddParamChange(88, *value, GlobalVariable.ConfigPara.RS485Enable); - GlobalVariable.ConfigPara.RS485Enable = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWNoComEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.NoComEnable; - } - else if(R_or_RW == 1) - { - if((*value == 0 )|| (*value == 1)) - { - Log_AddParamChange(98, *value, GlobalVariable.ConfigPara.NoComEnable); - GlobalVariable.ConfigPara.NoComEnable = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWPVModuleWidth1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)+1) = *value; - } -} -static void RWPVModuleWidth2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)) = *value; - if((GlobalVariable.ConfigParaBuffer.PVModuleWidth >= 0.2) && (GlobalVariable.ConfigParaBuffer.PVModuleWidth <= 20.0) ) - { - Log_AddParamChange(89, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)+1)); - Log_AddParamChange(90, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth))); - GlobalVariable.ConfigPara.PVModuleWidth = GlobalVariable.ConfigParaBuffer.PVModuleWidth; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWPostSpacing1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)+1) = *value; - } -} - -static void RWPostSpacing2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)) = *value; - - if((GlobalVariable.ConfigParaBuffer.PostSpacing >= GlobalVariable.ConfigPara.PVModuleWidth) - && (GlobalVariable.ConfigParaBuffer.PostSpacing <= 50.0) ) - { - Log_AddParamChange(91, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)+1)); - Log_AddParamChange(92, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing))); - GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigParaBuffer.PostSpacing; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWTerrainSlope1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)+1); - } - else if(R_or_RW == 1) - { - - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)+1) = *value; - } -} -static void RWTerrainSlope2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)) = *value; - if((GlobalVariable.ConfigParaBuffer.TerrainSlope >= -45.0f) - && (GlobalVariable.ConfigParaBuffer.TerrainSlope <= 45.0f)) - { - Log_AddParamChange(93, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)+1)); - Log_AddParamChange(94, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope))); - GlobalVariable.ConfigPara.TerrainSlope = GlobalVariable.ConfigParaBuffer.TerrainSlope; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - -static void RWUpWindSpeed(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)); - } - -// else if(R_or_RW == 1) -// { -// if(*value <= 40) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpWindSpeed, *value ); -// Log_AddParamChange(99, *value, GlobalVariable.ConfigPara.UpWindSpeed); -// *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -static void RWUpStartTime(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= 1000) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpStartTime, *value ); -// Log_AddParamChange(100, *value, GlobalVariable.ConfigPara.UpStartTime); -// *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -static void RWLowWindSpeed(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= (GlobalVariable.ConfigPara.UpWindSpeed - 1)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, *value ); -// Log_AddParamChange(101, *value, GlobalVariable.ConfigPara.LowWindSpeed); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = *value; -// } -// else -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, GlobalVariable.ConfigPara.UpWindSpeed - 1 ); -// Log_AddParamChange(101, GlobalVariable.ConfigPara.UpWindSpeed - 1, GlobalVariable.ConfigPara.LowWindSpeed); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = GlobalVariable.ConfigPara.UpWindSpeed - 1; -// } -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -} -static void RWLowStopTime(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= 1000) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowStopTime, *value ); -// Log_AddParamChange(102, *value, GlobalVariable.ConfigPara.LowStopTime); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} - -static void RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1) = *value; - } -} -static void RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)) = *value; - if((GlobalVariable.ConfigParaBuffer.ESoftLimitAngle > 29.9f ) - && (GlobalVariable.ConfigParaBuffer.ESoftLimitAngle < 150.1f) ) - { - Log_AddParamChange(103, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1)); - Log_AddParamChange(104, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle))); - GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - - } -} -static void RWWSoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)+1); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)+1) = *value; - } -} -static void RWWSoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)) = *value; - if( (GlobalVariable.ConfigParaBuffer.WSoftLimitAngle > 29.9f) - && ( GlobalVariable.ConfigParaBuffer.WSoftLimitAngle < 150.1f)) - { - Log_AddParamChange(105, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)+1)); - Log_AddParamChange(106, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle))); - GlobalVariable.ConfigPara.WSoftLimitAngle = GlobalVariable.ConfigParaBuffer.WSoftLimitAngle; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - - } -} -static void RWBackAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)); - } - else if(R_or_RW == 1) - { - if(*value >= 59.9 && *value <= 120.1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.BackAngle, *value ); - Log_AddParamChange(111, *value, GlobalVariable.ConfigPara.BackAngle); - *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWEWindProtectionAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWindProtectionAngle)); - } - else if(R_or_RW == 1) - { - if(*value >= 60 && *value <= 90) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EWindProtectionAngle, *value ); - Log_AddParamChange(112, *value, GlobalVariable.ConfigPara.EWindProtectionAngle); - *(((unsigned short *)&GlobalVariable.ConfigPara.EWindProtectionAngle)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -static void RWWWindProtectionAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WWindProtectionAngle)); - } - else if(R_or_RW == 1) - { - if(*value >= 90 && *value <= 120) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WWindProtectionAngle, *value ); - Log_AddParamChange(113, *value, GlobalVariable.ConfigPara.WWindProtectionAngle); - *(((unsigned short *)&GlobalVariable.ConfigPara.WWindProtectionAngle)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -/*********************************************************************************** - *函数名:RWManufactor - *??? 述:读写LORA厂???参??? - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWManufactor(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_manufactor)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_manufactor, *value ); - Log_AddParamChange(200, *value, GlobalVariable.ConfigPara.Lora_manufactor); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_manufactor)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWDeviceIDH - *??? 述:读写LORA模块ID参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWDeviceIDH(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDH)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceIDH, *value ); - Log_AddParamChange(201, *value, GlobalVariable.ConfigPara.Lora_deviceIDH); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDH)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWDeviceIDL - *??? 述:读写LORA模块ID参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWDeviceIDL(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDL)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceIDL, *value ); - Log_AddParamChange(202, *value, GlobalVariable.ConfigPara.Lora_deviceIDL); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDL)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWDeviceNetID - *??? 述:读写LORA net ID参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWDeviceNetID(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceNetID)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceNetID, *value ); - Log_AddParamChange(203, *value, GlobalVariable.ConfigPara.Lora_deviceNetID); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceNetID)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTadd3 - *??? 述:读写LORA 易佰??? 03H 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTadd3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add3)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add3, *value ); - Log_AddParamChange(204, *value, GlobalVariable.ConfigPara.Lora_ybt_add3); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add3)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTadd4 - *??? 述:读写LORA 易佰??? 04H 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTadd4(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add4)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add4, *value ); - Log_AddParamChange(205, *value, GlobalVariable.ConfigPara.Lora_ybt_add4); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add4)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTChannel - *??? 述:读写LORA 易佰??? 信道 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTChannel(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_channel)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_channel, *value ); - Log_AddParamChange(206, *value, GlobalVariable.ConfigPara.Lora_ybt_channel); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_channel)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTadd6 - *??? 述:读写LORA 易佰??? 06H 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTadd6(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add6)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add6, *value ); - Log_AddParamChange(207, *value, GlobalVariable.ConfigPara.Lora_ybt_add6); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add6)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTkeyH - *??? 述:读写LORA 易佰??? 密钥 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTkeyH(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyH)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_keyH, *value ); - Log_AddParamChange(208, *value, GlobalVariable.ConfigPara.Lora_ybt_keyH); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyH)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWYBTkeyL - *??? 述:读写LORA 易佰??? 密钥 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWYBTkeyL(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyL)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_keyL, *value ); - Log_AddParamChange(209, *value, GlobalVariable.ConfigPara.Lora_ybt_keyL); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyL)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLbaudrate - *??? 述:读写LORA 捷迅易联 波特??? 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLbaudrate(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_baudrate)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_baudrate, *value ); - Log_AddParamChange(210, *value, GlobalVariable.ConfigPara.Lora_jxyl_baudrate); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_baudrate)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLparity - *??? 述:读写LORA 捷迅易联 校验 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLparity(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_parity)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_parity, *value ); - Log_AddParamChange(211, *value, GlobalVariable.ConfigPara.Lora_jxyl_parity); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_parity)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLfq1 - *??? 述:读写LORA 捷迅易联 频率 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLfq1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq1)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq1, *value ); - Log_AddParamChange(212, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq1); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq1)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLfq2 - *??? 述:读写LORA 捷迅易联 频率 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLfq2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq2)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq2, *value ); - Log_AddParamChange(213, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq2); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq2)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLfq3 - *??? 述:读写LORA 捷迅易联 频率 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLfq3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq3)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq3, *value ); - Log_AddParamChange(214, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq3); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq3)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLfactor - *??? 述:读写LORA 捷迅易联 扩???因??? 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLfactor(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_factor)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_factor, *value ); - Log_AddParamChange(215, *value, GlobalVariable.ConfigPara.Lora_jxyl_factor); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_factor)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLmode - *??? 述:读写LORA 捷迅易联 模式 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLmode(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_mode)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_mode, *value ); - Log_AddParamChange(216, *value, GlobalVariable.ConfigPara.Lora_jxyl_mode); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_mode)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLmode - *??? 述:读写LORA 捷迅易联 扩???带??? 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLbw(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_bw)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_bw, *value ); - Log_AddParamChange(217, *value, GlobalVariable.ConfigPara.Lora_jxyl_bw); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_bw)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWJXYLpower - *??? 述:读写LORA 捷迅易联 功率 参数 - *??? 入:读写标志位、?? - *返回值: - *??? 期:2020-8-17 - **********************************************************************************/ -static void RWJXYLpower(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_power)); - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_power, *value ); - Log_AddParamChange(218, *value, GlobalVariable.ConfigPara.Lora_jxyl_power); - *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_power)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.WriteFlag.LoraParaWrite = 1; - } -} - -/*********************************************************************************** - *函数名:RWTerrainSlopeDown - *??? 述: - *??? 入:读写标志位、?? - *返回值: - *??? 期:2021-8-17 - **********************************************************************************/ -static void RWTerrainSlopeEvening(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10); - } - else if(R_or_RW == 1) - { - GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening = ((float)((signed short)(*value)))/10.0f; - if(GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening >= -45.0f - && GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening <= 45.0f) - { - Log_AddParamChange(95, *value, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10)); - GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - else - { - Log_AddParamChange(95, (signed short)GlobalVariable.ConfigPara.TerrainSlope, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10)); - GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigPara.TerrainSlope; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -/************************************************* - Function : RWBatteryLowTriggerValue() - Description : Battery Low Trigger Value - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.13 - Additional Comments : [1800,2940],对应???设电压范围[18V,29.4V] -*************************************************/ -static void RWBatteryLowTriggerValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Low_TriggerValue; - } - else if(R_or_RW == 1) - { - if(*value >= 1800 && *value <= 2940) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_TriggerValue, *value ); - Log_AddParamChange(REG_BATTERY_LOW_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.Battery_Low_TriggerValue); - GlobalVariable.ConfigPara.Battery_Low_TriggerValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -/************************************************* - Function : RWBatteryLowRecoveryValue() - Description : Battery Low Recovery Value - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.13 - Additional Comments : [1800,2940],对应???设电压范围[18V,29.4V] -*************************************************/ -static void RWBatteryLowRecoveryValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Low_RecoveryValue; - } - else if(R_or_RW == 1) - { - if(*value >= 1800 && *value <= 2940) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_RecoveryValue, *value ); - Log_AddParamChange(REG_BATTERY_LOW_RECORERY_VALUE, *value, GlobalVariable.ConfigPara.Battery_Low_RecoveryValue); - GlobalVariable.ConfigPara.Battery_Low_RecoveryValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -/************************************************* - Function : RWBatteryEmptyTriggerValue() - Description : Battery Empty Trigger Value - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.13 - Additional Comments : [1800,2940],对应???设电压范围[18V,29.4V] -*************************************************/ -static void RWBatteryEmptyTriggerValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Empty_TriggerValue; - } - else if(R_or_RW == 1) - { - if(*value >= 1800 && *value <= 2940) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_TriggerValue, *value ); - Log_AddParamChange(REG_BATTERY_EMPTY_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.Battery_Empty_TriggerValue); - GlobalVariable.ConfigPara.Battery_Empty_TriggerValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -/************************************************* - Function : RWBatteryEmptyRecoveryValue() - Description : Battery Empty Recovery Value - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.13 - Additional Comments : [1800,2940],对应???设电压范围[18V,29.4V] -*************************************************/ -static void RWBatteryEmptyRecoveryValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue; - } - else if(R_or_RW == 1) - { - if(*value >= 1800 && *value <= 2940) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue, *value ); - Log_AddParamChange(REG_BATTERY_EMPTY_RECORERY_VALUE, *value, GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue); - GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - GlobalVariable.SpecialCheck.MasterSetBatErrParaToSlaveFlag = 1; - - } - } -} - -/************************************************* - Function : RResetCount() - Description : Reset Count - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RResetCount1(unsigned char R_or_RW, unsigned short *value) -{ - - - - - - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.Log.LogReset.ResetCount)+1); - } -} -static void RResetCount2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.Log.LogReset.ResetCount)); - } -} - -/************************************************* - Function : RWLogEnable() - Description : log enable - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RWLogEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.LogEnable; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LogEnable, *value ); - Log_AddParamChange(41, *value, GlobalVariable.ConfigPara.LogEnable); - GlobalVariable.ConfigPara.LogEnable = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - -/************************************************* - Function : RWPIDTarget() - Description : pid target - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -//static void RWPIDTarget(unsigned char R_or_RW, unsigned short *value) -//{ -// if(R_or_RW == 0) -// { -// *value = GlobalVariable.ConfigPara.Pid_Target; -// } -// else if(R_or_RW == 1) -// { -// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_Target, *value ); -// GlobalVariable.ConfigPara.Pid_Target = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -//} - -/************************************************* - Function : RWAskOperationNo() - Description : log Ask Operation No - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RWAskOperationNo(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Log.Ask_OperationNo ; - } - else if(R_or_RW == 1) - { - if( *value <= 100 ) - { - //Log_AddParamChange(10000 + 5, *value, GlobalVariable.Log.Ask_OperationNo); - GlobalVariable.Log.Ask_OperationNo = (unsigned short) *value; - } - } -} -/************************************************* - Function : - Description : from which num to read log - Input : null - Output : null - Return : null - Engineer : longcd - Revision : - Modified Date : - Additional Comments : -*************************************************/ -static void RWLogReadNum(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Log.read_num ; - } - else if(R_or_RW == 1) - { - GlobalVariable.Log.read_num = *value; - Log_ReadToBuf(GlobalVariable.Log.read_num); - } -} - -/************************************************* - Function : RWLogOperationSum() - Description : log Operation Sum - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RWLogOperationSum(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (GlobalVariable.Log.LogOperation.Sum > 100) ? 100 : GlobalVariable.Log.LogOperation.Sum ; - } -} - -/************************************************* - Function : RWAskWarningNo() - Description : log Ask Warning No - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RWAskWarningNo(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Log.Ask_WarningNo ; - } - else if(R_or_RW == 1) - { - if( *value <= 100 ) - { - GlobalVariable.Log.Ask_WarningNo = (unsigned short) *value; - } - } -} - -/************************************************* - Function : RWLogWarningSum() - Description : log Warning Sum - Input : null - Output : null - Return : null - Engineer : tangtao - Revision : V0.0 - Modified Date : 2021.10.08 - Additional Comments : -*************************************************/ -static void RWLogWarningSum(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (GlobalVariable.Log.LogWarning.Sum > 100) ? 100 : GlobalVariable.Log.LogWarning.Sum; - } -} - -/************************************************* - Function : RWInstallPostion() - Description : RWInstallPostion - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2022.08.23 - Additional Comments : -*************************************************/ -//static void RWInstallPostion(unsigned char R_or_RW, unsigned short *value) -//{ - -//} -/************************************************* - Function : RWSouthNorthShiftAngle() - Description : RWSouthNorthShiftAngle - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2022.08.25 - Additional Comments : -*************************************************/ -static void RWSouthNorthShiftAngle(unsigned char R_or_RW, unsigned short *value) -{ - short temp; - - if(R_or_RW == 0) - { - *value = *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle)); - } - else if(R_or_RW == 1) - { - temp = (signed short )(*value); - if( abs(temp) <= MAXABS_SOUTHNORTHSHIFTANGLE_PLUS100 ) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.SouthNorthShiftAngle, *value ); - Log_AddParamChange(413, *value, *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle))); - GlobalVariable.ConfigPara.SouthNorthShiftAngle = temp; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -/************************************************* - Function : RWFacingWindStopFunction_Enable() - Description : RWFacingWindStopFunction_Enable - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2022.08.30 - Additional Comments : -*************************************************/ -static void RWFacingWindStopFunction_Enable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.FacingWindStopFunction_Enable; - } - else if(R_or_RW == 1) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.FacingWindStopFunction_Enable, *value ); - Log_AddParamChange(116, *value, GlobalVariable.ConfigPara.FacingWindStopFunction_Enable); - GlobalVariable.ConfigPara.FacingWindStopFunction_Enable = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - -/************************************************* - Function : RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) - Description : RWYBTLoraParaEnable - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.03.08 - Additional Comments : 收到上位机下发的特殊字???:0x6A6A;MCU开始???取Lora参数 - MCU读取成功后,该寄存器??????改为0x7A7A; - 上位机???取???0x7A7A后,再去寄存???201-209读取Lora参数 -*************************************************/ -static void RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.SpecialCheck.ReadYBTLoraParaEnable; - } - else if(R_or_RW == 1) - { - GlobalVariable.SpecialCheck.ReadYBTLoraParaEnable = (unsigned short) *value; - } -} - - -/************************************************* - Function : RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value) - Description : RWEFacingWindAngle - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.01.09 - Additional Comments : 东迎风停靠???度,可设范围大于等???30???; -*************************************************/ -static void RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)); - } - else if(R_or_RW == 1) - { - if(*value >= 30 && *value <= 150) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EFacingWindAngle, *value ); - Log_AddParamChange(117, *value, GlobalVariable.ConfigPara.EFacingWindAngle); - *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -/************************************************* - Function : RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value) - Description : RWWFacingWindAngle - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.01.09 - Additional Comments : 西迎风停靠???度,可设范围小于等???150???; -*************************************************/ -static void RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)); - } - else if(R_or_RW == 1) - { - if(*value >= 30 && *value <= 150) - { - //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WFacingWindAngle, *value ); - Log_AddParamChange(118, *value, GlobalVariable.ConfigPara.WFacingWindAngle); - *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)) = *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -/************************************************* - Function : RWBatteryHighTemperatureProtection_TriggerValue() - Description : RWBatteryHighTemperatureProtection_TriggerValue - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.03 - Additional Comments : porting by longcd -*************************************************/ -static void RWBatteryHighTemperatureProtection_TriggerValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue; - } - else if(R_or_RW == 1) - { - // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); - if( (*value >= 25) && (*value <= 80) ) - { - Log_AddParamChange(REG_BATTERY_HIGHTEMPPRO_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue); - GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} -/************************************************* - Function : RWBatteryHighTemperatureProtection_ExitValue() - Description : RWBatteryHighTemperatureProtection_ExitValue - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.03 - Additional Comments : porting by longcd -*************************************************/ -static void RWBatteryHighTemperatureProtection_ExitValue(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue; - } - else if(R_or_RW == 1) - { - // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); - if( (*value >= 25) && (*value <= 80) ) - { - Log_AddParamChange(REG_BATTERY_HIGHTEMPPRO_EXIT_VALUE, *value, GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); - GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - -static void RWStopAllSlaveMotor(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.StopSlaveMotorFlag; - } - else if(R_or_RW == 1) - { - // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); - //д????????0????1????д????????????????????????д?? - if( (*value == 0x01) || (*value == 0x00) ) - { - if(*value != GlobalVariable.ConfigPara.StopSlaveMotorFlag) - { - Log_AddParamChange(REG_STOP_ALL_SLAVEMOTOR, *value, GlobalVariable.ConfigPara.StopSlaveMotorFlag); - GlobalVariable.ConfigPara.StopSlaveMotorFlag = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } - } -} - -/************************************************* - Function : RWBatSocLowRunBackWaitTime() - Description : RWBatSocLowRunBackWaitTime - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.08.11 - Additional Comments : BatSocLow报???时,返回大风保护位的等待时??? -*************************************************/ -static void RWBatSocLowRunBackWaitTime(unsigned char R_or_RW, unsigned short *value) -{ - - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime; - } - else if(R_or_RW == 1) - { - // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); - - if( (*value >= 0) && (*value <= 120) ) - { - Log_AddParamChange(REG_BATSOCLOWRUNBACK_WAITTIME , *value, GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime); - GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } - } -} - - - -/******************************************************* - commucation test -*******************************************************/ -static void RCommuTestCrcErr(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(0); - } -} - -static void RCommuTestCrcOk(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(1); - } -} - -static void RCommuTestReply(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(2); - } -} - -static void RWCommuTestClearAll(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = 0; - } - else if(R_or_RW == 1) - { - if(0xaa00 == *value) - { - CommuTest_ClearAll(); - } - } -} - - - -/************************************************* - Function : RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) - Description : RWYBTLoraParaEnable - Input : null - Output : null - Return : null - Engineer : Liuchengrun - Revision : V0.0 - Modified Date : 2024.03.05 - Additional Comments : 收到上位机下发的特殊字???:0x6B6B;MCU开始???取Bluetooth参数 - MCU读取成功后,该寄存器????改为0x7B7B;失败??3B3B; - 上位机???取??0x7B7B后,再去寄存??220-230读取Bluetooth参数 -*************************************************/ -static void RWYBTBluetoothParaEnable(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.SpecialCheck.ReadYBTBlueoothParaEnable; - } - else if(R_or_RW == 1) - { - GlobalVariable.SpecialCheck.ReadYBTBlueoothParaEnable = (unsigned short) *value; - } -} - -static void RBluetoothMACPara1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add1; - } -} -static void RBluetoothMACPara2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add2; - } -} -static void RBluetoothMACPara3(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add3; - } -} - -static void RBluetoothMACPara4(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add4; - } -} -static void RBluetoothMACPara5(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add5; - } -} -static void RBluetoothMACPara6(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add6; - } -} - -/************************************************* - Function : RWLostComm_BatsocLow_TargetAngle() - Description : RWLostComm_BatsocLow_TargetAngle - Input : null - Output : null - Return : null - Engineer : QuXiaoWen - Revision : V0.0 - Modified Date : 2024.08.14 - Additional Comments : 读写低电量或者失联时的保护角度 -*************************************************/ -static void RWLostComm_BatsocLow_TargetAngle(unsigned char R_or_RW, unsigned short *value) -{ - - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle; - } - else if(R_or_RW == 1) - { - // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); - - if(*value >= 30 && *value <= 150) - { - Log_AddParamChange(REG_LOSTCOMM_BATSOCLOW_TARGET_ANGLE, *value, GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle); - GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1;// - } - } -} - - - - - -/************************************************* -crc统??????数 -*************************************************/ - -static void RCommuTest_RecvID_Tracker_CrcOK(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(3); - } -} -/************************************************* -crc统??????数 -*************************************************/ - -static void RCommuTest_RecvID_Tracker_Reply(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(4); - } -} -/************************************************* -crc统??????数 -*************************************************/ - -static void RCommuTest_RecvID_Tracker_CrcErr(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(5); - } -} -/************************************************* -crc统??????数 -*************************************************/ - -static void RCommuTest_RecvID_00_CrcOK(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(6); - } -} -/************************************************* -crc统??????数 -*************************************************/ - -static void RCommuTest_RecvID_00_CrcErr(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = CommuTest_GetOne(7); - } -} - - - - - - - -static void ReadUIRightPanelMasterSlaveAlarmsHighPart2(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[0])+1); - } -} -static void ReadUIRightPanelMasterSlaveAlarmsLowPart2(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[0])); - } -} - -static void ReadUIRightPanelMasterSlaveAlarmsHighPart3(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[1])+1); - } -} -static void ReadUIRightPanelMasterSlaveAlarmsLowPart3(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[1])); - } -} - - - -static void RWWarningAndFaultOfSlave_1(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[0])); - // *value = 0xFFFF; - } -} - - -static void RWWarningAndFaultOfSlave_2(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[1])); - } -} - -static void RWWarningAndFaultOfSlave_3(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[2])); - } -} -static void RWWarningAndFaultOfSlave_4(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[3])); - } -} - -static void RWWarningAndFaultOfSlave_5(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[4])); - } -} -static void RWWarningAndFaultOfSlave_6(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[5])); - } -} -static void RWWarningAndFaultOfSlave_7(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[6])); - } -} -static void RWWarningAndFaultOfSlave_8(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[7])); - } -} -static void RWWarningAndFaultOfSlave_9(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[8])); - } -} -static void RWWarningAndFaultOfSlave_10(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[9])); - } -} -static void RWWarningAndFaultOfSlave_11(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[10])); - } -} -static void RWWarningAndFaultOfSlave_12(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[11])); - } -} -static void RWWarningAndFaultOfSlave_13(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[12])); - } -} -static void RWWarningAndFaultOfSlave_14(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[13])); - } -} -static void RWWarningAndFaultOfSlave_15(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[14])); - } -} -static void RWWarningAndFaultOfSlave_16(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[15])); - } -} -static void RWWarningAndFaultOfSlave_17(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[16])); - } -} -static void RWWarningAndFaultOfSlave_18(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[17])); - } -} - -static void RWWarningAndFaultOfSlave_19(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[18])); - } -} - -static void RWWarningAndFaultOfSlave_20(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[19])); - } -} - - - - - -static void RWStaticDiffAngle(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - - *value = GlobalVariable.ConfigPara.staticDiffAngle; - } - else if((R_or_RW == 1)&&( *value >= 3.0f && *value <= 6.0f)&&(GlobalVariable.ConfigPara.staticDiffAngle != *value)) - { - - Log_AddParamChange(REG_STATIC_DIFF_ANGLE, *value, GlobalVariable.ConfigPara.staticDiffAngle); - GlobalVariable.ConfigPara.staticDiffAngle = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - - -static void RWMoveDiffAngle(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.moveDiffAngle; - } - else if((R_or_RW == 1)&&( *value >= 3.0f && *value <= 10.0f)&&(GlobalVariable.ConfigPara.moveDiffAngle!= *value)) - { - - Log_AddParamChange(REG_MOVE_DIFF_ANGLE, *value, GlobalVariable.ConfigPara.moveDiffAngle); - GlobalVariable.ConfigPara.moveDiffAngle = (unsigned short) *value; - GlobalVariable.WriteFlag.ConfigParaWrite = 1; - } -} - -/************************************************* - Function : RWWeaherState(unsigned char R_or_RW, unsigned short *value) - Description : RWWeaherState(unsigned char R_or_RW, unsigned short *value) - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2024.11.14 - Additional Comments : 天气状态 - 1:晴天(自动跟踪) - 3:过渡天气(上午停80度,下午停100度) - 4:阴天(停90度) -*************************************************/ -static void RWWeaherState(unsigned char R_or_RW, unsigned short *value) -{ - static unsigned short WeatherStateTemp = 0; - - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&WeaherState)); - } - else if(R_or_RW == 1) - { - *(((unsigned short *)&WeaherState)) = *value; - - WeaherStateTime = GlobalVariable.Time.TodayTime; // 当前时间 - WeaherStateTimeFlag = 1; - Log_AddParamChange(REG_WEATHERSTATE , *value, WeatherStateTemp); - WeatherStateTemp = *value; - } - -} - - - -//以下内???为新???精简协???功能 -/************************************************* - Function : RProtocol_Version() - Description : RProtocol_Version - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 - Additional Comments : 协???版本,RegAddr: 29;(供上位机和通???箱区分使用不同的协???版本,通???箱???常???询时???以知道是否支持新协?????? - 0xAAF2:???持新的精简协???,同时兼容旧的协??? - 其他值:??????持旧协??? -*************************************************/ -static void RProtocol_Version(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.ProtocolVersion; - } -} -/************************************************* - Function : RProtocol_Version_S() - Description : RProtocol_Version_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 - Additional Comments : 协???版本,RegAddr: 29;(供上位机和通???箱区分使用不同的协???版本,通???箱???常???询时???以知道是否支持新协?????? - 0xAAF2:???持新的精简协???,同时兼容旧的协??? - 其他值:??????持旧协??? -*************************************************/ -static void RProtocol_Version_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.ProtocolVersion; - } -} -/************************************************* - Function : RDeviceType_S() - Description : RDeviceType_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???内的设???类型: -*************************************************/ -static void RDeviceType_S(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.DeviceType; - } -} -/************************************************* - Function : RDeviceEdition_S() - Description : RDeviceEdition_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???内的大版???号,???8为软件版???号,???8位为???件版???号: -*************************************************/ -static void RDeviceEdition_S(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.FixePara.DeviceEdition; - } -} -/************************************************* - Function : RVersion1_S() - Description : RVersion1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???小版???号;???8位为设???类型,???8位暂时不?????? -*************************************************/ -static void RVersion1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.FixePara.Version1); - } -} -/************************************************* - Function : RVersion2_S() - Description : RVersion2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???小版???号;???8位为发布版本号,???8位为测试版本号: -*************************************************/ -static void RVersion2_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.FixePara.Version2); - } -} -/************************************************* - Function : RPVBuckerVoltage_S - Description : RPVBuckerVoltage_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???PV组件电压,放???10倍: -*************************************************/ -static void RPVBuckerVoltage_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.PowerPara.PVBuckerVoltage * 10); - } -} -/************************************************* - Function : RBatVoltage_S - Description : RBatVoltage_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???电池电压,放???10倍: -*************************************************/ -static void RBatVoltage_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)(GlobalVariable.PowerPara.BatteryVoltage * 10); - } -} -/************************************************* - Function : RBatSOCTemp_S() - Description : RBatSOCTemp_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.25 -Additional Comments : 精简协???电池SOC(放大100???)/; -*************************************************/ -static void RBatSOCTemp_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = 0x00FF & (unsigned char)(GlobalVariable.PowerPara.BatterySOC*100); - *value = *value << 8; - *value &= 0xFF00; - *value |= ((signed char)(GlobalVariable.PowerPara.BatteryTemperature) & 0x00FF); - } -} -/************************************************* - Function : RTemp_S() - Description : RTemp_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???主板温度/; -*************************************************/ -static void RTemp_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(unsigned short *)&GlobalVariable.Tmp.BoardTmp; - } -} -/************************************************* - Function : RBatState_BatCurrent_S() - Description : RBatState_BatCurrent_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???电池充电状??/电池电流; -*************************************************/ -static void RBatState_BatCurrent_S(unsigned char R_or_RW, unsigned short *value) -{ - signed short temp = 0; - - temp = (signed short)(GlobalVariable.PowerPara.BatteryCurrent*100); - - if(R_or_RW == 0) - { - *value = 0; - *value |= (*(unsigned char*)(&GlobalVariable.PowerPara.ChargeState)) << 12; - *value |= *((unsigned short *)&temp); - } -} -/************************************************* - Function : RWWorkMode1_S() - Description : RWWorkMode1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???工作模式; -*************************************************/ -static void RWWorkMode1_S(unsigned char R_or_RW, unsigned short *value ) -{ - int i; - - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)); - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.WorkMode.WorkMode, GlobalVariable.WorkModeBuffer.WorkMode ); -// *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)) = *value; - -// if((GlobalVariable.WorkMode.WorkMode & 0xffff) != *value) -// { -// Log_AddWorkModeChange(*value, GlobalVariable.WorkMode.WorkMode,LOG_WORK_MODE_RCV); -// } -// -// for(i = 0; i < sizeof(valid_mode)/sizeof(valid_mode[0]); i++) -// { -// if(*value == valid_mode[i]) -// { -// break; -// } -// } -// -// if(i >= sizeof(valid_mode)/sizeof(valid_mode[0])) -// { -// return; //非有效模式直接返??? -// } - -// if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFF) -// { -// NVIC_SystemReset(); -// } -// else if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFE)//停机模式 -// { -// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkMode.WorkMode; //如果收到通???箱停机模式,保持原模式,不响??? -//// MotorAllStop(); /* Stop */ -//// GlobalVariable.WorkModeBuffer.WorkMode = AUTO_TRACKER_MODE; -//// RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR外???时??? -//// -//// EXTI_InitTypeDef EXTI_InitStructure; -//// NVIC_InitTypeDef NVIC_InitStructure; -//// RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); //使能复用功能时钟 - -// // //GPIOE.2 ??????线以及中???初???化配置 下降沿触??? LORA_RX : PA10 -//// GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource10); -//// -//// EXTI_InitStructure.EXTI_Line=EXTI_Line10; //PA10 -//// EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; -//// EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; -//// EXTI_InitStructure.EXTI_LineCmd = ENABLE; -//// EXTI_Init(&EXTI_InitStructure); //根据EXTI_InitStruct???指定的参数初始化外???EXTI寄存??? - -//// NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //使能按键WK_UP所在的外部??????通道 -//// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //抢占优先???2??? -//// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x03; //子优先级3 -//// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //使能外部??????通道 -//// NVIC_Init(&NVIC_InitStructure); -//// -//// IWDG_ReloadCounter(); -//// IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); -//// IWDG_SetPrescaler(IWDG_Prescaler_256); -//// IWDG_SetReload(0xFFF); -//// IWDG_ReloadCounter(); -//// -//// RTC_Local_Init(); -//// -//// us_tick = SysTick->CTRL; -//// SysTick->CTRL = 0; -//// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP模式 -//// OS_ERR err; -//// OSSchedLock(&err); -//// while(1) -//// { -//// if(uc_rtcFlag==1) -//// { -//// uc_rtcFlag = 0; -//// SysTick->CTRL = us_tick; -//// SystemInit(); -//// OS_CPU_SysTickInit(720000); -//// IWDG_ReloadCounter(); -//// RCC_LSICmd(ENABLE); -//// RTC_WaitForSynchro(); -//// RTC_Local_Init(); -//// us_tick = SysTick->CTRL; -//// SysTick->CTRL = 0; -//// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP模式 -//// } -//// } -// } -// else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) -// { -// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; -// GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; -// } -// else -// { -// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; -// } -// } -} -/************************************************* - Function : RWarningAndFault1_1_S() - Description : RWarningAndFault1_1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???Alarm; -*************************************************/ -static void RWarningAndFault1_1_S(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { -// *value = *(((unsigned short *)&GlobalVariable.MasterselfWarningAndFault)+1); - *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)+1); - } -} -/************************************************* - Function : RWarningAndFault1_2_S() - Description : RWarningAndFault1_2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???Alarm; -*************************************************/ -static void RWarningAndFault1_2_S(unsigned char R_or_RW, unsigned short *value ) -{ - if(R_or_RW == 0) - { -// *value = *(((unsigned short *)&GlobalVariable.MasterselfWarningAndFault)); - *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)); - } - -} -/************************************************* - Function : RMotorCurrent1_S() - Description : RMotorCurrent1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???电机电流; -*************************************************/ -static void RMotorCurrent1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (short)(GlobalVariable.Motor[0].Motorcurrent * 10); - } -} -/************************************************* - Function : RTargetAngle1_S() - Description : RTargetAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协??????标???度,放大100倍; -*************************************************/ -static void RTargetAngle1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short )(GlobalVariable.WorkMode.Target * 100); - } -} -/************************************************* - Function : RRealAngle1_S() - Description : RRealAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???实际角度,放大100倍; -*************************************************/ -static void RRealAngle1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = ( unsigned short )(GlobalVariable.Motor[0].ActualAngle * 100); - } -} -/************************************************* - Function : RWWorkMode2_S() - Description : RWWorkMode2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???工作模式; -*************************************************/ -static void RWWorkMode2_S(unsigned char R_or_RW, unsigned short *value ) -{ -} -/************************************************* - Function : RWarningAndFault1_1_S() - Description : RWarningAndFault1_1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???Alarm; -*************************************************/ -static void RWarningAndFault2_1_S(unsigned char R_or_RW, unsigned short *value ) -{ - -} -/************************************************* - Function : RWarningAndFault1_2_S() - Description : RWarningAndFault1_2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???Alarm; -*************************************************/ -static void RWarningAndFault2_2_S(unsigned char R_or_RW, unsigned short *value ) -{ - -} -/************************************************* - Function : RMotorCurrent1_S() - Description : RMotorCurrent1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???电机电流; -*************************************************/ -static void RMotorCurrent2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RTargetAngle1_S() - Description : RTargetAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协??????标???度,放大100倍; -*************************************************/ -static void RTargetAngle2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RRealAngle2_S() - Description : RRealAngle2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协??????标???度,放大100倍; -*************************************************/ -static void RRealAngle2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RWAIRemoteTarget1_S() - Description : RWAIRemoteTarget1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???远程???标???度1??? -*************************************************/ -static void RWAIRemoteTarget1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short)GlobalVariable.AIPara.AIRemoteAngle; - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.AIPara.AIRemoteAngle, *value ); -// Log_AddParamChange(384, *value, (unsigned short)GlobalVariable.AIPara.AIRemoteAngle); -// GlobalVariable.AIPara.AIRemoteAngle = (float)*value; -// GlobalVariable.AIPara.AIModeDelayCount = 0; -// } -} -/************************************************* - Function : RWAIRemoteTarget2_S() - Description : RWAIRemoteTarget2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???远程???标???度2??? -*************************************************/ -static void RWAIRemoteTarget2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RWRemoteWindDirect_S() - Description : RWRemoteWindDirect_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???远程风向??? -*************************************************/ -static void RWRemoteWindDirect_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Weather.RemoteWindDirect; - } -// else if(R_or_RW == 1) -// { -// Log_AddParamChange(387, *value, GlobalVariable.Weather.RemoteWindDirect); -// GlobalVariable.Weather.RemoteWindDirect = *value; -// } -} -/************************************************* - Function : RWRemoteWindSpeed_S() - Description : RWRemoteWindSpeed_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???远程风速; -*************************************************/ -static void RWRemoteWindSpeed_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.Weather.RemoteWindSpeed; - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.Weather.RemoteWindSpeed, *value ); -// Log_AddParamChange(386, *value, GlobalVariable.Weather.RemoteWindSpeed); -// GlobalVariable.Weather.RemoteWindSpeed = *value; -// } -} -/************************************************* - Function : RWLongitude1_S() - Description : RWLongitude1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???经度??? -*************************************************/ -/* Longitude */ -static void RWLongitude1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1); - } -// else if(R_or_RW == 1) -// { -// Log_AddParamChange(388, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1)); -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1) = *value; -// } -} -/************************************************* - Function : RWLongitude2_S() - Description : RWLongitude2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???经度??? -*************************************************/ -static void RWLongitude2_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)); - } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)) = *value; -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.Longitude, GlobalVariable.ConfigParaBuffer.Longitude ); -// -// if(GlobalVariable.ConfigParaBuffer.Longitude >= -180.0 -// &&GlobalVariable.ConfigParaBuffer.Longitude <= 180.0 ) -// { -// Log_AddParamChange(389, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude))); -// GlobalVariable.ConfigPara.Longitude = GlobalVariable.ConfigParaBuffer.Longitude; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} - -/************************************************* - Function : RWLatitude1_S() - Description : RWLatitude1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协??????度; -*************************************************/ -static void RWLatitude1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1); - } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1) = *value; -// } -} -/************************************************* - Function : RWLatitude2_S() - Description : RWLatitude2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协??????度; -*************************************************/ -static void RWLatitude2_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)); - } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)) = *value; -// if(GlobalVariable.ConfigParaBuffer.Latitude >= -90.0 -// && GlobalVariable.ConfigParaBuffer.Latitude <= 90.0) -// { -// Log_AddParamChange(390, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1)); -// Log_AddParamChange(391, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude))); -// GlobalVariable.ConfigPara.Latitude = GlobalVariable.ConfigParaBuffer.Latitude; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWTimeZone1_S() - Description : RWTimeZone1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???时区??? -*************************************************/ -static void RWTimeZone1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1); - } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1) = *value; -// } -} -/************************************************* - Function : RWTimeZone2_S() - Description : RWTimeZone2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.26 -Additional Comments : 精简协???时区??? -*************************************************/ -static void RWTimeZone2_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)); - } -// else if(R_or_RW == 1) -// { -// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)) = *value; -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.TimeZone, GlobalVariable.ConfigParaBuffer.TimeZone ); -// if(GlobalVariable.ConfigParaBuffer.TimeZone >= -12.0 -// && GlobalVariable.ConfigParaBuffer.TimeZone <= 12.0) -// { -// Log_AddParamChange(392, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); -// Log_AddParamChange(393, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone))); -// GlobalVariable.ConfigPara.TimeZone = GlobalVariable.ConfigParaBuffer.TimeZone; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWTimeYearMonth_S() - Description : RWTimeYearMonth_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 -Additional Comments : 精简协???年,月; 年:???8位;月:???8??? -*************************************************/ -static void RWTimeYearMonth_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = ((GlobalVariable.Time.Year % 2000) << 8) | (GlobalVariable.Time.Month); - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); -// GlobalVariable.TimeBuffer.Year = 2000 + (*value >> 8); -// GlobalVariable.TimeBuffer.Month = (*value & 0xFF); -// GlobalVariable.WriteFlag.TimeWrite = 2; -// } -} -/************************************************* - Function : RWTimeDayHour_S() - Description : RWTimeDayHour_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 -Additional Comments : 精简协???日,时; 日:???8位;时:???8??? -*************************************************/ -static void RWTimeDayHour_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = ((GlobalVariable.Time.Day) << 8) | (GlobalVariable.Time.Hour); - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); -// GlobalVariable.TimeBuffer.Day = (*value >> 8); -// GlobalVariable.TimeBuffer.Hour = (*value & 0xFF); -// GlobalVariable.WriteFlag.TimeWrite = 2; -// } -} -/************************************************* - Function : RWTimeMinuteSecond_S() - Description : RWTimeMinuteSecond_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 -Additional Comments : 精简协???分,秒; 分:???8位;秒:???8??? -*************************************************/ -static void RWTimeMinuteSecond_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = ((GlobalVariable.Time.Minute) << 8) | (GlobalVariable.Time.Second); - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); -// GlobalVariable.TimeBuffer.Minute = (*value >> 8); -// GlobalVariable.TimeBuffer.Second = (*value & 0xFF); -// GlobalVariable.WriteFlag.TimeWrite = 2; -// } -} -/************************************************* - Function : RElevationAngle1_S() - Description : RElevationAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 - Additional Comments : 精简协???,太阳高度???1 -*************************************************/ -static void RElevationAngle1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.AstronomyPara.ElevationAngle * 100; - } -} -/************************************************* - Function : RAzimuthAngle1_S() - Description : RAzimuthAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 - Additional Comments : 精简协???,太阳方位???1 -*************************************************/ -static void RAzimuthAngle1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.AstronomyPara.AzimuthAngle * 100; - } -} -/************************************************* - Function : RElevationAngle2_S() - Description : RElevationAngle2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 - Additional Comments : 精简协???,太阳高度???2 -*************************************************/ -static void RElevationAngle2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RAzimuthAngle2_S() - Description : RAzimuthAngle2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.27 - Additional Comments : 精简协???,太阳方位???2 -*************************************************/ -static void RAzimuthAngle2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RWComID_S() - Description : RWComID_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,控制器ID -*************************************************/ -static void RWComID_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID)); - } -// else if(R_or_RW == 1) -// { -// if(*value >= 1 && *value < 255) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); -// Log_AddParamChange(401, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ComID))); -// GlobalVariable.ConfigPara.ComID =(unsigned char) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWChannelSelect_S() - Description : RWChannelSelect_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,通道选择 -*************************************************/ -static void RWChannelSelect_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RRWEWTracingAccuracy_S() - Description : RWEWTracingAccuracy_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,跟???精度,放大100??? -*************************************************/ -static void RWEWTracingAccuracy_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short )(GlobalVariable.ConfigPara.EWTracingAccuracy * 100); - } -// else if(R_or_RW == 1) -// { -// -// GlobalVariable.ConfigPara.EWTracingAccuracy = (*value) * 0.01; -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.EWTracingAccuracy, GlobalVariable.ConfigParaBuffer.EWTracingAccuracy ); -// if(GlobalVariable.ConfigParaBuffer.EWTracingAccuracy >= 0.98 -// && GlobalVariable.ConfigParaBuffer.EWTracingAccuracy <= 5.1) -// { -// Log_AddParamChange(403, *value, (unsigned short )(GlobalVariable.ConfigPara.EWTracingAccuracy * 100)); -// GlobalVariable.ConfigPara.EWTracingAccuracy = GlobalVariable.ConfigParaBuffer.EWTracingAccuracy; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWHeatEnable_S() - Description : RWHeatEnable_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,加???使能 -*************************************************/ -static void RWHeatEnable_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable)); - } -// else if(R_or_RW == 1) -// { -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.HeatEnable, *value ); -// if((*value == 0) || (*value == 1)) -// { -// Log_AddParamChange(404, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable))); -// GlobalVariable.ConfigPara.HeatEnable =(unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWMotorOrientation_S() - Description : RWMotorOrientation_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,电机朝??? -*************************************************/ -static void RWMotorOrientation_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.MotorOrientation; - } -// else if(R_or_RW == 1) -// { -// if(*value == 0 || *value == 1) //0:电机朝东; 1:电机朝??? -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOrientation, *value ); -// Log_AddParamChange(405, *value, GlobalVariable.ConfigPara.MotorOrientation); -// GlobalVariable.ConfigPara.MotorOrientation = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWProtectCurrent_S() - Description : RWProtectCurrent_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,电机朝??? -*************************************************/ -static void RWProtectCurrent_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (unsigned short) (GlobalVariable.ConfigPara.MotorOverCurrentValue * 100); - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue = ((*value) * 0.01); -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValue, GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue ); -// -// if( (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue > 0.19f) && -// (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue < 20.1f ) ) //???6.1放大???20.1限制 -// { -// Log_AddParamChange(406, *value, (unsigned short) (GlobalVariable.ConfigPara.MotorOverCurrentValue * 100)); -// GlobalVariable.ConfigPara.MotorOverCurrentValue = GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWPVModuleWidth_S() - Description : RWPVModuleWidth_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,组件???度 -*************************************************/ -static void RWPVModuleWidth_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.PVModuleWidth * 100; - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.PVModuleWidth = (*value) * 0.01; -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.PVModuleWidth, GlobalVariable.ConfigParaBuffer.PVModuleWidth ); -// if((GlobalVariable.ConfigParaBuffer.PVModuleWidth >= 0.2) && (GlobalVariable.ConfigParaBuffer.PVModuleWidth <= 20.0) ) -// { -// Log_AddParamChange(407, *value, GlobalVariable.ConfigPara.PVModuleWidth * 100); -// GlobalVariable.ConfigPara.PVModuleWidth = GlobalVariable.ConfigParaBuffer.PVModuleWidth; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWPostSpacing_S() - Description : RWPostSpacing_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,立柱间??? -*************************************************/ -static void RWPostSpacing_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.PostSpacing * 100; - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.PostSpacing = (*value) * 0.01; -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.PostSpacing, GlobalVariable.ConfigParaBuffer.PostSpacing ); -// if((GlobalVariable.ConfigParaBuffer.PostSpacing >= GlobalVariable.ConfigPara.PVModuleWidth) &&( GlobalVariable.ConfigParaBuffer.PostSpacing <= 50.0) ) -// { -// Log_AddParamChange(408, *value, GlobalVariable.ConfigPara.PostSpacing * 100); -// GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigParaBuffer.PostSpacing; -// } -// else -// { -// Log_AddParamChange(408, (GlobalVariable.ConfigPara.PVModuleWidth - 0.1)*100, GlobalVariable.ConfigPara.PostSpacing * 100); -// GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigPara.PVModuleWidth - 0.1; -// } -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// -// } -} -/************************************************* - Function : RWTerrainSlope1_S() - Description : RWTerrainSlope1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,上坡度1 -*************************************************/ -static void RWTerrainSlope1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (signed short)GlobalVariable.ConfigPara.TerrainSlope * 100; - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.TerrainSlope = ((signed short)(*value)) * 0.01; -// if(GlobalVariable.ConfigParaBuffer.TerrainSlope >= -45.0f -// && GlobalVariable.ConfigParaBuffer.TerrainSlope <= 45.0f) -// { -// Log_AddParamChange(409, *value, GlobalVariable.ConfigPara.TerrainSlope * 100); -// GlobalVariable.ConfigPara.TerrainSlope = GlobalVariable.ConfigParaBuffer.TerrainSlope; -// -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWTerrainSlopeEvening1_S() - Description : RWTerrainSlopeEvening1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,下坡度1 -*************************************************/ -static void RWTerrainSlopeEvening1_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100); - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening = ((signed short)(*value)) * 0.01; -// if(GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening >= -45.0f -// && GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening <= 45.0f) -// { -// Log_AddParamChange(410, *value, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100)); -// GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// else -// { -// Log_AddParamChange(410, (signed short)(GlobalVariable.ConfigPara.TerrainSlope*100), (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100)); -// GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigPara.TerrainSlope; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWTerrainSlope2_S() - Description : RWTerrainSlope2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,上坡度2 -*************************************************/ -static void RWTerrainSlope2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RWTerrainSlopeEvening2_S() - Description : RWTerrainSlopeEvening2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,下坡度2 -*************************************************/ -static void RWTerrainSlopeEvening2_S(unsigned char R_or_RW, unsigned short *value) -{ - -} -/************************************************* - Function : RWSouthNorthShiftAngle1_S() - Description : RWSouthNorthShiftAngle1_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,南北向偏移角度1 -*************************************************/ -static void RWSouthNorthShiftAngle1_S(unsigned char R_or_RW, unsigned short *value) -{ - short temp; - - if(R_or_RW == 0) - { - *value = *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle)); - } -// else if(R_or_RW == 1) -// { -// temp = (signed short )(*value); -// if( abs(temp) <= MAXABS_SOUTHNORTHSHIFTANGLE_PLUS100 ) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.SouthNorthShiftAngle, *value ); -// Log_AddParamChange(413, *value, *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle))); -// GlobalVariable.ConfigPara.SouthNorthShiftAngle = temp; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWSouthNorthShiftAngle2_S() - Description : RWSouthNorthShiftAngle2_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,南北向偏移角度2 -*************************************************/ -static void RWSouthNorthShiftAngle2_S(unsigned char R_or_RW,unsigned short *value) -{ - -} -/************************************************* - Function : RWEWSoftLimitAngle_S() - Description : RWEWSoftLimitAngle_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,东西软限位角度,高字节:东限位;低字节:西限??? -*************************************************/ -static void RWEWSoftLimitAngle_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle ); - } -// else if(R_or_RW == 1) -// { -// GlobalVariable.ConfigParaBuffer.ESoftLimitAngle = ((*value) >> 8) * 1.00; //???8??? -// GlobalVariable.ConfigParaBuffer.WSoftLimitAngle = (*value & 0xFF) * 1.00; //???8??? - -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.ESoftLimitAngle, GlobalVariable.ConfigParaBuffer.ESoftLimitAngle ); -// if(GlobalVariable.ConfigParaBuffer.ESoftLimitAngle >= 29.9 ) -// { -// Log_AddParamChange(415, *value, (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle )); -// GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// -// if ( GlobalVariable.ConfigParaBuffer.WSoftLimitAngle <= 150.1) -// { -// Log_AddParamChange(415, *value, (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle )); -// GlobalVariable.ConfigPara.WSoftLimitAngle = GlobalVariable.ConfigParaBuffer.WSoftLimitAngle; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWCleaningDockAngle_S() - Description : RWCleaningDockAngle_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,清洗???度 -*************************************************/ -static void RWCleaningDockAngle_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.CleaningDockAngle; - } -// else if(R_or_RW == 1) -// { -// if(*value >= 30 && *value <= 150) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.CleaningDockAngle, *value ); -// Log_AddParamChange(416, *value, GlobalVariable.ConfigPara.CleaningDockAngle); -// GlobalVariable.ConfigPara.CleaningDockAngle = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWBackAngle_S() - Description : RWBackAngle_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,???返角度 -*************************************************/ -static void RWBackAngle_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)); - } -// else if(R_or_RW == 1) -// { -// if(*value >= 59.9 && *value <= 120.1) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.BackAngle, *value ); -// Log_AddParamChange(417, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWNoComEnable_S() - Description : RWNoComEnable_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,无通???使能 -*************************************************/ -static void RWNoComEnable_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.NoComEnable; - } -// else if(R_or_RW == 1) -// { -// if( (*value == 0) ||(*value == 1) ) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.NoComEnable, *value ); -// Log_AddParamChange(418, *value, GlobalVariable.ConfigPara.NoComEnable); -// GlobalVariable.ConfigPara.NoComEnable = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWUpWindSpeed_S() - Description : RWUpWindSpeed_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,大风保护启???????? -*************************************************/ -static void RWUpWindSpeed_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= 40) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpWindSpeed, *value ); -// Log_AddParamChange(419, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWUpStartTime_S() - Description : RWUpStartTime_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,大风保护启动时??? -*************************************************/ -static void RWUpStartTime_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= 1000) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpStartTime, *value ); -// Log_AddParamChange(420, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWLowWindSpeed_S() - Description : RWLowWindSpeed_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,退出大风保护????? -*************************************************/ -static void RWLowWindSpeed_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= (GlobalVariable.ConfigPara.UpWindSpeed - 1)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, *value ); -// Log_AddParamChange(421, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = *value; -// } -// else -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, GlobalVariable.ConfigPara.UpWindSpeed - 1 ); -// Log_AddParamChange(421, GlobalVariable.ConfigPara.UpWindSpeed - 1, *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = GlobalVariable.ConfigPara.UpWindSpeed - 1; -// } -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -} -/************************************************* - Function : RWLowStopTime_S() - Description : RWLowStopTime_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,退出大风保护时??? -*************************************************/ -static void RWLowStopTime_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)); - } -// else if(R_or_RW == 1) -// { -// if(*value <= 1000) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowStopTime, *value ); -// Log_AddParamChange(422, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime))); -// *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)) = *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWFacingWindStopFunction_Enable_S() - Description : RWFacingWindStopFunction_Enable_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,迎风停靠使??? -*************************************************/ -static void RWFacingWindStopFunction_Enable_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.FacingWindStopFunction_Enable; - } -// else if(R_or_RW == 1) -// { -// if((*value == 0) || (*value == 1 )) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.FacingWindStopFunction_Enable, *value ); -// Log_AddParamChange(423, *value, GlobalVariable.ConfigPara.FacingWindStopFunction_Enable); -// GlobalVariable.ConfigPara.FacingWindStopFunction_Enable = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWEWFacingWindAngle_S() - Description : RWEWFacingWindAngle_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.28 - Additional Comments : 精简协???,东西迎???停靠???度,高字节:东迎???停靠???;低字节:西迎风停靠??? -*************************************************/ -static void RWEWFacingWindAngle_S(unsigned char R_or_RW, unsigned short *value) -{ - unsigned short E_TempAngle, W_TempAngle; - if(R_or_RW == 0) - { - *value = (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle ; - } -// else if(R_or_RW == 1) -// { -// E_TempAngle = ((*value) >> 8); //东迎风???度取高8??? -// W_TempAngle = ((*value) & 0xFF); //西迎风???度去低8??? - -// -// if((E_TempAngle >= 30) && (E_TempAngle <= 150) ) -// { -// Log_AddParamChange(424, *value, (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle); -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EFacingWindAngle, E_TempAngle ); -// *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)) = E_TempAngle; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// -// if((W_TempAngle >= 30) && (W_TempAngle <= 150) ) -// { -// Log_AddParamChange(424, *value, (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle); -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WFacingWindAngle, W_TempAngle ); -// *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)) = W_TempAngle; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWBatteryLowTriggerValue_S() - Description : Battery Low Trigger Value_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.29 - Additional Comments : -*************************************************/ -static void RWBatteryLowTriggerValue_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Low_TriggerValue; - } -// else if(R_or_RW == 1) -// { -// if((*value >= 1800) && (*value <= 2940)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_TriggerValue, *value ); -// Log_AddParamChange(425, *value, GlobalVariable.ConfigPara.Battery_Low_TriggerValue); -// GlobalVariable.ConfigPara.Battery_Low_TriggerValue = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} - -/************************************************* - Function : RWBatteryLowRecoveryValue_S() - Description : RWBatteryLowRecoveryValue_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.29 - Additional Comments : -*************************************************/ -static void RWBatteryLowRecoveryValue_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Low_RecoveryValue; - } -// else if(R_or_RW == 1) -// { -// if((*value >= 1800) && (*value <= 2940)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_RecoveryValue, *value ); -// Log_AddParamChange(426, *value, GlobalVariable.ConfigPara.Battery_Low_RecoveryValue); -// GlobalVariable.ConfigPara.Battery_Low_RecoveryValue = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWBatteryEmptyTriggerValue_S() - Description : Battery Empty Trigger Value_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.29 - Additional Comments : -*************************************************/ -static void RWBatteryEmptyTriggerValue_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Empty_TriggerValue; - } -// else if(R_or_RW == 1) -// { -// if((*value >= 1800) && (*value <= 2940)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_TriggerValue, *value ); -// Log_AddParamChange(427, *value, GlobalVariable.ConfigPara.Battery_Empty_TriggerValue); -// GlobalVariable.ConfigPara.Battery_Empty_TriggerValue = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} - -/************************************************* - Function : RWBatteryEmptyRecoveryValue_S() - Description : Battery Empty Recovery Value_S - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.06.29 - Additional Comments : -*************************************************/ -static void RWBatteryEmptyRecoveryValue_S(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue; - } -// else if(R_or_RW == 1) -// { -// if((*value >= 1800) && (*value <= 2940)) -// { -// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue, *value ); -// Log_AddParamChange(428, *value, GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue); -// GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue = (unsigned short) *value; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} -/************************************************* - Function : RWBatteryHighTemperatureProtection_TriggerValue() - Description : RWBatteryHighTemperatureProtection_TriggerValue - Input : null - Output : null - Return : null - Engineer : Huruihong - Revision : V0.0 - Modified Date : 2023.05.03 - Additional Comments : porting by longcd -*************************************************/ -static void RWBatteryHighTemperatureProtection_Value_S(unsigned char R_or_RW, unsigned short *value) -{ - unsigned short TriggerValue_Temp, ExitValue_Temp; - - if(R_or_RW == 0) - { - *value = (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue; - } -// else if(R_or_RW == 1) -// { -// TriggerValue_Temp = (*value >> 8); -// ExitValue_Temp = (*value & 0xFF); -// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); -// if( (TriggerValue_Temp >= 25) && (TriggerValue_Temp <= 80) ) -// { -// Log_AddParamChange(429, *value, (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); -// GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue = TriggerValue_Temp; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// -// } -// -// if( (ExitValue_Temp >= 25) && (ExitValue_Temp <= 80) ) -// { -// Log_AddParamChange(429, *value, (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); -// GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue = ExitValue_Temp; -// GlobalVariable.WriteFlag.ConfigParaWrite = 1; -// } -// } -} - -/************************************************* -*************************************************/ -extern void SetCtrlCmd_QueryLora(void); -static void RWLoraHardwareStatus(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.SpecialCheck.LoraHardwareStatus; - } - else if(R_or_RW == 1) - { - SetCtrlCmd_QueryLora(); - } -} -/************************************************* -子板电流CH1,CH2 -*************************************************/ -static void RWVoutCurrentCh1(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.SpecialCheck.VoutCurrentCh1; - } -// else if(R_or_RW == 1) -// { -// } -} -static void RWVoutCurrentCh2(unsigned char R_or_RW, unsigned short *value) -{ - if(R_or_RW == 0) - { - *value = GlobalVariable.SpecialCheck.VoutCurrentCh2; - } -// else if(R_or_RW == 1) -// { -// } -} - -/*************************************************************************************************** - Jump table -***************************************************************************************************/ -void ASProtocolInit() -{ - RWRegister[0] = RDeviceEdition; - RWRegister[1] = RWWorkMode1; - RWRegister[2] = RWWorkMode2; - RWRegister[3] = RWarningAndFault1; - RWRegister[4] = RWarningAndFault2; - RWRegister[5] = RDeviceType; - RWRegister[6] = RWChannelEnable1; - RWRegister[7] = RElevationAngle1; - RWRegister[8] = RElevationAngle2; - RWRegister[9] = RAzimuthAngle1; - RWRegister[10] = RAzimuthAngle2; - - if ( GlobalVariable.ConfigPara.isMasterController ==NO)//从机 - { - RWRegister[11] = RTargetAngle1; - RWRegister[12] = RTargetAngle2; - } - - if ( GlobalVariable.ConfigPara.isMasterController == YES)//主机 - { - RWRegister[11] = RTargetAngle; - RWRegister[12] = RRealAngle; //Motor0实际角度 - } - - - - - RWRegister[13] = RRealAngle1; - RWRegister[14] = RRealAngle2; - RWRegister[15] = RRealAngle3; - RWRegister[16] = RRealAngle4; - RWRegister[17] = RRealAngle5; - RWRegister[18] = RRealAngle6; - - RWRegister[19] = ReadUIRightPanelMasterSlaveAlarmsHighPart2; - RWRegister[20] = ReadUIRightPanelMasterSlaveAlarmsLowPart2; - RWRegister[21] = ReadUIRightPanelMasterSlaveAlarmsHighPart3; - RWRegister[22] = ReadUIRightPanelMasterSlaveAlarmsLowPart3; - - RWRegister[23] = RWTimeYear; - RWRegister[24] = RWTimeMonth; - RWRegister[25] = RWTimeDay; - RWRegister[26] = RWTimeHour; - RWRegister[27] = RWTimeMinute; - RWRegister[28] = RWTimeSecond; - //RWRegister[29] = RProtocol_Version;//RWChannelEnable; - RWRegister[29] = RWChannelEnable2;//; - - RWRegister[31] = RWRemoteWindDirect; - RWRegister[33] = RWRemoteWindSpeed; - RWRegister[34] = RWAIRemoteTarget; - - RWRegister[35] = RMotorCurrent3;//从机:Motor3 current - RWRegister[36] = RMotorCurrent4; - RWRegister[37] = RMotorCurrent5; - RWRegister[38] = RMotorCurrent6; - RWRegister[39] = RTemp; - RWRegister[40] = RMotorCurrent; - RWRegister[41] = RMotorCurrent1; - RWRegister[42] = RMotorCurrent2; - // RWRegister[41] = RWLogEnable; //log enable -// RWRegister[42] = RWPIDTarget; //pdi target - RWRegister[43] = RWProtectCurrent1; - RWRegister[44] = RWProtectCurrent2; - RWRegister[45] = RWLongitude1; - RWRegister[46] = RWLongitude2; - RWRegister[47] = RWLatitude1; - RWRegister[48] = RWLatitude2; - RWRegister[49] = RWTimeZone1; - RWRegister[50] = RWTimeZone2; - RWRegister[51] = RWEWTracingAccuracy1; - RWRegister[52] = RWEWTracingAccuracy2; - RWRegister[REG_BATTERY_LOW_TRIGGER_VALUE] = RWBatteryLowTriggerValue; //Battery Low Trigger Value - RWRegister[REG_BATTERY_LOW_RECORERY_VALUE] = RWBatteryLowRecoveryValue; //Battery Low Recovery Value - RWRegister[55] = RPVBuckerVoltage; - RWRegister[56] = RBatState; - RWRegister[57] = RBatSOCTemp; - RWRegister[58] = RBatVoltage; - RWRegister[59] = RBatCurrent; - RWRegister[REG_BATTERY_EMPTY_TRIGGER_VALUE] = RWBatteryEmptyTriggerValue; //Battery Empty Trigger Value; - - - - - RWRegister[76] = RWWeaherState; //天气指令 - - -// RWRegister[61] = RWMotorOverCurrentValueG1; -// RWRegister[62] = RWMotorOverCurrentTimeG1; -// RWRegister[63] = RWMotorOverCurrentValueG2; -// RWRegister[64] = RWMotorOverCurrentTimeG2; -// RWRegister[65] = RWMotorOverCurrentValueG3; -// RWRegister[66] = RWMotorOverCurrentTimeG3; -// RWRegister[67] = RWMotorOverCurrentValueG4; -// RWRegister[68] = RWMotorOverCurrentTimeG4; -// RWRegister[69] = RWMotorOverCurrentValueG5; -// RWRegister[70] = RWMotorOverCurrentTimeG5; -// RWRegister[71] = RWMotorOverCurrentValueG6; -// RWRegister[72] = RWMotorOverCurrentTimeG6; -// RWRegister[73] = RWMotorOverCurrentValueG7; -// RWRegister[74] = RWMotorOverCurrentTimeG7; -// RWRegister[75] = RWMotorOverCurrentValueG8; -// RWRegister[76] = RWMotorOverCurrentTimeG8; -// RWRegister[77] = RWMotorOverCurrentValueG9; -// RWRegister[78] = RWMotorOverCurrentTimeG9; -// RWRegister[79] = RWMotorOverCurrentValueG10; -// RWRegister[80] = RWMotorOverCurrentTimeG10; - - - - - - RWRegister[81] = RWComID; - RWRegister[82] = RWPowerMode; -// RWRegister[83] = RWPIDKP; //PID KP - RWRegister[84] = RWCleaningDockAngle; - RWRegister[85] = RWMotorOrientation; - RWRegister[86] = RVersion1; - RWRegister[87] = RVersion2; - RWRegister[88] = RWRS485Enable; - RWRegister[89] = RWPVModuleWidth1; - RWRegister[90] = RWPVModuleWidth2; - RWRegister[91] = RWPostSpacing1; - RWRegister[92] = RWPostSpacing2; - RWRegister[93] = RWTerrainSlope1; - RWRegister[94] = RWTerrainSlope2; - RWRegister[95] = RWTerrainSlopeEvening; - RWRegister[REG_BATTERY_EMPTY_RECORERY_VALUE ] = RWBatteryEmptyRecoveryValue; //Battery Empty Recovery Value - - RWRegister[98] = RWNoComEnable; - RWRegister[99] = RWUpWindSpeed; - RWRegister[100] = RWUpStartTime; - RWRegister[101] = RWLowWindSpeed; - RWRegister[102] = RWLowStopTime; - - RWRegister[103] = RWESoftLimitAngle1; - RWRegister[104] = RWESoftLimitAngle2; - RWRegister[105] = RWWSoftLimitAngle1; - RWRegister[106] = RWWSoftLimitAngle2; - - RWRegister[107] = RWHeatEnable; //Heat -// RWRegister[108] = RWPIDKI; //PID KI -// RWRegister[109] = RWPIDKD; //PID KD -// RWRegister[110] = RWPIDSlope; //PID Slope - - RWRegister[111] = RWBackAngle; -// RWRegister[112] = RWEWindProtectionAngle; -// RWRegister[113] = RWWWindProtectionAngle; - RWRegister[112] = RWComID2; - RWRegister[113] = RWComID3; - - //RWRegister[114] = RWInstallPostion; //no define - RWRegister[115] = RWSouthNorthShiftAngle; - RWRegister[116] = RWFacingWindStopFunction_Enable; - RWRegister[117] = RWEFacingWindAngle; - RWRegister[118] = RWWFacingWindAngle; - - //porting by longcd - RWRegister[REG_BATTERY_HIGHTEMPPRO_TRIGGER_VALUE] = RWBatteryHighTemperatureProtection_TriggerValue; //120:????????, - RWRegister[REG_BATTERY_HIGHTEMPPRO_EXIT_VALUE] = RWBatteryHighTemperatureProtection_ExitValue; //121:?????????????????,??????,???????? - - RWRegister[REG_BATSOCLOWRUNBACK_WAITTIME] = RWBatSocLowRunBackWaitTime; //125 - - RWRegister[REG_LOSTCOMM_BATSOCLOW_TARGET_ANGLE] = RWLostComm_BatsocLow_TargetAngle; //139 - - - RWRegister[REG_RCOMM_TEST_CRCERR] = RCommuTestCrcErr;//181 - RWRegister[REG_RCOMM_TEST_CRCOK] = RCommuTestCrcOk; - RWRegister[REG_RCOMM_TEST_REPLAY] = RCommuTestReply; - RWRegister[REG_RWCOMM_TEST_CLEARALL] = RWCommuTestClearAll; //184 - //RWRegister[186] = RWModbusBusyCnt; //阿布扎比 - RWRegister[187] = RCommuTest_RecvID_Tracker_CrcOK; - RWRegister[188] = RCommuTest_RecvID_Tracker_Reply; - RWRegister[189] = RCommuTest_RecvID_Tracker_CrcErr; - RWRegister[190] = RCommuTest_RecvID_00_CrcOK; - RWRegister[191] = RCommuTest_RecvID_00_CrcErr; - - - RWRegister[131] = RWComID4; // - RWRegister[132] = RWComID5; - - RWRegister[REG_STOP_ALL_SLAVEMOTOR] = RWStopAllSlaveMotor; - RWRegister[REG_SET_CONTROLER_ROLE] = RWEnableMasterController;//149 - RWRegister[REG_SUBSLAVE_COUNT] = RWsubSlaveCount;// - RWRegister[REG_SUBSLAVE_POWER_SUPPLY_ENABLE] = RWsubSlavePowerSupplyEnable; - RWRegister[REG_STATIC_DIFF_ANGLE] = RWStaticDiffAngle;// - RWRegister[REG_MOVE_DIFF_ANGLE] = RWMoveDiffAngle;// - - - - RWRegister[199] = RWYBTLoraParaEnable; - RWRegister[200] = RWManufactor; - RWRegister[201] = RWDeviceIDH; - RWRegister[202] = RWDeviceIDL; - RWRegister[203] = RWDeviceNetID; - - RWRegister[204] = RWYBTadd3; - RWRegister[205] = RWYBTadd4; - RWRegister[206] = RWYBTChannel; - RWRegister[207] = RWYBTadd6; - RWRegister[208] = RWYBTkeyH; - RWRegister[209] = RWYBTkeyL; - - RWRegister[210] = RWJXYLbaudrate; - RWRegister[211] = RWJXYLparity; - RWRegister[212] = RWJXYLfq1; - RWRegister[213] = RWJXYLfq2; - RWRegister[214] = RWJXYLfq3; - RWRegister[215] = RWJXYLfactor; - RWRegister[216] = RWJXYLmode; - RWRegister[217] = RWJXYLbw; - RWRegister[218] = RWJXYLpower; - - - //读取Bluetooth模块参数的指?? - RWRegister[REG_YBT_BLUETOOTH_MAC_EN] = RWYBTBluetoothParaEnable; - RWRegister[221] = RBluetoothMACPara1; - RWRegister[222] = RBluetoothMACPara2; - RWRegister[223] = RBluetoothMACPara3; - RWRegister[224] = RBluetoothMACPara4; - RWRegister[225] = RBluetoothMACPara5; - RWRegister[226] = RBluetoothMACPara6; - - RWRegister[300] = RProtocol_Version_S; - RWRegister[301] = RDeviceType_S; //设???类??? - RWRegister[302] = RDeviceEdition_S; //大版?????? - RWRegister[303] = RVersion1_S; //小版??????1 - RWRegister[304] = RVersion2_S; //小版??????2 - RWRegister[305] = RPVBuckerVoltage_S; //PV组件电压 (与旧协???放大倍数不一???) - RWRegister[306] = RBatVoltage_S; //电池电压 (与旧协???放大倍数不一???) - RWRegister[307] = RBatSOCTemp_S;//电池电量/电池温度 - RWRegister[308] = RTemp_S;//主板温度 - RWRegister[309] = RBatState_BatCurrent_S; //充电状态、充电电??? - RWRegister[310] = RWWorkMode1_S;//工作模式1 - RWRegister[311] = RWarningAndFault1_1_S;//异常信息1—??1 - RWRegister[312] = RWarningAndFault1_2_S;//异常信息1-2 - RWRegister[313] = RMotorCurrent1_S; //电机电流1 - RWRegister[314] = RTargetAngle1_S;//???标???度1 - RWRegister[315] = RRealAngle1_S;//???标???度1 - //316-321,???用 - RWRegister[316] = RWWorkMode2_S;//工作模式2 - RWRegister[317] = RWarningAndFault2_1_S;//异常信息2—??1 - RWRegister[318] = RWarningAndFault2_2_S;//异常信息2-2 - RWRegister[319] = RMotorCurrent2_S; //电机电流2 - RWRegister[320] = RTargetAngle2_S;//???标???度2 - RWRegister[321] = RRealAngle2_S;//???标???度2 - - //与通???箱相关新增协???请在此区域???加???322-384 - - //通???箱、上位机读写:384-396 - RWRegister[384] = RWAIRemoteTarget1_S;//远程???标???度1 - RWRegister[385] = RWAIRemoteTarget2_S;//远程???标???度2,备用 - RWRegister[386] = RWRemoteWindSpeed_S;//远程风?? - RWRegister[387] = RWRemoteWindDirect_S;//远程风向 - - RWRegister[388] = RWTimeYearMonth_S;//年月 - RWRegister[389] = RWTimeDayHour_S;//日时 - RWRegister[390] = RWTimeMinuteSecond_S;//分??? - RWRegister[391] = RWLongitude1_S;//经度 - RWRegister[392] = RWLongitude2_S;//经度 - RWRegister[393] = RWLatitude1_S;//?????? - RWRegister[394] = RWLatitude2_S;//?????? - RWRegister[395] = RWTimeZone1_S;//时区 - RWRegister[396] = RWTimeZone2_S;//时区 - - RWRegister[397] = RElevationAngle1_S; //高度???1 - RWRegister[398] = RAzimuthAngle1_S; //方位???1 - - RWRegister[399] = RElevationAngle2_S;//高度???2,???用 - RWRegister[400] = RAzimuthAngle2_S;//方位???2,???用 - - //控制器内部参数,上位机???写 - RWRegister[401] = RWComID_S; //控制器ID - RWRegister[402] = RWChannelSelect_S; //通道选择,保??? - RWRegister[403] = RWEWTracingAccuracy_S;//跟踪精度 - RWRegister[404] = RWHeatEnable_S;//加热使能 - RWRegister[405] = RWMotorOrientation_S;//电机朝向 - RWRegister[406] = RWProtectCurrent_S;//保护电流 - - RWRegister[407] = RWPVModuleWidth_S;//组件宽度 - RWRegister[408] = RWPostSpacing_S;//立柱间距 - RWRegister[409] = RWTerrainSlope1_S;//上坡???1 - RWRegister[410] = RWTerrainSlopeEvening1_S;//下坡???1 - RWRegister[411] = RWTerrainSlope2_S;//上坡???2 - RWRegister[412] = RWTerrainSlopeEvening2_S;//下坡???2 - - RWRegister[413] = RWSouthNorthShiftAngle1_S;//南北向偏移???度1 - RWRegister[414] = RWSouthNorthShiftAngle2_S;//南北向偏移???度2 - RWRegister[415] = RWEWSoftLimitAngle_S;//东西???限位 - RWRegister[416] = RWCleaningDockAngle_S;//清洗角度 - RWRegister[417] = RWBackAngle_S;//夜返角度 - RWRegister[418] = RWNoComEnable_S;//无通???使能 - RWRegister[419] = RWUpWindSpeed_S;//进入大???保护????? - RWRegister[420] = RWUpStartTime_S;//进入大???保护时??? - RWRegister[421] = RWLowWindSpeed_S;//退出大风保护????? - RWRegister[422] = RWLowStopTime_S;//退出大风保护时??? - RWRegister[423] = RWFacingWindStopFunction_Enable_S;//迎???停靠功能使??? - RWRegister[424] = RWEWFacingWindAngle_S;//东西迎???停靠???度 - - RWRegister[425] = RWBatteryLowTriggerValue_S; //Battery Low Trigger Value - RWRegister[426] = RWBatteryLowRecoveryValue_S; //Battery Low Recovery Value - RWRegister[427] = RWBatteryEmptyTriggerValue_S; //Battery Empty Trigger Value; - RWRegister[428] = RWBatteryEmptyRecoveryValue_S; //Battery Empty Recovery Value - - RWRegister[429] = RWBatteryHighTemperatureProtection_Value_S; //高温保护阈值:高字节:???动阈值;低字节:退出阈??? - - RWRegister[431] = RWLoraHardwareStatus; - RWRegister[432] = RWVoutCurrentCh1; - RWRegister[433] = RWVoutCurrentCh2; - - - -} - -void ASQProtocolInit() -{ - RWRegisterQ[0] = RWWorkMode2; - RWRegisterQ[1] = RTargetAngle; - RWRegisterQ[2] = RRealAngle; - RWRegisterQ[3] = RWarningAndFault1; - RWRegisterQ[4] = RWarningAndFault2; - -} - -void ASLProtocolInit() -{ - RWRegisterL[0] = RResetCount1; //Reset count - RWRegisterL[1] = RResetCount2; - RWRegisterL[2] = RWLogWarningSum; //log warning sum - RWRegisterL[3] = RWAskWarningNo; //log warning No - RWRegisterL[4] = RWLogOperationSum; //log operation sum - RWRegisterL[5] = RWAskOperationNo; //log operation No - RWRegisterL[6] = (void *)0; // - RWRegisterL[7] = (void *)0; // - RWRegisterL[8] = (void *)0; // - RWRegisterL[9] = RWLogReadNum; //log读取序号 -} - - - - - - - - -//baseAddr = 20,000; -void ASSlaveProtocolInit(void) -{ - //从机报???信??? n*5+0:报???信???1-1 n*5+1:报???信???1-2 n*5+2:电机实际角度1 n*5+3:电机实际角度2 n*5+4:电机实际角度3 - RWRegisterSlave[0*5+0] = RWWarningAndFaultOfSlave_1;//从机1的报警信??? - RWRegisterSlave[0*5+1] = RRealAngle1;//从机1实际角度 - RWRegisterSlave[0*5+2] = RMotorCurrent1;//从机1电机电流 - - RWRegisterSlave[1*5+0] = RWWarningAndFaultOfSlave_2; - RWRegisterSlave[1*5+1] = RRealAngle2; //从机2实际角度 - RWRegisterSlave[1*5+2] = RMotorCurrent2; //从机2电机电流 - - RWRegisterSlave[2*5+0] = RWWarningAndFaultOfSlave_3; - RWRegisterSlave[2*5+1] = RRealAngle3; //从机3实际角度 - RWRegisterSlave[2*5+2] = RMotorCurrent3; //从机3电机电流 - - RWRegisterSlave[3*5+0] = RWWarningAndFaultOfSlave_4; - RWRegisterSlave[3*5+1] = RRealAngle4; //从机4实际角度 - RWRegisterSlave[3*5+2] = RMotorCurrent4; //从机4电机电流 - - RWRegisterSlave[4*5+0] = RWWarningAndFaultOfSlave_5; - RWRegisterSlave[4*5+1] = RRealAngle5; //从机5实际角度 - RWRegisterSlave[4*5+2] = RMotorCurrent5; //从机5电机电流 - - RWRegisterSlave[5*5+0] = RWWarningAndFaultOfSlave_6; - RWRegisterSlave[5*5+1] = RRealAngle6; //从机6实际角度 - RWRegisterSlave[5*5+2] = RMotorCurrent6; //从机6电机电流 - - RWRegisterSlave[6*5+0] = RWWarningAndFaultOfSlave_7; - RWRegisterSlave[6*5+1] = RRealAngle7; //从机7实际角度 - RWRegisterSlave[6*5+2] = RMotorCurrent7; //从机7电机电流 - - RWRegisterSlave[7*5+0] = RWWarningAndFaultOfSlave_8; - RWRegisterSlave[7*5+1] = RRealAngle8; //从机8实际角度 - RWRegisterSlave[7*5+2] = RMotorCurrent8; //从机8电机电流 - - RWRegisterSlave[8*5+0] = RWWarningAndFaultOfSlave_9; - RWRegisterSlave[8*5+1] = RRealAngle9; //从机9实际角度 - RWRegisterSlave[8*5+2] = RMotorCurrent9; //从机9电机电流 - - RWRegisterSlave[9*5+0] = RWWarningAndFaultOfSlave_10; - RWRegisterSlave[9*5+1] = RRealAngle10; //从机10实际角度 - RWRegisterSlave[9*5+2] = RMotorCurrent10; //从机10电机电流 - - RWRegisterSlave[10*5+0] = RWWarningAndFaultOfSlave_11; - RWRegisterSlave[10*5+1] = RRealAngle11; //从机11实际角度 - RWRegisterSlave[10*5+2] = RMotorCurrent11; //从机11电机电流 - - RWRegisterSlave[11*5+0] = RWWarningAndFaultOfSlave_12; - RWRegisterSlave[11*5+1] = RRealAngle12; //从机12实际角度 - RWRegisterSlave[11*5+2] = RMotorCurrent12; //从机12电机电流 - - RWRegisterSlave[12*5+0] = RWWarningAndFaultOfSlave_13; - RWRegisterSlave[12*5+1] = RRealAngle13; //从机13实际角度 - RWRegisterSlave[12*5+2] = RMotorCurrent13; //从机13电机电流 - - RWRegisterSlave[13*5+0] = RWWarningAndFaultOfSlave_14; - RWRegisterSlave[13*5+1] = RRealAngle14; //从机14实际角度 - RWRegisterSlave[13*5+2] = RMotorCurrent14; //从机14电机电流 - - RWRegisterSlave[14*5+0] = RWWarningAndFaultOfSlave_15; - RWRegisterSlave[14*5+1] = RRealAngle15; //从机15实际角度 - RWRegisterSlave[14*5+2] = RMotorCurrent15; //从机15电机电流 - - RWRegisterSlave[15*5+0] = RWWarningAndFaultOfSlave_16; - RWRegisterSlave[15*5+1] = RRealAngle16; //从机16实际角度 - RWRegisterSlave[15*5+2] = RMotorCurrent16; //从机16电机电流 - - RWRegisterSlave[16*5+0] = RWWarningAndFaultOfSlave_17; - RWRegisterSlave[16*5+1] = RRealAngle17; //从机17实际角度 - RWRegisterSlave[16*5+2] = RMotorCurrent17; //从机17电机电流 - - RWRegisterSlave[17*5+0] = RWWarningAndFaultOfSlave_18; - RWRegisterSlave[17*5+1] = RRealAngle18; //从机18实际角度 - RWRegisterSlave[17*5+2] = RMotorCurrent18; //从机18电机电流 - - RWRegisterSlave[18*5+0] = RWWarningAndFaultOfSlave_19; - RWRegisterSlave[18*5+1] = RRealAngle19; //从机19实际角度 - RWRegisterSlave[18*5+2] = RMotorCurrent19; //从机19电机电流 - - RWRegisterSlave[19*5+0] = RWWarningAndFaultOfSlave_20; - RWRegisterSlave[19*5+1] = RRealAngle20; //从机20实际角度 - RWRegisterSlave[19*5+2] = RMotorCurrent20; //从机20电机电流 - -} - -void *GetASProtocl() -{ - return RWRegister; -} -void *GetASQProtocl() -{ - return RWRegisterQ; -} -void *GetASLProtocl() -{ - return RWRegisterL; -} - -void *GetASSlaveProtocl() -{ - return RWRegisterSlave; -} - - - - - +#include "GlobalDefine.h" +#include "ASProtocol.h" +#include "BackupRegister.h" +#include "RtcLocalModule.h" +#include "os.h" +#include "MotorControl.h" +#include "log.h" +#include "math.h" +#include "Init.h" +#include +#include "ModbusFrame.h" +#include "gd32f30x.h" +#include +extern GlobalVariableDef GlobalVariable; + +/* Cross-context shared (Luna fatal-4 fix 2026-06-20): + * - written by RTC ISR / EXTI + * - read by main loop / low-power entry + * Must be volatile. Use safe_read_/safe_write_ from safe_atomic.h + * for any compound operation (read-modify-write, multi-byte). + * Currently only referenced by commented-out code; retained for + * future re-enable. */ +volatile unsigned short us_tick __attribute__((aligned(4))) = 0; +volatile unsigned char uc_rtcFlag = 0; + +extern uint16_t WeaherState; + +extern float WeaherStateTime; +extern unsigned char WeaherStateTimeFlag; + + + + +static const uint8_t valid_mode[] = { //鏈夋晥妯″紡 + MAINTENANCE_MODE, + CLEAN_MODE, + ANGLE_CALIBRATION_MODE, + AUTO_MODE, + AUTO_RAIN_MODE, + AUTO_SNOW_MODE, + AUTO_WIND_MODE, +// 0x29, + AUTO_AI_MODE, + AUTO_FLOOD_MODE, + MANUAL_MODE, + MANUAL_EAST_MODE, + MANUAL_WEST_MODE, + 0x00, + 0xff, + 0xfe +}; + + +/*************************************************************************************************** + Private Variable +***************************************************************************************************/ +/*R-0, RW-1*/ +static int8_t (* RWRegister[RWREGISTER_SUM])(unsigned char R_or_RW, unsigned short *value)={(void *)0}; +static int8_t (* RWRegisterQ[5] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; +static int8_t (* RWRegisterL[10] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; +static int8_t (* RWRegisterSlave[200] )(unsigned char R_or_RW, unsigned short *value)={(void *)0}; + +/*************************************************************************************************** + Jump function +***************************************************************************************************/ + +static int8_t RDeviceEdition(unsigned char R_or_RW, unsigned short *value ); +static int8_t RWWorkMode1(unsigned char R_or_RW, unsigned short *value ); +static int8_t RWWorkMode2(unsigned char R_or_RW, unsigned short *value ); +static int8_t RWarningAndFault1(unsigned char R_or_RW, unsigned short *value ); +static int8_t RWarningAndFault2(unsigned char R_or_RW, unsigned short *value ); +static int8_t RDeviceType(unsigned char R_or_RW, unsigned short *value); +static int8_t RWChannelEnable1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWChannelEnable2(unsigned char R_or_RW, unsigned short *value); + +static int8_t RElevationAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RElevationAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RAzimuthAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RAzimuthAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RTargetAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RTargetAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RRealAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RRealAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeYear(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeMonth(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeDay(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeHour(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeMinute(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeSecond(unsigned char R_or_RW, unsigned short *value); +static int8_t RWRemoteWindSpeed(unsigned char R_or_RW, unsigned short *value); +static int8_t RWRemoteWindDirect(unsigned char R_or_RW, unsigned short *value); + +static int8_t RWAIRemoteTarget(unsigned char R_or_RW, unsigned short *value); +static int8_t RTemp(unsigned char R_or_RW, unsigned short *value); + +static int8_t RMotorCurrent(unsigned char R_or_RW, unsigned short *value); +static int8_t RWProtectCurrent1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWProtectCurrent2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLongitude1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLongitude2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLatitude1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLatitude2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeZone1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTimeZone2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWEWTracingAccuracy1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWEWTracingAccuracy2(unsigned char R_or_RW, unsigned short *value); +static int8_t RPVBuckerVoltage(unsigned char R_or_RW, unsigned short *value); +static int8_t RBatState(unsigned char R_or_RW, unsigned short *value); +static int8_t RBatSOCTemp(unsigned char R_or_RW, unsigned short *value); +static int8_t RBatVoltage(unsigned char R_or_RW, unsigned short *value); +static int8_t RBatCurrent(unsigned char R_or_RW, unsigned short *value); + +static int8_t RWComID(unsigned char R_or_RW, unsigned short *value); +static int8_t RWPowerMode(unsigned char R_or_RW, unsigned short *value); +static int8_t RWCleaningDockAngle(unsigned char R_or_RW, unsigned short *value); + +static int8_t RWPVModuleWidth1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWPVModuleWidth2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWPostSpacing1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWPostSpacing2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTerrainSlope1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWTerrainSlope2(unsigned char R_or_RW, unsigned short *value); + +static int8_t RWUpWindSpeed(unsigned char R_or_RW, unsigned short *value); +static int8_t RWUpStartTime(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLowWindSpeed(unsigned char R_or_RW, unsigned short *value); +static int8_t RWLowStopTime(unsigned char R_or_RW, unsigned short *value); +static int8_t RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWWSoftLimitAngle1(unsigned char R_or_RW, unsigned short *value); +static int8_t RWWSoftLimitAngle2(unsigned char R_or_RW, unsigned short *value); +static int8_t RWBackAngle(unsigned char R_or_RW, unsigned short *value); +static int8_t RWEWindProtectionAngle(unsigned char R_or_RW, unsigned short *value); +static int8_t RWWWindProtectionAngle(unsigned char R_or_RW, unsigned short *value); + +//static int8_t RWInstallPostion(unsigned char R_or_RW, unsigned short *value); +static int8_t RWSouthNorthShiftAngle(unsigned char R_or_RW, unsigned short *value); +static int8_t RWFacingWindStopFunction_Enable(unsigned char R_or_RW, unsigned short *value); +static int8_t RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value); +static int8_t RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value); + +static int8_t RDeviceEdition(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.DeviceEdition; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWorkMode1(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)+1) = *value; + Log_AddParamChange(1, *value, GlobalVariable.WorkMode.WorkMode >> 16); + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWorkMode2(unsigned char R_or_RW, unsigned short *value ) +{ + int i; + + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.WorkMode.WorkMode, GlobalVariable.WorkModeBuffer.WorkMode ); + if((GlobalVariable.Weather.RemoteWindSpeed == 20) + ||((GlobalVariable.WorkMode.WorkMode & 0x00ff) == MOTOR_ALARM_MODE) ) //濡傛灉楂???閫熸垨鑰呮晠闅滅數鏈烘ā寮忥紝涓嶆敮鎸佹敼妯″紡,澶嶄綅闄??? + { + if(*value != 0xFF) + { + return AS_CB_ERR_INVALID; + } + } + *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)) = *value; + if((GlobalVariable.WorkMode.WorkMode & 0xffff) != *value) + { + Log_AddWorkModeChange(*value, GlobalVariable.WorkMode.WorkMode,LOG_WORK_MODE_RCV); + } + + for(i = 0; i < sizeof(valid_mode)/sizeof(valid_mode[0]); i++) + { + if(*value == valid_mode[i]) + { + break; + } + } + + + if(i >= sizeof(valid_mode)/sizeof(valid_mode[0])) + { + return AS_CB_ERR_INVALID; //闈炴湁鏁堟ā寮忕洿鎺ヨ繑??? + } + + if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFF) + { + NVIC_SystemReset(); + } + else if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFE)// + { + GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkMode.WorkMode; //濡傛灉鏀跺埌閫???绠卞仠鏈烘ā寮忥紝淇濇寔鍘熸ā寮忥紝涓嶅搷? +// MotorAllStop(); /* Stop */ +// GlobalVariable.WorkModeBuffer.WorkMode = AUTO_TRACKER_MODE; +// RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //浣胯兘PWR澶???鏃??? +// +// EXTI_InitTypeDef EXTI_InitStructure; +// NVIC_InitTypeDef NVIC_InitStructure; +// RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); //浣胯兘澶嶇敤鍔熻兘鏃堕挓 + + // //GPIOE.2 ??????绾夸互鍙婁腑???鍒???鍖栭厤缃 涓嬮檷娌胯Е??? LORA_RX : PA10 +// GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource10); +// +// EXTI_InitStructure.EXTI_Line=EXTI_Line10; //PA10 +// EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; +// EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; +// EXTI_InitStructure.EXTI_LineCmd = ENABLE; +// EXTI_Init(&EXTI_InitStructure); //鏍规嵁EXTI_InitStruct???鎸囧畾鐨勫弬鏁板垵濮嬪寲澶???EXTI瀵勫瓨??? + +// NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //浣胯兘鎸夐敭WK_UP鎵鍦ㄧ殑澶栭儴??????閫氶亾 +// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //鎶㈠崰浼樺厛???2??? +// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x03; //瀛愪紭鍏堢骇3 +// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //浣胯兘澶栭儴??????閫氶亾 +// NVIC_Init(&NVIC_InitStructure); +// +// IWDG_ReloadCounter(); +// IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); +// IWDG_SetPrescaler(IWDG_Prescaler_256); +// IWDG_SetReload(0xFFF); +// IWDG_ReloadCounter(); +// +// RTC_Local_Init(); +// +// us_tick = SysTick->CTRL; +// SysTick->CTRL = 0; +// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP妯″紡 +// OS_ERR err; +// OSSchedLock(&err); +// while(1) +// { +// if(uc_rtcFlag==1) +// { +// uc_rtcFlag = 0; +// SysTick->CTRL = us_tick; +// SystemInit(); +// OS_CPU_SysTickInit(720000); +// IWDG_ReloadCounter(); +// RCC_LSICmd(ENABLE); +// RTC_WaitForSynchro(); +// RTC_Local_Init(); +// us_tick = SysTick->CTRL; +// SysTick->CTRL = 0; +// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP妯″紡 +// } +// } + } + // else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) + // { + // GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; + // GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; + // } + // else + // { + // if ( GlobalVariable.ConfigPara.isMasterController == YES)//powerSlave:stay in manual mode + // { + + // if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0x00) + // { + // SetStopMotorToSlaves(); + // } + // GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; + // } + + else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) + { + GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; + GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; + } + else + { + if ( GlobalVariable.ConfigPara.isMasterController == YES) + { + //only masterController can change workMode,powerSlave:stay in manual mode + GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; + } + } + } + return AS_CB_ERR_INVALID; +} + +//void EXTI15_10_IRQHandler(void) +//{ +// NVIC_SystemReset(); +//} + +static int8_t RWarningAndFault1(unsigned char R_or_RW, unsigned short *value ) //High +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)+1); // + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWarningAndFault2(unsigned char R_or_RW, unsigned short *value )//low +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)); // + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RDeviceType(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.DeviceType; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +// 浣庝綅閫氶亾浣胯兘0鍒15閫氶亾 +static int8_t RWChannelEnable1(uint8_t R_or_RW, uint16_t *value) +{ + uint32_t *cfg = &GlobalVariable.ConfigPara.ChannelEnable; + uint32_t *buf = &GlobalVariable.ConfigParaBuffer.ChannelEnable; + + if (R_or_RW == 0) // 璇讳綆16 bit + { + *value = (uint16_t)(*cfg & 0xFFFF); + } + else // 鍐欎綆16 bit + { + // 鍐欏叆浣16bit鍒 buffer + *buf = (*buf & 0xFFFF0000) | (*value & 0xFFFF); + + if (GlobalVariable.ConfigPara.isMasterController == NO) + { + *cfg = 0x00000001; // 浠庢帶鍙厑璁搁氶亾 0 + } + else + { + // 鏇存柊閰嶇疆锛氫綆16浣 + *cfg = (*cfg & 0xFFFF0000) | (*value & 0xFFFF); + } + + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +// 楂樹綅閫氶亾浣胯兘16-31閫氶亾 +static int8_t RWChannelEnable2(uint8_t R_or_RW, uint16_t *value) +{ + uint32_t *cfg = &GlobalVariable.ConfigPara.ChannelEnable; + uint32_t *buf = &GlobalVariable.ConfigParaBuffer.ChannelEnable; + + if (R_or_RW == 0) // 璇婚珮16 bit + { + *value = (uint16_t)((*cfg >> 16) & 0xFFFF); + } + else // 鍐欓珮16 bit + { + // 鍐欏叆楂16bit鍒 buffer + *buf = (*buf & 0x0000FFFF) | (((uint32_t)*value) << 16); + + if (GlobalVariable.ConfigPara.isMasterController == NO) + { + *cfg = 0x00000000; // 浠庢帶寮哄埗鍏抽棴鍏ㄩ儴閫氶亾 + } + else + { + uint16_t oldHigh = (uint16_t)((*cfg >> 16) & 0xFFFF); + uint16_t oldLow = (uint16_t)(*cfg & 0xFFFF); + + // 鍐欐棩蹇 + Log_AddParamChange(6, *value, oldHigh); + Log_AddParamChange(29, *value, oldLow); + + // 鏇存柊閰嶇疆锛氶珮16浣 + *cfg = (*cfg & 0x0000FFFF) | (((uint32_t)*value) << 16); + + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + +// static int8_t RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) +// { +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1); +// } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1) = *value; +// } +// } +// static int8_t RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) +// { +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)); +// } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)) = *value; +// if((GlobalVariable.ConfigParaBuffer.ESoftLimitAngle > 29.9f ) +// && (GlobalVariable.ConfigParaBuffer.ESoftLimitAngle < 150.1f) ) +// { +// Log_AddParamChange(103, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1)); +// Log_AddParamChange(104, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle))); +// GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } + +// } +// } + + + + + + + + + + + + +static int8_t RElevationAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.ElevationAngle)+1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RElevationAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.ElevationAngle)); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RAzimuthAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.AzimuthAngle)+1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RAzimuthAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.AstronomyPara.AzimuthAngle)); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RTargetAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { +// *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)+1); + *value = GlobalVariable.WorkMode.Target * 100.0f; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + +static int8_t RTargetAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)+1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RTargetAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.WorkMode.Target)); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + + +static int8_t RRealAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Motor[0].ActualAngle * 100.0f; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if (YES == GlobalVariable.ConfigPara.isMasterController) + { + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 1) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[1].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + } + else + { + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.Motor[0].ActualAngle)+1); + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if (YES == GlobalVariable.ConfigPara.isMasterController) + { + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 2) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[2].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + } + else + { + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.Motor[0].ActualAngle)); + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 3) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[3].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle4(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 4) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[4].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RRealAngle5(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 5) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[5].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle6(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 6) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[6].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + +static int8_t RRealAngle7(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 7) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[7].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle8(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 8) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[8].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle9(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 9) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[9].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle10(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 10) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[10].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle11(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 11) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[11].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle12(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 12) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[12].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle13(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 13) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[13].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle14(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 14) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[14].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle15(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 15) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[15].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle16(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 16) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[16].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RRealAngle17(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 17) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[17].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle18(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 18) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[18].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle19(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 19) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[19].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RRealAngle20(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 20) & 0x01) == ENABLE) + { + *value = GlobalVariable.Motor[20].ActualAngle * 100.0f; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + + + + + +static int8_t RWTimeYear(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Year; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); + //Log_AddParamChange(23, *value, GlobalVariable.TimeBuffer.Year); + GlobalVariable.TimeBuffer.Year = *value; + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeMonth(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Month; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Month, *value ); + //Log_AddParamChange(24, *value, GlobalVariable.TimeBuffer.Month); + GlobalVariable.TimeBuffer.Month = *value; + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeDay(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Day; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Day, *value ); + //Log_AddParamChange(25, *value, GlobalVariable.TimeBuffer.Day); + GlobalVariable.TimeBuffer.Day = *value; + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeHour(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Hour; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Hour, *value ); + //Log_AddParamChange(26, *value, GlobalVariable.TimeBuffer.Hour); + GlobalVariable.TimeBuffer.Hour = *value; + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeMinute(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Minute; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Minute, *value ); + //Log_AddParamChange(27, *value, GlobalVariable.TimeBuffer.Minute); + GlobalVariable.TimeBuffer.Minute = *value; + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeSecond(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Time.Second; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Second, *value ); + //Log_AddParamChange(28, *value, GlobalVariable.TimeBuffer.Second); + GlobalVariable.TimeBuffer.Second = *value; + BKPWriteRTCUpdateFlag(); + GlobalVariable.WriteFlag.TimeWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWRemoteWindDirect(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Weather.RemoteWindDirect; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + Log_AddParamChange(31, *value, GlobalVariable.Weather.RemoteWindDirect); + GlobalVariable.Weather.RemoteWindDirect = *value; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWRemoteWindSpeed(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Weather.RemoteWindSpeed; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.Weather.RemoteWindSpeed, *value ); + + if(*value != GlobalVariable.Weather.RemoteWindSpeed) + { + if(20 == *value || 20 == GlobalVariable.Weather.RemoteWindSpeed) + { + Log_AddParamChange(33, *value, GlobalVariable.Weather.RemoteWindSpeed); + } + } + GlobalVariable.Weather.RemoteWindSpeed = *value; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWAIRemoteTarget(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)GlobalVariable.AIPara.AIRemoteAngle; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.AIPara.AIRemoteAngle, *value ); + Log_AddParamChange(34, *value, GlobalVariable.AIPara.AIRemoteAngle); + GlobalVariable.AIPara.AIRemoteAngle = (float)*value; + GlobalVariable.AIPara.AIModeDelayCount = 1; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RTemp(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(unsigned short *)&GlobalVariable.Tmp.BoardTmp; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RMotorCurrent(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (short)(GlobalVariable.Motor[0].Motorcurrent * 10); // + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 1) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[1].Motorcurrent * 10); // + // *value = 3000; + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 2) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[2].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 3) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[3].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent4(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 4) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[4].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent5(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 5) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[5].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent6(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 6) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[6].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RMotorCurrent7(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 7) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[7].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent8(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 8) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[8].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent9(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 9) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[9].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent10(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 10) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[10].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent11(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 11) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[11].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent12(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 12) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[12].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent13(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 13) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[13].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent14(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 14) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[14].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent15(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 15) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[15].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent16(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 16) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[16].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RMotorCurrent17(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 17) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[17].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent18(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 18) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[18].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent19(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 19) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[19].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RMotorCurrent20(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + if(((GlobalVariable.ConfigPara.ChannelEnable >> 20) & 0x01) == ENABLE) + { + *value = (short)(GlobalVariable.Motor[20].Motorcurrent * 10); // + } + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + + + +static int8_t RWProtectCurrent1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)+1) = *value; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWProtectCurrent2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)) = *value; + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValue, GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue ); + + if( (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue > 0.19f) && + (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue < 20.1f ) ) //???6.1鏀惧ぇ???20.1闄愬埗 + { + Log_AddParamChange(43, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue)+1)); + Log_AddParamChange(44, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValue))); + GlobalVariable.ConfigPara.MotorOverCurrentValue = GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + + + GlobalVariable.SpecialCheck.MasterSetProCurrentToSlaveFlag = 1; + + + } + } + return AS_CB_ERR_INVALID; +} + +/* Longitude */ +static int8_t RWLongitude1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWLongitude2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)) = *value; + if(GlobalVariable.ConfigParaBuffer.Longitude >= -180.0 + &&GlobalVariable.ConfigParaBuffer.Longitude <= 180.0 ) + { + if(fabs(GlobalVariable.ConfigParaBuffer.Longitude - GlobalVariable.ConfigPara.Longitude) >= 0.1f ) //???7.8?????? + { + Log_AddParamChange(45, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1)); + Log_AddParamChange(46, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude))); + GlobalVariable.ConfigPara.Longitude = GlobalVariable.ConfigParaBuffer.Longitude; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + } + return AS_CB_ERR_INVALID; +} + +/* Latitude */ +static int8_t RWLatitude1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWLatitude2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)) = *value; + if(GlobalVariable.ConfigParaBuffer.Latitude >= -90.0 + && GlobalVariable.ConfigParaBuffer.Latitude <= 90.0) + { + if(fabs(GlobalVariable.ConfigParaBuffer.Latitude - GlobalVariable.ConfigPara.Latitude) >= 0.1f )//???7.8?????? + { + Log_AddParamChange(47, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1)); + Log_AddParamChange(48, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude))); + GlobalVariable.ConfigPara.Latitude = GlobalVariable.ConfigParaBuffer.Latitude; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeZone1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { +// Log_AddParamChange(49, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTimeZone2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)) = *value; + if(GlobalVariable.ConfigParaBuffer.TimeZone >= -12.0 + && GlobalVariable.ConfigParaBuffer.TimeZone <= 12.0) + { + if(fabs(GlobalVariable.ConfigParaBuffer.TimeZone - GlobalVariable.ConfigPara.TimeZone) >= 0.5f ) + { + Log_AddParamChange(49, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); + Log_AddParamChange(50, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone))); + + GlobalVariable.ConfigPara.TimeZone = GlobalVariable.ConfigParaBuffer.TimeZone; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWEWTracingAccuracy1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWEWTracingAccuracy2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)) = *value; + if(GlobalVariable.ConfigParaBuffer.EWTracingAccuracy >= 0.98 + && GlobalVariable.ConfigParaBuffer.EWTracingAccuracy <= 5.1) + { + Log_AddParamChange(51, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.EWTracingAccuracy)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy)+1)); + Log_AddParamChange(52, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.EWTracingAccuracy))); + GlobalVariable.ConfigPara.EWTracingAccuracy = GlobalVariable.ConfigParaBuffer.EWTracingAccuracy; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RPVBuckerVoltage(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.PowerPara.PVBuckerVoltage * 10); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBatState(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = 0; + *value |= *(unsigned char*)(&GlobalVariable.PowerPara.ChargeState); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBatSOCTemp(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = 0x00FF & (unsigned char)(GlobalVariable.PowerPara.BatterySOC*100); + *value = *value << 8; + *value &= 0xFF00; + *value |= ((signed char)(GlobalVariable.PowerPara.BatteryTemperature) & 0x00FF); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBatVoltage(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.PowerPara.BatteryVoltage*10); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBatCurrent(unsigned char R_or_RW, unsigned short *value) +{ + signed short temp = 0; + if(R_or_RW == 0) + { + temp = (signed short)(GlobalVariable.PowerPara.BatteryCurrent*100); + *value = *((unsigned short *)&temp); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RVersion1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.FixePara.Version1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RVersion2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.FixePara.Version2); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWComID(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if (GlobalVariable.ConfigPara.isMasterController == 1) + { + if(*value >= 1 && *value < 255) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(81, *value, GlobalVariable.ConfigPara.ComID); + GlobalVariable.ConfigPara.ComID =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + + } + + else if (GlobalVariable.ConfigPara.isMasterController == 0) + { + if(*value >= 2 && *value <=21) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(81, *value, GlobalVariable.ConfigPara.ComID); + GlobalVariable.ConfigPara.ComID =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + + + + + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID2)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(112, *value, GlobalVariable.ConfigPara.ComID2); + GlobalVariable.ConfigPara.ComID2 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID3)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(113, *value, GlobalVariable.ConfigPara.ComID3); + GlobalVariable.ConfigPara.ComID3 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWComID4(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID4)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(131, *value, GlobalVariable.ConfigPara.ComID4); + GlobalVariable.ConfigPara.ComID4 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID5(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID5)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(132, *value, GlobalVariable.ConfigPara.ComID5); + GlobalVariable.ConfigPara.ComID5 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID6(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID6)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(133, *value, GlobalVariable.ConfigPara.ComID6); + GlobalVariable.ConfigPara.ComID6 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID7(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID7)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(134, *value, GlobalVariable.ConfigPara.ComID7); + GlobalVariable.ConfigPara.ComID7 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID8(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID8)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(135, *value, GlobalVariable.ConfigPara.ComID8); + GlobalVariable.ConfigPara.ComID8 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID9(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID9)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(136, *value, GlobalVariable.ConfigPara.ComID9); + GlobalVariable.ConfigPara.ComID9 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID10(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID10)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(137, *value, GlobalVariable.ConfigPara.ComID10); + GlobalVariable.ConfigPara.ComID10 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWComID11(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID11)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(138, *value, GlobalVariable.ConfigPara.ComID11); + GlobalVariable.ConfigPara.ComID11 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWComID12(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID12)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(139, *value, GlobalVariable.ConfigPara.ComID12); + GlobalVariable.ConfigPara.ComID12 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID13(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID13)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(140, *value, GlobalVariable.ConfigPara.ComID13); + GlobalVariable.ConfigPara.ComID13 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID14(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID14)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(141, *value, GlobalVariable.ConfigPara.ComID14); + GlobalVariable.ConfigPara.ComID14 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID15(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID15)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(142, *value, GlobalVariable.ConfigPara.ComID15); + GlobalVariable.ConfigPara.ComID15 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID16(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID16)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(143, *value, GlobalVariable.ConfigPara.ComID16); + GlobalVariable.ConfigPara.ComID16 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID17(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID17)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ) + Log_AddParamChange(144, *value, GlobalVariable.ConfigPara.ComID17); + GlobalVariable.ConfigPara.ComID17 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID18(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID18)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(145, *value, GlobalVariable.ConfigPara.ComID18); + GlobalVariable.ConfigPara.ComID18 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID19(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID19)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ) + Log_AddParamChange(146, *value, GlobalVariable.ConfigPara.ComID19); + GlobalVariable.ConfigPara.ComID19 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWComID20(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID20)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(147, *value, GlobalVariable.ConfigPara.ComID20); + GlobalVariable.ConfigPara.ComID20 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWComID21(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID21)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1 && *value < 255) + { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); + Log_AddParamChange(148, *value, GlobalVariable.ConfigPara.ComID21); + GlobalVariable.ConfigPara.ComID21 =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWEnableMasterController(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.isMasterController)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value) == NO) + { + if(( GlobalVariable.ConfigPara.ComID >= 2) && (GlobalVariable.ConfigPara.ComID <= 21)) + { + // + Log_AddParamChange(REG_SET_CONTROLER_ROLE, *value, GlobalVariable.ConfigPara.isMasterController); + GlobalVariable.ConfigPara.isMasterController =(unsigned char) *value; + FixedParaInit();//鏇存崲鍥轰欢鐗堟湰鍙凤紝閫傞厤涓讳粠瑙掕壊 + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + else if((*value) == YES) + { + if(( GlobalVariable.ConfigPara.ComID >= 1) && (GlobalVariable.ConfigPara.ComID < 255)) + { + + + Log_AddParamChange(REG_SET_CONTROLER_ROLE, *value, GlobalVariable.ConfigPara.isMasterController); + GlobalVariable.ConfigPara.isMasterController =(unsigned char) *value; + + FixedParaInit();//鏇存崲鍥轰欢鐗堟湰鍙凤紝閫傞厤涓讳粠瑙掕壊 + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWsubSlaveCount(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.subSlaveCount)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value >= 1) &&( *value )< 30) + { + Log_AddParamChange(REG_SUBSLAVE_COUNT, *value, GlobalVariable.ConfigPara.subSlaveCount); + GlobalVariable.ConfigPara.subSlaveCount =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + + +static int8_t RWsubSlavePowerSupplyEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.subSlavePowerSupplyEnable)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value == YES) ||( *value ) == NO) + { + Log_AddParamChange(REG_SUBSLAVE_POWER_SUPPLY_ENABLE, *value, GlobalVariable.ConfigPara.subSlavePowerSupplyEnable); + GlobalVariable.ConfigPara.subSlavePowerSupplyEnable =(unsigned char) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + +/************************************************* + Function : RWPIDKP() + Description : PID KP + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +//static int8_t RWPIDKP(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKp)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKp, *value ); +// GlobalVariable.ConfigPara.Pid_CurrKp =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +/************************************************* + Function : RWPIDKI() + Description : PID KI + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +//static int8_t RWPIDKI(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKi)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKi, *value ); +// GlobalVariable.ConfigPara.Pid_CurrKi =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +/************************************************* + Function : RWPIDKD() + Description : PID KD + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +//static int8_t RWPIDKD(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrKd)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrKd, *value ); +// GlobalVariable.ConfigPara.Pid_CurrKd =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +/************************************************* + Function : RWPIDSlope() + Description : PID Slope + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +//static int8_t RWPIDSlope(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Pid_CurrSlope)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_CurrSlope, *value ); +// GlobalVariable.ConfigPara.Pid_CurrSlope =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + + + +static int8_t RWHeatEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value == 0 )|| (*value == 1)) + { + Log_AddParamChange(107, *value, GlobalVariable.ConfigPara.HeatEnable); + GlobalVariable.ConfigPara.HeatEnable =(unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + +//static int8_t RWMotorOverCurrentValueG1(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG1)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG1, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG1 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG1(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG1)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG1, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG1 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG2(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG2)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG2, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG2 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG2(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG2)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG2, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG2 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG3(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG3)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG3, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG3 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG3(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG3)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG3, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG3 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG4(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG4)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG4, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG4 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG4(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG4)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG4, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG4 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG5(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG5)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG5, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG5 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG5(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG5)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG5, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG5 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG6(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG6)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG6, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG6 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG6(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG6)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG6, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG6 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG7(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG7)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG7, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG7 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG7(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG7)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG7, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG7 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG8(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG8)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG8, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG8 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG8(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG8)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG8, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG8 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG9(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG9)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG9, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG9 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG9(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG9)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG9, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG9 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentValueG10(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentValueG10)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValueG10, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentValueG10 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +//static int8_t RWMotorOverCurrentTimeG10(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = *(((unsigned short *)&GlobalVariable.ConfigPara.MotorOverCurrentTimeG10)); +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentTimeG10, *value ); +// GlobalVariable.ConfigPara.MotorOverCurrentTimeG10 =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +static int8_t RWPowerMode(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.PowerMode; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value <= 3) + { + Log_AddParamChange(82, *value, GlobalVariable.ConfigPara.PowerMode); + GlobalVariable.ConfigPara.PowerMode = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWCleaningDockAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.CleaningDockAngle; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value >= 30) && (*value <= 150)) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.CleaningDockAngle, *value ); + Log_AddParamChange(84, *value, GlobalVariable.ConfigPara.CleaningDockAngle); + GlobalVariable.ConfigPara.CleaningDockAngle = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWMotorOrientation(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.MotorOrientation; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value == 0 || *value == 1) //0锛氱數鏈烘湞涓滐紱 1锛氱數鏈烘湞??? + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOrientation, *value ); + Log_AddParamChange(85, *value, GlobalVariable.ConfigPara.MotorOrientation); + GlobalVariable.ConfigPara.MotorOrientation = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWRS485Enable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.RS485Enable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value == 0 )|| (*value == 1)) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.RS485Enable, *value ); + Log_AddParamChange(88, *value, GlobalVariable.ConfigPara.RS485Enable); + GlobalVariable.ConfigPara.RS485Enable = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWNoComEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.NoComEnable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if((*value == 0 )|| (*value == 1)) + { + Log_AddParamChange(98, *value, GlobalVariable.ConfigPara.NoComEnable); + GlobalVariable.ConfigPara.NoComEnable = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWPVModuleWidth1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWPVModuleWidth2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)) = *value; + if((GlobalVariable.ConfigParaBuffer.PVModuleWidth >= 0.2) && (GlobalVariable.ConfigParaBuffer.PVModuleWidth <= 20.0) ) + { + Log_AddParamChange(89, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PVModuleWidth)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth)+1)); + Log_AddParamChange(90, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.PVModuleWidth))); + GlobalVariable.ConfigPara.PVModuleWidth = GlobalVariable.ConfigParaBuffer.PVModuleWidth; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWPostSpacing1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)+1) = *value; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWPostSpacing2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)) = *value; + + if((GlobalVariable.ConfigParaBuffer.PostSpacing >= GlobalVariable.ConfigPara.PVModuleWidth) + && (GlobalVariable.ConfigParaBuffer.PostSpacing <= 50.0) ) + { + Log_AddParamChange(91, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.PostSpacing)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing)+1)); + Log_AddParamChange(92, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.PostSpacing))); + GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigParaBuffer.PostSpacing; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTerrainSlope1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWTerrainSlope2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)) = *value; + if((GlobalVariable.ConfigParaBuffer.TerrainSlope >= -45.0f) + && (GlobalVariable.ConfigParaBuffer.TerrainSlope <= 45.0f)) + { + Log_AddParamChange(93, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TerrainSlope)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope)+1)); + Log_AddParamChange(94, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TerrainSlope))); + GlobalVariable.ConfigPara.TerrainSlope = GlobalVariable.ConfigParaBuffer.TerrainSlope; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + +static int8_t RWUpWindSpeed(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)); + return AS_CB_OK; + } + +// else if(R_or_RW == 1) +// { +// if(*value <= 40) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpWindSpeed, *value ); +// Log_AddParamChange(99, *value, GlobalVariable.ConfigPara.UpWindSpeed); +// *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +static int8_t RWUpStartTime(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= 1000) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpStartTime, *value ); +// Log_AddParamChange(100, *value, GlobalVariable.ConfigPara.UpStartTime); +// *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +static int8_t RWLowWindSpeed(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= (GlobalVariable.ConfigPara.UpWindSpeed - 1)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, *value ); +// Log_AddParamChange(101, *value, GlobalVariable.ConfigPara.LowWindSpeed); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = *value; +// } +// else +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, GlobalVariable.ConfigPara.UpWindSpeed - 1 ); +// Log_AddParamChange(101, GlobalVariable.ConfigPara.UpWindSpeed - 1, GlobalVariable.ConfigPara.LowWindSpeed); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = GlobalVariable.ConfigPara.UpWindSpeed - 1; +// } +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } + return AS_CB_ERR_INVALID; +} +static int8_t RWLowStopTime(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= 1000) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowStopTime, *value ); +// Log_AddParamChange(102, *value, GlobalVariable.ConfigPara.LowStopTime); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} + +static int8_t RWESoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWESoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)) = *value; + if((GlobalVariable.ConfigParaBuffer.ESoftLimitAngle > 29.9f ) + && (GlobalVariable.ConfigParaBuffer.ESoftLimitAngle < 150.1f) ) + { + Log_AddParamChange(103, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.ESoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle)+1)); + Log_AddParamChange(104, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ESoftLimitAngle))); + GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWSoftLimitAngle1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)+1); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)+1) = *value; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWSoftLimitAngle2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)) = *value; + if( (GlobalVariable.ConfigParaBuffer.WSoftLimitAngle > 29.9f) + && ( GlobalVariable.ConfigParaBuffer.WSoftLimitAngle < 150.1f)) + { + Log_AddParamChange(105, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.WSoftLimitAngle)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle)+1)); + Log_AddParamChange(106, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.WSoftLimitAngle))); + GlobalVariable.ConfigPara.WSoftLimitAngle = GlobalVariable.ConfigParaBuffer.WSoftLimitAngle; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + + } + return AS_CB_ERR_INVALID; +} +static int8_t RWBackAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 59.9 && *value <= 120.1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.BackAngle, *value ); + Log_AddParamChange(111, *value, GlobalVariable.ConfigPara.BackAngle); + *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWEWindProtectionAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EWindProtectionAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 60 && *value <= 90) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EWindProtectionAngle, *value ); + Log_AddParamChange(112, *value, GlobalVariable.ConfigPara.EWindProtectionAngle); + *(((unsigned short *)&GlobalVariable.ConfigPara.EWindProtectionAngle)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWWindProtectionAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WWindProtectionAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 90 && *value <= 120) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WWindProtectionAngle, *value ); + Log_AddParamChange(113, *value, GlobalVariable.ConfigPara.WWindProtectionAngle); + *(((unsigned short *)&GlobalVariable.ConfigPara.WWindProtectionAngle)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +/*********************************************************************************** + *鍑芥暟鍚嶏細RWManufactor + *??? 杩帮細璇诲啓LORA鍘???鍙??? + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWManufactor(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_manufactor)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_manufactor, *value ); + Log_AddParamChange(200, *value, GlobalVariable.ConfigPara.Lora_manufactor); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_manufactor)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWDeviceIDH + *??? 杩帮細璇诲啓LORA妯″潡ID鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWDeviceIDH(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDH)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceIDH, *value ); + Log_AddParamChange(201, *value, GlobalVariable.ConfigPara.Lora_deviceIDH); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDH)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWDeviceIDL + *??? 杩帮細璇诲啓LORA妯″潡ID鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWDeviceIDL(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDL)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceIDL, *value ); + Log_AddParamChange(202, *value, GlobalVariable.ConfigPara.Lora_deviceIDL); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceIDL)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWDeviceNetID + *??? 杩帮細璇诲啓LORA net ID鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWDeviceNetID(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceNetID)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_deviceNetID, *value ); + Log_AddParamChange(203, *value, GlobalVariable.ConfigPara.Lora_deviceNetID); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_deviceNetID)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTadd3 + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 03H 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTadd3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add3)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add3, *value ); + Log_AddParamChange(204, *value, GlobalVariable.ConfigPara.Lora_ybt_add3); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add3)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTadd4 + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 04H 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTadd4(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add4)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add4, *value ); + Log_AddParamChange(205, *value, GlobalVariable.ConfigPara.Lora_ybt_add4); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add4)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTChannel + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 淇¢亾 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTChannel(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_channel)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_channel, *value ); + Log_AddParamChange(206, *value, GlobalVariable.ConfigPara.Lora_ybt_channel); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_channel)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTadd6 + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 06H 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTadd6(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add6)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_add6, *value ); + Log_AddParamChange(207, *value, GlobalVariable.ConfigPara.Lora_ybt_add6); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_add6)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTkeyH + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 瀵嗛挜 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTkeyH(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyH)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_keyH, *value ); + Log_AddParamChange(208, *value, GlobalVariable.ConfigPara.Lora_ybt_keyH); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyH)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWYBTkeyL + *??? 杩帮細璇诲啓LORA 鏄撲桨??? 瀵嗛挜 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWYBTkeyL(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyL)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_ybt_keyL, *value ); + Log_AddParamChange(209, *value, GlobalVariable.ConfigPara.Lora_ybt_keyL); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_ybt_keyL)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLbaudrate + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 娉㈢壒??? 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLbaudrate(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_baudrate)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_baudrate, *value ); + Log_AddParamChange(210, *value, GlobalVariable.ConfigPara.Lora_jxyl_baudrate); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_baudrate)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLparity + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 鏍¢獙 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLparity(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_parity)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_parity, *value ); + Log_AddParamChange(211, *value, GlobalVariable.ConfigPara.Lora_jxyl_parity); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_parity)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLfq1 + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 棰戠巼 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLfq1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq1)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq1, *value ); + Log_AddParamChange(212, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq1); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq1)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLfq2 + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 棰戠巼 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLfq2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq2)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq2, *value ); + Log_AddParamChange(213, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq2); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq2)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLfq3 + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 棰戠巼 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLfq3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq3)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_fq3, *value ); + Log_AddParamChange(214, *value, GlobalVariable.ConfigPara.Lora_jxyl_fq3); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_fq3)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLfactor + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 鎵???鍥??? 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLfactor(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_factor)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_factor, *value ); + Log_AddParamChange(215, *value, GlobalVariable.ConfigPara.Lora_jxyl_factor); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_factor)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLmode + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 妯″紡 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLmode(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_mode)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_mode, *value ); + Log_AddParamChange(216, *value, GlobalVariable.ConfigPara.Lora_jxyl_mode); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_mode)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLmode + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 鎵???甯??? 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLbw(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_bw)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_bw, *value ); + Log_AddParamChange(217, *value, GlobalVariable.ConfigPara.Lora_jxyl_bw); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_bw)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWJXYLpower + *??? 杩帮細璇诲啓LORA 鎹疯繀鏄撹仈 鍔熺巼 鍙傛暟 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2020-8-17 + **********************************************************************************/ +static int8_t RWJXYLpower(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_power)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Lora_jxyl_power, *value ); + Log_AddParamChange(218, *value, GlobalVariable.ConfigPara.Lora_jxyl_power); + *(((unsigned short *)&GlobalVariable.ConfigPara.Lora_jxyl_power)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.WriteFlag.LoraParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/*********************************************************************************** + *鍑芥暟鍚嶏細RWTerrainSlopeDown + *??? 杩帮細 + *??? 鍏ワ細璇诲啓鏍囧織浣嶃?? + *杩斿洖鍊硷細 + *??? 鏈燂細2021-8-17 + **********************************************************************************/ +static int8_t RWTerrainSlopeEvening(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening = ((float)((signed short)(*value)))/10.0f; + if(GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening >= -45.0f + && GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening <= 45.0f) + { + Log_AddParamChange(95, *value, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10)); + GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + else + { + Log_AddParamChange(95, (signed short)GlobalVariable.ConfigPara.TerrainSlope, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*10)); + GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigPara.TerrainSlope; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryLowTriggerValue() + Description : Battery Low Trigger Value + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.13 + Additional Comments : [1800,2940],瀵瑰簲???璁剧數鍘嬭寖鍥碵18V,29.4V] +*************************************************/ +static int8_t RWBatteryLowTriggerValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Low_TriggerValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1800 && *value <= 2940) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_TriggerValue, *value ); + Log_AddParamChange(REG_BATTERY_LOW_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.Battery_Low_TriggerValue); + GlobalVariable.ConfigPara.Battery_Low_TriggerValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryLowRecoveryValue() + Description : Battery Low Recovery Value + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.13 + Additional Comments : [1800,2940],瀵瑰簲???璁剧數鍘嬭寖鍥碵18V,29.4V] +*************************************************/ +static int8_t RWBatteryLowRecoveryValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Low_RecoveryValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1800 && *value <= 2940) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_RecoveryValue, *value ); + Log_AddParamChange(REG_BATTERY_LOW_RECORERY_VALUE, *value, GlobalVariable.ConfigPara.Battery_Low_RecoveryValue); + GlobalVariable.ConfigPara.Battery_Low_RecoveryValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryEmptyTriggerValue() + Description : Battery Empty Trigger Value + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.13 + Additional Comments : [1800,2940],瀵瑰簲???璁剧數鍘嬭寖鍥碵18V,29.4V] +*************************************************/ +static int8_t RWBatteryEmptyTriggerValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Empty_TriggerValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1800 && *value <= 2940) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_TriggerValue, *value ); + Log_AddParamChange(REG_BATTERY_EMPTY_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.Battery_Empty_TriggerValue); + GlobalVariable.ConfigPara.Battery_Empty_TriggerValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryEmptyRecoveryValue() + Description : Battery Empty Recovery Value + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.13 + Additional Comments : [1800,2940],瀵瑰簲???璁剧數鍘嬭寖鍥碵18V,29.4V] +*************************************************/ +static int8_t RWBatteryEmptyRecoveryValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 1800 && *value <= 2940) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue, *value ); + Log_AddParamChange(REG_BATTERY_EMPTY_RECORERY_VALUE, *value, GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue); + GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + GlobalVariable.SpecialCheck.MasterSetBatErrParaToSlaveFlag = 1; + + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RResetCount() + Description : Reset Count + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RResetCount1(unsigned char R_or_RW, unsigned short *value) +{ + + + + + + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.Log.LogReset.ResetCount)+1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RResetCount2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.Log.LogReset.ResetCount)); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWLogEnable() + Description : log enable + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RWLogEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.LogEnable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LogEnable, *value ); + Log_AddParamChange(41, *value, GlobalVariable.ConfigPara.LogEnable); + GlobalVariable.ConfigPara.LogEnable = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWPIDTarget() + Description : pid target + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +//static int8_t RWPIDTarget(unsigned char R_or_RW, unsigned short *value) +//{ +// if(R_or_RW == 0) +// { +// *value = GlobalVariable.ConfigPara.Pid_Target; +// } +// else if(R_or_RW == 1) +// { +// LogOperation_ParameterChange( GlobalVariable.ConfigPara.Pid_Target, *value ); +// GlobalVariable.ConfigPara.Pid_Target = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +//} + +/************************************************* + Function : RWAskOperationNo() + Description : log Ask Operation No + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RWAskOperationNo(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Log.Ask_OperationNo ; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if( *value <= 100 ) + { + //Log_AddParamChange(10000 + 5, *value, GlobalVariable.Log.Ask_OperationNo); + GlobalVariable.Log.Ask_OperationNo = (unsigned short) *value; + } + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : + Description : from which num to read log + Input : null + Output : null + Return : null + Engineer : longcd + Revision : + Modified Date : + Additional Comments : +*************************************************/ +static int8_t RWLogReadNum(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Log.read_num ; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + GlobalVariable.Log.read_num = *value; + Log_ReadToBuf(GlobalVariable.Log.read_num); + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWLogOperationSum() + Description : log Operation Sum + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RWLogOperationSum(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (GlobalVariable.Log.LogOperation.Sum > 100) ? 100 : GlobalVariable.Log.LogOperation.Sum ; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWAskWarningNo() + Description : log Ask Warning No + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RWAskWarningNo(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Log.Ask_WarningNo ; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if( *value <= 100 ) + { + GlobalVariable.Log.Ask_WarningNo = (unsigned short) *value; + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWLogWarningSum() + Description : log Warning Sum + Input : null + Output : null + Return : null + Engineer : tangtao + Revision : V0.0 + Modified Date : 2021.10.08 + Additional Comments : +*************************************************/ +static int8_t RWLogWarningSum(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (GlobalVariable.Log.LogWarning.Sum > 100) ? 100 : GlobalVariable.Log.LogWarning.Sum; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWInstallPostion() + Description : RWInstallPostion + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2022.08.23 + Additional Comments : +*************************************************/ +//static int8_t RWInstallPostion(unsigned char R_or_RW, unsigned short *value) +//{ + +//} +/************************************************* + Function : RWSouthNorthShiftAngle() + Description : RWSouthNorthShiftAngle + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2022.08.25 + Additional Comments : +*************************************************/ +static int8_t RWSouthNorthShiftAngle(unsigned char R_or_RW, unsigned short *value) +{ + short temp; + + if(R_or_RW == 0) + { + *value = *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + temp = (signed short )(*value); + if( abs(temp) <= MAXABS_SOUTHNORTHSHIFTANGLE_PLUS100 ) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.SouthNorthShiftAngle, *value ); + Log_AddParamChange(413, *value, *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle))); + GlobalVariable.ConfigPara.SouthNorthShiftAngle = temp; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWFacingWindStopFunction_Enable() + Description : RWFacingWindStopFunction_Enable + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2022.08.30 + Additional Comments : +*************************************************/ +static int8_t RWFacingWindStopFunction_Enable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.FacingWindStopFunction_Enable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.FacingWindStopFunction_Enable, *value ); + Log_AddParamChange(116, *value, GlobalVariable.ConfigPara.FacingWindStopFunction_Enable); + GlobalVariable.ConfigPara.FacingWindStopFunction_Enable = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) + Description : RWYBTLoraParaEnable + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.03.08 + Additional Comments : 鏀跺埌涓婁綅鏈轰笅鍙戠殑鐗规畩瀛???锛0x6A6A;MCU寮濮???鍙朙ora鍙傛暟 + MCU璇诲彇鎴愬姛鍚庯紝璇ュ瘎瀛樺櫒??????鏀逛负0x7A7A; + 涓婁綅鏈???鍙???0x7A7A鍚庯紝鍐嶅幓瀵勫瓨???201-209璇诲彇Lora鍙傛暟 +*************************************************/ +static int8_t RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.SpecialCheck.ReadYBTLoraParaEnable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + GlobalVariable.SpecialCheck.ReadYBTLoraParaEnable = (unsigned short) *value; + } + return AS_CB_ERR_INVALID; +} + + +/************************************************* + Function : RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value) + Description : RWEFacingWindAngle + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.01.09 + Additional Comments : 涓滆繋椋庡仠闈???搴︼紝鍙鑼冨洿澶т簬绛???30???; +*************************************************/ +static int8_t RWEFacingWindAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 30 && *value <= 150) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EFacingWindAngle, *value ); + Log_AddParamChange(117, *value, GlobalVariable.ConfigPara.EFacingWindAngle); + *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value) + Description : RWWFacingWindAngle + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.01.09 + Additional Comments : 瑗胯繋椋庡仠闈???搴︼紝鍙鑼冨洿灏忎簬绛???150???; +*************************************************/ +static int8_t RWWFacingWindAngle(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(*value >= 30 && *value <= 150) + { + //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WFacingWindAngle, *value ); + Log_AddParamChange(118, *value, GlobalVariable.ConfigPara.WFacingWindAngle); + *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)) = *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBatteryHighTemperatureProtection_TriggerValue() + Description : RWBatteryHighTemperatureProtection_TriggerValue + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.03 + Additional Comments : porting by longcd +*************************************************/ +static int8_t RWBatteryHighTemperatureProtection_TriggerValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); + if( (*value >= 25) && (*value <= 80) ) + { + Log_AddParamChange(REG_BATTERY_HIGHTEMPPRO_TRIGGER_VALUE, *value, GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue); + GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBatteryHighTemperatureProtection_ExitValue() + Description : RWBatteryHighTemperatureProtection_ExitValue + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.03 + Additional Comments : porting by longcd +*************************************************/ +static int8_t RWBatteryHighTemperatureProtection_ExitValue(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); + if( (*value >= 25) && (*value <= 80) ) + { + Log_AddParamChange(REG_BATTERY_HIGHTEMPPRO_EXIT_VALUE, *value, GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); + GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWStopAllSlaveMotor(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.StopSlaveMotorFlag; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); + //写????????0????1????写????????????????????????写?? + if( (*value == 0x01) || (*value == 0x00) ) + { + if(*value != GlobalVariable.ConfigPara.StopSlaveMotorFlag) + { + Log_AddParamChange(REG_STOP_ALL_SLAVEMOTOR, *value, GlobalVariable.ConfigPara.StopSlaveMotorFlag); + GlobalVariable.ConfigPara.StopSlaveMotorFlag = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatSocLowRunBackWaitTime() + Description : RWBatSocLowRunBackWaitTime + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.08.11 + Additional Comments : BatSocLow鎶???鏃讹紝杩斿洖澶ч淇濇姢浣嶇殑绛夊緟鏃??? +*************************************************/ +static int8_t RWBatSocLowRunBackWaitTime(unsigned char R_or_RW, unsigned short *value) +{ + + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); + + if( (*value >= 0) && (*value <= 120) ) + { + Log_AddParamChange(REG_BATSOCLOWRUNBACK_WAITTIME , *value, GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime); + GlobalVariable.ConfigPara.BatSocLowRunBackWaitTime = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + } + return AS_CB_ERR_INVALID; +} + + + +/******************************************************* + commucation test +*******************************************************/ +static int8_t RCommuTestCrcErr(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(0); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RCommuTestCrcOk(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RCommuTestReply(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(2); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWCommuTestClearAll(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = 0; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + if(0xaa00 == *value) + { + CommuTest_ClearAll(); + } + } + return AS_CB_ERR_INVALID; +} + + + +/************************************************* + Function : RWYBTLoraParaEnable(unsigned char R_or_RW, unsigned short *value) + Description : RWYBTLoraParaEnable + Input : null + Output : null + Return : null + Engineer : Liuchengrun + Revision : V0.0 + Modified Date : 2024.03.05 + Additional Comments : 鏀跺埌涓婁綅鏈轰笅鍙戠殑鐗规畩瀛???锛0x6B6B;MCU寮濮???鍙朆luetooth鍙傛暟 + MCU璇诲彇鎴愬姛鍚庯紝璇ュ瘎瀛樺櫒????鏀逛负0x7B7B;澶辫触??3B3B; + 涓婁綅鏈???鍙??0x7B7B鍚庯紝鍐嶅幓瀵勫瓨??220-230璇诲彇Bluetooth鍙傛暟 +*************************************************/ +static int8_t RWYBTBluetoothParaEnable(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.SpecialCheck.ReadYBTBlueoothParaEnable; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + GlobalVariable.SpecialCheck.ReadYBTBlueoothParaEnable = (unsigned short) *value; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RBluetoothMACPara1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add1; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBluetoothMACPara2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add2; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBluetoothMACPara3(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add3; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RBluetoothMACPara4(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add4; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBluetoothMACPara5(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add5; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RBluetoothMACPara6(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Bluetooth_YBT_add6; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWLostComm_BatsocLow_TargetAngle() + Description : RWLostComm_BatsocLow_TargetAngle + Input : null + Output : null + Return : null + Engineer : QuXiaoWen + Revision : V0.0 + Modified Date : 2024.08.14 + Additional Comments : 璇诲啓浣庣數閲忔垨鑰呭け鑱旀椂鐨勪繚鎶よ搴 +*************************************************/ +static int8_t RWLostComm_BatsocLow_TargetAngle(unsigned char R_or_RW, unsigned short *value) +{ + + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); + + if(*value >= 30 && *value <= 150) + { + Log_AddParamChange(REG_LOSTCOMM_BATSOCLOW_TARGET_ANGLE, *value, GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle); + GlobalVariable.ConfigPara.LostComm_BatsocLow_TargetAngle = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1;// + } + } + return AS_CB_ERR_INVALID; +} + + + + + +/************************************************* +crc缁??????鏁 +*************************************************/ + +static int8_t RCommuTest_RecvID_Tracker_CrcOK(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(3); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* +crc缁??????鏁 +*************************************************/ + +static int8_t RCommuTest_RecvID_Tracker_Reply(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(4); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* +crc缁??????鏁 +*************************************************/ + +static int8_t RCommuTest_RecvID_Tracker_CrcErr(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(5); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* +crc缁??????鏁 +*************************************************/ + +static int8_t RCommuTest_RecvID_00_CrcOK(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(6); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* +crc缁??????鏁 +*************************************************/ + +static int8_t RCommuTest_RecvID_00_CrcErr(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = CommuTest_GetOne(7); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + + + + + + +static void ReadUIRightPanelMasterSlaveAlarmsHighPart2(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[0])+1); + } +} +static void ReadUIRightPanelMasterSlaveAlarmsLowPart2(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[0])); + } +} + +static void ReadUIRightPanelMasterSlaveAlarmsHighPart3(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[1])+1); + } +} +static void ReadUIRightPanelMasterSlaveAlarmsLowPart3(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.UIRightPanelMasterSlaveAlarms[1])); + } +} + + + +static int8_t RWWarningAndFaultOfSlave_1(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[0])); + // *value = 0xFFFF; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + +static int8_t RWWarningAndFaultOfSlave_2(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[1])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWarningAndFaultOfSlave_3(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[2])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_4(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[3])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWarningAndFaultOfSlave_5(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[4])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_6(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[5])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_7(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[6])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_8(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[7])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_9(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[8])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_10(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[9])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_11(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[10])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_12(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[11])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_13(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[12])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_14(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[13])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_15(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[14])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_16(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[15])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_17(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[16])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +static int8_t RWWarningAndFaultOfSlave_18(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[17])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWarningAndFaultOfSlave_19(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[18])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + +static int8_t RWWarningAndFaultOfSlave_20(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.PowerAndCommonSlaveAlarmsUpdate[19])); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} + + + + + +static int8_t RWStaticDiffAngle(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + + *value = GlobalVariable.ConfigPara.staticDiffAngle; + return AS_CB_OK; + } + else if((R_or_RW == 1)&&( *value >= 3.0f && *value <= 6.0f)&&(GlobalVariable.ConfigPara.staticDiffAngle != *value)) + { + + Log_AddParamChange(REG_STATIC_DIFF_ANGLE, *value, GlobalVariable.ConfigPara.staticDiffAngle); + GlobalVariable.ConfigPara.staticDiffAngle = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + + +static int8_t RWMoveDiffAngle(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.moveDiffAngle; + return AS_CB_OK; + } + else if((R_or_RW == 1)&&( *value >= 3.0f && *value <= 10.0f)&&(GlobalVariable.ConfigPara.moveDiffAngle!= *value)) + { + + Log_AddParamChange(REG_MOVE_DIFF_ANGLE, *value, GlobalVariable.ConfigPara.moveDiffAngle); + GlobalVariable.ConfigPara.moveDiffAngle = (unsigned short) *value; + GlobalVariable.WriteFlag.ConfigParaWrite = 1; + } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWWeaherState(unsigned char R_or_RW, unsigned short *value) + Description : RWWeaherState(unsigned char R_or_RW, unsigned short *value) + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2024.11.14 + Additional Comments : 澶╂皵鐘舵 + 1锛氭櫞澶(鑷姩璺熻釜) + 3锛氳繃娓″ぉ姘(涓婂崍鍋80搴︼紝涓嬪崍鍋100搴) + 4锛氶槾澶(鍋90搴) +*************************************************/ +static int8_t RWWeaherState(unsigned char R_or_RW, unsigned short *value) +{ + static unsigned short WeatherStateTemp = 0; + + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&WeaherState)); + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + *(((unsigned short *)&WeaherState)) = *value; + + WeaherStateTime = GlobalVariable.Time.TodayTime; // 褰撳墠鏃堕棿 + WeaherStateTimeFlag = 1; + Log_AddParamChange(REG_WEATHERSTATE , *value, WeatherStateTemp); + WeatherStateTemp = *value; + } + return AS_CB_ERR_INVALID; +} + + + +//浠ヤ笅鍐???涓烘柊???绮剧畝鍗???鍔熻兘 +/************************************************* + Function : RProtocol_Version() + Description : RProtocol_Version + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 + Additional Comments : 鍗???鐗堟湰,RegAddr: 29;锛堜緵涓婁綅鏈哄拰閫???绠卞尯鍒嗕娇鐢ㄤ笉鍚岀殑鍗???鐗堟湰,閫???绠???甯???璇㈡椂???浠ョ煡閬撴槸鍚︽敮鎸佹柊鍗?????? + 0xAAF2:???鎸佹柊鐨勭簿绠鍗???锛屽悓鏃跺吋瀹规棫鐨勫崗??? + 鍏朵粬鍊硷細??????鎸佹棫鍗??? +*************************************************/ +static int8_t RProtocol_Version(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.ProtocolVersion; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RProtocol_Version_S() + Description : RProtocol_Version_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 + Additional Comments : 鍗???鐗堟湰,RegAddr: 29;锛堜緵涓婁綅鏈哄拰閫???绠卞尯鍒嗕娇鐢ㄤ笉鍚岀殑鍗???鐗堟湰,閫???绠???甯???璇㈡椂???浠ョ煡閬撴槸鍚︽敮鎸佹柊鍗?????? + 0xAAF2:???鎸佹柊鐨勭簿绠鍗???锛屽悓鏃跺吋瀹规棫鐨勫崗??? + 鍏朵粬鍊硷細??????鎸佹棫鍗??? +*************************************************/ +static int8_t RProtocol_Version_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.ProtocolVersion; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RDeviceType_S() + Description : RDeviceType_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???鍐呯殑璁???绫诲瀷锛 +*************************************************/ +static int8_t RDeviceType_S(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.DeviceType; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RDeviceEdition_S() + Description : RDeviceEdition_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???鍐呯殑澶х増???鍙凤紝???8涓鸿蒋浠剁増???鍙凤紝???8浣嶄负???浠剁増???鍙凤細 +*************************************************/ +static int8_t RDeviceEdition_S(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.FixePara.DeviceEdition; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RVersion1_S() + Description : RVersion1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???灏忕増???鍙凤紱???8浣嶄负璁???绫诲瀷锛???8浣嶆殏鏃朵笉?????? +*************************************************/ +static int8_t RVersion1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.FixePara.Version1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RVersion2_S() + Description : RVersion2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???灏忕増???鍙凤紱???8浣嶄负鍙戝竷鐗堟湰鍙凤紝???8浣嶄负娴嬭瘯鐗堟湰鍙凤細 +*************************************************/ +static int8_t RVersion2_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.FixePara.Version2); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RPVBuckerVoltage_S + Description : RPVBuckerVoltage_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???PV缁勪欢鐢靛帇锛屾斁???10鍊嶏細 +*************************************************/ +static int8_t RPVBuckerVoltage_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.PowerPara.PVBuckerVoltage * 10); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RBatVoltage_S + Description : RBatVoltage_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???鐢垫睜鐢靛帇锛屾斁???10鍊嶏細 +*************************************************/ +static int8_t RBatVoltage_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)(GlobalVariable.PowerPara.BatteryVoltage * 10); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RBatSOCTemp_S() + Description : RBatSOCTemp_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.25 +Additional Comments : 绮剧畝鍗???鐢垫睜SOC(鏀惧ぇ100???)/; +*************************************************/ +static int8_t RBatSOCTemp_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = 0x00FF & (unsigned char)(GlobalVariable.PowerPara.BatterySOC*100); + *value = *value << 8; + *value &= 0xFF00; + *value |= ((signed char)(GlobalVariable.PowerPara.BatteryTemperature) & 0x00FF); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RTemp_S() + Description : RTemp_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???涓绘澘娓╁害/; +*************************************************/ +static int8_t RTemp_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(unsigned short *)&GlobalVariable.Tmp.BoardTmp; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RBatState_BatCurrent_S() + Description : RBatState_BatCurrent_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???鐢垫睜鍏呯數鐘??/鐢垫睜鐢垫祦; +*************************************************/ +static int8_t RBatState_BatCurrent_S(unsigned char R_or_RW, unsigned short *value) +{ + signed short temp = 0; + + temp = (signed short)(GlobalVariable.PowerPara.BatteryCurrent*100); + + if(R_or_RW == 0) + { + *value = 0; + *value |= (*(unsigned char*)(&GlobalVariable.PowerPara.ChargeState)) << 12; + *value |= *((unsigned short *)&temp); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWWorkMode1_S() + Description : RWWorkMode1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???宸ヤ綔妯″紡; +*************************************************/ +static int8_t RWWorkMode1_S(unsigned char R_or_RW, unsigned short *value ) +{ + int i; + + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.WorkMode.WorkMode)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.WorkMode.WorkMode, GlobalVariable.WorkModeBuffer.WorkMode ); +// *(((unsigned short *)&GlobalVariable.WorkModeBuffer.WorkMode)) = *value; + +// if((GlobalVariable.WorkMode.WorkMode & 0xffff) != *value) +// { +// Log_AddWorkModeChange(*value, GlobalVariable.WorkMode.WorkMode,LOG_WORK_MODE_RCV); +// } +// +// for(i = 0; i < sizeof(valid_mode)/sizeof(valid_mode[0]); i++) +// { +// if(*value == valid_mode[i]) +// { +// break; +// } +// } +// +// if(i >= sizeof(valid_mode)/sizeof(valid_mode[0])) +// { +// return AS_CB_ERR_INVALID; //闈炴湁鏁堟ā寮忕洿鎺ヨ繑??? +// } + +// if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFF) +// { +// NVIC_SystemReset(); +// } +// else if((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == 0xFE)//鍋滄満妯″紡 +// { +// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkMode.WorkMode; //濡傛灉鏀跺埌閫???绠卞仠鏈烘ā寮忥紝淇濇寔鍘熸ā寮忥紝涓嶅搷??? +//// MotorAllStop(); /* Stop */ +//// GlobalVariable.WorkModeBuffer.WorkMode = AUTO_TRACKER_MODE; +//// RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //浣胯兘PWR澶???鏃??? +//// +//// EXTI_InitTypeDef EXTI_InitStructure; +//// NVIC_InitTypeDef NVIC_InitStructure; +//// RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); //浣胯兘澶嶇敤鍔熻兘鏃堕挓 + +// // //GPIOE.2 ??????绾夸互鍙婁腑???鍒???鍖栭厤缃 涓嬮檷娌胯Е??? LORA_RX : PA10 +//// GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource10); +//// +//// EXTI_InitStructure.EXTI_Line=EXTI_Line10; //PA10 +//// EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; +//// EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; +//// EXTI_InitStructure.EXTI_LineCmd = ENABLE; +//// EXTI_Init(&EXTI_InitStructure); //鏍规嵁EXTI_InitStruct???鎸囧畾鐨勫弬鏁板垵濮嬪寲澶???EXTI瀵勫瓨??? + +//// NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //浣胯兘鎸夐敭WK_UP鎵鍦ㄧ殑澶栭儴??????閫氶亾 +//// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //鎶㈠崰浼樺厛???2??? +//// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x03; //瀛愪紭鍏堢骇3 +//// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //浣胯兘澶栭儴??????閫氶亾 +//// NVIC_Init(&NVIC_InitStructure); +//// +//// IWDG_ReloadCounter(); +//// IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); +//// IWDG_SetPrescaler(IWDG_Prescaler_256); +//// IWDG_SetReload(0xFFF); +//// IWDG_ReloadCounter(); +//// +//// RTC_Local_Init(); +//// +//// us_tick = SysTick->CTRL; +//// SysTick->CTRL = 0; +//// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP妯″紡 +//// OS_ERR err; +//// OSSchedLock(&err); +//// while(1) +//// { +//// if(uc_rtcFlag==1) +//// { +//// uc_rtcFlag = 0; +//// SysTick->CTRL = us_tick; +//// SystemInit(); +//// OS_CPU_SysTickInit(720000); +//// IWDG_ReloadCounter(); +//// RCC_LSICmd(ENABLE); +//// RTC_WaitForSynchro(); +//// RTC_Local_Init(); +//// us_tick = SysTick->CTRL; +//// SysTick->CTRL = 0; +//// PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);//STOP妯″紡 +//// } +//// } +// } +// else if ((GlobalVariable.WorkModeBuffer.WorkMode & 0xFF) == AUTO_AI_MODE) +// { +// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; +// GlobalVariable.AIPara.AIRemoteAngle=GlobalVariable.Motor[0].ActualAngle; +// } +// else +// { +// GlobalVariable.WorkMode.WorkMode = GlobalVariable.WorkModeBuffer.WorkMode; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWarningAndFault1_1_S() + Description : RWarningAndFault1_1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???Alarm; +*************************************************/ +static int8_t RWarningAndFault1_1_S(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { +// *value = *(((unsigned short *)&GlobalVariable.MasterselfWarningAndFault)+1); + *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)+1); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWarningAndFault1_2_S() + Description : RWarningAndFault1_2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???Alarm; +*************************************************/ +static int8_t RWarningAndFault1_2_S(unsigned char R_or_RW, unsigned short *value ) +{ + if(R_or_RW == 0) + { +// *value = *(((unsigned short *)&GlobalVariable.MasterselfWarningAndFault)); + *value = *(((unsigned short *)&GlobalVariable.SystemWarningAndFaultUpdate)); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RMotorCurrent1_S() + Description : RMotorCurrent1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???鐢垫満鐢垫祦; +*************************************************/ +static int8_t RMotorCurrent1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (short)(GlobalVariable.Motor[0].Motorcurrent * 10); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RTargetAngle1_S() + Description : RTargetAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗??????鏍???搴,鏀惧ぇ100鍊嶏紱 +*************************************************/ +static int8_t RTargetAngle1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short )(GlobalVariable.WorkMode.Target * 100); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RRealAngle1_S() + Description : RRealAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???瀹為檯瑙掑害,鏀惧ぇ100鍊嶏紱 +*************************************************/ +static int8_t RRealAngle1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = ( unsigned short )(GlobalVariable.Motor[0].ActualAngle * 100); + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWWorkMode2_S() + Description : RWWorkMode2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???宸ヤ綔妯″紡; +*************************************************/ +static int8_t RWWorkMode2_S(unsigned char R_or_RW, unsigned short *value ) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWarningAndFault1_1_S() + Description : RWarningAndFault1_1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???Alarm; +*************************************************/ +static int8_t RWarningAndFault2_1_S(unsigned char R_or_RW, unsigned short *value ) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWarningAndFault1_2_S() + Description : RWarningAndFault1_2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???Alarm; +*************************************************/ +static int8_t RWarningAndFault2_2_S(unsigned char R_or_RW, unsigned short *value ) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RMotorCurrent1_S() + Description : RMotorCurrent1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???鐢垫満鐢垫祦; +*************************************************/ +static int8_t RMotorCurrent2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RTargetAngle1_S() + Description : RTargetAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗??????鏍???搴,鏀惧ぇ100鍊嶏紱 +*************************************************/ +static int8_t RTargetAngle2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RRealAngle2_S() + Description : RRealAngle2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗??????鏍???搴,鏀惧ぇ100鍊嶏紱 +*************************************************/ +static int8_t RRealAngle2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWAIRemoteTarget1_S() + Description : RWAIRemoteTarget1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???杩滅▼???鏍???搴1??? +*************************************************/ +static int8_t RWAIRemoteTarget1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short)GlobalVariable.AIPara.AIRemoteAngle; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.AIPara.AIRemoteAngle, *value ); +// Log_AddParamChange(384, *value, (unsigned short)GlobalVariable.AIPara.AIRemoteAngle); +// GlobalVariable.AIPara.AIRemoteAngle = (float)*value; +// GlobalVariable.AIPara.AIModeDelayCount = 0; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWAIRemoteTarget2_S() + Description : RWAIRemoteTarget2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???杩滅▼???鏍???搴2??? +*************************************************/ +static int8_t RWAIRemoteTarget2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWRemoteWindDirect_S() + Description : RWRemoteWindDirect_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???杩滅▼椋庡悜??? +*************************************************/ +static int8_t RWRemoteWindDirect_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Weather.RemoteWindDirect; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// Log_AddParamChange(387, *value, GlobalVariable.Weather.RemoteWindDirect); +// GlobalVariable.Weather.RemoteWindDirect = *value; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWRemoteWindSpeed_S() + Description : RWRemoteWindSpeed_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???杩滅▼椋庨燂紱 +*************************************************/ +static int8_t RWRemoteWindSpeed_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.Weather.RemoteWindSpeed; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.Weather.RemoteWindSpeed, *value ); +// Log_AddParamChange(386, *value, GlobalVariable.Weather.RemoteWindSpeed); +// GlobalVariable.Weather.RemoteWindSpeed = *value; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWLongitude1_S() + Description : RWLongitude1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???缁忓害??? +*************************************************/ +/* Longitude */ +static int8_t RWLongitude1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// Log_AddParamChange(388, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)+1)); +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)+1) = *value; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWLongitude2_S() + Description : RWLongitude2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???缁忓害??? +*************************************************/ +static int8_t RWLongitude2_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Longitude)) = *value; +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.Longitude, GlobalVariable.ConfigParaBuffer.Longitude ); +// +// if(GlobalVariable.ConfigParaBuffer.Longitude >= -180.0 +// &&GlobalVariable.ConfigParaBuffer.Longitude <= 180.0 ) +// { +// Log_AddParamChange(389, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Longitude))); +// GlobalVariable.ConfigPara.Longitude = GlobalVariable.ConfigParaBuffer.Longitude; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWLatitude1_S() + Description : RWLatitude1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗??????搴︼紱 +*************************************************/ +static int8_t RWLatitude1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1) = *value; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWLatitude2_S() + Description : RWLatitude2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗??????搴︼紱 +*************************************************/ +static int8_t RWLatitude2_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)) = *value; +// if(GlobalVariable.ConfigParaBuffer.Latitude >= -90.0 +// && GlobalVariable.ConfigParaBuffer.Latitude <= 90.0) +// { +// Log_AddParamChange(390, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.Latitude)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude)+1)); +// Log_AddParamChange(391, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.Latitude))); +// GlobalVariable.ConfigPara.Latitude = GlobalVariable.ConfigParaBuffer.Latitude; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTimeZone1_S() + Description : RWTimeZone1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???鏃跺尯??? +*************************************************/ +static int8_t RWTimeZone1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1) = *value; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTimeZone2_S() + Description : RWTimeZone2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.26 +Additional Comments : 绮剧畝鍗???鏃跺尯??? +*************************************************/ +static int8_t RWTimeZone2_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)) = *value; +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.TimeZone, GlobalVariable.ConfigParaBuffer.TimeZone ); +// if(GlobalVariable.ConfigParaBuffer.TimeZone >= -12.0 +// && GlobalVariable.ConfigParaBuffer.TimeZone <= 12.0) +// { +// Log_AddParamChange(392, *(((unsigned short *)&GlobalVariable.ConfigParaBuffer.TimeZone)+1), *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone)+1)); +// Log_AddParamChange(393, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.TimeZone))); +// GlobalVariable.ConfigPara.TimeZone = GlobalVariable.ConfigParaBuffer.TimeZone; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTimeYearMonth_S() + Description : RWTimeYearMonth_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 +Additional Comments : 绮剧畝鍗???骞达紝鏈堬紱 骞达細???8浣嶏紱鏈堬細???8??? +*************************************************/ +static int8_t RWTimeYearMonth_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = ((GlobalVariable.Time.Year % 2000) << 8) | (GlobalVariable.Time.Month); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); +// GlobalVariable.TimeBuffer.Year = 2000 + (*value >> 8); +// GlobalVariable.TimeBuffer.Month = (*value & 0xFF); +// GlobalVariable.WriteFlag.TimeWrite = 2; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTimeDayHour_S() + Description : RWTimeDayHour_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 +Additional Comments : 绮剧畝鍗???鏃ワ紝鏃讹紱 鏃ワ細???8浣嶏紱鏃讹細???8??? +*************************************************/ +static int8_t RWTimeDayHour_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = ((GlobalVariable.Time.Day) << 8) | (GlobalVariable.Time.Hour); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); +// GlobalVariable.TimeBuffer.Day = (*value >> 8); +// GlobalVariable.TimeBuffer.Hour = (*value & 0xFF); +// GlobalVariable.WriteFlag.TimeWrite = 2; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTimeMinuteSecond_S() + Description : RWTimeMinuteSecond_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 +Additional Comments : 绮剧畝鍗???鍒嗭紝绉掞紱 鍒嗭細???8浣嶏紱绉掞細???8??? +*************************************************/ +static int8_t RWTimeMinuteSecond_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = ((GlobalVariable.Time.Minute) << 8) | (GlobalVariable.Time.Second); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.TimeBuffer.Year, *value ); +// GlobalVariable.TimeBuffer.Minute = (*value >> 8); +// GlobalVariable.TimeBuffer.Second = (*value & 0xFF); +// GlobalVariable.WriteFlag.TimeWrite = 2; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RElevationAngle1_S() + Description : RElevationAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 + Additional Comments : 绮剧畝鍗???锛屽お闃抽珮搴???1 +*************************************************/ +static int8_t RElevationAngle1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.AstronomyPara.ElevationAngle * 100; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RAzimuthAngle1_S() + Description : RAzimuthAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 + Additional Comments : 绮剧畝鍗???锛屽お闃虫柟浣???1 +*************************************************/ +static int8_t RAzimuthAngle1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.AstronomyPara.AzimuthAngle * 100; + return AS_CB_OK; + } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RElevationAngle2_S() + Description : RElevationAngle2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 + Additional Comments : 绮剧畝鍗???锛屽お闃抽珮搴???2 +*************************************************/ +static int8_t RElevationAngle2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RAzimuthAngle2_S() + Description : RAzimuthAngle2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.27 + Additional Comments : 绮剧畝鍗???锛屽お闃虫柟浣???2 +*************************************************/ +static int8_t RAzimuthAngle2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWComID_S() + Description : RWComID_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屾帶鍒跺櫒ID +*************************************************/ +static int8_t RWComID_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.ComID)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value >= 1 && *value < 255) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.ComID, *value ); +// Log_AddParamChange(401, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.ComID))); +// GlobalVariable.ConfigPara.ComID =(unsigned char) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWChannelSelect_S() + Description : RWChannelSelect_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岄氶亾閫夋嫨 +*************************************************/ +static int8_t RWChannelSelect_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RRWEWTracingAccuracy_S() + Description : RWEWTracingAccuracy_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岃窡???绮惧害,鏀惧ぇ100??? +*************************************************/ +static int8_t RWEWTracingAccuracy_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short )(GlobalVariable.ConfigPara.EWTracingAccuracy * 100); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// +// GlobalVariable.ConfigPara.EWTracingAccuracy = (*value) * 0.01; +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.EWTracingAccuracy, GlobalVariable.ConfigParaBuffer.EWTracingAccuracy ); +// if(GlobalVariable.ConfigParaBuffer.EWTracingAccuracy >= 0.98 +// && GlobalVariable.ConfigParaBuffer.EWTracingAccuracy <= 5.1) +// { +// Log_AddParamChange(403, *value, (unsigned short )(GlobalVariable.ConfigPara.EWTracingAccuracy * 100)); +// GlobalVariable.ConfigPara.EWTracingAccuracy = GlobalVariable.ConfigParaBuffer.EWTracingAccuracy; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWHeatEnable_S() + Description : RWHeatEnable_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屽姞???浣胯兘 +*************************************************/ +static int8_t RWHeatEnable_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.HeatEnable, *value ); +// if((*value == 0) || (*value == 1)) +// { +// Log_AddParamChange(404, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.HeatEnable))); +// GlobalVariable.ConfigPara.HeatEnable =(unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWMotorOrientation_S() + Description : RWMotorOrientation_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岀數鏈烘湞??? +*************************************************/ +static int8_t RWMotorOrientation_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.MotorOrientation; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value == 0 || *value == 1) //0锛氱數鏈烘湞涓滐紱 1锛氱數鏈烘湞??? +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOrientation, *value ); +// Log_AddParamChange(405, *value, GlobalVariable.ConfigPara.MotorOrientation); +// GlobalVariable.ConfigPara.MotorOrientation = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWProtectCurrent_S() + Description : RWProtectCurrent_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岀數鏈烘湞??? +*************************************************/ +static int8_t RWProtectCurrent_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (unsigned short) (GlobalVariable.ConfigPara.MotorOverCurrentValue * 100); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue = ((*value) * 0.01); +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.MotorOverCurrentValue, GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue ); +// +// if( (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue > 0.19f) && +// (GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue < 20.1f ) ) //???6.1鏀惧ぇ???20.1闄愬埗 +// { +// Log_AddParamChange(406, *value, (unsigned short) (GlobalVariable.ConfigPara.MotorOverCurrentValue * 100)); +// GlobalVariable.ConfigPara.MotorOverCurrentValue = GlobalVariable.ConfigParaBuffer.MotorOverCurrentValue; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWPVModuleWidth_S() + Description : RWPVModuleWidth_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岀粍浠???搴 +*************************************************/ +static int8_t RWPVModuleWidth_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.PVModuleWidth * 100; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.PVModuleWidth = (*value) * 0.01; +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.PVModuleWidth, GlobalVariable.ConfigParaBuffer.PVModuleWidth ); +// if((GlobalVariable.ConfigParaBuffer.PVModuleWidth >= 0.2) && (GlobalVariable.ConfigParaBuffer.PVModuleWidth <= 20.0) ) +// { +// Log_AddParamChange(407, *value, GlobalVariable.ConfigPara.PVModuleWidth * 100); +// GlobalVariable.ConfigPara.PVModuleWidth = GlobalVariable.ConfigParaBuffer.PVModuleWidth; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWPostSpacing_S() + Description : RWPostSpacing_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岀珛鏌遍棿??? +*************************************************/ +static int8_t RWPostSpacing_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.PostSpacing * 100; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.PostSpacing = (*value) * 0.01; +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.PostSpacing, GlobalVariable.ConfigParaBuffer.PostSpacing ); +// if((GlobalVariable.ConfigParaBuffer.PostSpacing >= GlobalVariable.ConfigPara.PVModuleWidth) &&( GlobalVariable.ConfigParaBuffer.PostSpacing <= 50.0) ) +// { +// Log_AddParamChange(408, *value, GlobalVariable.ConfigPara.PostSpacing * 100); +// GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigParaBuffer.PostSpacing; +// } +// else +// { +// Log_AddParamChange(408, (GlobalVariable.ConfigPara.PVModuleWidth - 0.1)*100, GlobalVariable.ConfigPara.PostSpacing * 100); +// GlobalVariable.ConfigPara.PostSpacing = GlobalVariable.ConfigPara.PVModuleWidth - 0.1; +// } +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTerrainSlope1_S() + Description : RWTerrainSlope1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屼笂鍧″害1 +*************************************************/ +static int8_t RWTerrainSlope1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (signed short)GlobalVariable.ConfigPara.TerrainSlope * 100; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.TerrainSlope = ((signed short)(*value)) * 0.01; +// if(GlobalVariable.ConfigParaBuffer.TerrainSlope >= -45.0f +// && GlobalVariable.ConfigParaBuffer.TerrainSlope <= 45.0f) +// { +// Log_AddParamChange(409, *value, GlobalVariable.ConfigPara.TerrainSlope * 100); +// GlobalVariable.ConfigPara.TerrainSlope = GlobalVariable.ConfigParaBuffer.TerrainSlope; +// +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTerrainSlopeEvening1_S() + Description : RWTerrainSlopeEvening1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屼笅鍧″害1 +*************************************************/ +static int8_t RWTerrainSlopeEvening1_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening = ((signed short)(*value)) * 0.01; +// if(GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening >= -45.0f +// && GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening <= 45.0f) +// { +// Log_AddParamChange(410, *value, (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100)); +// GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigParaBuffer.TerrainSlopeEvening; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// else +// { +// Log_AddParamChange(410, (signed short)(GlobalVariable.ConfigPara.TerrainSlope*100), (signed short)(GlobalVariable.ConfigPara.TerrainSlopeEvening*100)); +// GlobalVariable.ConfigPara.TerrainSlopeEvening = GlobalVariable.ConfigPara.TerrainSlope; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTerrainSlope2_S() + Description : RWTerrainSlope2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屼笂鍧″害2 +*************************************************/ +static int8_t RWTerrainSlope2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWTerrainSlopeEvening2_S() + Description : RWTerrainSlopeEvening2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屼笅鍧″害2 +*************************************************/ +static int8_t RWTerrainSlopeEvening2_S(unsigned char R_or_RW, unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWSouthNorthShiftAngle1_S() + Description : RWSouthNorthShiftAngle1_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屽崡鍖楀悜鍋忕Щ瑙掑害1 +*************************************************/ +static int8_t RWSouthNorthShiftAngle1_S(unsigned char R_or_RW, unsigned short *value) +{ + short temp; + + if(R_or_RW == 0) + { + *value = *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// temp = (signed short )(*value); +// if( abs(temp) <= MAXABS_SOUTHNORTHSHIFTANGLE_PLUS100 ) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.SouthNorthShiftAngle, *value ); +// Log_AddParamChange(413, *value, *((( short *)&GlobalVariable.ConfigPara.SouthNorthShiftAngle))); +// GlobalVariable.ConfigPara.SouthNorthShiftAngle = temp; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWSouthNorthShiftAngle2_S() + Description : RWSouthNorthShiftAngle2_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屽崡鍖楀悜鍋忕Щ瑙掑害2 +*************************************************/ +static int8_t RWSouthNorthShiftAngle2_S(unsigned char R_or_RW,unsigned short *value) +{ + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWEWSoftLimitAngle_S() + Description : RWEWSoftLimitAngle_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屼笢瑗胯蒋闄愪綅瑙掑害锛岄珮瀛楄妭锛氫笢闄愪綅锛涗綆瀛楄妭:瑗块檺??? +*************************************************/ +static int8_t RWEWSoftLimitAngle_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle ); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// GlobalVariable.ConfigParaBuffer.ESoftLimitAngle = ((*value) >> 8) * 1.00; //???8??? +// GlobalVariable.ConfigParaBuffer.WSoftLimitAngle = (*value & 0xFF) * 1.00; //???8??? + +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.ESoftLimitAngle, GlobalVariable.ConfigParaBuffer.ESoftLimitAngle ); +// if(GlobalVariable.ConfigParaBuffer.ESoftLimitAngle >= 29.9 ) +// { +// Log_AddParamChange(415, *value, (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle )); +// GlobalVariable.ConfigPara.ESoftLimitAngle = GlobalVariable.ConfigParaBuffer.ESoftLimitAngle; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// +// if ( GlobalVariable.ConfigParaBuffer.WSoftLimitAngle <= 150.1) +// { +// Log_AddParamChange(415, *value, (((unsigned short)GlobalVariable.ConfigPara.ESoftLimitAngle) << 8 ) | ((unsigned short)GlobalVariable.ConfigPara.WSoftLimitAngle )); +// GlobalVariable.ConfigPara.WSoftLimitAngle = GlobalVariable.ConfigParaBuffer.WSoftLimitAngle; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWCleaningDockAngle_S() + Description : RWCleaningDockAngle_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屾竻娲???搴 +*************************************************/ +static int8_t RWCleaningDockAngle_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.CleaningDockAngle; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value >= 30 && *value <= 150) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.CleaningDockAngle, *value ); +// Log_AddParamChange(416, *value, GlobalVariable.ConfigPara.CleaningDockAngle); +// GlobalVariable.ConfigPara.CleaningDockAngle = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBackAngle_S() + Description : RWBackAngle_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛???杩旇搴 +*************************************************/ +static int8_t RWBackAngle_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value >= 59.9 && *value <= 120.1) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.BackAngle, *value ); +// Log_AddParamChange(417, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.BackAngle)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWNoComEnable_S() + Description : RWNoComEnable_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屾棤閫???浣胯兘 +*************************************************/ +static int8_t RWNoComEnable_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.NoComEnable; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if( (*value == 0) ||(*value == 1) ) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.NoComEnable, *value ); +// Log_AddParamChange(418, *value, GlobalVariable.ConfigPara.NoComEnable); +// GlobalVariable.ConfigPara.NoComEnable = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWUpWindSpeed_S() + Description : RWUpWindSpeed_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屽ぇ椋庝繚鎶ゅ惎???????? +*************************************************/ +static int8_t RWUpWindSpeed_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= 40) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpWindSpeed, *value ); +// Log_AddParamChange(419, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.UpWindSpeed)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWUpStartTime_S() + Description : RWUpStartTime_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛屽ぇ椋庝繚鎶ゅ惎鍔ㄦ椂??? +*************************************************/ +static int8_t RWUpStartTime_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= 1000) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.UpStartTime, *value ); +// Log_AddParamChange(420, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.UpStartTime)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWLowWindSpeed_S() + Description : RWLowWindSpeed_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岄鍑哄ぇ椋庝繚鎶????? +*************************************************/ +static int8_t RWLowWindSpeed_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= (GlobalVariable.ConfigPara.UpWindSpeed - 1)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, *value ); +// Log_AddParamChange(421, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = *value; +// } +// else +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowWindSpeed, GlobalVariable.ConfigPara.UpWindSpeed - 1 ); +// Log_AddParamChange(421, GlobalVariable.ConfigPara.UpWindSpeed - 1, *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowWindSpeed)) = GlobalVariable.ConfigPara.UpWindSpeed - 1; +// } +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWLowStopTime_S() + Description : RWLowStopTime_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岄鍑哄ぇ椋庝繚鎶ゆ椂??? +*************************************************/ +static int8_t RWLowStopTime_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)); + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if(*value <= 1000) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.LowStopTime, *value ); +// Log_AddParamChange(422, *value, *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime))); +// *(((unsigned short *)&GlobalVariable.ConfigPara.LowStopTime)) = *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWFacingWindStopFunction_Enable_S() + Description : RWFacingWindStopFunction_Enable_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???锛岃繋椋庡仠闈犱娇??? +*************************************************/ +static int8_t RWFacingWindStopFunction_Enable_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.FacingWindStopFunction_Enable; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if((*value == 0) || (*value == 1 )) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.FacingWindStopFunction_Enable, *value ); +// Log_AddParamChange(423, *value, GlobalVariable.ConfigPara.FacingWindStopFunction_Enable); +// GlobalVariable.ConfigPara.FacingWindStopFunction_Enable = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWEWFacingWindAngle_S() + Description : RWEWFacingWindAngle_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.28 + Additional Comments : 绮剧畝鍗???,涓滆タ杩???鍋滈潬???搴︼紝楂樺瓧鑺傦細涓滆繋???鍋滈潬???锛涗綆瀛楄妭锛氳タ杩庨鍋滈潬??? +*************************************************/ +static int8_t RWEWFacingWindAngle_S(unsigned char R_or_RW, unsigned short *value) +{ + unsigned short E_TempAngle, W_TempAngle; + if(R_or_RW == 0) + { + *value = (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle ; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// E_TempAngle = ((*value) >> 8); //涓滆繋椋???搴﹀彇楂8??? +// W_TempAngle = ((*value) & 0xFF); //瑗胯繋椋???搴﹀幓浣8??? + +// +// if((E_TempAngle >= 30) && (E_TempAngle <= 150) ) +// { +// Log_AddParamChange(424, *value, (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle); +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.EFacingWindAngle, E_TempAngle ); +// *(((unsigned short *)&GlobalVariable.ConfigPara.EFacingWindAngle)) = E_TempAngle; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// +// if((W_TempAngle >= 30) && (W_TempAngle <= 150) ) +// { +// Log_AddParamChange(424, *value, (GlobalVariable.ConfigPara.EFacingWindAngle << 8) | GlobalVariable.ConfigPara.WFacingWindAngle); +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.WFacingWindAngle, W_TempAngle ); +// *(((unsigned short *)&GlobalVariable.ConfigPara.WFacingWindAngle)) = W_TempAngle; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBatteryLowTriggerValue_S() + Description : Battery Low Trigger Value_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.29 + Additional Comments : +*************************************************/ +static int8_t RWBatteryLowTriggerValue_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Low_TriggerValue; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if((*value >= 1800) && (*value <= 2940)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_TriggerValue, *value ); +// Log_AddParamChange(425, *value, GlobalVariable.ConfigPara.Battery_Low_TriggerValue); +// GlobalVariable.ConfigPara.Battery_Low_TriggerValue = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryLowRecoveryValue_S() + Description : RWBatteryLowRecoveryValue_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.29 + Additional Comments : +*************************************************/ +static int8_t RWBatteryLowRecoveryValue_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Low_RecoveryValue; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if((*value >= 1800) && (*value <= 2940)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Low_RecoveryValue, *value ); +// Log_AddParamChange(426, *value, GlobalVariable.ConfigPara.Battery_Low_RecoveryValue); +// GlobalVariable.ConfigPara.Battery_Low_RecoveryValue = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBatteryEmptyTriggerValue_S() + Description : Battery Empty Trigger Value_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.29 + Additional Comments : +*************************************************/ +static int8_t RWBatteryEmptyTriggerValue_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Empty_TriggerValue; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if((*value >= 1800) && (*value <= 2940)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_TriggerValue, *value ); +// Log_AddParamChange(427, *value, GlobalVariable.ConfigPara.Battery_Empty_TriggerValue); +// GlobalVariable.ConfigPara.Battery_Empty_TriggerValue = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} + +/************************************************* + Function : RWBatteryEmptyRecoveryValue_S() + Description : Battery Empty Recovery Value_S + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.06.29 + Additional Comments : +*************************************************/ +static int8_t RWBatteryEmptyRecoveryValue_S(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// if((*value >= 1800) && (*value <= 2940)) +// { +// //LogOperation_ParameterChange( GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue, *value ); +// Log_AddParamChange(428, *value, GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue); +// GlobalVariable.ConfigPara.Battery_Empty_RecoveryValue = (unsigned short) *value; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} +/************************************************* + Function : RWBatteryHighTemperatureProtection_TriggerValue() + Description : RWBatteryHighTemperatureProtection_TriggerValue + Input : null + Output : null + Return : null + Engineer : Huruihong + Revision : V0.0 + Modified Date : 2023.05.03 + Additional Comments : porting by longcd +*************************************************/ +static int8_t RWBatteryHighTemperatureProtection_Value_S(unsigned char R_or_RW, unsigned short *value) +{ + unsigned short TriggerValue_Temp, ExitValue_Temp; + + if(R_or_RW == 0) + { + *value = (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// TriggerValue_Temp = (*value >> 8); +// ExitValue_Temp = (*value & 0xFF); +// // LogOperation_ParameterChange( GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue, *value ); +// if( (TriggerValue_Temp >= 25) && (TriggerValue_Temp <= 80) ) +// { +// Log_AddParamChange(429, *value, (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); +// GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue = TriggerValue_Temp; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// +// } +// +// if( (ExitValue_Temp >= 25) && (ExitValue_Temp <= 80) ) +// { +// Log_AddParamChange(429, *value, (GlobalVariable.ConfigPara.BatteryHighTempProtectTriggerValue << 8) | GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue); +// GlobalVariable.ConfigPara.BatteryHighTempProtectExitValue = ExitValue_Temp; +// GlobalVariable.WriteFlag.ConfigParaWrite = 1; +// } +// } + return AS_CB_ERR_INVALID; +} + +/************************************************* +*************************************************/ +extern void SetCtrlCmd_QueryLora(void); +static int8_t RWLoraHardwareStatus(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.SpecialCheck.LoraHardwareStatus; + return AS_CB_OK; + } + else if(R_or_RW == 1) + { + SetCtrlCmd_QueryLora(); + } + return AS_CB_ERR_INVALID; +} +/************************************************* +瀛愭澘鐢垫祦CH1,CH2 +*************************************************/ +static int8_t RWVoutCurrentCh1(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.SpecialCheck.VoutCurrentCh1; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// } + return AS_CB_ERR_INVALID; +} +static int8_t RWVoutCurrentCh2(unsigned char R_or_RW, unsigned short *value) +{ + if(R_or_RW == 0) + { + *value = GlobalVariable.SpecialCheck.VoutCurrentCh2; + return AS_CB_OK; + } +// else if(R_or_RW == 1) +// { +// } + return AS_CB_ERR_INVALID; +} + +/*************************************************************************************************** + Jump table +***************************************************************************************************/ +void ASProtocolInit() +{ + RWRegister[0] = RDeviceEdition; + RWRegister[1] = RWWorkMode1; + RWRegister[2] = RWWorkMode2; + RWRegister[3] = RWarningAndFault1; + RWRegister[4] = RWarningAndFault2; + RWRegister[5] = RDeviceType; + RWRegister[6] = RWChannelEnable1; + RWRegister[7] = RElevationAngle1; + RWRegister[8] = RElevationAngle2; + RWRegister[9] = RAzimuthAngle1; + RWRegister[10] = RAzimuthAngle2; + + if ( GlobalVariable.ConfigPara.isMasterController ==NO)//浠庢満 + { + RWRegister[11] = RTargetAngle1; + RWRegister[12] = RTargetAngle2; + } + + if ( GlobalVariable.ConfigPara.isMasterController == YES)//涓绘満 + { + RWRegister[11] = RTargetAngle; + RWRegister[12] = RRealAngle; //Motor0瀹為檯瑙掑害 + } + + + + + RWRegister[13] = RRealAngle1; + RWRegister[14] = RRealAngle2; + RWRegister[15] = RRealAngle3; + RWRegister[16] = RRealAngle4; + RWRegister[17] = RRealAngle5; + RWRegister[18] = RRealAngle6; + + RWRegister[19] = ReadUIRightPanelMasterSlaveAlarmsHighPart2; + RWRegister[20] = ReadUIRightPanelMasterSlaveAlarmsLowPart2; + RWRegister[21] = ReadUIRightPanelMasterSlaveAlarmsHighPart3; + RWRegister[22] = ReadUIRightPanelMasterSlaveAlarmsLowPart3; + + RWRegister[23] = RWTimeYear; + RWRegister[24] = RWTimeMonth; + RWRegister[25] = RWTimeDay; + RWRegister[26] = RWTimeHour; + RWRegister[27] = RWTimeMinute; + RWRegister[28] = RWTimeSecond; + //RWRegister[29] = RProtocol_Version;//RWChannelEnable; + RWRegister[29] = RWChannelEnable2;//; + + RWRegister[31] = RWRemoteWindDirect; + RWRegister[33] = RWRemoteWindSpeed; + RWRegister[34] = RWAIRemoteTarget; + + RWRegister[35] = RMotorCurrent3;//浠庢満锛歁otor3 current + RWRegister[36] = RMotorCurrent4; + RWRegister[37] = RMotorCurrent5; + RWRegister[38] = RMotorCurrent6; + RWRegister[39] = RTemp; + RWRegister[40] = RMotorCurrent; + RWRegister[41] = RMotorCurrent1; + RWRegister[42] = RMotorCurrent2; + // RWRegister[41] = RWLogEnable; //log enable +// RWRegister[42] = RWPIDTarget; //pdi target + RWRegister[43] = RWProtectCurrent1; + RWRegister[44] = RWProtectCurrent2; + RWRegister[45] = RWLongitude1; + RWRegister[46] = RWLongitude2; + RWRegister[47] = RWLatitude1; + RWRegister[48] = RWLatitude2; + RWRegister[49] = RWTimeZone1; + RWRegister[50] = RWTimeZone2; + RWRegister[51] = RWEWTracingAccuracy1; + RWRegister[52] = RWEWTracingAccuracy2; + RWRegister[REG_BATTERY_LOW_TRIGGER_VALUE] = RWBatteryLowTriggerValue; //Battery Low Trigger Value + RWRegister[REG_BATTERY_LOW_RECORERY_VALUE] = RWBatteryLowRecoveryValue; //Battery Low Recovery Value + RWRegister[55] = RPVBuckerVoltage; + RWRegister[56] = RBatState; + RWRegister[57] = RBatSOCTemp; + RWRegister[58] = RBatVoltage; + RWRegister[59] = RBatCurrent; + RWRegister[REG_BATTERY_EMPTY_TRIGGER_VALUE] = RWBatteryEmptyTriggerValue; //Battery Empty Trigger Value; + + + + + RWRegister[76] = RWWeaherState; //澶╂皵鎸囦护 + + +// RWRegister[61] = RWMotorOverCurrentValueG1; +// RWRegister[62] = RWMotorOverCurrentTimeG1; +// RWRegister[63] = RWMotorOverCurrentValueG2; +// RWRegister[64] = RWMotorOverCurrentTimeG2; +// RWRegister[65] = RWMotorOverCurrentValueG3; +// RWRegister[66] = RWMotorOverCurrentTimeG3; +// RWRegister[67] = RWMotorOverCurrentValueG4; +// RWRegister[68] = RWMotorOverCurrentTimeG4; +// RWRegister[69] = RWMotorOverCurrentValueG5; +// RWRegister[70] = RWMotorOverCurrentTimeG5; +// RWRegister[71] = RWMotorOverCurrentValueG6; +// RWRegister[72] = RWMotorOverCurrentTimeG6; +// RWRegister[73] = RWMotorOverCurrentValueG7; +// RWRegister[74] = RWMotorOverCurrentTimeG7; +// RWRegister[75] = RWMotorOverCurrentValueG8; +// RWRegister[76] = RWMotorOverCurrentTimeG8; +// RWRegister[77] = RWMotorOverCurrentValueG9; +// RWRegister[78] = RWMotorOverCurrentTimeG9; +// RWRegister[79] = RWMotorOverCurrentValueG10; +// RWRegister[80] = RWMotorOverCurrentTimeG10; + + + + + + RWRegister[81] = RWComID; + RWRegister[82] = RWPowerMode; +// RWRegister[83] = RWPIDKP; //PID KP + RWRegister[84] = RWCleaningDockAngle; + RWRegister[85] = RWMotorOrientation; + RWRegister[86] = RVersion1; + RWRegister[87] = RVersion2; + RWRegister[88] = RWRS485Enable; + RWRegister[89] = RWPVModuleWidth1; + RWRegister[90] = RWPVModuleWidth2; + RWRegister[91] = RWPostSpacing1; + RWRegister[92] = RWPostSpacing2; + RWRegister[93] = RWTerrainSlope1; + RWRegister[94] = RWTerrainSlope2; + RWRegister[95] = RWTerrainSlopeEvening; + RWRegister[REG_BATTERY_EMPTY_RECORERY_VALUE ] = RWBatteryEmptyRecoveryValue; //Battery Empty Recovery Value + + RWRegister[98] = RWNoComEnable; + RWRegister[99] = RWUpWindSpeed; + RWRegister[100] = RWUpStartTime; + RWRegister[101] = RWLowWindSpeed; + RWRegister[102] = RWLowStopTime; + + RWRegister[103] = RWESoftLimitAngle1; + RWRegister[104] = RWESoftLimitAngle2; + RWRegister[105] = RWWSoftLimitAngle1; + RWRegister[106] = RWWSoftLimitAngle2; + + RWRegister[107] = RWHeatEnable; //Heat +// RWRegister[108] = RWPIDKI; //PID KI +// RWRegister[109] = RWPIDKD; //PID KD +// RWRegister[110] = RWPIDSlope; //PID Slope + + RWRegister[111] = RWBackAngle; +// RWRegister[112] = RWEWindProtectionAngle; +// RWRegister[113] = RWWWindProtectionAngle; + RWRegister[112] = RWComID2; + RWRegister[113] = RWComID3; + + //RWRegister[114] = RWInstallPostion; //no define + RWRegister[115] = RWSouthNorthShiftAngle; + RWRegister[116] = RWFacingWindStopFunction_Enable; + RWRegister[117] = RWEFacingWindAngle; + RWRegister[118] = RWWFacingWindAngle; + + //porting by longcd + RWRegister[REG_BATTERY_HIGHTEMPPRO_TRIGGER_VALUE] = RWBatteryHighTemperatureProtection_TriggerValue; //120:????????, + RWRegister[REG_BATTERY_HIGHTEMPPRO_EXIT_VALUE] = RWBatteryHighTemperatureProtection_ExitValue; //121:?????????????????,??????,???????? + + RWRegister[REG_BATSOCLOWRUNBACK_WAITTIME] = RWBatSocLowRunBackWaitTime; //125 + + RWRegister[REG_LOSTCOMM_BATSOCLOW_TARGET_ANGLE] = RWLostComm_BatsocLow_TargetAngle; //139 + + + RWRegister[REG_RCOMM_TEST_CRCERR] = RCommuTestCrcErr;//181 + RWRegister[REG_RCOMM_TEST_CRCOK] = RCommuTestCrcOk; + RWRegister[REG_RCOMM_TEST_REPLAY] = RCommuTestReply; + RWRegister[REG_RWCOMM_TEST_CLEARALL] = RWCommuTestClearAll; //184 + //RWRegister[186] = RWModbusBusyCnt; //闃垮竷鎵庢瘮 + RWRegister[187] = RCommuTest_RecvID_Tracker_CrcOK; + RWRegister[188] = RCommuTest_RecvID_Tracker_Reply; + RWRegister[189] = RCommuTest_RecvID_Tracker_CrcErr; + RWRegister[190] = RCommuTest_RecvID_00_CrcOK; + RWRegister[191] = RCommuTest_RecvID_00_CrcErr; + + + RWRegister[131] = RWComID4; // + RWRegister[132] = RWComID5; + + RWRegister[REG_STOP_ALL_SLAVEMOTOR] = RWStopAllSlaveMotor; + RWRegister[REG_SET_CONTROLER_ROLE] = RWEnableMasterController;//149 + RWRegister[REG_SUBSLAVE_COUNT] = RWsubSlaveCount;// + RWRegister[REG_SUBSLAVE_POWER_SUPPLY_ENABLE] = RWsubSlavePowerSupplyEnable; + RWRegister[REG_STATIC_DIFF_ANGLE] = RWStaticDiffAngle;// + RWRegister[REG_MOVE_DIFF_ANGLE] = RWMoveDiffAngle;// + + + + RWRegister[199] = RWYBTLoraParaEnable; + RWRegister[200] = RWManufactor; + RWRegister[201] = RWDeviceIDH; + RWRegister[202] = RWDeviceIDL; + RWRegister[203] = RWDeviceNetID; + + RWRegister[204] = RWYBTadd3; + RWRegister[205] = RWYBTadd4; + RWRegister[206] = RWYBTChannel; + RWRegister[207] = RWYBTadd6; + RWRegister[208] = RWYBTkeyH; + RWRegister[209] = RWYBTkeyL; + + RWRegister[210] = RWJXYLbaudrate; + RWRegister[211] = RWJXYLparity; + RWRegister[212] = RWJXYLfq1; + RWRegister[213] = RWJXYLfq2; + RWRegister[214] = RWJXYLfq3; + RWRegister[215] = RWJXYLfactor; + RWRegister[216] = RWJXYLmode; + RWRegister[217] = RWJXYLbw; + RWRegister[218] = RWJXYLpower; + + + //璇诲彇Bluetooth妯″潡鍙傛暟鐨勬寚?? + RWRegister[REG_YBT_BLUETOOTH_MAC_EN] = RWYBTBluetoothParaEnable; + RWRegister[221] = RBluetoothMACPara1; + RWRegister[222] = RBluetoothMACPara2; + RWRegister[223] = RBluetoothMACPara3; + RWRegister[224] = RBluetoothMACPara4; + RWRegister[225] = RBluetoothMACPara5; + RWRegister[226] = RBluetoothMACPara6; + + RWRegister[300] = RProtocol_Version_S; + RWRegister[301] = RDeviceType_S; //璁???绫??? + RWRegister[302] = RDeviceEdition_S; //澶х増?????? + RWRegister[303] = RVersion1_S; //灏忕増??????1 + RWRegister[304] = RVersion2_S; //灏忕増??????2 + RWRegister[305] = RPVBuckerVoltage_S; //PV缁勪欢鐢靛帇 (涓庢棫鍗???鏀惧ぇ鍊嶆暟涓嶄竴???) + RWRegister[306] = RBatVoltage_S; //鐢垫睜鐢靛帇 (涓庢棫鍗???鏀惧ぇ鍊嶆暟涓嶄竴???) + RWRegister[307] = RBatSOCTemp_S;//鐢垫睜鐢甸噺/鐢垫睜娓╁害 + RWRegister[308] = RTemp_S;//涓绘澘娓╁害 + RWRegister[309] = RBatState_BatCurrent_S; //鍏呯數鐘舵併佸厖鐢电數??? + RWRegister[310] = RWWorkMode1_S;//宸ヤ綔妯″紡1 + RWRegister[311] = RWarningAndFault1_1_S;//寮傚父淇℃伅1鈥??1 + RWRegister[312] = RWarningAndFault1_2_S;//寮傚父淇℃伅1-2 + RWRegister[313] = RMotorCurrent1_S; //鐢垫満鐢垫祦1 + RWRegister[314] = RTargetAngle1_S;//???鏍???搴1 + RWRegister[315] = RRealAngle1_S;//???鏍???搴1 + //316-321锛???鐢 + RWRegister[316] = RWWorkMode2_S;//宸ヤ綔妯″紡2 + RWRegister[317] = RWarningAndFault2_1_S;//寮傚父淇℃伅2鈥??1 + RWRegister[318] = RWarningAndFault2_2_S;//寮傚父淇℃伅2-2 + RWRegister[319] = RMotorCurrent2_S; //鐢垫満鐢垫祦2 + RWRegister[320] = RTargetAngle2_S;//???鏍???搴2 + RWRegister[321] = RRealAngle2_S;//???鏍???搴2 + + //涓庨???绠辩浉鍏虫柊澧炲崗???璇峰湪姝ゅ尯鍩???鍔???322-384 + + //閫???绠便佷笂浣嶆満璇诲啓:384-396 + RWRegister[384] = RWAIRemoteTarget1_S;//杩滅▼???鏍???搴1 + RWRegister[385] = RWAIRemoteTarget2_S;//杩滅▼???鏍???搴2,澶囩敤 + RWRegister[386] = RWRemoteWindSpeed_S;//杩滅▼椋?? + RWRegister[387] = RWRemoteWindDirect_S;//杩滅▼椋庡悜 + + RWRegister[388] = RWTimeYearMonth_S;//骞存湀 + RWRegister[389] = RWTimeDayHour_S;//鏃ユ椂 + RWRegister[390] = RWTimeMinuteSecond_S;//鍒??? + RWRegister[391] = RWLongitude1_S;//缁忓害 + RWRegister[392] = RWLongitude2_S;//缁忓害 + RWRegister[393] = RWLatitude1_S;//?????? + RWRegister[394] = RWLatitude2_S;//?????? + RWRegister[395] = RWTimeZone1_S;//鏃跺尯 + RWRegister[396] = RWTimeZone2_S;//鏃跺尯 + + RWRegister[397] = RElevationAngle1_S; //楂樺害???1 + RWRegister[398] = RAzimuthAngle1_S; //鏂逛綅???1 + + RWRegister[399] = RElevationAngle2_S;//楂樺害???2锛???鐢 + RWRegister[400] = RAzimuthAngle2_S;//鏂逛綅???2锛???鐢 + + //鎺у埗鍣ㄥ唴閮ㄥ弬鏁帮紝涓婁綅鏈???鍐 + RWRegister[401] = RWComID_S; //鎺у埗鍣↖D + RWRegister[402] = RWChannelSelect_S; //閫氶亾閫夋嫨锛屼繚??? + RWRegister[403] = RWEWTracingAccuracy_S;//璺熻釜绮惧害 + RWRegister[404] = RWHeatEnable_S;//鍔犵儹浣胯兘 + RWRegister[405] = RWMotorOrientation_S;//鐢垫満鏈濆悜 + RWRegister[406] = RWProtectCurrent_S;//淇濇姢鐢垫祦 + + RWRegister[407] = RWPVModuleWidth_S;//缁勪欢瀹藉害 + RWRegister[408] = RWPostSpacing_S;//绔嬫煴闂磋窛 + RWRegister[409] = RWTerrainSlope1_S;//涓婂潯???1 + RWRegister[410] = RWTerrainSlopeEvening1_S;//涓嬪潯???1 + RWRegister[411] = RWTerrainSlope2_S;//涓婂潯???2 + RWRegister[412] = RWTerrainSlopeEvening2_S;//涓嬪潯???2 + + RWRegister[413] = RWSouthNorthShiftAngle1_S;//鍗楀寳鍚戝亸绉???搴1 + RWRegister[414] = RWSouthNorthShiftAngle2_S;//鍗楀寳鍚戝亸绉???搴2 + RWRegister[415] = RWEWSoftLimitAngle_S;//涓滆タ???闄愪綅 + RWRegister[416] = RWCleaningDockAngle_S;//娓呮礂瑙掑害 + RWRegister[417] = RWBackAngle_S;//澶滆繑瑙掑害 + RWRegister[418] = RWNoComEnable_S;//鏃犻???浣胯兘 + RWRegister[419] = RWUpWindSpeed_S;//杩涘叆澶???淇濇姢????? + RWRegister[420] = RWUpStartTime_S;//杩涘叆澶???淇濇姢鏃??? + RWRegister[421] = RWLowWindSpeed_S;//閫鍑哄ぇ椋庝繚鎶????? + RWRegister[422] = RWLowStopTime_S;//閫鍑哄ぇ椋庝繚鎶ゆ椂??? + RWRegister[423] = RWFacingWindStopFunction_Enable_S;//杩???鍋滈潬鍔熻兘浣??? + RWRegister[424] = RWEWFacingWindAngle_S;//涓滆タ杩???鍋滈潬???搴 + + RWRegister[425] = RWBatteryLowTriggerValue_S; //Battery Low Trigger Value + RWRegister[426] = RWBatteryLowRecoveryValue_S; //Battery Low Recovery Value + RWRegister[427] = RWBatteryEmptyTriggerValue_S; //Battery Empty Trigger Value; + RWRegister[428] = RWBatteryEmptyRecoveryValue_S; //Battery Empty Recovery Value + + RWRegister[429] = RWBatteryHighTemperatureProtection_Value_S; //楂樻俯淇濇姢闃堝硷細楂樺瓧鑺傦細???鍔ㄩ槇鍊硷紱浣庡瓧鑺傦細閫鍑洪槇??? + + RWRegister[431] = RWLoraHardwareStatus; + RWRegister[432] = RWVoutCurrentCh1; + RWRegister[433] = RWVoutCurrentCh2; + + + +} + +void ASQProtocolInit() +{ + RWRegisterQ[0] = RWWorkMode2; + RWRegisterQ[1] = RTargetAngle; + RWRegisterQ[2] = RRealAngle; + RWRegisterQ[3] = RWarningAndFault1; + RWRegisterQ[4] = RWarningAndFault2; + +} + +void ASLProtocolInit() +{ + RWRegisterL[0] = RResetCount1; //Reset count + RWRegisterL[1] = RResetCount2; + RWRegisterL[2] = RWLogWarningSum; //log warning sum + RWRegisterL[3] = RWAskWarningNo; //log warning No + RWRegisterL[4] = RWLogOperationSum; //log operation sum + RWRegisterL[5] = RWAskOperationNo; //log operation No + RWRegisterL[6] = (void *)0; // + RWRegisterL[7] = (void *)0; // + RWRegisterL[8] = (void *)0; // + RWRegisterL[9] = RWLogReadNum; //log璇诲彇搴忓彿 +} + + + + + + + + +//baseAddr = 20,000; +void ASSlaveProtocolInit(void) +{ + //浠庢満鎶???淇??? n*5+0:鎶???淇???1-1 n*5+1:鎶???淇???1-2 n*5+2:鐢垫満瀹為檯瑙掑害1 n*5+3:鐢垫満瀹為檯瑙掑害2 n*5+4:鐢垫満瀹為檯瑙掑害3 + RWRegisterSlave[0*5+0] = RWWarningAndFaultOfSlave_1;//浠庢満1鐨勬姤璀︿俊??? + RWRegisterSlave[0*5+1] = RRealAngle1;//浠庢満1瀹為檯瑙掑害 + RWRegisterSlave[0*5+2] = RMotorCurrent1;//浠庢満1鐢垫満鐢垫祦 + + RWRegisterSlave[1*5+0] = RWWarningAndFaultOfSlave_2; + RWRegisterSlave[1*5+1] = RRealAngle2; //浠庢満2瀹為檯瑙掑害 + RWRegisterSlave[1*5+2] = RMotorCurrent2; //浠庢満2鐢垫満鐢垫祦 + + RWRegisterSlave[2*5+0] = RWWarningAndFaultOfSlave_3; + RWRegisterSlave[2*5+1] = RRealAngle3; //浠庢満3瀹為檯瑙掑害 + RWRegisterSlave[2*5+2] = RMotorCurrent3; //浠庢満3鐢垫満鐢垫祦 + + RWRegisterSlave[3*5+0] = RWWarningAndFaultOfSlave_4; + RWRegisterSlave[3*5+1] = RRealAngle4; //浠庢満4瀹為檯瑙掑害 + RWRegisterSlave[3*5+2] = RMotorCurrent4; //浠庢満4鐢垫満鐢垫祦 + + RWRegisterSlave[4*5+0] = RWWarningAndFaultOfSlave_5; + RWRegisterSlave[4*5+1] = RRealAngle5; //浠庢満5瀹為檯瑙掑害 + RWRegisterSlave[4*5+2] = RMotorCurrent5; //浠庢満5鐢垫満鐢垫祦 + + RWRegisterSlave[5*5+0] = RWWarningAndFaultOfSlave_6; + RWRegisterSlave[5*5+1] = RRealAngle6; //浠庢満6瀹為檯瑙掑害 + RWRegisterSlave[5*5+2] = RMotorCurrent6; //浠庢満6鐢垫満鐢垫祦 + + RWRegisterSlave[6*5+0] = RWWarningAndFaultOfSlave_7; + RWRegisterSlave[6*5+1] = RRealAngle7; //浠庢満7瀹為檯瑙掑害 + RWRegisterSlave[6*5+2] = RMotorCurrent7; //浠庢満7鐢垫満鐢垫祦 + + RWRegisterSlave[7*5+0] = RWWarningAndFaultOfSlave_8; + RWRegisterSlave[7*5+1] = RRealAngle8; //浠庢満8瀹為檯瑙掑害 + RWRegisterSlave[7*5+2] = RMotorCurrent8; //浠庢満8鐢垫満鐢垫祦 + + RWRegisterSlave[8*5+0] = RWWarningAndFaultOfSlave_9; + RWRegisterSlave[8*5+1] = RRealAngle9; //浠庢満9瀹為檯瑙掑害 + RWRegisterSlave[8*5+2] = RMotorCurrent9; //浠庢満9鐢垫満鐢垫祦 + + RWRegisterSlave[9*5+0] = RWWarningAndFaultOfSlave_10; + RWRegisterSlave[9*5+1] = RRealAngle10; //浠庢満10瀹為檯瑙掑害 + RWRegisterSlave[9*5+2] = RMotorCurrent10; //浠庢満10鐢垫満鐢垫祦 + + RWRegisterSlave[10*5+0] = RWWarningAndFaultOfSlave_11; + RWRegisterSlave[10*5+1] = RRealAngle11; //浠庢満11瀹為檯瑙掑害 + RWRegisterSlave[10*5+2] = RMotorCurrent11; //浠庢満11鐢垫満鐢垫祦 + + RWRegisterSlave[11*5+0] = RWWarningAndFaultOfSlave_12; + RWRegisterSlave[11*5+1] = RRealAngle12; //浠庢満12瀹為檯瑙掑害 + RWRegisterSlave[11*5+2] = RMotorCurrent12; //浠庢満12鐢垫満鐢垫祦 + + RWRegisterSlave[12*5+0] = RWWarningAndFaultOfSlave_13; + RWRegisterSlave[12*5+1] = RRealAngle13; //浠庢満13瀹為檯瑙掑害 + RWRegisterSlave[12*5+2] = RMotorCurrent13; //浠庢満13鐢垫満鐢垫祦 + + RWRegisterSlave[13*5+0] = RWWarningAndFaultOfSlave_14; + RWRegisterSlave[13*5+1] = RRealAngle14; //浠庢満14瀹為檯瑙掑害 + RWRegisterSlave[13*5+2] = RMotorCurrent14; //浠庢満14鐢垫満鐢垫祦 + + RWRegisterSlave[14*5+0] = RWWarningAndFaultOfSlave_15; + RWRegisterSlave[14*5+1] = RRealAngle15; //浠庢満15瀹為檯瑙掑害 + RWRegisterSlave[14*5+2] = RMotorCurrent15; //浠庢満15鐢垫満鐢垫祦 + + RWRegisterSlave[15*5+0] = RWWarningAndFaultOfSlave_16; + RWRegisterSlave[15*5+1] = RRealAngle16; //浠庢満16瀹為檯瑙掑害 + RWRegisterSlave[15*5+2] = RMotorCurrent16; //浠庢満16鐢垫満鐢垫祦 + + RWRegisterSlave[16*5+0] = RWWarningAndFaultOfSlave_17; + RWRegisterSlave[16*5+1] = RRealAngle17; //浠庢満17瀹為檯瑙掑害 + RWRegisterSlave[16*5+2] = RMotorCurrent17; //浠庢満17鐢垫満鐢垫祦 + + RWRegisterSlave[17*5+0] = RWWarningAndFaultOfSlave_18; + RWRegisterSlave[17*5+1] = RRealAngle18; //浠庢満18瀹為檯瑙掑害 + RWRegisterSlave[17*5+2] = RMotorCurrent18; //浠庢満18鐢垫満鐢垫祦 + + RWRegisterSlave[18*5+0] = RWWarningAndFaultOfSlave_19; + RWRegisterSlave[18*5+1] = RRealAngle19; //浠庢満19瀹為檯瑙掑害 + RWRegisterSlave[18*5+2] = RMotorCurrent19; //浠庢満19鐢垫満鐢垫祦 + + RWRegisterSlave[19*5+0] = RWWarningAndFaultOfSlave_20; + RWRegisterSlave[19*5+1] = RRealAngle20; //浠庢満20瀹為檯瑙掑害 + RWRegisterSlave[19*5+2] = RMotorCurrent20; //浠庢満20鐢垫満鐢垫祦 + +} + +void *GetASProtocl() +{ + return RWRegister; +} +void *GetASQProtocl() +{ + return RWRegisterQ; +} +void *GetASLProtocl() +{ + return RWRegisterL; +} + +void *GetASSlaveProtocl() +{ + return RWRegisterSlave; +} + + + + +