log spreadfactor after value has been forced into range

This commit is contained in:
Morgan 'ARR\!' Allen 2020-02-26 07:43:00 -08:00
parent 4af5798765
commit 38377d32af

View file

@ -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));
}