From 45478af0d36a9f6a066fa535e34539cc2879fb02 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 13 Feb 2024 16:27:21 +1100 Subject: [PATCH] lora/sx126x: Clean up some struct formatting. Changes are cosmetic - and maybe very minor code size - but not functional. _reg_read() was calling struct.packinto() with an incorrect number of arguments but it seems like Micropython didn't mind, as result is correct for both versions. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- micropython/lora/lora-sx126x/lora/sx126x.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/micropython/lora/lora-sx126x/lora/sx126x.py b/micropython/lora/lora-sx126x/lora/sx126x.py index ff0263d9d..eeb3bffb7 100644 --- a/micropython/lora/lora-sx126x/lora/sx126x.py +++ b/micropython/lora/lora-sx126x/lora/sx126x.py @@ -469,7 +469,7 @@ def calibrate(self): # See DS 13.1.12 Calibrate Function # calibParam 0xFE means to calibrate all blocks. - self._cmd("BBH", _CMD_SET_RX, timeout >> 16, timeout) + self._cmd(">BBH", _CMD_SET_RX, timeout >> 16, timeout) # 24 bits return self._dio1 @@ -729,10 +729,10 @@ def _cmd(self, fmt, *write_args, n_read=0, write_buf=None, read_buf=None): return res def _reg_read(self, addr): - return self._cmd("BBBB", _CMD_READ_REGISTER, addr >> 8, addr & 0xFF, n_read=1)[0] + return self._cmd(">BHB", _CMD_READ_REGISTER, addr, 0, n_read=1)[0] def _reg_write(self, addr, val): - return self._cmd("BBBB", _CMD_WRITE_REGISTER, addr >> 8, addr & 0xFF, val & 0xFF) + return self._cmd(">BHB", _CMD_WRITE_REGISTER, addr, val & 0xFF) class _SX1262(_SX126x):