diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino index a669363c3..aae18311e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino @@ -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; } + } } } diff --git a/tasmota/tasmota_xnrg_energy/xnrg_25_v9240.ino b/tasmota/tasmota_xnrg_energy/xnrg_25_v9240.ino index e9a15f121..56c60cfac 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_25_v9240.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_25_v9240.ino @@ -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; }