Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit c046f5f

Browse files
gijsiomsariisik
authored andcommitted
fixes the re-initialization of lora OTAA
return the semaphore taken by the previous, unsuccesful, join attempt. When re-initializing lora, it would wait indefinitely
1 parent 12e32a6 commit c046f5f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

esp32/mods/modlora.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -1102,16 +1102,16 @@ static void TASK_LoRa (void *pvParameters) {
11021102
#endif
11031103
mibReq.Type = MIB_NETWORK_ACTIVATION;
11041104
mibReq.Param.NetworkActivation = ACTIVATION_TYPE_OTAA;
1105-
LoRaMacMibSetRequestConfirm( &mibReq );
1106-
1107-
TimerStart( &TxNextActReqTimer );
1105+
LoRaMacMibSetRequestConfirm( &mibReq );
1106+
1107+
TimerStart( &TxNextActReqTimer );
11081108
mlmeReq.Type = MLME_JOIN;
11091109
mlmeReq.Req.Join.DevEui = (uint8_t *)lora_obj.u.otaa.DevEui;
11101110
mlmeReq.Req.Join.AppEui = (uint8_t *)lora_obj.u.otaa.AppEui;
11111111
mlmeReq.Req.Join.AppKey = (uint8_t *)lora_obj.u.otaa.AppKey;
11121112
mlmeReq.Req.Join.NbTrials = 1;
11131113
mlmeReq.Req.Join.DR = (uint8_t) lora_obj.otaa_dr;
1114-
LoRaMacMlmeRequest( &mlmeReq );
1114+
LoRaMacMlmeRequest( &mlmeReq );
11151115
} else {
11161116
mibReq.Type = MIB_NETWORK_ACTIVATION;
11171117
mibReq.Param.NetworkActivation = ACTIVATION_TYPE_ABP;
@@ -1692,6 +1692,13 @@ static bool lora_tx_space (void) {
16921692
/// \class LoRa - Semtech SX1272 radio driver
16931693
static mp_obj_t lora_init_helper(lora_obj_t *self, const mp_arg_val_t *args) {
16941694
lora_cmd_data_t cmd_data;
1695+
xSemaphoreGive(xLoRaSigfoxSem);
1696+
// vEventGroupDelete(LoRaEvents);
1697+
// xQueueReset(xCmdQueue);
1698+
// xQueueReset(xRxQueue);
1699+
// xQueueReset(xCbQueue);
1700+
// LoRaEvents = xEventGroupCreate();
1701+
16951702

16961703
cmd_data.info.init.stack_mode = args[0].u_int;
16971704
lora_validate_mode (cmd_data.info.init.stack_mode);

0 commit comments

Comments
 (0)