mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
Fix EnergyReset type unsigned long
This commit is contained in:
parent
503a0d9f00
commit
9ab00b533c
@ -507,39 +507,20 @@ boolean HlwCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_len,
|
|||||||
unit = UNIT_MILLIAMPERE;
|
unit = UNIT_MILLIAMPERE;
|
||||||
}
|
}
|
||||||
else if ((CMND_ENERGYRESET == command_code) && (index > 0) && (index <= 3)) {
|
else if ((CMND_ENERGYRESET == command_code) && (index > 0) && (index <= 3)) {
|
||||||
/*
|
|
||||||
if ((payload >= 1) && (payload <= 3)) {
|
|
||||||
switch (payload) {
|
|
||||||
case 1:
|
|
||||||
hlw_kWhtoday = 0;
|
|
||||||
RtcSettings.hlw_kWhtoday = 0;
|
|
||||||
Settings.hlw_kWhtoday = 0;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Settings.hlw_kWhyesterday = 0;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
RtcSettings.hlw_kWhtotal = 0;
|
|
||||||
Settings.hlw_kWhtotal = RtcSettings.hlw_kWhtotal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
char *p;
|
char *p;
|
||||||
long lnum = strtol(dataBuf, &p, 10);
|
unsigned long lnum = strtoul(dataBuf, &p, 10);
|
||||||
if (p != dataBuf) {
|
if (p != dataBuf) {
|
||||||
lnum *= 100;
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 1:
|
case 1:
|
||||||
hlw_kWhtoday = lnum *1000;
|
hlw_kWhtoday = lnum *100000;
|
||||||
RtcSettings.hlw_kWhtoday = hlw_kWhtoday;
|
RtcSettings.hlw_kWhtoday = hlw_kWhtoday;
|
||||||
Settings.hlw_kWhtoday = hlw_kWhtoday;
|
Settings.hlw_kWhtoday = hlw_kWhtoday;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Settings.hlw_kWhyesterday = lnum *1000;
|
Settings.hlw_kWhyesterday = lnum *100000;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
RtcSettings.hlw_kWhtotal = lnum;
|
RtcSettings.hlw_kWhtotal = lnum *100;
|
||||||
Settings.hlw_kWhtotal = RtcSettings.hlw_kWhtotal;
|
Settings.hlw_kWhtotal = RtcSettings.hlw_kWhtotal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user