Fix Shelly 2.5 low reactive power channels

This commit is contained in:
Theo Arends 2022-10-13 09:42:42 +02:00
parent d0ee5776e5
commit 4471868580
1 changed files with 7 additions and 1 deletions

View File

@ -406,7 +406,13 @@ void Ade7953GetData(void) {
} else { } else {
Ade7953.active_power[channel] = abs(reg[channel][1]); Ade7953.active_power[channel] = abs(reg[channel][1]);
apparent_power[channel] = abs(reg[channel][2]); apparent_power[channel] = abs(reg[channel][2]);
reactive_power[channel] = ((acc_mode & VARNLOAD[channel]) != 0) ? 0 : abs(reg[channel][3]);
uint32_t swapped_channel = channel;
if (ADE7953_SHELLY_25 == Ade7953.model) {
swapped_channel = ~channel;
}
reactive_power[channel] = ((acc_mode & VARNLOAD[swapped_channel]) != 0) ? 0 : abs(reg[channel][3]);
} }
} }