From 72535848b6eb579d7ebbb3173895ee234b4a2950 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 7 Oct 2024 09:21:46 +1030 Subject: [PATCH] Cleanup SPI handles when re-starting --- tx/radio_wrappers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tx/radio_wrappers.py b/tx/radio_wrappers.py index 8fa70f6..68ed3a5 100644 --- a/tx/radio_wrappers.py +++ b/tx/radio_wrappers.py @@ -65,6 +65,10 @@ class RFM98W_Serial(object): Configure the RFM98W into direct asynchronous FSK mode, with the appropriate power, deviation, and transmit frequency. """ + # Cleanup any open file handlers. + if self.hw: + self.hw.teardown() + self.hw = HardwareInterface(self.spidevice) self.lora = LoRaRFM98W(self.hw, verbose=False)