Skip to content

Commit

Permalink
Fix passing the wrong event type to cord registration callback
Browse files Browse the repository at this point in the history
Before `SAUL_CORD_EP_DEREGISTERED` was passed when registration
succeeded and `SAUL_CORD_EP_REGISTERED` when registration failed.
I switched it.

Also cord ep dump is called outside of the register function now.
  • Loading branch information
MatthiasBraeuer committed Dec 16, 2019
1 parent ef64547 commit f2426ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion RIOT
Submodule RIOT updated 713 files
16 changes: 8 additions & 8 deletions saul_cord_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void _set_timer(void)
* @param[in] event The event that occurred
*/
static void _notify(saul_cord_ep_event_t event) {
if(_cb != NULL) {
if (_cb != NULL) {
_cb(event);
}
}
Expand Down Expand Up @@ -93,23 +93,23 @@ static int register_rd(void) {
puts("Registering with RD now, this may take a short while...");

if (cord_ep_register(&remote, regif) != CORD_EP_OK) {
_notify(SAUL_CORD_EP_REGISTERED);
return 1;
}
else {
_notify(SAUL_CORD_EP_DEREGISTERED);
cord_ep_dump_status();
return 1;
}

_notify(SAUL_CORD_EP_REGISTERED);

return 0;
}

static void saul_cord_ep_register(void) {
printf("DEBUG: RD-ADDRESS: %s\n", ip);

while(register_rd()){
while (register_rd()) {
puts("Try again to register to RD deamon");
}

cord_ep_dump_status();
}

static void *_reg_runner(void *arg)
Expand All @@ -129,7 +129,7 @@ static void *_reg_runner(void *arg)
_notify(SAUL_CORD_EP_UPDATED);
}
else {
_notify(SAUL_CORD_EP_DEREGISTERED);
_notify(SAUL_CORD_EP_DEREGISTERED);
saul_cord_ep_register();
_set_timer();
}
Expand Down

0 comments on commit f2426ce

Please sign in to comment.