Resize HX711 weight_item field

Resize HX711 weight_item field from 16 bit to 32 bit
This commit is contained in:
Theo Arends 2018-10-21 17:54:51 +02:00
parent b15f0026b7
commit a7c912111c
3 changed files with 8 additions and 4 deletions

View File

@ -2,6 +2,7 @@
* Add more API callbacks and document API.md * Add more API callbacks and document API.md
* Add support for La Crosse TX20 Anemometer (#2654, #3146) * Add support for La Crosse TX20 Anemometer (#2654, #3146)
* Add optional HX711 scale interface to web GUI demonstrating easy GUI plug-in * 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 * 6.2.1.17 20181017
* Enable updated non-blocking PubSubClient as default MQTT client * Enable updated non-blocking PubSubClient as default MQTT client

View File

@ -322,9 +322,12 @@ struct SYSCFG {
uint16_t mcp230xx_int_timer; // 718 uint16_t mcp230xx_int_timer; // 718
uint8_t rgbwwTable[5]; // 71A 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 uint16_t weight_max; // 7BE Total max weight in kilogram
unsigned long weight_reference; // 7C0 Reference weight in gram unsigned long weight_reference; // 7C0 Reference weight in gram
unsigned long weight_calibration; // 7C4 unsigned long weight_calibration; // 7C4

View File

@ -195,7 +195,7 @@ bool HxCommand()
break; break;
case 6: // WeightItem case 6: // WeightItem
if (strstr(XdrvMailbox.data, ",")) { 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; show_parms = true;
break; break;
@ -440,7 +440,7 @@ void HxSaveSettings()
char tmp[100]; char tmp[100];
WebGetArg("p2", tmp, sizeof(tmp)); 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(); HxLogUpdates();
} }