Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class C window settings still not working correctly #765

Closed
Pirakutu opened this issue Jul 24, 2019 · 0 comments
Closed

Class C window settings still not working correctly #765

Pirakutu opened this issue Jul 24, 2019 · 0 comments
Assignees

Comments

@Pirakutu
Copy link

Hi there, this is still not working correctly. For example when the device received a new set of RX2/RXC params per MAC command, these changes are saved into the NVM variables but not into the actual running variables. This is not too bad for the RX2 params, as these are set once the timer event kicks in after sending a message. However, the local RXC params are never updated. I added this to ScheduleTX in LoRaMac.c to solve the problem (the reason i added it there is that the servers usually change the devices RX2/RXC frequecies once they have received an answer from the node, as this is a ACK MAC command [triggers a tx needed event]):

// Compute Rx1 windows parameters
RegionComputeRxWindowParameters( MacCtx.NvmCtx->Region,
                                 RegionApplyDrOffset( MacCtx.NvmCtx->Region, MacCtx.NvmCtx->MacParams.DownlinkDwellTime, MacCtx.NvmCtx->MacParams.ChannelsDatarate, MacCtx.NvmCtx->MacParams.Rx1DrOffset ),
                                 MacCtx.NvmCtx->MacParams.MinRxSymbols,
                                 MacCtx.NvmCtx->MacParams.SystemMaxRxError,
                                 &MacCtx.RxWindow1Config );
// Compute Rx2 windows parameters
RegionComputeRxWindowParameters( MacCtx.NvmCtx->Region,
                                 MacCtx.NvmCtx->MacParams.Rx2Channel.Datarate,
                                 MacCtx.NvmCtx->MacParams.MinRxSymbols,
                                 MacCtx.NvmCtx->MacParams.SystemMaxRxError,
                                 &MacCtx.RxWindow2Config );

/* ADDED CODE */
if( ( MacCtx.NvmCtx->DeviceClass == CLASS_C ) && ( MacCtx.NvmCtx->NetworkActivation != ACTIVATION_TYPE_NONE ) )
{
    // We can only compute the RX C window parameters, if we are already
    // in class c mode and joined. We cannot setup an RX C window in case of any other
    // class type.
    // Update RxC frequency if it has changed
    if (MacCtx.RxWindowCConfig.Frequency !=  MacCtx.NvmCtx->MacParams.RxCChannel.Frequency){
      MacCtx.RxWindowCConfig.Frequency = MacCtx.NvmCtx->MacParams.Rx2Channel.Frequency;
    }
    // Compute RxC windows parameters if datarate has changed
    if (MacCtx.RxWindowCConfig.Datarate != MacCtx.NvmCtx->MacParams.RxCChannel.Datarate)
    RegionComputeRxWindowParameters( MacCtx.NvmCtx->Region,
                                     MacCtx.NvmCtx->MacParams.RxCChannel.Datarate,
                                     MacCtx.NvmCtx->MacParams.MinRxSymbols,
                                     MacCtx.NvmCtx->MacParams.SystemMaxRxError,
                                     &MacCtx.RxWindowCConfig );
}
/* ADDED CODE */

Originally posted by @Pirakutu in #699 (comment)

@djaeckle djaeckle added this to the Release Version 4.4.3 milestone Aug 13, 2019
mluis1 pushed a commit that referenced this issue Nov 13, 2019
…rs into OpenContinuousRxCWindow for class c
@mluis1 mluis1 closed this as completed Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants