---add auto recalibration when remove bottle of soap
This commit is contained in:
parent
246d3d9949
commit
8ebcc9e014
|
@ -21,16 +21,16 @@
|
||||||
#include "sts_weight_scale.h"
|
#include "sts_weight_scale.h"
|
||||||
|
|
||||||
uint32_t HX711_Buffer;
|
uint32_t HX711_Buffer;
|
||||||
uint32_t gross_weight;
|
volatile uint32_t gross_weight;
|
||||||
int32_t net_weight;
|
int32_t net_weight;
|
||||||
uint8_t Flag_Error;
|
uint8_t Flag_Error;
|
||||||
|
volatile uint32_t last_net_weight=0;
|
||||||
int sts_weight_scale(void)
|
int sts_weight_scale(void)
|
||||||
{
|
{
|
||||||
HX711_Init();
|
HX711_Init();
|
||||||
Get_GrossWeight();
|
Get_GrossWeight();
|
||||||
|
|
||||||
HAL_Delay(2000);
|
HAL_Delay(500);
|
||||||
|
|
||||||
Get_GrossWeight();
|
Get_GrossWeight();
|
||||||
|
|
||||||
|
@ -38,12 +38,18 @@ int sts_weight_scale(void)
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
Get_NetWeight();
|
Get_NetWeight();
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "Net Weight = %d g \r\n", net_weight);
|
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);
|
HAL_Delay(2000);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-752586124573436390" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1200016478792897337" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-752586124573436390" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1200016478792897337" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|
Loading…
Reference in New Issue