[LoRaWAN] Add datarate into event structure (#885)

* [LoRaWAN] Move TX power logic to function

* Update keywords

* [LoRaWAN] Add datarate into event structure
pull/893/head
StevenCellist 2023-11-27 16:43:56 +01:00 zatwierdzone przez GitHub
rodzic b2b73ab21d
commit b6f6718f1f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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->confirmed = isConfirmed;
event->confirming = isConfirmingDown;
event->datarate = this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK];
event->freq = currentChannels[event->dir].freq;
event->power = this->txPwrCur;
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->confirmed = isConfirmedDown;
event->confirming = isConfirmingUp;
event->datarate = this->dataRates[RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK];
event->freq = currentChannels[event->dir].freq;
event->power = this->txPwrCur;
event->fcnt = isAppDownlink ? this->aFcntDown : this->nFcntDown;

Wyświetl plik

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