最大幅值分支合并
This commit is contained in:
parent
e8c26428cc
commit
c63e035ef2
|
@ -162,10 +162,10 @@ typedef struct {
|
||||||
uint16_t currentIndex;
|
uint16_t currentIndex;
|
||||||
uint16_t ave;
|
uint16_t ave;
|
||||||
} AverageCalculator;
|
} AverageCalculator;
|
||||||
extern AverageCalculator Test1;
|
extern AverageCalculator wave_max_val_1;
|
||||||
extern AverageCalculator Test2;
|
extern AverageCalculator wave_max_val_2;
|
||||||
extern AverageCalculator Test3;
|
extern AverageCalculator wave_max_val_3;
|
||||||
extern AverageCalculator Test4;
|
extern AverageCalculator wave_max_val_4;
|
||||||
|
|
||||||
// 切换通道
|
// 切换通道
|
||||||
void change_channel(uint32_t channel);
|
void change_channel(uint32_t channel);
|
||||||
|
|
|
@ -71,10 +71,10 @@ typedef enum
|
||||||
FRT_REGISTER_LINEAR_POINT_Y_4 = 48, /* 线性插值校准点4 */
|
FRT_REGISTER_LINEAR_POINT_Y_4 = 48, /* 线性插值校准点4 */
|
||||||
FRT_REGISTER_LINEAR_POINT_Y_5 = 49, /* 线性插值校准点5 */
|
FRT_REGISTER_LINEAR_POINT_Y_5 = 49, /* 线性插值校准点5 */
|
||||||
FRT_REGISTER_LINEAR_ENABLE = 50, /* 线性插值使能 */
|
FRT_REGISTER_LINEAR_ENABLE = 50, /* 线性插值使能 */
|
||||||
FRT_REGISTER_TEST1 = 51, /* 测试寄存器 */
|
FRT_REGISTER_MAX_WAVE_1 = 51, /* 换能器最大波形 */
|
||||||
FRT_REGISTER_TEST2 = 52, /* 测试寄存器 */
|
FRT_REGISTER_MAX_WAVE_2 = 52, /* 换能器最大波形 */
|
||||||
FRT_REGISTER_TEST3 = 53, /* 测试寄存器 */
|
FRT_REGISTER_MAX_WAVE_3 = 53, /* 换能器最大波形 */
|
||||||
FRT_REGISTER_TEST4 = 54, /* 测试寄存器 */
|
FRT_REGISTER_MAX_WAVE_4 = 54, /* 换能器最大波形 */
|
||||||
}FRT_MsgRegister;
|
}FRT_MsgRegister;
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
|
|
|
@ -36,10 +36,10 @@ void addValue(AverageCalculator *calc, uint16_t value) {
|
||||||
}
|
}
|
||||||
calc->ave = sum / calc->count;
|
calc->ave = sum / calc->count;
|
||||||
}
|
}
|
||||||
AverageCalculator Test1;
|
AverageCalculator wave_max_val_1;
|
||||||
AverageCalculator Test2;
|
AverageCalculator wave_max_val_2;
|
||||||
AverageCalculator Test3;
|
AverageCalculator wave_max_val_3;
|
||||||
AverageCalculator Test4;
|
AverageCalculator wave_max_val_4;
|
||||||
uint16_t wave_max_val1;
|
uint16_t wave_max_val1;
|
||||||
uint16_t wave_max_val2;
|
uint16_t wave_max_val2;
|
||||||
uint16_t wave_max_val3;
|
uint16_t wave_max_val3;
|
||||||
|
@ -427,8 +427,8 @@ void wind_task(void const * argument)
|
||||||
play_one_measure(adc_val1,ADC_VAL_LEN);
|
play_one_measure(adc_val1,ADC_VAL_LEN);
|
||||||
|
|
||||||
|
|
||||||
tofx = cal_tof(adc_val,ADC_VAL_LEN, &wave_max_val1);addValue(&Test1, wave_max_val1);
|
tofx = cal_tof(adc_val,ADC_VAL_LEN, &wave_max_val1);addValue(&wave_max_val_1, wave_max_val1);
|
||||||
tofy = cal_tof(adc_val1,ADC_VAL_LEN, &wave_max_val2);addValue(&Test2, wave_max_val2);
|
tofy = cal_tof(adc_val1,ADC_VAL_LEN, &wave_max_val2);addValue(&wave_max_val_2, wave_max_val2);
|
||||||
|
|
||||||
|
|
||||||
// 接受信号很小
|
// 接受信号很小
|
||||||
|
@ -486,8 +486,8 @@ void wind_task(void const * argument)
|
||||||
play_one_measure(adc_val1,ADC_VAL_LEN);
|
play_one_measure(adc_val1,ADC_VAL_LEN);
|
||||||
|
|
||||||
|
|
||||||
tofx = cal_tof(adc_val,ADC_VAL_LEN, &wave_max_val3);addValue(&Test3, wave_max_val3);
|
tofx = cal_tof(adc_val,ADC_VAL_LEN, &wave_max_val3);addValue(&wave_max_val_3, wave_max_val3);
|
||||||
tofy = cal_tof(adc_val1,ADC_VAL_LEN, &wave_max_val4);addValue(&Test4, wave_max_val4);
|
tofy = cal_tof(adc_val1,ADC_VAL_LEN, &wave_max_val4);addValue(&wave_max_val_4, wave_max_val4);
|
||||||
|
|
||||||
// 如果测量的信号幅值过小。
|
// 如果测量的信号幅值过小。
|
||||||
if(tofx<0||tofy<0)
|
if(tofx<0||tofy<0)
|
||||||
|
|
|
@ -67,6 +67,10 @@ static u_int16_t FRT_ReadRegPoint_3Y(void *pMsg);
|
||||||
static u_int16_t FRT_ReadRegPoint_4Y(void *pMsg);
|
static u_int16_t FRT_ReadRegPoint_4Y(void *pMsg);
|
||||||
static u_int16_t FRT_ReadRegPoint_5Y(void *pMsg);
|
static u_int16_t FRT_ReadRegPoint_5Y(void *pMsg);
|
||||||
static u_int16_t FRT_ReadRegLinearEnable(void *pMsg);
|
static u_int16_t FRT_ReadRegLinearEnable(void *pMsg);
|
||||||
|
static u_int16_t FRT_ReadReg_MaxWave_1(void *pMsg);
|
||||||
|
static u_int16_t FRT_ReadReg_MaxWave_2(void *pMsg);
|
||||||
|
static u_int16_t FRT_ReadReg_MaxWave_3(void *pMsg);
|
||||||
|
static u_int16_t FRT_ReadReg_MaxWave_4(void *pMsg);
|
||||||
/* 写配置 */
|
/* 写配置 */
|
||||||
static u_int16_t FRT_WriteRegTransducerCFG1R5(void *pMsg);
|
static u_int16_t FRT_WriteRegTransducerCFG1R5(void *pMsg);
|
||||||
static u_int16_t FRT_WriteRegTransducerCFG4R5(void *pMsg);
|
static u_int16_t FRT_WriteRegTransducerCFG4R5(void *pMsg);
|
||||||
|
@ -81,11 +85,6 @@ static u_int16_t FRT_WriteRegPoint_3Y(void *pMsg);
|
||||||
static u_int16_t FRT_WriteRegPoint_4Y(void *pMsg);
|
static u_int16_t FRT_WriteRegPoint_4Y(void *pMsg);
|
||||||
static u_int16_t FRT_WriteRegPoint_5Y(void *pMsg);
|
static u_int16_t FRT_WriteRegPoint_5Y(void *pMsg);
|
||||||
static u_int16_t FRT_WriteRegLinearEnable(void *pMsg);
|
static u_int16_t FRT_WriteRegLinearEnable(void *pMsg);
|
||||||
/* 测试 */
|
|
||||||
static u_int16_t FRT_ReadRegTest1(void *pMsg);
|
|
||||||
static u_int16_t FRT_ReadRegTest2(void *pMsg);
|
|
||||||
static u_int16_t FRT_ReadRegTest3(void *pMsg);
|
|
||||||
static u_int16_t FRT_ReadRegTest4(void *pMsg);
|
|
||||||
|
|
||||||
static void pdebug_mcs_info();
|
static void pdebug_mcs_info();
|
||||||
|
|
||||||
|
@ -142,10 +141,10 @@ FRT_RegProcTable_s g_RegTbl[] =
|
||||||
{ FRT_REGISTER_LINEAR_POINT_Y_4, FRT_ReadRegPoint_4Y }, /* 线性插值校准点4 */
|
{ FRT_REGISTER_LINEAR_POINT_Y_4, FRT_ReadRegPoint_4Y }, /* 线性插值校准点4 */
|
||||||
{ FRT_REGISTER_LINEAR_POINT_Y_5, FRT_ReadRegPoint_5Y }, /* 线性插值校准点5 */
|
{ FRT_REGISTER_LINEAR_POINT_Y_5, FRT_ReadRegPoint_5Y }, /* 线性插值校准点5 */
|
||||||
{ FRT_REGISTER_LINEAR_ENABLE, FRT_ReadRegLinearEnable }, /* 线性插值使能 */
|
{ FRT_REGISTER_LINEAR_ENABLE, FRT_ReadRegLinearEnable }, /* 线性插值使能 */
|
||||||
{ FRT_REGISTER_TEST1, FRT_ReadRegTest1 }, /* 测试寄存器 */
|
{ FRT_REGISTER_MAX_WAVE_1, FRT_ReadReg_MaxWave_1 }, /* 波形最大幅值 */
|
||||||
{ FRT_REGISTER_TEST2, FRT_ReadRegTest2 }, /* 测试寄存器 */
|
{ FRT_REGISTER_MAX_WAVE_2, FRT_ReadReg_MaxWave_2 }, /* 波形最大幅值 */
|
||||||
{ FRT_REGISTER_TEST3, FRT_ReadRegTest3 }, /* 测试寄存器 */
|
{ FRT_REGISTER_MAX_WAVE_3, FRT_ReadReg_MaxWave_3 }, /* 波形最大幅值 */
|
||||||
{ FRT_REGISTER_TEST4, FRT_ReadRegTest4 }, /* 测试寄存器 */
|
{ FRT_REGISTER_MAX_WAVE_4, FRT_ReadReg_MaxWave_4 }, /* 波形最大幅值 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 写寄存器处理表 */
|
/* 写寄存器处理表 */
|
||||||
|
@ -807,43 +806,43 @@ static u_int16_t FRT_ReadRegLinearEnable(void *pMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 111111111111111
|
* @brief 波形最大幅值S
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
static u_int16_t FRT_ReadRegTest1(void *pMsg)
|
static u_int16_t FRT_ReadReg_MaxWave_1(void *pMsg)
|
||||||
{
|
{
|
||||||
u_int16_t value=(u_int16_t)(Test1.ave);
|
u_int16_t value=(u_int16_t)(wave_max_val_1.ave);
|
||||||
return FRT_swap_endian_16(value);
|
return FRT_swap_endian_16(value);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 111111111111111
|
* @brief 波形最大幅值N
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
static u_int16_t FRT_ReadRegTest2(void *pMsg)
|
static u_int16_t FRT_ReadReg_MaxWave_2(void *pMsg)
|
||||||
{
|
{
|
||||||
u_int16_t value=(u_int16_t)(Test2.ave);
|
u_int16_t value=(u_int16_t)(wave_max_val_2.ave);
|
||||||
return FRT_swap_endian_16(value);
|
return FRT_swap_endian_16(value);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 111111111111111
|
* @brief 波形最大幅值E
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
static u_int16_t FRT_ReadRegTest3(void *pMsg)
|
static u_int16_t FRT_ReadReg_MaxWave_3(void *pMsg)
|
||||||
{
|
{
|
||||||
u_int16_t value=(u_int16_t)(Test3.ave);
|
u_int16_t value=(u_int16_t)(wave_max_val_3.ave);
|
||||||
return FRT_swap_endian_16(value);
|
return FRT_swap_endian_16(value);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 111111111111111
|
* @brief 波形最大幅值W
|
||||||
* @param
|
* @param
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
static u_int16_t FRT_ReadRegTest4(void *pMsg)
|
static u_int16_t FRT_ReadReg_MaxWave_4(void *pMsg)
|
||||||
{
|
{
|
||||||
u_int16_t value=(u_int16_t)(Test4.ave);
|
u_int16_t value=(u_int16_t)(wave_max_val_4.ave);
|
||||||
return FRT_swap_endian_16(value);
|
return FRT_swap_endian_16(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,7 +1155,7 @@ void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg)
|
||||||
start_reg_addr < 0x00 ||\
|
start_reg_addr < 0x00 ||\
|
||||||
(start_reg_addr > FRT_REGISTER_PRESSURE && start_reg_addr < FRT_REGISTER_DEVICE_ADDR) ||\
|
(start_reg_addr > FRT_REGISTER_PRESSURE && start_reg_addr < FRT_REGISTER_DEVICE_ADDR) ||\
|
||||||
(start_reg_addr > FRT_REGISTER_TEMPHUM_UPDATE_TIME && start_reg_addr < FRT_REGISTER_TRANSDUCER_CFG_1R5) ||\
|
(start_reg_addr > FRT_REGISTER_TEMPHUM_UPDATE_TIME && start_reg_addr < FRT_REGISTER_TRANSDUCER_CFG_1R5) ||\
|
||||||
start_reg_addr > FRT_REGISTER_TEST4 \
|
start_reg_addr > FRT_REGISTER_MAX_WAVE_4 \
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1168,7 +1167,7 @@ void FRT_MsgProc_ReadRegister(device_handle device, void *pMsg)
|
||||||
reg_num < 0x01 ||\
|
reg_num < 0x01 ||\
|
||||||
(((reg_num + start_reg_addr - 1) > FRT_REGISTER_PRESSURE) && ((reg_num + start_reg_addr - 1) < FRT_REGISTER_DEVICE_ADDR)) ||\
|
(((reg_num + start_reg_addr - 1) > FRT_REGISTER_PRESSURE) && ((reg_num + start_reg_addr - 1) < FRT_REGISTER_DEVICE_ADDR)) ||\
|
||||||
(((reg_num + start_reg_addr -1) > FRT_REGISTER_TEMPHUM_UPDATE_TIME) && ((reg_num + start_reg_addr -1) < FRT_REGISTER_TRANSDUCER_CFG_1R5)) ||\
|
(((reg_num + start_reg_addr -1) > FRT_REGISTER_TEMPHUM_UPDATE_TIME) && ((reg_num + start_reg_addr -1) < FRT_REGISTER_TRANSDUCER_CFG_1R5)) ||\
|
||||||
((reg_num + start_reg_addr -1) > FRT_REGISTER_TEST4) \
|
((reg_num + start_reg_addr -1) > FRT_REGISTER_MAX_WAVE_4) \
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue