@@ -21,18 +21,17 @@ TaskHandle_t lmicTask = NULL, lorasendTask = NULL;
2121char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer for LMIC event message
2222
2323class MyHalConfig_t : public Arduino_LMIC ::HalConfiguration_t {
24-
2524public:
2625 MyHalConfig_t (){};
2726
2827 // set SPI pins to board configuration, pins may come from pins_arduino.h
29- virtual void begin (void ) override {
28+ void begin (void ) override {
3029 SPI.begin (LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
3130 }
3231
33- // virtual void end(void) override
32+ // void end(void) override
3433
35- // virtual ostime_t setModuleActive(bool state) override
34+ // ostime_t setModuleActive(bool state) override
3635};
3736
3837static MyHalConfig_t myHalConfig{};
@@ -50,9 +49,7 @@ static const lmic_pinmap myPinmap = {
5049 .pConfig = &myHalConfig};
5150
5251void lora_setupForNetwork (bool preJoin) {
53-
5452 if (preJoin) {
55-
5653#if CFG_LMIC_US_like
5754 // in the US, with TTN, it saves join time if we start on subband 1
5855 // (channels 8-15). This will get overridden after the join by
@@ -196,7 +193,6 @@ void lora_send(void *pvParameters) {
196193 MessageBuffer_t SendBuffer;
197194
198195 while (1 ) {
199-
200196 // postpone until we are joined if we are not
201197 while (!LMIC.devaddr ) {
202198 vTaskDelay (pdMS_TO_TICKS (500 ));
@@ -213,7 +209,6 @@ void lora_send(void *pvParameters) {
213209 switch (LMIC_setTxData2_strict (SendBuffer.MessagePort , SendBuffer.Message ,
214210 SendBuffer.MessageSize ,
215211 (cfg.countermode & 0x02 ))) {
216-
217212 case LMIC_ERROR_SUCCESS:
218213#if (TIME_SYNC_LORASERVER)
219214 // if last packet sent was a timesync request, store TX timestamp
@@ -237,7 +232,6 @@ void lora_send(void *pvParameters) {
237232 break ;
238233 default : // other LMIC return code
239234 ESP_LOGE (TAG, " LMIC error, message not sent and deleted" );
240-
241235 } // switch
242236 delay (2 ); // yield to CPU
243237 } // while(1)
@@ -351,7 +345,6 @@ void lmictask(void *pvParameters) {
351345
352346// lmic event handler
353347void myEventCallback (void *pUserData, ev_t ev) {
354-
355348 // using message descriptors from LMIC library
356349 static const char *const evNames[] = {LMIC_EVENT_NAME_TABLE__INIT};
357350 // get current length of lora send queue
@@ -366,7 +359,6 @@ void myEventCallback(void *pUserData, ev_t ev) {
366359
367360 // process current event message
368361 switch (ev) {
369-
370362 case EV_TXCOMPLETE:
371363 // -> processed in lora_send()
372364 break ;
@@ -411,15 +403,13 @@ void myEventCallback(void *pUserData, ev_t ev) {
411403// event EV_RXCOMPLETE message handler
412404void myRxCallback (void *pUserData, uint8_t port, const uint8_t *pMsg,
413405 size_t nMsg) {
414-
415406 // display amount of received data
416407 if (nMsg)
417408 ESP_LOGI (TAG, " Received %u byte(s) of payload on port %u" , nMsg, port);
418409 else if (port)
419410 ESP_LOGI (TAG, " Received empty message on port %u" , port);
420411
421412 switch (port) {
422-
423413 // rcommand received -> call interpreter
424414 case RCMDPORT:
425415 rcommand (pMsg, nMsg);
@@ -432,7 +422,6 @@ void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
432422 timesync_serverAnswer (const_cast <uint8_t *>(pMsg), nMsg);
433423 break ;
434424#endif
435-
436425 } // switch
437426}
438427
@@ -513,7 +502,6 @@ bool ttn_rtc_restore() {
513502// https://github.com/JackGruber/ESP32-LMIC-DeepSleep-example/blob/master/src/main.cpp
514503
515504void SaveLMICToRTC (int deepsleep_sec) {
516-
517505 // ESP32 can't track millis during DeepSleep and no option to advance
518506 // millis after DeepSleep. Therefore reset DutyCyles before saving LMIC struct
519507
0 commit comments