Skip to content

LoRa: Stack cleanup #6566

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

Merged
merged 6 commits into from
Apr 10, 2018
Merged

LoRa: Stack cleanup #6566

merged 6 commits into from
Apr 10, 2018

Conversation

AnttiKauppila
Copy link

Description

Refactored and cleaned up some internal code.
Tested manually by running tests locally

Pull request type

[ ] Fix
[ X] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

Antti Kauppila added 3 commits April 9, 2018 11:10
- This implements IOTCELL-697
- This touches API, but does not break it, old ones still work in a same manner!
@0xc0170 0xc0170 requested a review from kivaisan April 9, 2018 08:21
{
if (params) {
if (is_otaa) {
// if ((params->connection_u.otaa.dev_eui == NULL) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code shall be removed

// network server that the device was disconnected or restarted.
// At the moment, this implementation does not support a non-volatile
// memory storage.
//_lw_session.downlink_counter; //Get from NVM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these 2 lines here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reminder for NVM support. It will be added later for LoRa

@AnttiKauppila
Copy link
Author

@hasnainvirk, @kivaisan, @kjbracey-arm Can you review this?

@0xc0170 0xc0170 requested review from hasnainvirk and kjbracey April 9, 2018 09:12
0xc0170
0xc0170 previously approved these changes Apr 9, 2018
*/
void join_by_abp(const lorawan_connect_abp_t& abp_join);
lorawan_status_t join(bool is_otaa = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is_otaa should not have a default value. Defaulting to OTAA can enable easy mistake in calling this method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same comment applies to prepare_join method as well.

#include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
#define LoRaPHY_region LoRaPHYUS915Hybrid
#else
#error "Unsupported region, check your configuration."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work, because any unknown identifier will be interpreted as 0, so it will pass the #if MBED CONF_LORA_PHY == EU868 test.

You need the identifiers you recognise to be non-zero. Which is a bit unfortunate if you're trying to be backwards-compatible with having a meaning for 0.

- Also removed useless else from loraphy_target.h
@AnttiKauppila
Copy link
Author

Changed according to Kimmo's and Kevin's comments

#define KR920 7
#define US915 8
#define US915_HYBRID 9

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These end up permanently defined for any application code including LoRaWANStack.h. Again, maybe some concatenation could be done to allow short IDs in the JSON but not clutter C namespace. Could be done in future.

@AnttiKauppila
Copy link
Author

Region handling is now improved and also made sure it is still backwards compatible

@AnttiKauppila
Copy link
Author

@0xc0170 Can you trigger the build for this?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 9, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2018

Build : SUCCESS

Build number : 1686
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6566/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2018

@AnttiKauppila
Copy link
Author

@0xc0170 Can you merge this in now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants