From 38377d32af270a096df14c3ca40d6ea7072858e8 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Wed, 26 Feb 2020 07:43:00 -0800 Subject: [PATCH] log spreadfactor after value has been forced into range --- main/esp32-lora.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/esp32-lora.c b/main/esp32-lora.c index 8f576b2..96fb3c8 100644 --- a/main/esp32-lora.c +++ b/main/esp32-lora.c @@ -216,8 +216,6 @@ void lora32_toggle_reset(lora32_cfg_t *config) { } void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor) { - ESP_LOGI(TAG, "lora32_set_spreadfactor: %d", factor); - if(factor <= 6) { factor = 6; @@ -230,6 +228,8 @@ void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor) { lora32_write_reg(lora, REG_DETECTION_THRESHOLD, DETECT_THRES_OTHER); } + ESP_LOGI(TAG, "lora32_set_spreadfactor: %d", factor); + lora32_write_reg(lora, REG_MODEM_CONFIG_2, (lora32_read_reg(lora, REG_MODEM_CONFIG_2) & 0x0F) | ((factor << 4) & 0xF0)); }