add FHSS IRQ handling

This commit is contained in:
Morgan 'ARR\!' Allen 2021-12-02 10:02:08 -08:00
parent 6ad9cba796
commit a347f418c8

View file

@ -417,6 +417,21 @@ static void IRAM_ATTR lora32_dio_task(void *arg) {
// these *should* fire at the same time, defaults to false // these *should* fire at the same time, defaults to false
if(lora->cad_done != NULL) lora->cad_done(lora, cad_detected); if(lora->cad_done != NULL) lora->cad_done(lora, cad_detected);
} }
if((irqs & IRQ_FHSS_CHANGE) == IRQ_FHSS_CHANGE) {
ESP_LOGI(TAG, "switching channel %d: %d", lora->channel, lora->channels[lora->channel]);
if(lora->channel == 0 && lora->channels[lora->channel] == 0) continue;
if(lora->channels[lora->channel] == 0) {
ESP_LOGI(TAG, "reseting to channel 0");
lora->channel = 0;
}
lora32_set_frequency(lora, lora->frequency + (lora->channels[lora->channel] * bandwidths[lora->bandwidth]));
lora->channel++;
}
} }
} }