添加滤波器,整理不需要的文件

This commit is contained in:
95384 2024-11-15 13:38:41 +08:00
commit 44d1520ac2
23 changed files with 170 additions and 5026 deletions

6
.gitignore vendored
View File

@ -1 +1,7 @@
EWARM/micro_climate/ EWARM/micro_climate/
EWARM/settings/
frt_protocol.c
README.md
软件框架图.vsdx
软件流程图.vsdx
赛联-微气象传感器软件设计说明书.docx

View File

@ -1,485 +0,0 @@
#include "frt_protocol.h"
#include "cmsis_os.h"
#include "assertions.h"
#include "inflash.h"
#include "anemometer_dev.h"
#include "sht30.h"
extern u_int8_t rs485_out_buff[50];
/* 静态函数申明 */
static void send_uart_pack(device_handle device,FRT_MsgFunctionCode_e cmd_type, const void *data, u_int16_t len);
static void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg);
static void FRT_MsgProc_WriteRegister(device_handle device, void *pMsg);
static u_int16_t FRT_ReadReg(unsigned char regId);
static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegTemperature(void *pMsg);
static u_int16_t FRT_ReadRegHumidity(void *pMsg);
static u_int16_t FRT_ReadRegPressure(void *pMsg);
static u_int16_t FRT_ReadRegRain(void *pMsg);
static u_int16_t FRT_ReadRegPrecipitationIntensity(void *pMsg);
static u_int16_t FRT_ReadRegDeviceAddr(void *pMsg);
static void pdebug_mcs_info();
/* 功能码处理表 */
FRT_FuncionMsgProcTable_s g_MsgTbl[] =
{
{ FRT_FUNCTION_CODE_READ_REGISTER, FRT_MsgProc_ReadRegister },
{ FRT_FUNCTION_CODE_WRITE_REGISTER, FRT_MsgProc_WriteRegister },
};
/* 寄存器处理表 */
FRT_RegProcTable_s g_RegTbl[] =
{
{ FRT_REGISTER_MIN_WIND_DIRECTION, FRT_ReadRegMinWindDiretion },
{ FRT_REGISTER_AVERAGE_WIND_DIRECTION, FRT_ReadRegAverageWindDirection },
{ FRT_REGISTER_MAX_WIND_DIRECTION, FRT_ReadRegMaxWindDirection },
{ FRT_REGISTER_MIN_WIND_SPEED, FRT_ReadRegMinWindSpeed },
{ FRT_REGISTER_AVERAGE_WIND_SPEED, FRT_ReadRegAverageWindSpeed },
{ FRT_REGISTER_MAX_WIND_SPEED, FRT_ReadRegMaxWindSpeed },
{ FRT_REGISTER_TEMPERATURE, FRT_ReadRegTemperature },
{ FRT_REGISTER_HUMIDITY, FRT_ReadRegHumidity },
{ FRT_REGISTER_PRESSURE, FRT_ReadRegPressure },
{ FRT_REGISTER_RAIN, FRT_ReadRegRain },
{ FRT_REGISTER_PRECIPITATION_INTENSITY, FRT_ReadRegPrecipitationIntensity },
{ FRT_REGISTER_DEVICE_ADDR, FRT_ReadRegDeviceAddr },
// { FRT_REGISTER_COMMU_BAUDRATE, FRT_ReadRegCommuBaudRate },
// { FRT_REGISTER_SPEED_AVERAGE_TIME, FRT_ReadRegSpeedAverageTime },
// { FRT_REGISTER_TEMPHUM_UPDATE_TIME, FRT_ReadRegTempHumUpdateTime },
// { FRT_REGISTER_RAIN_POWER_CONTROL, FRT_ReadRegRainPowerCtl },
};
/**
* @brief modbus crc16算法
* @param
* @retval
*/
unsigned short CRC16(unsigned char *arr_buff, unsigned char len)
{
unsigned short crc=0xFFFF;
unsigned char i, j;
for ( j=0; j<len; j++){
crc=crc ^*arr_buff++;
for ( i=0; i<8; i++){
if( ( crc&0x0001) >0){
crc=crc>>1;
crc=crc^ 0xa001;
}else{
crc=crc>>1;
}
}
}
return crc;
}
/**
* @brief 交换高低字节
* @param
* @retval
*/
static u_int16_t FRT_swap_endian_16(u_int16_t value)
{
return ((value << 8) | (value >> 8));
}
/**
* @brief 读最小风向寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg)
{
u_int16_t value = (u_int16_t)(g_stMcs_Para.min_wind_direction *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读平均风向寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg)
{
u_int16_t value = (u_int16_t)(g_stMcs_Para.average_wind_direction *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读最大风向寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.max_wind_direction *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读最小风速寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.min_wind_speed *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读平均风速寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.average_wind_speed *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读最大风速寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.max_wind_speed *10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读温度寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegTemperature(void *pMsg)
{
u_int16_t value= (u_int16_t)(g_stMcs_Para.temperature*10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读湿度寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegHumidity(void *pMsg)
{
u_int16_t value=(u_int16_t)(g_stMcs_Para.humidity*10);
return FRT_swap_endian_16(value);
}
/**
* @brief 读气压寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegPressure(void *pMsg)
{
u_int16_t value=8;
return FRT_swap_endian_16(value);
}
/**
* @brief 读雨量寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegRain(void *pMsg)
{
u_int16_t value=9;
return FRT_swap_endian_16(value);
}
/**
* @brief 读光辐射强度寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegPrecipitationIntensity(void *pMsg)
{
u_int16_t value=10;
return FRT_swap_endian_16(value);
}
/**
* @brief 读设备地址寄存器值
* @param
* @retval
*/
static u_int16_t FRT_ReadRegDeviceAddr(void *pMsg)
{
u_int16_t value=g_stConfigInfo.addr;
return FRT_swap_endian_16(value);
}
/**
* @brief 封装协议发送
* @param
* @retval 数据正确返回TRUE数据异常返回FALSE
*/
static void send_uart_pack(device_handle device,FRT_MsgFunctionCode_e cmd_type, const void *data, u_int16_t len)
{
memset(rs485_out_buff,0,sizeof(rs485_out_buff));
frt_climate_pack_resp *pack = (frt_climate_pack_resp*)rs485_out_buff;
pack->addr = g_stConfigInfo.addr;
pack->func = FRT_FUNCTION_CODE_READ_REGISTER;
pack->data_len = len;
memcpy(pack->data, data, len);
*(u_int16_t*)&pack->data[len] = CRC16((u_int8_t *)&pack->addr,pack->data_len+3);
uart_dev_write(device,(u_int8_t*)pack,pack->data_len+5);
}
/**
* @brief 遍历处理寄存器
* @param
* @retval
*/
u_int16_t FRT_ReadReg(unsigned char regId)
{
for(u_int16_t i = 0; i < sizeof(g_RegTbl) / sizeof(FRT_RegProcTable_s); i++){
//term_printf("regId:%d, g_RegTbl.regId :%d\r\n",regId,g_RegTbl[i].regId);
if (regId == g_RegTbl[i].regId){
return g_RegTbl[i].pRegProc(NULL);
}
}
return 0;
}
/**
* @brief 处理读取寄存器数据
* @param
* @retval
*/
void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg)
{
static u_int8_t reg_value_buff[2*100]={0x00};
memset(reg_value_buff,0,sizeof(reg_value_buff));
frt_climate_pack *pack = (frt_climate_pack*)pMsg;
u_int16_t start_reg_addr = (pack->addr_begin_high_byte<<8)| pack->addr_begin_low_byte;
u_int16_t reg_num= (pack->regnum_begin_high_byte<<8)| pack->regnum_begin_low_byte;
AssertError(start_reg_addr < 100,return, "读取寄存器起始地址错误%d",start_reg_addr);
AssertError(reg_num < 100,return, "读取寄存器数量错误%d",reg_num);
/* 采集sht30数据 */
AssertError(get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity),g_stMcs_Para.temperature=0;g_stMcs_Para.humidity=0,"采集sht30温湿度数据失败" );
// /* 调试信息 */
// pdebug_mcs_info();
for(u_int16_t pos=0; pos <reg_num; pos++){
*(u_int16_t*)&reg_value_buff[pos*2] = FRT_ReadReg((start_reg_addr+pos));
}
if(device == g_term_uart_handle)
{
pdebug_mcs_info();
}
if(device == g_rs485_uart_handle)
{
send_uart_pack(device, FRT_FUNCTION_CODE_READ_REGISTER, (u_int8_t*)&reg_value_buff, reg_num*2);
pdebug_mcs_info();
}
}
/**
* @brief 处理写入寄存器数据
* @param
* @retval
*/
void FRT_MsgProc_WriteRegister(device_handle device, void *pMsg)
{
term_printf("00000");
static u_int8_t reg_value_buff[2*100]={0x00};
memset(reg_value_buff,0,sizeof(reg_value_buff));
frt_climate_pack *pack = (frt_climate_pack*)pMsg;
u_int16_t start_reg_addr = (pack->addr_begin_high_byte<<8)| pack->addr_begin_low_byte;
u_int16_t reg_num= (pack->regnum_begin_high_byte<<8)| pack->regnum_begin_low_byte;
AssertError(start_reg_addr < 100,return, "读取寄存器起始地址错误%d",start_reg_addr);
AssertError(reg_num < 100,return, "读取寄存器数量错误%d",reg_num);
/* 采集sht30数据 */
AssertError(get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity),g_stMcs_Para.temperature=0;g_stMcs_Para.humidity=0,"采集sht30温湿度数据失败" );
/* 调试信息 */
pdebug_mcs_info();
for(u_int16_t pos=0; pos <reg_num; pos++){
*(u_int16_t*)&reg_value_buff[pos*2] = FRT_ReadReg((start_reg_addr+pos));
}
send_uart_pack(device, FRT_FUNCTION_CODE_READ_REGISTER, (u_int8_t*)&reg_value_buff, reg_num*2);
}
/**
* @brief 读取串口数据
* @param
* @retval
*/
static int uart_read_frt_climate_pack(device_handle uart_handle,u_int8_t *buff, u_int32_t buff_size)
{
u_int32_t offset = 0;
char c = 0;
// frt_climate_pack *pack = (frt_climate_pack *)buff;
unsigned char new_buff[50];
buff_size--; //预留一个'\0'位置
for (int i = 0; i < buff_size;i++)
{
c = uart_dev_in_char(uart_handle);
buff[i] = c;
}
int start_index = buff_size; // 初始化为一个不可能的值
// 遍历数组以找到符合条件的字节对
for (int i = 0; i < buff_size; i += 1)
{
if ((buff[i] == g_stConfigInfo.addr) && ((buff[i + 1] == 0x03) || (buff[i + 1] == 0x10)))
{
start_index = i; // 从符合条件的字节对开始复制
break;
}
}
if (start_index == buff_size)
{
return 0;
}
memcpy(new_buff, buff + start_index, buff_size - start_index);
// for (int i = 0; i < buff_size; i++) {
// term_printf("%x ", new_buff[i]);
// }
// term_printf("\r\n");
if (new_buff[1] == 0x30)
{
offset = 8
}
if (new_buff[1] == 0x10)
{
}
// for (offset = 0; offset < buff_size;){
// c = uart_dev_in_char(uart_handle);
// buff[offset++] = c;
// if (offset == sizeof(pack->addr)){
// if (pack->addr != g_stConfigInfo.addr){
// memcpy(buff, buff+1, offset-1);
// offset--;
// buff_size--;
// }
// }else if (offset == FRT_CLIMATE_PACK_SIZE(pack)){
// return offset;
// }
// }
return 0;
}
/**
* @brief 处理一条消息
* @param
* @retval
*/
void FRT_MsgHandler(device_handle device, u_int8_t *pMsg, u_int32_t MsgLen)
{
frt_climate_pack *pack = (frt_climate_pack*)pMsg;
//AssertErrorNoPrint((CRC16(pMsg, MsgLen-2) == FRT_CLIMATE_PACK_CRC16(pHeader)),return);
// AssertError((CRC16(pMsg, MsgLen-2) == FRT_CLIMATE_PACK_CRC16(pack)),return,"crc16校验失败");
// AssertError((pack->func == FRT_FUNCTION_CODE_READ_REGISTER) ||\
// (pack->func == FRT_FUNCTION_CODE_WRITE_REGISTER),return,"crc16校验失败");
// 断言有问题CRC出错卡死
if(CRC16(pMsg, MsgLen-2) != FRT_CLIMATE_PACK_CRC16(pack))
{
// term_printf("CRC不过");
return;
}
if((pack->func != FRT_FUNCTION_CODE_READ_REGISTER) && (pack->func != FRT_FUNCTION_CODE_WRITE_REGISTER))
{
// term_printf("功能码不过");
return;
}
for (u_int16_t i = 0; i < sizeof(g_MsgTbl) / sizeof(FRT_FuncionMsgProcTable_s); i++){
if (pack->func == g_MsgTbl[i].msgId){
g_MsgTbl[i].pMsgProc(device, pMsg);
}
}
}
/**
* @brief 读取并解析串口数据
* @param
* @retval
*/
static u_int8_t rs485_buff[50]={0x00};
void read_and_process_uart_data(device_handle device)
{
if(uart_dev_char_present(device)){
osDelay(20);
memset(rs485_buff,0,sizeof(rs485_buff));
int ret = uart_read_frt_climate_pack(device, rs485_buff, sizeof(rs485_buff));
if(ret > 0){
FRT_MsgHandler(device, rs485_buff, ret);
}
}
}
/* 打印微气象数据 */
static void pdebug_mcs_info()
{
term_printf("min_wind_direction: %.2f\r\n", g_stMcs_Para.min_wind_direction);
term_printf("average_wind_direction: %.2f\r\n", g_stMcs_Para.average_wind_direction);
term_printf("max_wind_direction: %.2f\r\n", g_stMcs_Para.max_wind_direction);
term_printf("min_wind_speed: %.2f\r\n", g_stMcs_Para.min_wind_speed);
term_printf("average_wind_speed: %.2f\r\n", g_stMcs_Para.average_wind_speed);
term_printf("max_wind_speed: %.2f\r\n", g_stMcs_Para.max_wind_speed);
term_printf("temperature: %.2f\r\n", g_stMcs_Para.temperature);
term_printf("humidity: %.2f\r\n", g_stMcs_Para.humidity);
term_printf("pressure: %.2f\r\n", g_stMcs_Para.pressure);
term_printf("rain: %.2f\r\n", g_stMcs_Para.precipitation);
// term_printf("precipitation_intensity: %.2f\r\n", g_stMcs_Para.precipitation_intensity);
}
// 30 03 00 00 00 0B 00 2C

