Skip to content

Commit

Permalink
Let moat_poll run in some update_idle calls, as discussed in #7
Browse files Browse the repository at this point in the history
  • Loading branch information
stromnet committed Nov 12, 2015
1 parent 84bd9b6 commit 256112b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions moat.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ void do_command(uint8_t cmd)

void update_idle(uint8_t bits)
{
if(bits < 8)
return;
moat_poll();
}

#if CONSOLE_PING
Expand Down
13 changes: 8 additions & 5 deletions onewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void _wait_complete(void)
return;
}
uart_poll();
update_idle(1); // actbit
update_idle((mode == OWM_IDLE || bitp < 0x80) ? 8 : 1);
}
}

Expand Down Expand Up @@ -336,16 +336,12 @@ char _onewire_poll(void) {
} else if(bitp != 0x80) {
DBG(0x1E);
sei();
update_idle(1);
uart_poll();
} else {
DBG(0x1F);
sei();
}

// RESET processing takes longer.
// update_idle((mode == OWM_SLEEP) ? 100 : (mode <= OWM_AFTER_RESET) ? 20 : (mode < OWM_IDLE) ? 8 : 1); // TODO

if (mode == OWM_IDLE) {
DBG(0x10);
set_idle();
Expand All @@ -354,6 +350,13 @@ char _onewire_poll(void) {
DBG(0x2F);
return 0;
}

// RESET processing takes longer.
update_idle((mode == OWM_SLEEP) ? 100
: (mode <= OWM_PRESENCE) ? 20
: (mode < OWM_IDLE || bitp < 0x80) ? 8
: 1);

return 1;
}
void onewire_poll(void) {
Expand Down

0 comments on commit 256112b

Please sign in to comment.