@@ -267,7 +267,8 @@ static TimerEvent_t TxNextActReqTimer;
267267static nvs_handle modlora_nvs_handle ;
268268static const char * modlora_nvs_data_key [E_LORA_NVS_NUM_KEYS ] = { "JOINED" , "UPLNK" , "DWLNK" , "DEVADDR" ,
269269 "NWSKEY" , "APPSKEY" , "NETID" , "ADRACK" ,
270- "MACPARAMS" , "CHANNELS" , "SRVACK" };
270+ "MACPARAMS" , "CHANNELS" , "SRVACK" , "MACNXTTX" ,
271+ "MACBUFIDX" , "MACRPTIDX" , "MACBUF" , "MACRPTBUF" };
271272
272273/******************************************************************************
273274 DECLARE PRIVATE FUNCTIONS
@@ -785,6 +786,32 @@ static void TASK_LoRa (void *pvParameters) {
785786 * ack_req = false;
786787 }
787788
789+ uint32_t mac_cmd_next_tx ;
790+ modlora_nvs_get_uint (E_LORA_NVS_MAC_NXT_TX , (uint32_t * )& mac_cmd_next_tx );
791+ bool * next_tx = LoRaMacGetMacCmdNextTx ();
792+ if (mac_cmd_next_tx ) {
793+ * next_tx = true;
794+ } else {
795+ * next_tx = false;
796+ }
797+
798+ uint32_t mac_cmd_buffer_idx ;
799+ modlora_nvs_get_uint (E_LORA_NVS_MAC_CMD_BUF_IDX , (uint32_t * )& mac_cmd_buffer_idx );
800+ uint8_t * buffer_idx = LoRaMacGetMacCmdBufferIndex ();
801+ * buffer_idx = mac_cmd_buffer_idx ;
802+
803+ modlora_nvs_get_uint (E_LORA_NVS_MAC_CMD_BUF_RPT_IDX , (uint32_t * )& mac_cmd_buffer_idx );
804+ buffer_idx = LoRaMacGetMacCmdBufferRepeatIndex ();
805+ * buffer_idx = mac_cmd_buffer_idx ;
806+
807+ // write the buffered MAC commads directly from NVRAM
808+ length = 15 ;
809+ modlora_nvs_get_blob (E_LORA_NVS_ELE_MAC_BUF , (void * )LoRaMacGetMacCmdBuffer (), & length );
810+
811+ // write the buffered MAC commads to repeat directly from NVRAM
812+ length = 15 ;
813+ modlora_nvs_get_blob (E_LORA_NVS_ELE_MAC_RPT_BUF , (void * )LoRaMacGetMacCmdBufferRepeat (), & length );
814+
788815 lora_obj .activation = E_LORA_ACTIVATION_ABP ;
789816 lora_obj .state = E_LORA_STATE_JOIN ;
790817 // clear the joined flag until the nvram_save method is called again
0 commit comments