File diff suppressed because one or more lines are too long

Binary file not shown.

72
Drivers/Filter/FIR.c Normal file
View File

@ -0,0 +1,72 @@
#include "FIR.h"
////const int16_t pCoeffs[numTaps] = {
//// 328, -27, -96, -175, -226, -219, -157, -71, -11,
//// -21, -109, -231, -304, -232, 41, 492, 1002, 1379,
//// 1423, 1009, 147, -981, -2064, -2748, -2758, -2001, -621,
//// 1034, 2504, 3366, 3366, 2504, 1034, -621, -2001, -2758,
//// -2748, -2064, -981, 147, 1009, 1423, 1379, 1002, 492,
//// 41, -232, -304, -231, -109, -21, -11, -71, -157,
//// -219, -226, -175, -96, -27, 328
////};
//
//const int16_t pCoeffs[numTaps] = {
// 1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, -1,
// -1, -1, 0, 2, 4, 5, 6, 4, 1, -4, -8, -11,
// -11, -8, -2, 4, 10, 13, 13, 10, 4, -2, -8, -11,
// -11, -8, -4, 1, 4, 6, 5, 4, 2, 0, -1, -1,
// -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 1
//};
//
//
//arm_fir_instance_q15 bpf_s;
//
//int16_t pState[ADC_VAL_LEN+numTaps-1];
//
//void firFilterInit(void)
//{
// arm_fir_init_q15(&bpf_s,numTaps,pCoeffs,pState,ADC_VAL_LEN);
//}
//
//void firBPFFilter(int16_t *rawValue,int16_t *outData,uint32_t len)
//{
// arm_fir_q15(&bpf_s,rawValue,outData,len);
//}
const float pCoeffs[numTaps] = {
0.01000739448 , -0.0008298238972, -0.002934818622, -0.005351484753 , -0.006882067304 ,
-0.006692492869 , -0.004794952925 , -0.002162534744, -0.000337747857 , -0.0006400240236 ,
-0.003314057132 , -0.007060859352 , -0.00928321667 , -0.007090434898 , 0.001251851092 ,
0.01502577588 , 0.03057955019 , 0.04208169878 , 0.04344128817 , 0.03078254126 ,
0.004476505332 , -0.02993877046 , -0.06297727674 , -0.08384874463 , -0.08415342867 ,
-0.06107503176 , -0.01894705743 , 0.03154437244 , 0.07641164213 , 0.1027124152 ,
0.1027124152 , 0.07641164213 , 0.03154437244 , -0.01894705743 , -0.06107503176 ,
-0.08415342867 , -0.08384874463 , -0.06297727674 , -0.02993877046 , 0.004476505332 ,
0.03078254126 , 0.04344128817 , 0.04208169878 , 0.03057955019 , 0.01502577588 ,
0.001251851092 , -0.007090434898 , -0.00928321667 , -0.007060859352 , -0.003314057132 ,
-0.0006400240236, -0.000337747857 , -0.002162534744, -0.004794952925 , -0.006692492869 ,
-0.006882067304 , -0.005351484753 , -0.002934818622, -0.0008298238972, 0.01000739448
};
arm_fir_instance_f32 bpf_s;
float32_t pState[ADC_VAL_LEN+numTaps-1];
void firFilterInit(void)
{
arm_fir_init_f32(&bpf_s,numTaps,pCoeffs,pState,ADC_VAL_LEN);
}
void firBPFFilter(float32_t *rawValue,float32_t *outData,uint32_t len)
{
arm_fir_f32(&bpf_s,rawValue,outData,len);
}

