trx_toolkit: simplify Transceiver.power_event_handler()

Change-Id: I283f7ced0309bf823ad78c90e8006b9e9474dee7
changes/59/28759/8
Vadim Yanitskiy 7 months ago
parent cea02697a9
commit 8144470129
  1. 10
      src/target/trx_toolkit/ctrl_if_trx.py
  2. 16
      src/target/trx_toolkit/transceiver.py

@ -107,10 +107,7 @@ class CTRLInterfaceTRX(CTRLInterface):
return -1
log.info("(%s) Starting transceiver..." % self.trx)
self.trx.running = True
# Notify transceiver about that
self.trx.power_event_handler("POWERON")
self.trx.power_event_handler(poweron=True)
return 0
@ -118,10 +115,7 @@ class CTRLInterfaceTRX(CTRLInterface):
log.debug("(%s) Recv POWEROFF cmd" % self.trx)
log.info("(%s) Stopping transceiver..." % self.trx)
self.trx.running = False
# Notify transceiver about that
self.trx.power_event_handler("POWEROFF")
self.trx.power_event_handler(poweron=False)
return 0

@ -222,19 +222,13 @@ class Transceiver:
def ctrl_cmd_handler(self, request):
return None
def power_event_handler(self, event):
# Update child transceivers
for trx in self.child_trx_list.trx_list:
if event == "POWERON":
trx.running = True
elif event == "POWEROFF":
trx.running = False
def power_event_handler(self, poweron: bool) -> None:
# Update self and child transceivers
for trx in [self, *self.child_trx_list.trx_list]:
trx.running = poweron
if not poweron:
trx.disable_fh()
# Reset frequency hopping parameters
if event == "POWEROFF":
self.disable_fh()
# Trigger clock generator if required
if self.clck_gen is not None:
clck_links = self.clck_gen.clck_links

Loading…
Cancel
Save