mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Fix ESP32 compilation V9240
This commit is contained in:
parent
007608914c
commit
cae4551762
@ -924,7 +924,6 @@ uint32_t EnergyGetCalibration(uint32_t cal_type, uint32_t chan = 0) {
|
||||
case ENERGY_POWER_CALIBRATION: return Settings->energy_power_calibration;
|
||||
case ENERGY_VOLTAGE_CALIBRATION: return Settings->energy_voltage_calibration;
|
||||
case ENERGY_CURRENT_CALIBRATION: return Settings->energy_current_calibration;
|
||||
|
||||
}
|
||||
}
|
||||
return Settings->energy_frequency_calibration;
|
||||
@ -1301,6 +1300,7 @@ void EnergyShow(bool json) {
|
||||
else if (0 == Energy->current[i]) {
|
||||
reactive_power[i] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,13 +379,23 @@ float V9240::value(const V9240::parameter p) const
|
||||
|
||||
void V9240::set_checksum()
|
||||
{
|
||||
CKSUM = UINT32_MAX - std::accumulate(rw_mem,rw_mem+rw_len-1 ,0);
|
||||
// CKSUM = UINT32_MAX - std::accumulate(rw_mem,rw_mem+rw_len-1 ,0);
|
||||
int init = 0;
|
||||
for (uint32_t i = 0; i < rw_len-1; i++) {
|
||||
init += rw_mem[i];
|
||||
}
|
||||
CKSUM = UINT32_MAX - init;
|
||||
write(Address::CKSUM,CKSUM);
|
||||
}
|
||||
|
||||
char V9240::calc_check(char *buff, size_t len)
|
||||
{
|
||||
return ~std::accumulate(buff,buff+len,0)+0x33;
|
||||
// return ~std::accumulate(buff,buff+len,0)+0x33;
|
||||
char init = 0;
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
init += buff[i];
|
||||
}
|
||||
return ~init + 0x33;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user