From efd0cc3819850ab034d744aef8154da0aa05d762 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 3 Mar 2020 16:52:29 +0100 Subject: [PATCH] lorawan.cpp: code sanitizations --- include/lorawan.h | 2 +- src/lorawan.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/lorawan.h b/include/lorawan.h index 4afc5982..90a7db56 100644 --- a/include/lorawan.h +++ b/include/lorawan.h @@ -46,7 +46,7 @@ void lora_queuereset(void); void IRAM_ATTR myEventCallback(void *pUserData, ev_t ev); void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg, size_t nMsg); -void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess); +//void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess); void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[], const uint8_t tablesize); //u1_t os_getBattLevel(void); diff --git a/src/lorawan.cpp b/src/lorawan.cpp index 80bd768a..5c9ab138 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -261,10 +261,14 @@ void lora_send(void *pvParameters) { // attempt to transmit payload else { - // switch (LMIC_sendWithCallback_strict( - switch (LMIC_sendWithCallback( - SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize, - (cfg.countermode & 0x02), myTxCallback, &SendBuffer.MessagePort)) { + switch (LMIC_setTxData2_strict(SendBuffer.MessagePort, SendBuffer.Message, + SendBuffer.MessageSize, + (cfg.countermode & 0x02))) { + + // switch (LMIC_sendWithCallback_strict( + // SendBuffer.MessagePort, SendBuffer.Message, + // SendBuffer.MessageSize, (cfg.countermode & 0x02), myTxCallback, + // &SendBuffer.MessagePort)) { case LMIC_ERROR_SUCCESS: @@ -566,7 +570,8 @@ void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg, } // switch } -// transmit complete message handler +/* +// event TRANSMIT COMPLETE message handler void myTxCallback(void *pUserData, int fSuccess) { uint8_t *const sendport = (uint8_t *)pUserData; @@ -577,6 +582,7 @@ void myTxCallback(void *pUserData, int fSuccess) { // LMIC could not tx on *sendport -> error handling yet to come } } +*/ // decode LORAWAN MAC message void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],