41
Drivers/Filter/FIR.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef _FIR__H_
#define _FIR__H_
#include "main.h"
#include "math.h"
#include "anemometer_dev.h"
#define numTaps 60
//const float B[numTaps] = {
// 0.01000739448,-0.0008298238972,-0.002934818622,-0.005351484753,-0.006882067304,
// -0.006692492869,-0.004794952925,-0.002162534744,-0.000337747857,-0.0006400240236,
// -0.003314057132,-0.007060859352, -0.00928321667,-0.007090434898, 0.001251851092,
// 0.01502577588, 0.03057955019, 0.04208169878, 0.04344128817, 0.03078254126,
// 0.004476505332, -0.02993877046, -0.06297727674, -0.08384874463, -0.08415342867,
// -0.06107503176, -0.01894705743, 0.03154437244, 0.07641164213, 0.1027124152,
// 0.1027124152, 0.07641164213, 0.03154437244, -0.01894705743, -0.06107503176,
// -0.08415342867, -0.08384874463, -0.06297727674, -0.02993877046, 0.004476505332,
// 0.03078254126, 0.04344128817, 0.04208169878, 0.03057955019, 0.01502577588,
// 0.001251851092,-0.007090434898, -0.00928321667,-0.007060859352,-0.003314057132,
// -0.0006400240236,-0.000337747857,-0.002162534744,-0.004794952925,-0.006692492869,
// -0.006882067304,-0.005351484753,-0.002934818622,-0.0008298238972, 0.01000739448
//};
//const int BL = 60;
void firFilterInit(void);
void firBPFFilter(float32_t *rawValue,float32_t *outData,uint32_t len);
//void firBPFFilter(int16_t *rawValue,int16_t *outData,uint32_t len);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -701,7 +701,7 @@
<data> <data>
<extensions></extensions> <extensions></extensions>
<cmdline></cmdline> <cmdline></cmdline>
<hasPrio>160</hasPrio> <hasPrio>1</hasPrio>
<buildSequence>inputOutputBased</buildSequence> <buildSequence>inputOutputBased</buildSequence>
</data> </data>
</settings> </settings>
@ -786,7 +786,7 @@
</option> </option>
<option> <option>
<name>IlinkIcfFile</name> <name>IlinkIcfFile</name>
<state>$PROJ_DIR$\stm32l496xx_flash_app-1109.icf</state> <state>$PROJ_DIR$\stm32l496xx_flash.icf</state>
</option> </option>
<option> <option>
<name>IlinkIcfFileSlave</name> <name>IlinkIcfFileSlave</name>
@ -1226,6 +1226,12 @@
<file> <file>
<name>$PROJ_DIR$\..\Drivers\Filter\filter.h</name> <name>$PROJ_DIR$\..\Drivers\Filter\filter.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\Drivers\Filter\FIR.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\Filter\FIR.h</name>
</file>
</group> </group>
<group> <group>
<name>HP203B</name> <name>HP203B</name>

