From c3f61ce3f790fb88e045f1232c82f6e5065c21be Mon Sep 17 00:00:00 2001 From: MarekWo Date: Mon, 6 Apr 2026 14:33:13 +0200 Subject: [PATCH] fix: get radio returns actual values, implement set radio command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get radio used wrong key names (freq/bw/sf/cr instead of radio_freq/radio_bw/radio_sf/radio_cr from SELF_INFO payload). set radio was missing entirely — would silently fall through to custom variable handler. Now parses freq,bw,sf,cr and calls mc.commands.set_radio(). Co-Authored-By: Claude Opus 4.6 --- app/device_manager.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/device_manager.py b/app/device_manager.py index 04aae96..54d2cbd 100644 --- a/app/device_manager.py +++ b/app/device_manager.py @@ -2879,10 +2879,10 @@ class DeviceManager: return {'success': True, 'data': bat or {}} elif param == 'radio': return {'success': True, 'data': { - 'freq': info.get('freq', '?'), - 'bw': info.get('bw', '?'), - 'sf': info.get('sf', '?'), - 'cr': info.get('cr', '?'), + 'freq': info.get('radio_freq', '?'), + 'bw': info.get('radio_bw', '?'), + 'sf': info.get('radio_sf', '?'), + 'cr': info.get('radio_cr', '?'), }} elif param == 'stats': stats = self.get_device_stats() @@ -2934,6 +2934,14 @@ class DeviceManager: lat = info.get('lat', 0) self.execute(self.mc.commands.set_coords(lat, float(value)), timeout=5) return {'success': True, 'message': f'Lon set to: {value}'} + elif param == 'radio': + parts = value.split(',') + if len(parts) != 4: + return {'success': False, 'error': 'Format: set radio ,,,'} + freq, bw = float(parts[0].strip()), float(parts[1].strip()) + sf, cr = int(parts[2].strip()), int(parts[3].strip()) + self.execute(self.mc.commands.set_radio(freq, bw, sf, cr), timeout=5) + return {'success': True, 'message': f'Radio set to: freq={freq}, bw={bw}, sf={sf}, cr={cr}'} elif param == 'pin': self.execute(self.mc.commands.set_devicepin(value), timeout=5) return {'success': True, 'message': 'PIN set'}