I have a solar inverter that I'm successfully getting values from via ModbusMaster-particle - and so far it's working great for things like voltages, line frequency, percent load, etc - basically, anything that fits neatly into a byte value.

I went for extra credit, and am attempting to read charging watts, which has values like 6000, and that means I have to read a lo and hi register and then do the math to put the two values together. I thought I found an answer, but in using it now, the value I'm getting back is not making sense to me. So asking for help on what is probably a dumb mistake on my part...

Message spec for the device....

The register spec for the hi/lo values for AC charge current...

...and the subsection where I'm trying to do my thing... I want to get to charge AMPS but the device only tells me watts, so I divide watts by volts to get amps. Volts is reading fine.

```
//ac_charge_watts_high_byte
result = rs485.readInputRegisters(13,1);
if (result == rs485.ku8MBSuccess) {
STATS.ac_charge_watts_high_byte = rs485.getResponseBuffer(0);
}
//ac_charge_watts_low_byte
result = rs485.readInputRegisters(14,1);
if (result == rs485.ku8MBSuccess) {
STATS.ac_charge_watts_low_byte = rs485.getResponseBuffer(0);
}
//compute charge amps, as long as we are all non-zero (no div0 problems)
// credit: https://github.com/TheTrueRandom/growatt-modbus/blob/master/src/growattClient.js
// high_byte = 0
// low_byte = 410
// line_volts = 246.2
if(STATS.ac_charge_watts_high_byte >= 0 && STATS.ac_charge_watts_low_byte >= 0 && STATS.line_volts > 0) {
STATS.charge_current = (((STATS.ac_charge_watts_high_byte << 16 | STATS.ac_charge_watts_low_byte) / 10.0) / STATS.line_volts);
} else {
STATS.charge_current = 0.0;
}
```

I am expecting values like 20A, but am currently getting 5.7A via this code.

Added some debug cloud functions -

register 13 = 0 (ac watt high)

register 14 = 12280 (ac watt low) units 0.1W

12280 << 16 still equals 12280

12280 | 0 still equals 12280

12280/10 = 1228 / 245.9 (volts) = 5A - so the math is functioning, but the result is not.

Any fresh eyes spot a problem?

Thx for listening!