sipo fixes and demo
This commit is contained in:
@@ -96,6 +96,7 @@ class Client:
|
||||
|
||||
self.unit_lu = {}
|
||||
|
||||
callsigns = []
|
||||
for n in range(0,count):
|
||||
cs = pp.u8()
|
||||
name = pp.str()
|
||||
@@ -106,6 +107,9 @@ class Client:
|
||||
'callsign': cs,
|
||||
'type': type,
|
||||
}
|
||||
if cs in callsigns:
|
||||
raise Exception("Duplicate callsign! Wrong GEX config!")
|
||||
callsigns.append(cs)
|
||||
|
||||
def ini_read(self) -> str:
|
||||
""" Read the settings INI file """
|
||||
|
||||
+3
-1
@@ -16,12 +16,14 @@ class SIPO(gex.Unit):
|
||||
def _type(self):
|
||||
return 'SIPO'
|
||||
|
||||
def load(self, buffers, confirm=True):
|
||||
def load(self, buffers, end=0x0000, confirm=True):
|
||||
""" Load data - buffers is a list of lists or byte arrays """
|
||||
if type(buffers[0]) == int:
|
||||
buffers = [buffers]
|
||||
|
||||
pb = gex.PayloadBuilder()
|
||||
pb.u16(end)
|
||||
|
||||
for b in buffers:
|
||||
pb.blob(b)
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import time
|
||||
|
||||
import gex
|
||||
|
||||
with gex.Client(gex.TrxRawUSB()) as client:
|
||||
sipo = gex.SIPO(client, 'sipo')
|
||||
d4 = gex.DOut(client, 'd4')
|
||||
|
||||
# Jort the lights
|
||||
sipo.load([
|
||||
[0x0a, 0x0f],
|
||||
[0xF8, 0xFC],
|
||||
[0x00, 0x00],
|
||||
[0x02, 0x00],
|
||||
], end=0x04)
|
||||
|
||||
d4.write(1)
|
||||
# sipo.set_data(0x04)
|
||||
# sipo.store()
|
||||
Reference in New Issue
Block a user