[LoRaWAN] Add datarate into event structure

This commit is contained in:
StevenCellist 2023-11-27 16:20:06 +01:00
parent 3d6db1b79a
commit 4703f58b7f
3 changed files with 7 additions and 0 deletions

View file

@ -214,6 +214,8 @@ void loop() {
Serial.println(event.confirmed); Serial.println(event.confirmed);
Serial.print(F("[LoRaWAN] Confirming:\t")); Serial.print(F("[LoRaWAN] Confirming:\t"));
Serial.println(event.confirming); Serial.println(event.confirming);
Serial.print(F("[LoRaWAN] Datarate:\t"));
Serial.print(event.datarate);
Serial.print(F("[LoRaWAN] Frequency:\t")); Serial.print(F("[LoRaWAN] Frequency:\t"));
Serial.print(event.freq, 3); Serial.print(event.freq, 3);
Serial.println(F(" MHz")); Serial.println(F(" MHz"));

View file

@ -904,6 +904,7 @@ int16_t LoRaWANNode::uplink(uint8_t* data, size_t len, uint8_t port, bool isConf
event->dir = RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK; event->dir = RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK;
event->confirmed = isConfirmed; event->confirmed = isConfirmed;
event->confirming = isConfirmingDown; event->confirming = isConfirmingDown;
event->datarate = this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK];
event->freq = currentChannels[event->dir].freq; event->freq = currentChannels[event->dir].freq;
event->power = this->txPwrCur; event->power = this->txPwrCur;
event->fcnt = this->fcntUp; event->fcnt = this->fcntUp;
@ -1262,6 +1263,7 @@ int16_t LoRaWANNode::downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event)
event->dir = RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK; event->dir = RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK;
event->confirmed = isConfirmedDown; event->confirmed = isConfirmedDown;
event->confirming = isConfirmingUp; event->confirming = isConfirmingUp;
event->datarate = this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK];
event->freq = currentChannels[event->dir].freq; event->freq = currentChannels[event->dir].freq;
event->power = this->txPwrCur; event->power = this->txPwrCur;
event->fcnt = isAppDownlink ? this->aFcntDown : this->nFcntDown; event->fcnt = isAppDownlink ? this->aFcntDown : this->nFcntDown;

View file

@ -326,6 +326,9 @@ struct LoRaWANEvent_t {
(e.g., server downlink reply to confirmed uplink sent by user application)*/ (e.g., server downlink reply to confirmed uplink sent by user application)*/
bool confirming; bool confirming;
/*! \brief Datarate */
uint8_t datarate;
/*! \brief Frequency in MHz */ /*! \brief Frequency in MHz */
float freq; float freq;