cal_factor must be 1 when absent

This commit is contained in:
Joerg Lehmann 2020-02-29 13:59:34 +01:00
parent f3e2e0181a
commit 8592ba94aa
1 changed files with 3 additions and 3 deletions

View File

@ -655,7 +655,7 @@ void ReadSensors(SENSOR_data &sensor_data) {
// Gewicht berechnen
weight_current32 = (int32_t)((((res.weight1 - w1_0_real) / config_data.cal_w1_factor) + ((res.weight2 - w2_0_real) / config_data.cal_w2_factor)) / 5.0);
if (weight_current32 < 0) {
weight_current32 = 0;
} else if (weight_current32 > UINT16_MAX) {
@ -1364,7 +1364,7 @@ cCommandStream::CommandStatus cmdCalibrateScaleA(cCommandStream *pThis, void *pC
if (w1_gramm == "NA") {
// scale a is not connected
config_data.cal_w1_factor = 0.0;
config_data.cal_w1_factor = 1.0;
config_data.cal_w1_0 = NOT_ATTACHED;
} else {
setup_scales();
@ -1386,7 +1386,7 @@ cCommandStream::CommandStatus cmdCalibrateScaleB(cCommandStream *pThis, void *pC
if (w2_gramm == "NA") {
// scale b is not connected
config_data.cal_w2_factor = 0.0;
config_data.cal_w2_factor = 1.0;
config_data.cal_w2_0 = NOT_ATTACHED;
} else {
setup_scales();