From 50004ca89a10980cc746e251d88be0113356e0ce Mon Sep 17 00:00:00 2001 From: Kimmo Vaisanen Date: Mon, 2 Jul 2018 13:28:05 +0300 Subject: [PATCH] Lora: Add initialize() method to set LoRaWANTimeHandler class for phy Instead of giving LoRaWANTimeHandler object as parameter for constructor, object is now given via own initialize() method. This change is needed for future refactoring where application can give own PHY object for LoRa stack. --- features/lorawan/lorastack/mac/LoRaMac.cpp | 3 ++- features/lorawan/lorastack/phy/LoRaPHY.cpp | 22 +++++++++++-------- features/lorawan/lorastack/phy/LoRaPHY.h | 12 ++++++++-- .../lorawan/lorastack/phy/LoRaPHYAS923.cpp | 7 +++--- features/lorawan/lorastack/phy/LoRaPHYAS923.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYAU915.cpp | 7 +++--- features/lorawan/lorastack/phy/LoRaPHYAU915.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYCN470.cpp | 3 +-- features/lorawan/lorastack/phy/LoRaPHYCN470.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYCN779.cpp | 3 +-- features/lorawan/lorastack/phy/LoRaPHYCN779.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYEU433.cpp | 3 +-- features/lorawan/lorastack/phy/LoRaPHYEU433.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYEU868.cpp | 3 +-- features/lorawan/lorastack/phy/LoRaPHYEU868.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYIN865.cpp | 3 +-- features/lorawan/lorastack/phy/LoRaPHYIN865.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYKR920.cpp | 7 +++--- features/lorawan/lorastack/phy/LoRaPHYKR920.h | 2 +- .../lorawan/lorastack/phy/LoRaPHYUS915.cpp | 7 +++--- features/lorawan/lorastack/phy/LoRaPHYUS915.h | 2 +- .../lorastack/phy/LoRaPHYUS915Hybrid.cpp | 7 +++--- .../lorastack/phy/LoRaPHYUS915Hybrid.h | 2 +- 23 files changed, 55 insertions(+), 52 deletions(-) diff --git a/features/lorawan/lorastack/mac/LoRaMac.cpp b/features/lorawan/lorastack/mac/LoRaMac.cpp index 1b98bd39e1..90845245b9 100644 --- a/features/lorawan/lorastack/mac/LoRaMac.cpp +++ b/features/lorawan/lorastack/mac/LoRaMac.cpp @@ -73,7 +73,7 @@ using namespace mbed; LoRaMac::LoRaMac() : _lora_time(), - _lora_phy(_lora_time), + _lora_phy(), _mac_commands(), _channel_plan(), _lora_crypto(), @@ -1687,6 +1687,7 @@ void LoRaMac::set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx lorawan_status_t LoRaMac::initialize(EventQueue *queue) { _lora_time.activate_timer_subsystem(queue); + _lora_phy.initialize(&_lora_time); _ev_queue = queue; diff --git a/features/lorawan/lorastack/phy/LoRaPHY.cpp b/features/lorawan/lorastack/phy/LoRaPHY.cpp index ed1f8a543b..f889a09161 100644 --- a/features/lorawan/lorastack/phy/LoRaPHY.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHY.cpp @@ -35,9 +35,8 @@ SPDX-License-Identifier: BSD-3-Clause #define CHANNELS_IN_MASK 16 -LoRaPHY::LoRaPHY(LoRaWANTimeHandler &lora_time) - : _radio(NULL), - _lora_time(lora_time) +LoRaPHY::LoRaPHY() + : _radio(NULL) { memset(&phy_params, 0, sizeof(phy_params)); } @@ -47,6 +46,11 @@ LoRaPHY::~LoRaPHY() _radio = NULL; } +void LoRaPHY::initialize(LoRaWANTimeHandler *lora_time) +{ + _lora_time = lora_time; +} + bool LoRaPHY::mask_bit_test(const uint16_t *mask, unsigned bit) { return mask[bit / 16] & (1U << (bit % 16)); @@ -268,9 +272,9 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle, for (uint8_t i = 0; i < nb_bands; i++) { if (joined == false) { - uint32_t txDoneTime = MAX(_lora_time.get_elapsed_time(bands[i].last_join_tx_time), + uint32_t txDoneTime = MAX(_lora_time->get_elapsed_time(bands[i].last_join_tx_time), (duty_cycle == true) ? - _lora_time.get_elapsed_time(bands[i].last_tx_time) : 0); + _lora_time->get_elapsed_time(bands[i].last_tx_time) : 0); if (bands[i].off_time <= txDoneTime) { bands[i].off_time = 0; @@ -284,12 +288,12 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle, // if network has been joined if (duty_cycle == true) { - if (bands[i].off_time <= _lora_time.get_elapsed_time(bands[i].last_tx_time)) { + if (bands[i].off_time <= _lora_time->get_elapsed_time(bands[i].last_tx_time)) { bands[i].off_time = 0; } if (bands[i].off_time != 0) { - next_tx_delay = MIN(bands[i].off_time - _lora_time.get_elapsed_time(bands[i].last_tx_time), + next_tx_delay = MIN(bands[i].off_time - _lora_time->get_elapsed_time(bands[i].last_tx_time), next_tx_delay); } } else { @@ -1222,7 +1226,7 @@ lorawan_status_t LoRaPHY::set_next_channel(channel_selection_params_t *params, } if (params->aggregate_timeoff - <= _lora_time.get_elapsed_time(params->last_aggregate_tx_time)) { + <= _lora_time->get_elapsed_time(params->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregate_timeoff = 0; @@ -1238,7 +1242,7 @@ lorawan_status_t LoRaPHY::set_next_channel(channel_selection_params_t *params, } else { delay_tx++; next_tx_delay = params->aggregate_timeoff - - _lora_time.get_elapsed_time(params->last_aggregate_tx_time); + _lora_time->get_elapsed_time(params->last_aggregate_tx_time); } if (channel_count > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHY.h b/features/lorawan/lorastack/phy/LoRaPHY.h index 81a482012f..663901c90c 100644 --- a/features/lorawan/lorastack/phy/LoRaPHY.h +++ b/features/lorawan/lorastack/phy/LoRaPHY.h @@ -45,6 +45,14 @@ class LoRaPHY : private mbed::NonCopyable { public: virtual ~LoRaPHY(); + /** Initialize LoRaPHY + * + * LoRaMac calls this to initialize LoRaPHY. + * + * @param lora_time a pointer to LoRaWANTimeHandler object + */ + void initialize(LoRaWANTimeHandler *lora_time); + /** Stores a reference to Radio object. * * Application is responsible for constructing a 'LoRaRadio' object @@ -517,7 +525,7 @@ public: //Verifiers bool verify_nb_join_trials(uint8_t nb_join_trials); protected: - LoRaPHY(LoRaWANTimeHandler &lora_time); + LoRaPHY(); /** * Looks up corresponding band for a frequency. Returns -1 if not in any band. @@ -624,7 +632,7 @@ protected: protected: LoRaRadio *_radio; - LoRaWANTimeHandler &_lora_time; + LoRaWANTimeHandler *_lora_time; loraphy_params_t phy_params; }; diff --git a/features/lorawan/lorastack/phy/LoRaPHYAS923.cpp b/features/lorawan/lorastack/phy/LoRaPHYAS923.cpp index 648a944ba6..dc0d6b3368 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYAS923.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYAS923.cpp @@ -241,8 +241,7 @@ static const uint32_t bandwidths_AS923[] = {125000, 125000, 125000, 125000, 1250 */ static const int8_t rx1_dr_offset_AS923[] = {0, 1, 2, 3, 4, 5, -1, -2}; -LoRaPHYAS923::LoRaPHYAS923(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYAS923::LoRaPHYAS923() { bands[0] = AS923_BAND0; @@ -352,7 +351,7 @@ lorawan_status_t LoRaPHYAS923::set_next_channel(channel_selection_params_t* next channel_mask[0] |= LC(1) + LC(2); } - if (next_channel_prams->aggregate_timeoff <= _lora_time.get_elapsed_time(next_channel_prams->last_aggregate_tx_time)) { + if (next_channel_prams->aggregate_timeoff <= _lora_time->get_elapsed_time(next_channel_prams->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregate_timeoff = 0; @@ -368,7 +367,7 @@ lorawan_status_t LoRaPHYAS923::set_next_channel(channel_selection_params_t* next enabled_channels, &delay_tx); } else { delay_tx++; - next_tx_delay = next_channel_prams->aggregate_timeoff - _lora_time.get_elapsed_time(next_channel_prams->last_aggregate_tx_time); + next_tx_delay = next_channel_prams->aggregate_timeoff - _lora_time->get_elapsed_time(next_channel_prams->last_aggregate_tx_time); } if (nb_enabled_channels > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHYAS923.h b/features/lorawan/lorastack/phy/LoRaPHYAS923.h index 88030339ad..7643dad5d9 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYAS923.h +++ b/features/lorawan/lorastack/phy/LoRaPHYAS923.h @@ -50,7 +50,7 @@ class LoRaPHYAS923 : public LoRaPHY { public: - LoRaPHYAS923(LoRaWANTimeHandler &lora_time); + LoRaPHYAS923(); virtual ~LoRaPHYAS923(); virtual int8_t get_alternate_DR(uint8_t nb_trials); diff --git a/features/lorawan/lorastack/phy/LoRaPHYAU915.cpp b/features/lorawan/lorastack/phy/LoRaPHYAU915.cpp index f7ae219b85..b0708bb786 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYAU915.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYAU915.cpp @@ -221,8 +221,7 @@ static const uint8_t max_payload_with_repeater_AU915[] = { 51, 51, 51, 115, 222, 222, 222, 0, 33, 109, 222, 222, 222, 222, 0, 0 }; -LoRaPHYAU915::LoRaPHYAU915(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYAU915::LoRaPHYAU915() { bands[0] = AU915_BAND0; @@ -584,7 +583,7 @@ lorawan_status_t LoRaPHYAU915::set_next_channel(channel_selection_params_t* next } } - if (next_chan_params->aggregate_timeoff <= _lora_time.get_elapsed_time(next_chan_params->last_aggregate_tx_time)) { + if (next_chan_params->aggregate_timeoff <= _lora_time->get_elapsed_time(next_chan_params->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregated_timeOff = 0; @@ -600,7 +599,7 @@ lorawan_status_t LoRaPHYAU915::set_next_channel(channel_selection_params_t* next enabled_channels, &delay_tx); } else { delay_tx++; - next_tx_delay = next_chan_params->aggregate_timeoff - _lora_time.get_elapsed_time(next_chan_params->last_aggregate_tx_time); + next_tx_delay = next_chan_params->aggregate_timeoff - _lora_time->get_elapsed_time(next_chan_params->last_aggregate_tx_time); } if (nb_enabled_channels > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHYAU915.h b/features/lorawan/lorastack/phy/LoRaPHYAU915.h index 14f63b8915..1db1ff227c 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYAU915.h +++ b/features/lorawan/lorastack/phy/LoRaPHYAU915.h @@ -53,7 +53,7 @@ class LoRaPHYAU915 : public LoRaPHY{ public: - LoRaPHYAU915(LoRaWANTimeHandler &lora_time); + LoRaPHYAU915(); virtual ~LoRaPHYAU915(); virtual bool rx_config(rx_config_params_t* config); diff --git a/features/lorawan/lorastack/phy/LoRaPHYCN470.cpp b/features/lorawan/lorastack/phy/LoRaPHYCN470.cpp index b3bdef530d..cbf8a8a582 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYCN470.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYCN470.cpp @@ -204,8 +204,7 @@ static const uint8_t max_payloads_CN470[] = {51, 51, 51, 115, 222, 222}; static const uint8_t max_payloads_with_repeater_CN470[] = {51, 51, 51, 115, 222, 222}; -LoRaPHYCN470::LoRaPHYCN470(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYCN470::LoRaPHYCN470() { bands[0] = CN470_BAND0; diff --git a/features/lorawan/lorastack/phy/LoRaPHYCN470.h b/features/lorawan/lorastack/phy/LoRaPHYCN470.h index 6132fb6b65..4c66999df8 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYCN470.h +++ b/features/lorawan/lorastack/phy/LoRaPHYCN470.h @@ -53,7 +53,7 @@ class LoRaPHYCN470 : public LoRaPHY { public: - LoRaPHYCN470(LoRaWANTimeHandler &lora_time); + LoRaPHYCN470(); virtual ~LoRaPHYCN470(); virtual bool rx_config(rx_config_params_t* config); diff --git a/features/lorawan/lorastack/phy/LoRaPHYCN779.cpp b/features/lorawan/lorastack/phy/LoRaPHYCN779.cpp index 6f1f618bde..ff6e6d6903 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYCN779.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYCN779.cpp @@ -230,8 +230,7 @@ static const uint8_t max_payloads_CN779[] = {51, 51, 51, 115, 242, 242, 242, 242 static const uint8_t max_payloads_with_repeater_CN779[] = {51, 51, 51, 115, 222, 222, 222, 222}; -LoRaPHYCN779::LoRaPHYCN779(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYCN779::LoRaPHYCN779() { bands[0] = CN779_BAND0; diff --git a/features/lorawan/lorastack/phy/LoRaPHYCN779.h b/features/lorawan/lorastack/phy/LoRaPHYCN779.h index b931c43f84..1641b3d55e 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYCN779.h +++ b/features/lorawan/lorastack/phy/LoRaPHYCN779.h @@ -45,7 +45,7 @@ class LoRaPHYCN779 : public LoRaPHY { public: - LoRaPHYCN779(LoRaWANTimeHandler &lora_time); + LoRaPHYCN779(); virtual ~LoRaPHYCN779(); private: diff --git a/features/lorawan/lorastack/phy/LoRaPHYEU433.cpp b/features/lorawan/lorastack/phy/LoRaPHYEU433.cpp index fdd9361736..a4d2dbded5 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYEU433.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYEU433.cpp @@ -231,8 +231,7 @@ static const uint8_t max_payloads_EU433[] = {51, 51, 51, 115, 242, 242, 242, 242 static const uint8_t max_payloads_with_repeater_EU433[] = {51, 51, 51, 115, 222, 222, 222, 222}; -LoRaPHYEU433::LoRaPHYEU433(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYEU433::LoRaPHYEU433() { bands[0] = EU433_BAND0; diff --git a/features/lorawan/lorastack/phy/LoRaPHYEU433.h b/features/lorawan/lorastack/phy/LoRaPHYEU433.h index ccffc9d207..c924732886 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYEU433.h +++ b/features/lorawan/lorastack/phy/LoRaPHYEU433.h @@ -51,7 +51,7 @@ class LoRaPHYEU433 : public LoRaPHY { public: - LoRaPHYEU433(LoRaWANTimeHandler &lora_time); + LoRaPHYEU433(); virtual ~LoRaPHYEU433(); private: diff --git a/features/lorawan/lorastack/phy/LoRaPHYEU868.cpp b/features/lorawan/lorastack/phy/LoRaPHYEU868.cpp index 381cd003b7..1478a42163 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYEU868.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYEU868.cpp @@ -256,8 +256,7 @@ static const uint8_t max_payloads_EU868[] = {51, 51, 51, 115, 242, 242, 242, 242 */ static const uint8_t max_payloads_repeater_EU868[] = {51, 51, 51, 115, 222, 222, 222, 222}; -LoRaPHYEU868::LoRaPHYEU868(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYEU868::LoRaPHYEU868() { bands[0] = EU868_BAND0; bands[1] = EU868_BAND1; diff --git a/features/lorawan/lorastack/phy/LoRaPHYEU868.h b/features/lorawan/lorastack/phy/LoRaPHYEU868.h index 404a9f11a6..8925041279 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYEU868.h +++ b/features/lorawan/lorastack/phy/LoRaPHYEU868.h @@ -54,7 +54,7 @@ class LoRaPHYEU868 : public LoRaPHY { public: - LoRaPHYEU868(LoRaWANTimeHandler &lora_time); + LoRaPHYEU868(); virtual ~LoRaPHYEU868(); private: diff --git a/features/lorawan/lorastack/phy/LoRaPHYIN865.cpp b/features/lorawan/lorastack/phy/LoRaPHYIN865.cpp index fffe91cc4b..d9e0631885 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYIN865.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYIN865.cpp @@ -232,8 +232,7 @@ static const uint8_t max_payloads_with_repeater[] = { 51, 51, 51, 115, 222, 222, */ static const int8_t rx1_dr_offset_IN865[] = { 0, 1, 2, 3, 4, 5, -1, -2 }; -LoRaPHYIN865::LoRaPHYIN865(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYIN865::LoRaPHYIN865() { bands[0] = IN865_BAND0; diff --git a/features/lorawan/lorastack/phy/LoRaPHYIN865.h b/features/lorawan/lorastack/phy/LoRaPHYIN865.h index 5d47f67a7a..50e2d41821 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYIN865.h +++ b/features/lorawan/lorastack/phy/LoRaPHYIN865.h @@ -52,7 +52,7 @@ class LoRaPHYIN865 : public LoRaPHY { public: - LoRaPHYIN865(LoRaWANTimeHandler &lora_time); + LoRaPHYIN865(); virtual ~LoRaPHYIN865(); virtual uint8_t apply_DR_offset(int8_t dr, int8_t dr_offset ); diff --git a/features/lorawan/lorastack/phy/LoRaPHYKR920.cpp b/features/lorawan/lorastack/phy/LoRaPHYKR920.cpp index fd238b4ba5..97d6b6a814 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYKR920.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYKR920.cpp @@ -241,8 +241,7 @@ static const uint8_t max_payloads_KR920[] = { 51, 51, 51, 115, 242, 242 }; */ static const uint8_t max_payloads_with_repeater_KR920[] = { 51, 51, 51, 115, 222, 222 }; -LoRaPHYKR920::LoRaPHYKR920(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYKR920::LoRaPHYKR920() { bands[0] = KR920_BAND0; @@ -422,7 +421,7 @@ lorawan_status_t LoRaPHYKR920::set_next_channel(channel_selection_params_t* para channel_mask[0] |= LC(1) + LC(2) + LC(3); } - if (params->aggregate_timeoff <= _lora_time.get_elapsed_time(params->last_aggregate_tx_time)) { + if (params->aggregate_timeoff <= _lora_time->get_elapsed_time(params->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregate_timeoff = 0; @@ -436,7 +435,7 @@ lorawan_status_t LoRaPHYKR920::set_next_channel(channel_selection_params_t* para enabled_channels, &delay_tx); } else { delay_tx++; - nextTxDelay = params->aggregate_timeoff - _lora_time.get_elapsed_time(params->last_aggregate_tx_time); + nextTxDelay = params->aggregate_timeoff - _lora_time->get_elapsed_time(params->last_aggregate_tx_time); } if (nb_enabled_channels > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHYKR920.h b/features/lorawan/lorastack/phy/LoRaPHYKR920.h index 49253d0135..771a335b16 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYKR920.h +++ b/features/lorawan/lorastack/phy/LoRaPHYKR920.h @@ -51,7 +51,7 @@ class LoRaPHYKR920 : public LoRaPHY { public: - LoRaPHYKR920(LoRaWANTimeHandler &lora_time); + LoRaPHYKR920(); virtual ~LoRaPHYKR920(); virtual bool verify_frequency_for_band(uint32_t freq, uint8_t band) const; diff --git a/features/lorawan/lorastack/phy/LoRaPHYUS915.cpp b/features/lorawan/lorastack/phy/LoRaPHYUS915.cpp index e3ae1ad583..a0ef187caa 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYUS915.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYUS915.cpp @@ -211,8 +211,7 @@ static const uint8_t max_payloads_US915[] = { 11, 53, 125, 242, 242, 0, 0, 0, 53 */ static const uint8_t max_payloads_with_repeater_US915[] = {11, 53, 125, 242, 242, 0, 0, 0, 33, 109, 222, 222, 222, 222, 0, 0}; -LoRaPHYUS915::LoRaPHYUS915(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYUS915::LoRaPHYUS915() { bands[0] = US915_BAND0; @@ -624,7 +623,7 @@ lorawan_status_t LoRaPHYUS915::set_next_channel(channel_selection_params_t* para } } - if (params->aggregate_timeoff <= _lora_time.get_elapsed_time(params->last_aggregate_tx_time)) { + if (params->aggregate_timeoff <= _lora_time->get_elapsed_time(params->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregate_timeOff = 0; @@ -638,7 +637,7 @@ lorawan_status_t LoRaPHYUS915::set_next_channel(channel_selection_params_t* para enabled_channels, &delay_tx); } else { delay_tx++; - next_tx_delay = params->aggregate_timeoff - _lora_time.get_elapsed_time(params->last_aggregate_tx_time); + next_tx_delay = params->aggregate_timeoff - _lora_time->get_elapsed_time(params->last_aggregate_tx_time); } if (nb_enabled_channels > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHYUS915.h b/features/lorawan/lorastack/phy/LoRaPHYUS915.h index b5e34bd1d8..2c883ae69d 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYUS915.h +++ b/features/lorawan/lorastack/phy/LoRaPHYUS915.h @@ -51,7 +51,7 @@ class LoRaPHYUS915 : public LoRaPHY { public: - LoRaPHYUS915(LoRaWANTimeHandler &lora_time); + LoRaPHYUS915(); virtual ~LoRaPHYUS915(); virtual void restore_default_channels(); diff --git a/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.cpp b/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.cpp index 4ae99dc791..cc07e46968 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.cpp +++ b/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.cpp @@ -210,8 +210,7 @@ static const uint8_t max_payloads_US915_HYBRID[] = { 11, 53, 125, 242, 242, 0, 0 */ static const uint8_t max_payloads_with_repeater_US915_HYBRID[] = { 11, 53, 125, 242, 242, 0, 0, 0, 33, 109, 222, 222, 222, 222, 0, 0 }; -LoRaPHYUS915Hybrid::LoRaPHYUS915Hybrid(LoRaWANTimeHandler &lora_time) - : LoRaPHY(lora_time) +LoRaPHYUS915Hybrid::LoRaPHYUS915Hybrid() { bands[0] = US915_HYBRID_BAND0; @@ -622,7 +621,7 @@ lorawan_status_t LoRaPHYUS915Hybrid::set_next_channel(channel_selection_params_t } } - if (params->aggregate_timeoff <= _lora_time.get_elapsed_time( params->last_aggregate_tx_time)) { + if (params->aggregate_timeoff <= _lora_time->get_elapsed_time( params->last_aggregate_tx_time)) { // Reset Aggregated time off *aggregate_timeOff = 0; @@ -638,7 +637,7 @@ lorawan_status_t LoRaPHYUS915Hybrid::set_next_channel(channel_selection_params_t enabled_channels, &delay_tx); } else { delay_tx++; - next_tx_delay = params->aggregate_timeoff - _lora_time.get_elapsed_time(params->last_aggregate_tx_time); + next_tx_delay = params->aggregate_timeoff - _lora_time->get_elapsed_time(params->last_aggregate_tx_time); } if (nb_enabled_channels > 0) { diff --git a/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h b/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h index fefd7ddac3..af59d7343a 100644 --- a/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h +++ b/features/lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h @@ -51,7 +51,7 @@ class LoRaPHYUS915Hybrid : public LoRaPHY { public: - LoRaPHYUS915Hybrid(LoRaWANTimeHandler &lora_time); + LoRaPHYUS915Hybrid(); virtual ~LoRaPHYUS915Hybrid(); virtual void restore_default_channels();