Here's the problematic section. Starting here.
Code: Select all
// allocate lora32_cfg_t to receive config from Queue
lora32_cfg_t *lora = malloc(sizeof(lora32_cfg_t));
while(1) {
// wait for event over Queue
if(xQueueReceive(dio_event_queue, (void*)lora, portMAX_DELAY) != pdPASS) continue;
lora32_set_frequency(lora, lora->frequency + (lora->channels[lora->channel] * bandwidths[lora->bandwidth]));
lora->channel++;
}
One of my suspicions is the malloc at the start but I'm unable to think of another way to handle multiple devices with a single task. Another area of concern is the path the pointer takes. The setup start around line 583. Here the lora32_cfg_t is passed to the ISR handler, which simple passes it along with xQueueSend, doing nothing else.
Line 583
Code: Select all
gpio_isr_handler_add(lora->dio0, lora32_on_dio, (void*)lora);
Code: Select all
static void IRAM_ATTR lora32_on_dio(void *arg) {
xQueueSend(dio_event_queue, arg, (TickType_t)0);
}
I'm pretty stumped by this one, when reading all the data seems fine and intact but writing back to the pointer clearly isn't working. Any insight would be appreciated and I'll keep updating this for clarification as I get back to hacking.