View File

@ -1541,6 +1541,12 @@
<file> <file>
<name>$PROJ_DIR$\..\Drivers\Filter\filter.h</name> <name>$PROJ_DIR$\..\Drivers\Filter\filter.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\Drivers\Filter\FIR.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\Filter\FIR.h</name>
</file>
</group> </group>
<group> <group>
<name>HP203B</name> <name>HP203B</name>

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<userBookmarks />

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<crun>
<version>1</version>
<filter_entries>
<filter index="0" type="default">
<type>*</type>
<start_file>*</start_file>
<end_file>*</end_file>
<action_debugger>0</action_debugger>
<action_log>1</action_log>
</filter>
</filter_entries>
</crun>

File diff suppressed because one or more lines are too long

View File

@ -1,179 +0,0 @@
<?xml version="1.0"?>
<settings>
<Stack>
<FillEnabled>0</FillEnabled>
<OverflowWarningsEnabled>1</OverflowWarningsEnabled>
<WarningThreshold>90</WarningThreshold>
<SpWarningsEnabled>1</SpWarningsEnabled>
<WarnLogOnly>1</WarnLogOnly>
<UseTrigger>1</UseTrigger>
<TriggerName>main</TriggerName>
<LimitSize>0</LimitSize>
<ByteLimit>50</ByteLimit>
</Stack>
<PlDriver>
<FirstRun>0</FirstRun>
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf</MemConfigValue>
</PlDriver>
<Jet>
<JetConnSerialNo>WCH CMSIS-DAP:209E8F06A596</JetConnSerialNo>
<JetConnFoundProbes />
<PrevWtdReset>Connect during reset</PrevWtdReset>
<OnlineReset>Software</OnlineReset>
<DisableInterrupts>0</DisableInterrupts>
<LeaveRunning>0</LeaveRunning>
<MultiCoreRunAll>0</MultiCoreRunAll>
<CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet>
</Jet>
<ArmDriver>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
</ArmDriver>
<DebugChecksum>
<Checksum>3526353147</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
<StopOnThrow>_ 0</StopOnThrow>
</Exceptions>
<SWOManager>
<SamplingDivider>8192</SamplingDivider>
<OverrideClock>0</OverrideClock>
<CpuClock>0</CpuClock>
<SwoClock>0</SwoClock>
<DataLogMode>0</DataLogMode>
<ItmPortsEnabled>63</ItmPortsEnabled>
<ItmTermIOPorts>1</ItmTermIOPorts>
<ItmLogPorts>0</ItmLogPorts>
<ItmLogFile>$PROJ_DIR$\ITM.log</ItmLogFile>
<PowerForcePC>1</PowerForcePC>
<PowerConnectPC>1</PowerConnectPC>
</SWOManager>
<Disassembly>
<MixedMode>1</MixedMode>
<InstrCount>0</InstrCount>
</Disassembly>
<TerminalIO>
<InputSource>1</InputSource>
<InputMode>10</InputMode>
<Filename>$PROJ_DIR$\TermIOInput.txt</Filename>
<InputEcho>1</InputEcho>
<ShowReset>0</ShowReset>
<InputEncoding>2</InputEncoding>
<OutputEncoding>2</OutputEncoding>
</TerminalIO>
<CallStack>
<ShowArgs>0</ShowArgs>
</CallStack>
<StLinkDriver>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<stlinkserialNo>0665FF323541483043141633</stlinkserialNo>
<stlinkfoundProbes />
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<CStepIntDis>_ 0</CStepIntDis>
</StLinkDriver>
<SWOTraceHWSettings>
<OverrideDefaultClocks>0</OverrideDefaultClocks>
<CpuClock>80000000</CpuClock>
<ClockAutoDetect>0</ClockAutoDetect>
<ClockWanted>2000000</ClockWanted>
<JtagSpeed>2000000</JtagSpeed>
<Prescaler>40</Prescaler>
<TimeStampPrescIndex>0</TimeStampPrescIndex>
<TimeStampPrescData>0</TimeStampPrescData>
<PcSampCYCTAP>1</PcSampCYCTAP>
<PcSampPOSTCNT>15</PcSampPOSTCNT>
<PcSampIndex>0</PcSampIndex>
<DataLogMode>0</DataLogMode>
<ITMportsEnable>0</ITMportsEnable>
<ITMportsTermIO>0</ITMportsTermIO>
<ITMportsLogFile>0</ITMportsLogFile>
<ITMlogFile>$PROJ_DIR$\ITM.log</ITMlogFile>
</SWOTraceHWSettings>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<ETMTraceWindow>
<PortWidth>4</PortWidth>
<PortMode>0</PortMode>
<CaptureDataValues>0</CaptureDataValues>
<CaptureDataAddresses>0</CaptureDataAddresses>
<CaptureDataRange>0</CaptureDataRange>
<DataFirst>0</DataFirst>
<DataLast>4294967295</DataLast>
<StopWhen>0</StopWhen>
<StallCPU>0</StallCPU>
<NoPCCapture>0</NoPCCapture>
</ETMTraceWindow>
<Trace2>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
</Trace2>
<SWOTraceWindow>
<PcSampling>0</PcSampling>
<InterruptLogs>0</InterruptLogs>
<ForcedTimeStamps>0</ForcedTimeStamps>
<EventCPI>0</EventCPI>
<EventEXC>0</EventEXC>
<EventFOLD>0</EventFOLD>
<EventLSU>0</EventLSU>
<EventSLEEP>0</EventSLEEP>
</SWOTraceWindow>
<DataLog>
<GraphEnabled>0</GraphEnabled>
<LogEnabled>0</LogEnabled>
<ShowTimeLog>1</ShowTimeLog>
<SumEnabled>0</SumEnabled>
<ShowTimeSum>1</ShowTimeSum>
</DataLog>
<InterruptLog>
<GraphEnabled>0</GraphEnabled>
<LogEnabled>0</LogEnabled>
<ShowTimeLog>1</ShowTimeLog>
<SumEnabled>0</SumEnabled>
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</InterruptLog>
<EventLog>
<GraphEnabled>0</GraphEnabled>
<LogEnabled>0</LogEnabled>
<ShowTimeLog>1</ShowTimeLog>
<Title_0>Ch3</Title_0>
<Symbol_0>0 0 1</Symbol_0>
<Title_1>Ch2</Title_1>
<Symbol_1>0 0 1</Symbol_1>
<Title_2>Ch1</Title_2>
<Symbol_2>0 0 1</Symbol_2>
<Title_3>Ch0</Title_3>
<Symbol_3>0 0 1</Symbol_3>
<SumEnabled>0</SumEnabled>
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</EventLog>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>3</Mode>
<Graph>0</Graph>
<Symbiont>0</Symbiont>
<Exclusions />
</DriverProfiling>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<Aliases>
<A0>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Include\arm_math.h" ""</A0>
<A1>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Source\ComplexMathFunctions\arm_cmplx_mag_f32.c" ""</A1>
<A2>_ "D:\GitHub\ARM-software\CMSIS_5.old\CMSIS\DSP\Source\TransformFunctions\arm_rfft_fast_init_f32.c" ""</A2>
<Count>3</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings>

