From f6a5efe8fad8e62184291b967cc84833b26e5cf7 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Fri, 12 Jul 2024 12:55:40 +0800 Subject: [PATCH] --- revised gap value for 20kg --- Core/Src/sts_weight_scale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Src/sts_weight_scale.c b/Core/Src/sts_weight_scale.c index d5b768a..0a4905a 100644 --- a/Core/Src/sts_weight_scale.c +++ b/Core/Src/sts_weight_scale.c @@ -73,7 +73,7 @@ uint8_t Flag_Error = 0; //#define GapValue 903.2 // for 1kg bar //#define GapValue 106.5 // for 20kg bar //#define GapValue 101.5 // for 20kg bar -#define GapValue 99.0 // for 20kg bar +#define GapValue 99.08 // for 20kg bar void HX711_Init(void) { @@ -151,7 +151,7 @@ uint32_t HX711_Read(void) //增益128 void Get_GrossWeight(void) { gross_weight = HX711_Read(); - gross_weight = KalmanFilter(gross_weight); + //gross_weight = KalmanFilter(gross_weight); //APP_LOG(TS_OFF, VLEVEL_M, "\r\n ##### Gross Weight =%d <<<<<< \r\n",gross_weight); } @@ -167,7 +167,7 @@ void Get_NetWeight(void) net_weight = HX711_Buffer; net_weight = net_weight - gross_weight; //获取实物的AD采样数值。 - net_weight = (int32_t)((float)net_weight/GapValue); //计算实物的实际重量 + net_weight = (int32_t)((float)net_weight/(float)GapValue); //计算实物的实际重量 //因为不同的传感器特性曲线不一样,因此,每一个传感器需要矫正这里的GapValue这个除数。 //当发现测试出来的重量偏大时,增加该数值。