Skip to content

Commit

Permalink
Fix ESP8266 energy cal range chk
Browse files Browse the repository at this point in the history
  • Loading branch information
arendst committed Aug 20, 2024
1 parent ab2d6c1 commit ba7161f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,7 @@ void EnergyCommandSetCal(uint32_t cal_type) {
float Igoal = Pgoal / Ugoal; // 0.26087 A
float R = Ugoal / Igoal; // 881,666 Ohm

uint32_t channel = XdrvMailbox.index;
if (channel > Energy->phase_count) { channel = 1; }
channel--;
uint32_t channel = ((1 == XdrvMailbox.index -1) && (2 == Energy->phase_count)) ? 1 : 0;
float Umeas = Energy->voltage[channel]; // 232.0
// Calculate current and power based on measured voltage
float Ical = Umeas / R; // 0.26306 A
Expand Down

0 comments on commit ba7161f

Please sign in to comment.