Skip to content

LoRa refactoring #6279

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 7 commits into from
Mar 20, 2018
Merged

LoRa refactoring #6279

merged 7 commits into from
Mar 20, 2018

Conversation

AnttiKauppila
Copy link

@AnttiKauppila AnttiKauppila commented Mar 6, 2018

Description

Internal refactoring for LoRa done.

  • Main target of refactoring was to remove LoRaMac dependency from classes which should not have it.
  • Basically code has been moved to more logical places and functionality has not been modified
  • Doxygen documentation updated for all new functions.
  • Greentea tests have been run manually, results:
    report_mbed-lora-tests-private-tests-lorawan-abp.html: >> Test cases: 2 passed, 0 failed
    report_mbed-lora-tests-private-tests-lorawan-basic.html: >> Test cases: 18 passed, 0 failed
    report_mbed-lora-tests-private-tests-lorawan-extended.html: >> Test cases: 13 passed, 0 failed
    report_mbed-lora-tests-private-tests-lorawan-otaa_with_json_incorrect.html: >> Test cases: 1 passed, 0 failed
    report_mbed-lora-tests-private-tests-lorawan-private_otaa.html: >> Test cases: 1 passed, 0 failed

Pull request type

  • Fix
  • Refactor
  • New target
  • Feature
  • Breaking change

@AnttiKauppila
Copy link
Author

@kjbracey-arm, @kivaisan please review this.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2018

Looking at the changes, isn't this breaking change (should it be labeled as such in the PR type) ?

@AnttiKauppila
Copy link
Author

Doesn't "breaking change" mean that API is somehow changed?
What is the difference between "refactor" and "breaking change"?
As I mentioned I have only changed the place of the code and verified using our test set that nothing has changed from application perspective.

@adbridge
Copy link
Contributor

adbridge commented Mar 7, 2018

@AnttiKauppila yes breaking change means either a change in API, OR a change in behaviour from the users perspective. If this has neither then it is just refactor and can go into a patch release.

uint8_t _num_retry;
events::EventQueue *_queue;
bool _duty_cycle_on;
uint8_t _app_port;
Copy link
Contributor

Choose a reason for hiding this comment

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

We can save some padding bytes by moving _app_port next to _num_retry

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@@ -416,8 +426,8 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(uint8_t *payload,

bool LoRaMacCommand::is_sticky_mac_command_pending()
{
//DEAD CODE: mac_cmd_buf_idx_to_repeat is never set
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually a bug in void LoRaMacCommand::parse_mac_commands_to_repeat(). Add
mac_cmd_buf_idx_to_repeat = cmd_cnt;
to the end of that function.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

/**
* Indicates if there are any pending sticky MAC commands
*/
bool sticky_mac_cmd;
Copy link
Contributor

Choose a reason for hiding this comment

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

We now have two similar variables (sticky_mac_cmd vs. mac_cmd_buf_idx_to_repeat). We can later check if these could be combined.

Copy link
Author

Choose a reason for hiding this comment

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

This new variable is used in add_mac_command() and merging it with mac_cmd_buf_idx_to_repeat would mean that if the value is non-zero it should be increased but how much, we need to investigate. Plus it might be potential to cause a break in functionality, so we will leave it later as you suggested.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 9, 2018

@AnttiKauppila
Copy link
Author

@adbridge and @0xc0170 Do you have some comments still for this?

0xc0170
0xc0170 previously approved these changes Mar 12, 2018
@AnttiKauppila
Copy link
Author

When will this merge happen?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 15, 2018

When will this merge happen?

We will have gatekeeping most likely today (we were preparing two release candidates and faced some CI related issues).

@cmonr
Copy link
Contributor

cmonr commented Mar 15, 2018

@AnttiKauppila It looks like this PR will need to be rebased, due to an earlier LORA-related PR being brought in.

@AnttiKauppila
Copy link
Author

Conflict resolved

@cmonr
Copy link
Contributor

cmonr commented Mar 16, 2018

@AnttiKauppila Please undo your last commit, and rebase your changes with master.

Our release process does not work well with merge commits from master within PRs.

I can start CI as soon as that's corrected.

Antti Kauppila added 3 commits March 16, 2018 17:58
- LoRaMacCommand does not have any external dependencies anymore
- Also LoRaMacMlme is not using LoRaMacCommand anymore
- get_phy_params function was very heavy weight and needed to be refactored.
- switch-case clauses have been refactored to be functions now and the complexity of the usage has been improved a lot.
- There are no functional changes, this is internal only change
- Internal refactoring only, no functional changes
@mbed-ci
Copy link

mbed-ci commented Mar 18, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Mar 18, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 18, 2018

@AnttiKauppila
Copy link
Author

ci-morph test has now failed 3 times in a row (different reasons) and none of the failures is related to LoRa???
Where can I report issues about unstable tests?

@AnttiKauppila
Copy link
Author

@0xc0170 Can this be rebuild?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 19, 2018

Where can I report issues about unstable tests?

@studavekar Please review

I'll check the rest of the queue if it has similar issues

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 19, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 19, 2018

@kjbracey-arm Can you review this refactor?

@AnttiKauppila
Copy link
Author

AnttiKauppila commented Mar 19, 2018

It looks like this is going to last forever, so I am planning to push 20+ commits extra on this tomorrow. Then the initial message will be changed as well, because of new feature will be introduced.

@adbridge
Copy link
Contributor

@AnttiKauppila If you push a new feature then this moves out to 5.9

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 19, 2018

It looks like this is going to last forever, so I am planning to push 20+ commits extra on this tomorrow. Then the initial message will be changed as well, because of new feature will be introduced.

It's ready, just would like @kjbracey-arm to have a last approval and goes in. We should not mix features-bugs-other things together. And adding here 20 commits won't help getting this faster.

@studavekar
Copy link
Contributor

Where can I report issues about unstable tests?
@studavekar Please review

Flash - clock and cache test - failure - #6224 - workaround - #6340
http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6279/1240

ST Link device issues. - Fix cold boot device so communication link is restored
http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6279/1249
http://mbed-os-logs.s3-website-us-west-1.amazonaws.com/?prefix=logs/6279/1250

Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Fine for master, but I would query the 5.8.1 label regardless. Do we really want general refactoring in patch releases, if it's not fixing a specific bug and has a chance of accidentally introducing a new one?

@AnttiKauppila
Copy link
Author

I am fine with 5.9 label

@AnttiKauppila
Copy link
Author

@0xc0170 Who will do the merge for this?

@cmonr
Copy link
Contributor

cmonr commented Mar 20, 2018

🖐️

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.

8 participants