Prepared switch bank control

This commit is contained in:
2025-12-28 09:26:22 +01:00
parent 1c78f24505
commit d6ce21ff03
2 changed files with 65 additions and 12 deletions

View File

@@ -155,9 +155,9 @@ def parse_127257(buf, boatdata):
boatdata.setValue("ROLL", roll)
def parse_127501(buf):
# Switch control status
# Switch bank control status
# 7 byte for switches every switch takes 2 bits
# 0 = Off, 1=On, 2 and 3 unknown
# 0 = Off, 1=On, 2=reserved and 3=no action
instance = buf[0]
switch = [0] * 28
ix = 0
@@ -169,18 +169,24 @@ def parse_127501(buf):
ix += 1
def parse_127502(buf):
# Switch control
# Switch bank control
# 7 byte for switches every switch takes 2 bits
# 0 = Off, 1=On, 2 and 3 unknown
# 0 = Off, 1=On, 2=reserved and 3=no action
instance = buf[0]
switch = [0] * 28
ix = 0
for b in range(1, 8):
val = buf[b]
for x in range(4):
switch[ix] = val & 0x03
val = val >> 2
ix += 1
if instance in boatdata.switchbank:
ix = 1
for b in range(1, 8):
val = buf[b]
for x in range(4):
switch = val & 0x03
if switch == 1:
boatdata.switchbank[instance].setSwitchOn(ix)
elif switch == 0:
boatdata.switchbank[instance].setSwitchOff(ix)
val = val >> 2
ix += 1
else:
print(f"Switchbank {instance} not defined")
def parse_127505(buf, boatdata):
# Fluid Level