---update for zero

This commit is contained in:
Yunhorn 2024-10-10 14:49:30 +08:00
parent 74799cf5ed
commit 5a32d524ec
2 changed files with 11 additions and 5 deletions

View File

@ -75,13 +75,13 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power
*/
#define DEBUGGER_ENABLED 0
#define DEBUGGER_ENABLED 1
/**
* @brief Disable Low Power mode
* @note 0: LowPowerMode enabled. MCU enters stop2 mode, 1: LowPowerMode disabled. MCU enters sleep mode only
*/
#define LOW_POWER_DISABLE 0
#define LOW_POWER_DISABLE 1
/* USER CODE BEGIN EC */

View File

@ -36,10 +36,16 @@ void sts_weight_scale_init(void)
void sts_weight_scale(sts_sensor_t *sts_sensor_data)
{
float tmp_net_weight[20]={0.0}, sum_tmp_net_weight=0.0;
//while(1)
{
Get_NetWeight();
for (uint8_t cnt=0;cnt<20;cnt++) {
Get_NetWeight();
tmp_net_weight[cnt] = net_weight;
sum_tmp_net_weight +=tmp_net_weight[cnt];
}
net_weight=sum_tmp_net_weight/20.0;
APP_LOG(TS_OFF, VLEVEL_M, "Net Weight = %d g \r\n", net_weight);
sts_sensor_data->weight_scale_value=net_weight;
@ -172,7 +178,7 @@ void Get_NetWeight(void)
//因为不同的传感器特性曲线不一样因此每一个传感器需要矫正这里的GapValue这个除数。
//当发现测试出来的重量偏大时,增加该数值。
//net_weight = KalmanFilter(net_weight);
net_weight = KalmanFilter(net_weight);
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n ##### Net Weight =%d \r\n", net_weight);//如果测试出来的重量偏小时,减小改数值。
}
}