View File

@ -1,40 +0,0 @@
@REM This batch file has been generated by the IAR Embedded Workbench
@REM C-SPY Debugger, as an aid to preparing a command line for running
@REM the cspybat command line utility using the appropriate settings.
@REM
@REM Note that this file is generated every time a new debug session
@REM is initialized, so you may want to move or rename the file before
@REM making changes.
@REM
@REM You can launch cspybat by typing the name of this batch file followed
@REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
@REM
@REM Read about available command line parameters in the C-SPY Debugging
@REM Guide. Hints about additional command line parameters that may be
@REM useful in specific cases:
@REM --download_only Downloads a code image without starting a debug
@REM session afterwards.
@REM --silent Omits the sign-on message.
@REM --timeout Limits the maximum allowed execution time.
@REM
@echo off
if not "%~1" == "" goto debugFile
@echo on
"D:\Program Files\IAR Systems\common\bin\cspybat" -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.general.xcl" --backend -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.driver.xcl"
@echo off
goto end
:debugFile
@echo on
"D:\Program Files\IAR Systems\common\bin\cspybat" -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.general.xcl" "--debug_file=%~1" --backend -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.driver.xcl"
@echo off
:end

View File

@ -1,31 +0,0 @@
param([String]$debugfile = "");
# This powershell file has been generated by the IAR Embedded Workbench
# C - SPY Debugger, as an aid to preparing a command line for running
# the cspybat command line utility using the appropriate settings.
#
# Note that this file is generated every time a new debug session
# is initialized, so you may want to move or rename the file before
# making changes.
#
# You can launch cspybat by typing Powershell.exe -File followed by the name of this batch file, followed
# by the name of the debug file (usually an ELF / DWARF or UBROF file).
#
# Read about available command line parameters in the C - SPY Debugging
# Guide. Hints about additional command line parameters that may be
# useful in specific cases :
# --download_only Downloads a code image without starting a debug
# session afterwards.
# --silent Omits the sign - on message.
# --timeout Limits the maximum allowed execution time.
#
if ($debugfile -eq "")
{
& "D:\Program Files\IAR Systems\common\bin\cspybat" -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.general.xcl" --backend -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.driver.xcl"
}
else
{
& "D:\Program Files\IAR Systems\common\bin\cspybat" -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.general.xcl" --debug_file=$debugfile --backend -f "E:\Y\IAR\micro_climate\EWARM\settings\micro_climate.micro_climate.driver.xcl"
}

View File

@ -1,31 +0,0 @@
"--endian=little"
"--cpu=Cortex-M4"
"--fpu=VFPv4_SP"
"-p"
"D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32L496RG.ddf"
"--drv_verify_download"
"--semihosting"
"--device=STM32L496RG"
"--drv_interface=SWD"
"--stlink_reset_strategy=0,2"
"--drv_swo_clock_setup=80000000,0,2000000"
"--drv_catch_exceptions=0x000"
"--drv_debug_ap=0"
"--stlink_probe=stlinkv2"

View File

@ -1,15 +0,0 @@
"D:\Program Files\IAR Systems\arm\bin\armPROC.dll"
"D:\Program Files\IAR Systems\arm\bin\armSTLINK.dll"
"E:\Y\IAR\micro_climate\EWARM\micro_climate\Exe\micro_climate.out"
--plugin="D:\Program Files\IAR Systems\arm\bin\armbat.dll"
--device_macro="D:\Program Files\IAR Systems\arm/config/debugger/ST/STM32L4xx.dmac"
--flash_loader="D:\Program Files\IAR Systems\arm/config/flashloader/ST/FlashSTM32L4AxxG.board"

View File

@ -1,39 +0,0 @@
# 微气象传感器
#### 介绍
{**以下是 Gitee 平台说明,您可以替换此简介**
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,384 +0,0 @@
#include "frt_protocol.h"
#include "cmsis_os.h"
#include "assertions.h"
#include "inflash.h"
#include "anemometer_dev.h"
#include "sht30.h"
extern u_int8_t rs485_out_buff[50];
/* 静态函数申明 */
static void send_uart_pack(device_handle device,FRT_MsgFunctionCode_e cmd_type, const void *data, u_int16_t len);
static void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg);
static u_int16_t FRT_ReadReg(unsigned char regId);
static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg);
static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg);
static u_int16_t FRT_ReadRegTemperature(void *pMsg);
static u_int16_t FRT_ReadRegHumidity(void *pMsg);
static u_int16_t FRT_ReadRegPressure(void *pMsg);
static u_int16_t FRT_ReadRegRain(void *pMsg);
static u_int16_t FRT_ReadRegPrecipitationIntensity(void *pMsg);
static u_int16_t FRT_ReadRegDeviceAddr(void *pMsg);
static void pdebug_mcs_info();
/* 功能码处理表 */
FRT_FuncionMsgProcTable_s g_MsgTbl[] =
{
{ FRT_FUNCTION_CODE_READ_REGISTER, FRT_MsgProc_ReadRegister },
// { FRT_FUNCTION_CODE_WRITE_REGISTER, FRT_MsgProc_WriteRegister },
};
/* 寄存器处理表 */
FRT_RegProcTable_s g_RegTbl[] =
{
{ FRT_REGISTER_MIN_WIND_DIRECTION, FRT_ReadRegMinWindDiretion },
{ FRT_REGISTER_AVERAGE_WIND_DIRECTION, FRT_ReadRegAverageWindDirection },
{ FRT_REGISTER_MAX_WIND_DIRECTION, FRT_ReadRegMaxWindDirection },
{ FRT_REGISTER_MIN_WIND_SPEED, FRT_ReadRegMinWindSpeed },
{ FRT_REGISTER_AVERAGE_WIND_SPEED, FRT_ReadRegAverageWindSpeed },
{ FRT_REGISTER_MAX_WIND_SPEED, FRT_ReadRegMaxWindSpeed },
{ FRT_REGISTER_TEMPERATURE, FRT_ReadRegTemperature },
{ FRT_REGISTER_HUMIDITY, FRT_ReadRegHumidity },
{ FRT_REGISTER_PRESSURE, FRT_ReadRegPressure },
{ FRT_REGISTER_RAIN, FRT_ReadRegRain },
{ FRT_REGISTER_PRECIPITATION_INTENSITY, FRT_ReadRegPrecipitationIntensity },
{ FRT_REGISTER_DEVICE_ADDR, FRT_ReadRegDeviceAddr },
// { FRT_REGISTER_COMMU_BAUDRATE, FRT_ReadRegCommuBaudRate },
// { FRT_REGISTER_SPEED_AVERAGE_TIME, FRT_ReadRegSpeedAverageTime },
// { FRT_REGISTER_TEMPHUM_UPDATE_TIME, FRT_ReadRegTempHumUpdateTime },
// { FRT_REGISTER_RAIN_POWER_CONTROL, FRT_ReadRegRainPowerCtl },
};
/**
* @brief modbus crc16算法
* @param
* @retval
*/
unsigned short CRC16(unsigned char *arr_buff, unsigned char len)
{
unsigned short crc=0xFFFF;
unsigned char i, j;
for ( j=0; j<len; j++){
crc=crc ^*arr_buff++;
for ( i=0; i<8; i++){
if( ( crc&0x0001) >0){
crc=crc>>1;
crc=crc^ 0xa001;
}else{
crc=crc>>1;
}
}
}
return crc;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMinWindDiretion(void *pMsg)
{
u_int16_t value = (u_int16_t)g_stMcs_Para.min_wind_direction *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegAverageWindDirection(void *pMsg)
{
u_int16_t value = (u_int16_t)g_stMcs_Para.average_wind_direction *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMaxWindDirection(void *pMsg)
{
u_int16_t value=(u_int16_t)g_stMcs_Para.max_wind_direction *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMinWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)g_stMcs_Para.min_wind_speed *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegAverageWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)g_stMcs_Para.average_wind_speed *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegMaxWindSpeed(void *pMsg)
{
u_int16_t value=(u_int16_t)g_stMcs_Para.max_wind_speed *10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegTemperature(void *pMsg)
{
u_int16_t value= (u_int16_t)g_stMcs_Para.temperature*10;
return value;
}
/**
* @brief 湿
* @param
* @retval
*/
static u_int16_t FRT_ReadRegHumidity(void *pMsg)
{
u_int16_t value=(u_int16_t)g_stMcs_Para.humidity*10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegPressure(void *pMsg)
{
u_int16_t value=8;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegRain(void *pMsg)
{
u_int16_t value=9;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegPrecipitationIntensity(void *pMsg)
{
u_int16_t value=10;
return value;
}
/**
* @brief
* @param
* @retval
*/
static u_int16_t FRT_ReadRegDeviceAddr(void *pMsg)
{
u_int16_t value=g_stConfigInfo.addr;
return value;
}
/**
* @brief
* @param
* @retval TRUEFALSE
*/
static void send_uart_pack(device_handle device,FRT_MsgFunctionCode_e cmd_type, const void *data, u_int16_t len)
{
memset(rs485_out_buff,0,sizeof(rs485_out_buff));
frt_climate_pack_resp *pack = (frt_climate_pack_resp*)rs485_out_buff;
pack->addr = g_stConfigInfo.addr;
pack->func = FRT_FUNCTION_CODE_READ_REGISTER;
pack->data_len = len;
memcpy(pack->data, data, len);
*(u_int16_t*)&pack->data[len] = CRC16((u_int8_t *)&pack->addr,pack->data_len+3);
uart_dev_write(device,(u_int8_t*)pack,pack->data_len+5);
}
/**
* @brief
* @param
* @retval
*/
u_int16_t FRT_ReadReg(unsigned char regId)
{
for(u_int16_t i = 0; i < sizeof(g_RegTbl) / sizeof(FRT_RegProcTable_s); i++){
//term_printf("regId:%d, g_RegTbl.regId :%d\r\n",regId,g_RegTbl[i].regId);
if (regId == g_RegTbl[i].regId){
return g_RegTbl[i].pRegProc(NULL);
}
}
return 0;
}
/**
* @brief
* @param
* @retval
*/
void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg)
{
static u_int8_t reg_value_buff[2*100]={0x00};
memset(reg_value_buff,0,sizeof(reg_value_buff));
frt_climate_pack *pack = (frt_climate_pack*)pMsg;
u_int16_t start_reg_addr = (pack->addr_begin_high_byte<<8)| pack->addr_begin_low_byte;
u_int16_t reg_num= (pack->regnum_begin_high_byte<<8)| pack->regnum_begin_low_byte;
AssertError(start_reg_addr < 100,return, "读取寄存器起始地址错误%d",start_reg_addr);
AssertError(reg_num < 100,return, "读取寄存器数量错误%d",reg_num);
/* 采集sht30数据 */
AssertError(get_temp_humi_data(&g_stMcs_Para.temperature, &g_stMcs_Para.humidity),g_stMcs_Para.temperature=0;g_stMcs_Para.humidity=0,"采集sht30温湿度数据失败" );
/* 调试信息 */
pdebug_mcs_info();
for(u_int16_t pos=0; pos <reg_num; pos++){
*(u_int16_t*)&reg_value_buff[pos*2] = FRT_ReadReg((start_reg_addr+pos));
}
send_uart_pack(device, FRT_FUNCTION_CODE_READ_REGISTER, (u_int8_t*)&reg_value_buff, reg_num*2);
}
/**
* @brief
* @param
* @retval
*/
static int uart_read_frt_climate_pack(device_handle uart_handle,u_int8_t *buff, u_int32_t buff_size)
{
u_int32_t offset = 0;
char c = 0;
frt_climate_pack *pack = (frt_climate_pack *)buff;
buff_size--; //预留一个'\0'位置
for (offset = 0; offset < buff_size;){
c = uart_dev_in_char(uart_handle);
buff[offset++] = c;
if (offset == sizeof(pack->addr)){
if (pack->addr != g_stConfigInfo.addr){
memcpy(buff, buff+1, offset-1);
offset--;
buff_size--;
}
}else if (offset == FRT_CLIMATE_PACK_SIZE(pack)){
return offset;
}
}
return 0;
}
/**
* @brief
* @param
* @retval
*/
void FRT_MsgHandler(device_handle device, u_int8_t *pMsg, u_int32_t MsgLen)
{
frt_climate_pack *pack = (frt_climate_pack*)pMsg;
//AssertErrorNoPrint((CRC16(pMsg, MsgLen-2) == FRT_CLIMATE_PACK_CRC16(pHeader)),return);
AssertError((CRC16(pMsg, MsgLen-2) == FRT_CLIMATE_PACK_CRC16(pack)),return,"crc16校验失败");
AssertError((pack->func == FRT_FUNCTION_CODE_READ_REGISTER) ||\
(pack->func == FRT_FUNCTION_CODE_WRITE_REGISTER),return,"crc16校验失败");
for (u_int16_t i = 0; i < sizeof(g_MsgTbl) / sizeof(FRT_FuncionMsgProcTable_s); i++){
if (pack->func == g_MsgTbl[i].msgId){
g_MsgTbl[i].pMsgProc(device, pMsg);
}
}
}
/**
* @brief
* @param
* @retval
*/
static u_int8_t rs485_buff[50]={0x00};
void read_and_process_uart_data(device_handle device)
{
if(uart_dev_char_present(device)){
osDelay(20);
memset(rs485_buff,0,sizeof(rs485_buff));
int ret = uart_read_frt_climate_pack(device, rs485_buff, sizeof(rs485_buff));
if(ret > 0){
FRT_MsgHandler(device, rs485_buff, ret);
}
}
}
/* 打印微气象数据 */
static void pdebug_mcs_info()
{
term_printf("min_wind_direction: %.2f\r\n", g_stMcs_Para.min_wind_direction);
term_printf("average_wind_direction: %.2f\r\n", g_stMcs_Para.average_wind_direction);
term_printf("max_wind_direction: %.2f\r\n", g_stMcs_Para.max_wind_direction);
term_printf("min_wind_speed: %.2f\r\n", g_stMcs_Para.min_wind_speed);
term_printf("average_wind_speed: %.2f\r\n", g_stMcs_Para.average_wind_speed);
term_printf("max_wind_speed: %.2f\r\n", g_stMcs_Para.max_wind_speed);
term_printf("temperature: %.2f\r\n", g_stMcs_Para.temperature);
term_printf("humidity: %.2f\r\n", g_stMcs_Para.humidity);
term_printf("precipitation: %.2f\r\n", g_stMcs_Para.precipitation);
term_printf("precipitation_intensity: %.2f\r\n", g_stMcs_Para.precipitation_intensity);
}
// 30 03 00 00 00 0B 00 2C

Binary file not shown.

Binary file not shown.