diff --git a/drivers/include/sx127x.h b/drivers/include/sx127x.h index c7712be83839ace42436d5e3d03785c806c0cbcb..0d9f4f4be5138dc5d57f848f5da0ad2777f7a5a0 100644 --- a/drivers/include/sx127x.h +++ b/drivers/include/sx127x.h @@ -173,8 +173,8 @@ typedef struct { uint8_t coderate; /**< Error coding rate */ uint8_t freq_hop_period; /**< Frequency hop period */ uint8_t flags; /**< Boolean flags */ - uint32_t rx_timeout; /**< RX timeout in symbols */ - uint32_t tx_timeout; /**< TX timeout in symbols */ + uint32_t rx_timeout; /**< RX timeout in microseconds */ + uint32_t tx_timeout; /**< TX timeout in microseconds */ } sx127x_lora_settings_t; /** diff --git a/drivers/sx127x/sx127x_getset.c b/drivers/sx127x/sx127x_getset.c index 46a27bb67b851fbab7acf77cc4cf850053b197f5..ec60723425dd186e884edc314a00c92c5bd38510 100644 --- a/drivers/sx127x/sx127x_getset.c +++ b/drivers/sx127x/sx127x_getset.c @@ -313,6 +313,7 @@ void sx127x_set_rx(sx127x_t *dev) xtimer_set(&(dev->_internal.rx_timeout_timer), dev->settings.lora.rx_timeout); } + if (dev->settings.lora.flags & SX127X_RX_CONTINUOUS_FLAG) { sx127x_set_op_mode(dev, SX127X_RF_LORA_OPMODE_RECEIVER); } @@ -830,13 +831,11 @@ void sx127x_set_symbol_timeout(sx127x_t *dev, uint16_t timeout) { DEBUG("[sx127x] Set symbol timeout: %d\n", timeout); - dev->settings.lora.rx_timeout = timeout; - uint8_t config2_reg = sx127x_reg_read(dev, SX127X_REG_LR_MODEMCONFIG2); config2_reg &= SX127X_RF_LORA_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK; config2_reg |= (timeout >> 8) & ~SX127X_RF_LORA_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK; sx127x_reg_write(dev, SX127X_REG_LR_MODEMCONFIG2, config2_reg); - sx127x_reg_write(dev, SX127X_REG_LR_SYMBTIMEOUTLSB,timeout & 0xFF); + sx127x_reg_write(dev, SX127X_REG_LR_SYMBTIMEOUTLSB, timeout & 0xFF); } bool sx127x_get_iq_invert(const sx127x_t *dev) diff --git a/drivers/sx127x/sx127x_netdev.c b/drivers/sx127x/sx127x_netdev.c index 84d22c38b4d1d4673306e659b094f491870a6bb5..72b355c4c1aaba4e55cf0c293bd52048ac166d15 100644 --- a/drivers/sx127x/sx127x_netdev.c +++ b/drivers/sx127x/sx127x_netdev.c @@ -194,7 +194,6 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) } xtimer_remove(&dev->_internal.rx_timeout_timer); - /* Read the last packet from FIFO */ uint8_t last_rx_addr = sx127x_reg_read(dev, SX127X_REG_LR_FIFORXCURRENTADDR); sx127x_reg_write(dev, SX127X_REG_LR_FIFOADDRPTR, last_rx_addr);