diff --git a/Core/Src/sts_weight_scale.c b/Core/Src/sts_weight_scale.c
index 8ffd183..bfd89a8 100644
--- a/Core/Src/sts_weight_scale.c
+++ b/Core/Src/sts_weight_scale.c
@@ -21,16 +21,16 @@
#include "sts_weight_scale.h"
uint32_t HX711_Buffer;
-uint32_t gross_weight;
+volatile uint32_t gross_weight;
int32_t net_weight;
uint8_t Flag_Error;
-
+volatile uint32_t last_net_weight=0;
int sts_weight_scale(void)
{
HX711_Init();
Get_GrossWeight();
- HAL_Delay(2000);
+ HAL_Delay(500);
Get_GrossWeight();
@@ -38,12 +38,18 @@ int sts_weight_scale(void)
while(1)
{
Get_NetWeight();
-
APP_LOG(TS_OFF, VLEVEL_M, "Net Weight = %d g \r\n", net_weight);
+ last_net_weight = net_weight;
+ if (((last_net_weight - net_weight) > 100) && (net_weight > 100)) // re-calibrate
+ {
+ Get_GrossWeight();
+ HAL_Delay(100);
+ Get_GrossWeight();
+ HAL_Delay(2000);
+ }
HAL_Delay(2000);
-
}
}
diff --git a/STM32CubeIDE/.settings/language.settings.xml b/STM32CubeIDE/.settings/language.settings.xml
index 816e149..90666d3 100644
--- a/STM32CubeIDE/.settings/language.settings.xml
+++ b/STM32CubeIDE/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+