Hi,
I get the current from battery monitor but the numbers are always positive, even when the battery discharges. How can I get the sign to distinguish beween charging and discharging
This site is now in read-only archive mode. Please move all discussion, and create a new account at the new Victron Community site.
Hi,
I get the current from battery monitor but the numbers are always positive, even when the battery discharges. How can I get the sign to distinguish beween charging and discharging
It looks like the value is represented as a signed 16 bit number.
I would use a function, containing:
if (msg.payload > 2**8) { msg.payload -= 2**16 } return msg;
It checks if the number is larger than 2^8. If so, it subtracts 2^16 from the value.
48 People are following this question.