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

calling join() restore the module to default baud rate... #219

Closed
alexbn71 opened this issue Jul 7, 2017 · 9 comments
Closed

calling join() restore the module to default baud rate... #219

alexbn71 opened this issue Jul 7, 2017 · 9 comments
Assignees

Comments

@alexbn71
Copy link
Contributor

alexbn71 commented Jul 7, 2017

Hello,

I issue an "autobaud" to comunicate with RN2483 (at 9600) but when I call the join() function it calls at the beginning the reset() function that restore RN2483 to default baud rate, thus canceling the effect of my autobaud.

If I comment the code inside reset() that issue the reboot, all works fine.

My proposal is to leave the reset() function PUBLIC and leave the programmer the ability to force a reboot.
While in the join() function leave only the setting of devEui.

Regards
Alessandro

@alexbn71 alexbn71 changed the title calling reset() restore the module to factory... calling join() restore the module to baud rate... Jul 7, 2017
@alexbn71 alexbn71 changed the title calling join() restore the module to baud rate... calling join() restore the module to default baud rate... Jul 7, 2017
@alexbn71
Copy link
Contributor Author

alexbn71 commented Jul 7, 2017

I'm sorry I was working on an old version of the library but the new one has a similar problem...

@alexbn71
Copy link
Contributor Author

alexbn71 commented Jul 7, 2017

this it works:

void TheThingsNetwork::reset(bool adr)
{
  // It's pretty useless this test, the baud rate could be performed every time.	
  //if (!baudDetermined)
  //{
    autoBaud();
  //}
  
  // Issue a REBOOT using the right baud rate. The response will be garbage if the
  // communication is not done at default baud rate and should be discarded
  size_t length = readResponse(SYS_TABLE, SYS_RESET, buffer, sizeof(buffer));
  // After REBOOT set again the module to the right baud rate.
  autoBaud();
  // And now get all infos about the module 
  length = readResponse(SYS_TABLE, SYS_TABLE, SYS_GET_VER, buffer, sizeof(buffer));

  // buffer contains "RN2xx3[xx] x.x.x ...", splitting model from version
  char *model = strtok(buffer, " ");
  debugPrintIndex(SHOW_MODEL, model);
  char *version = strtok(NULL, " ");
  debugPrintIndex(SHOW_VERSION, version);

@johanstokking
Copy link
Member

@alexbn71 thanks for reporting. Can you file a PR?

@johanstokking johanstokking self-assigned this Jul 17, 2017
@alexbn71
Copy link
Contributor Author

TheThingsNetwork_Blason.zip

The fix is inside TheThingsNetwork::reset no other changes are necessary to get it working.

PS Ignore the two minor improvments that you could find in the code outside "TheThingsNetwork::reset" function, that are not related to this topic.

Alex

@johanstokking
Copy link
Member

Thanks. Can you file a pull request here on GitHub? Otherwise I'll do it, let me know

@alexbn71
Copy link
Contributor Author

Sure, sorry...

@alexbn71
Copy link
Contributor Author

I hope I did it right, it's my first time

Alex

@johanstokking
Copy link
Member

Closed by #223

@johanstokking
Copy link
Member

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

No branches or pull requests

2 participants