diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index e6a95eae2..d1f82a2d0 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -2,6 +2,7 @@ * Add more API callbacks and document API.md * Add support for La Crosse TX20 Anemometer (#2654, #3146) * Add optional HX711 scale interface to web GUI demonstrating easy GUI plug-in + * Resize HX711 weight_item field from 16 bit to 32 bit * * 6.2.1.17 20181017 * Enable updated non-blocking PubSubClient as default MQTT client diff --git a/sonoff/settings.h b/sonoff/settings.h index bef70acc5..29aaf2121 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -322,9 +322,12 @@ struct SYSCFG { uint16_t mcp230xx_int_timer; // 718 uint8_t rgbwwTable[5]; // 71A - byte free_71F[157]; // 71F + byte free_71F[153]; // 71F + + unsigned long weight_item; // 7B8 Weight of one item in gram * 10 + + byte free_7BC[2]; // 7BC - uint16_t weight_item; // 7BC Weight of one item in gram * 10 uint16_t weight_max; // 7BE Total max weight in kilogram unsigned long weight_reference; // 7C0 Reference weight in gram unsigned long weight_calibration; // 7C4 diff --git a/sonoff/xsns_34_hx711.ino b/sonoff/xsns_34_hx711.ino index 64736f574..7e9b7ff30 100644 --- a/sonoff/xsns_34_hx711.ino +++ b/sonoff/xsns_34_hx711.ino @@ -195,7 +195,7 @@ bool HxCommand() break; case 6: // WeightItem if (strstr(XdrvMailbox.data, ",")) { - Settings.weight_item = (uint16_t)(CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 2)) * 10); + Settings.weight_item = (unsigned long)(CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 2)) * 10); } show_parms = true; break; @@ -440,7 +440,7 @@ void HxSaveSettings() char tmp[100]; WebGetArg("p2", tmp, sizeof(tmp)); - Settings.weight_item = (!strlen(tmp)) ? 0 : (uint16_t)(CharToDouble(tmp) * 10000); + Settings.weight_item = (!strlen(tmp)) ? 0 : (unsigned long)(CharToDouble(tmp) * 10000); HxLogUpdates(); }