From 8d31cba18c5fe08c8827358f877f043310be2346 Mon Sep 17 00:00:00 2001 From: E-t0m <110770475+E-t0m@users.noreply.github.com> Date: Sun, 10 Sep 2023 10:07:52 +0200 Subject: [PATCH] fixing soyosource data frame There was an error in an old fix, that solved wrong values in small demands < 20 W. But introduced errors around 250 / 500 W. This one is tested with 3 different hardware versions and no anomaly was found anymore. --- zeroinput.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zeroinput.py b/zeroinput.py index ed63f26..17ece50 100644 --- a/zeroinput.py +++ b/zeroinput.py @@ -65,7 +65,9 @@ def set_soyo_demand(ser,power): # create the packet for soyosource gti pu = power >> 8 pl = power & 0xFF cs = 264 - pu - pl - if cs >= 256: cs = 8 + if cs > 255: + if power > 250: cs -= 256 + else: cs -= 255 ser.write( bytearray([0x24,0x56,0x00,0x21,pu,pl,0x80,cs]) ) ser.flush()