Skip to content

Commit 0dd269c

Browse files
committed
Fixes for the new register reader.
1 parent e2a47a6 commit 0dd269c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

aspSUB20.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,21 @@ def processingThread(self):
273273
@staticmethod
274274
def _read_register(sub20SN, device_count, devices, spi_registers, maxRetry=MAX_SPI_RETRY, waitRetry=WAIT_SPI_RETRY):
275275
command = ["/usr/local/bin/readARXDevice", str(sub20SN), str(device_count)]
276-
for dev,cmd in zip(devices,spi_commands):
276+
for dev,reg in zip(devices,spi_registers):
277277
command.append(str(dev))
278-
command.append("0x%04X" % cmd)
278+
command.append("0x%04X" % reg)
279279

280280
regRE = re.compile(r'(?P<device>\d*): (?P<register>0x[0-9a-fA-F]*)')
281281

282282
attempt = 0
283-
status = True
283+
status = False
284284
data = {}
285285
while ((not status) and (attempt <= maxRetry)):
286286
if attempt != 0:
287287
time.sleep(waitRetry)
288288

289289
try:
290-
resp = subprocess.check_output(command)
290+
resp = subprocess.check_output(command, text=True)
291291
for line in resp.split('\n'):
292292
mtch = regRE.search(line)
293293
if mtch:
@@ -323,16 +323,16 @@ def read_register(self, device, register):
323323

324324
if device >= self._sub20Mapper[sub20SN][0] and device <= self._sub20Mapper[sub20SN][1]:
325325
devices = [device - self._sub20Mapper[sub20SN][0] + 1,]
326-
commands = [command,]
327-
sub_data = self._run_command(sub20SN, device_count, devices, commands, maxRetry=self._maxRetry, waitRetry=self._waitRetry)
326+
commands = [register,]
327+
sub_data = self._read_register(sub20SN, device_count, devices, commands, maxRetry=self._maxRetry, waitRetry=self._waitRetry)
328328
data.update(sub_data)
329329

330330
if not data:
331331
data = False
332332
elif len(data.keys()) == 1:
333-
data = data.items()[]
333+
data = list(data.values())[0]
334334

335-
return data
335+
return data
336336

337337

338338
def psuSend(sub20SN, psuAddress, state, maxRetry=MAX_I2C_RETRY, waitRetry=WAIT_I2C_RETRY):

0 commit comments

Comments
 (0)