summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/src
diff options
context:
space:
mode:
authorFlorent Duchon2013-05-02 17:53:20 +0200
committerFlorent Duchon2013-05-02 22:52:48 +0200
commitf7644ea9054e8f24490f1ad62928b7371727da59 (patch)
treea7fadb55cd97fe8db2876b648cccfd8b04b9ef7e /digital/beacon/src
parent3872b92328b5f562e2fdb4272c46f50c46144a38 (diff)
digital/beacon: fix imprecised rebasing when offset is too small
Diffstat (limited to 'digital/beacon/src')
-rw-r--r--digital/beacon/src/codewheel.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c
index 73c0329f..cfa2e761 100644
--- a/digital/beacon/src/codewheel.c
+++ b/digital/beacon/src/codewheel.c
@@ -111,7 +111,12 @@ ISR(TIMER3_COMPA_vect)
{
if(codewheel_get_state() == CODEWHEEL_REQUEST_REBASE)
{
- OCR3A = codewheel_get_rebase_offset();
+ /* if rebase offset is too short, wait 1 turn before doing it */
+ if(codewheel_get_rebase_offset() < 60)
+ OCR3A = CODEWHEEL_CPR+codewheel_get_rebase_offset();
+ else
+ OCR3A = codewheel_get_rebase_offset();
+
codewheel_set_state(CODEWHEEL_REBASED);
uprintf("Rebased\r\n");
}