diff --git a/src/LMIC-node.cpp b/src/LMIC-node.cpp index 93d04c0..2b179a2 100644 --- a/src/LMIC-node.cpp +++ b/src/LMIC-node.cpp @@ -520,10 +520,20 @@ void initLmic(bit_t adrEnabled = 1, serial.println(")"); #endif #endif + + #ifdef MCCI_LMIC + // Register a custom eventhandler and don't use default onEvent() to enable + // additional features (e.g. make EV_RXSTART available). User data pointer is omitted. + LMIC_registerEventCb(&onLmicEvent, nullptr); + #endif } +#ifdef MCCI_LMIC +void onLmicEvent(void *pUserData, ev_t ev) +#else void onEvent(ev_t ev) +#endif { // LMIC event handler ostime_t timestamp = os_getTime(); diff --git a/src/LMIC-node.h b/src/LMIC-node.h index 5840a57..a6eeeac 100644 --- a/src/LMIC-node.h +++ b/src/LMIC-node.h @@ -46,6 +46,7 @@ enum class PrintTarget { All, Serial, Display }; // Forward declarations void processWork(ostime_t timestamp); void processDownlink(ostime_t eventTimestamp, uint8_t fPort, uint8_t* data, uint8_t dataLength); +void onLmicEvent(void *pUserData, ev_t ev); void displayTxSymbol(bool visible); #ifndef DO_WORK_INTERVAL_SECONDS // Should be set in platformio.ini