将瞬时风速风向,极大极小添加进协议

This commit is contained in:
95384 2024-11-27 16:51:48 +08:00
parent 51e5b07b49
commit 4c91d4bf82
2 changed files with 129 additions and 73 deletions

View File

@ -24,15 +24,19 @@ typedef enum
{ {
FRT_REGISTER_MIN_WIND_DIRECTION = 0, /* 最小风向 */ FRT_REGISTER_MIN_WIND_DIRECTION = 0, /* 最小风向 */
FRT_REGISTER_AVERAGE_WIND_DIRECTION = 1, /* 平均风向 */ FRT_REGISTER_AVERAGE_WIND_DIRECTION = 1, /* 平均风向 */
FRT_REGISTER_MAX_WIND_DIRECTION = 2, /* 最大风向 */ FRT_REGISTER_INSTANTANEOUS_WIND_DIRECTION = 2, /* 瞬时风向 */
FRT_REGISTER_MIN_WIND_SPEED = 3, /* 最小风速 */ FRT_REGISTER_MAX_WIND_DIRECTION = 3, /* 最大风向 */
FRT_REGISTER_AVERAGE_WIND_SPEED = 4, /* 平均风速 */ FRT_REGISTER_MIN_WIND_SPEED = 4, /* 最小风速 */
FRT_REGISTER_MAX_WIND_SPEED = 5, /* 最大风速 */ FRT_REGISTER_THROUGH_WIND_SPEED = 5, /* 极小风速 */
FRT_REGISTER_TEMPERATURE = 6, /* 大气温度 */ FRT_REGISTER_AVERAGE_WIND_SPEED = 6, /* 平均风速 */
FRT_REGISTER_HUMIDITY = 7, /* 大气湿度 */ FRT_REGISTER_INSTANTANEOUS_WIND_SPEED = 7, /* 瞬时风速 */
FRT_REGISTER_PRESSURE = 8, /* 大气压 */ FRT_REGISTER_PEAK_WIND_SPEED = 8, /* 极大风速 */
FRT_REGISTER_RAIN = 9, /* 雨量 */ FRT_REGISTER_MAX_WIND_SPEED = 9, /* 最大风速 */
FRT_REGISTER_PRECIPITATION_INTENSITY = 10, /* 总辐射 */ FRT_REGISTER_TEMPERATURE = 10, /* 大气温度 */
FRT_REGISTER_HUMIDITY = 11, /* 大气湿度 */
FRT_REGISTER_PRESSURE = 12, /* 大气压 */
FRT_REGISTER_RAIN = 13, /* 雨量 */
FRT_REGISTER_PRECIPITATION_INTENSITY = 14, /* 总辐射 */
FRT_REGISTER_DEVICE_ADDR = 20, /* 设备地址 */ FRT_REGISTER_DEVICE_ADDR = 20, /* 设备地址 */
FRT_REGISTER_COMMU_BAUDRATE = 21, /* 波特率 */ FRT_REGISTER_COMMU_BAUDRATE = 21, /* 波特率 */

View File

@ -17,9 +17,13 @@ static u_int16_t FRT_ReadReg(unsigned char regId);
/* 读 */ /* 读 */
static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg); static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg); static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegInstantaneousWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg); static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg); static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegThroughWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg); static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegInstantaneousWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegPeakWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg); static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegTemperature(void *pMsg); static u_int16_t FRT_ReadRegTemperature(void *pMsg);
static u_int16_t FRT_ReadRegHumidity(void *pMsg); static u_int16_t FRT_ReadRegHumidity(void *pMsg);
@ -85,9 +89,13 @@ FRT_RegProcTable_s g_RegTbl[] =
{ {
{ FRT_REGISTER_MIN_WIND_DIRECTION, FRT_ReadRegMinWindDiretion }, /* 最小风向 */ { FRT_REGISTER_MIN_WIND_DIRECTION, FRT_ReadRegMinWindDiretion }, /* 最小风向 */
{ FRT_REGISTER_AVERAGE_WIND_DIRECTION, FRT_ReadRegAverageWindDirection }, /* 平均风向 */ { FRT_REGISTER_AVERAGE_WIND_DIRECTION, FRT_ReadRegAverageWindDirection }, /* 平均风向 */
{ FRT_REGISTER_INSTANTANEOUS_WIND_DIRECTION, FRT_ReadRegInstantaneousWindDirection }, /* 瞬时风向 */
{ FRT_REGISTER_MAX_WIND_DIRECTION, FRT_ReadRegMaxWindDirection }, /* 最大风向 */ { FRT_REGISTER_MAX_WIND_DIRECTION, FRT_ReadRegMaxWindDirection }, /* 最大风向 */
{ FRT_REGISTER_MIN_WIND_SPEED, FRT_ReadRegMinWindSpeed }, /* 最小风速 */ { FRT_REGISTER_MIN_WIND_SPEED, FRT_ReadRegMinWindSpeed }, /* 最小风速 */
{ FRT_REGISTER_THROUGH_WIND_SPEED, FRT_ReadRegThroughWindSpeed }, /* 极小风速 */
{ FRT_REGISTER_AVERAGE_WIND_SPEED, FRT_ReadRegAverageWindSpeed }, /* 平均风速 */ { FRT_REGISTER_AVERAGE_WIND_SPEED, FRT_ReadRegAverageWindSpeed }, /* 平均风速 */
{ FRT_REGISTER_INSTANTANEOUS_WIND_SPEED, FRT_ReadRegInstantaneousWindSpeed }, /* 瞬时风速 */
{ FRT_REGISTER_PEAK_WIND_SPEED, FRT_ReadRegPeakWindSpeed }, /* 极大风速 */
{ FRT_REGISTER_MAX_WIND_SPEED, FRT_ReadRegMaxWindSpeed }, /* 最大风速 */ { FRT_REGISTER_MAX_WIND_SPEED, FRT_ReadRegMaxWindSpeed }, /* 最大风速 */
{ FRT_REGISTER_TEMPERATURE, FRT_ReadRegTemperature }, /* 大气温度 */ { FRT_REGISTER_TEMPERATURE, FRT_ReadRegTemperature }, /* 大气温度 */
{ FRT_REGISTER_HUMIDITY, FRT_ReadRegHumidity }, /* 大气湿度 */ { FRT_REGISTER_HUMIDITY, FRT_ReadRegHumidity }, /* 大气湿度 */
@ -197,6 +205,17 @@ static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg)
return FRT_swap_endian_16(value); return FRT_swap_endian_16(value);
} }
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegInstantaneousWindDirection(void *pMsg)
{
u_int16_t value = (u_int16_t)(g_stMcs_Para.instantaneous_wind_direction *10);
return FRT_swap_endian_16(value);
}
/** /**
* @brief * @brief
* @param * @param
@ -219,6 +238,17 @@ static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg)
return FRT_swap_endian_16(value); return FRT_swap_endian_16(value);
} }
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegThroughWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.trough_wind_speed *10);
return FRT_swap_endian_16(value);
}
/** /**
* @brief * @brief
* @param * @param
@ -230,6 +260,28 @@ static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg)
return FRT_swap_endian_16(value); return FRT_swap_endian_16(value);
} }
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegInstantaneousWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.instantaneous_wind_speed *10);
return FRT_swap_endian_16(value);
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegPeakWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.peak_wind_speed *10);
return FRT_swap_endian_16(value);
}
/** /**
* @brief * @brief
* @param * @param
@ -538,7 +590,7 @@ static u_int16_t FRT_ReadRegErrorData(void *pMsg)
*/ */
static u_int16_t FRT_ReadRegWindC(void *pMsg) static u_int16_t FRT_ReadRegWindC(void *pMsg)
{ {
u_int16_t value=weather_info.wind_c = 0; u_int16_t value=(u_int16_t)(weather_info.wind_c *10);
return FRT_swap_endian_16(value); return FRT_swap_endian_16(value);
} }