diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-07-18 21:53:43 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-07-18 21:53:43 +0200 |
commit | e607769a8027f9e3bfb675d09fe587d2a1d295e8 (patch) | |
tree | d116dac71c35edc7786fe3e0b0fc521fcfdfb2a5 | |
parent | 65fb2e5e20b47bf0ca9cdadbf4f2bd2bc47d2635 (diff) | |
download | glutte-o-matic-e607769a8027f9e3bfb675d09fe587d2a1d295e8.tar.gz glutte-o-matic-e607769a8027f9e3bfb675d09fe587d2a1d295e8.tar.bz2 glutte-o-matic-e607769a8027f9e3bfb675d09fe587d2a1d295e8.zip |
Fix ATTENTE, require additional timing check
-rw-r--r-- | doc/db25_logique.svg | 8 | ||||
-rw-r--r-- | src/common/src/Core/fsm.c | 25 |
2 files changed, 23 insertions, 10 deletions
diff --git a/doc/db25_logique.svg b/doc/db25_logique.svg index abefd6c..bb8fbe9 100644 --- a/doc/db25_logique.svg +++ b/doc/db25_logique.svg @@ -54,12 +54,12 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.7" - inkscape:cx="336.55867" - inkscape:cy="473.31641" + inkscape:zoom="0.67277217" + inkscape:cx="372.04724" + inkscape:cy="526.1811" inkscape:document-units="px" inkscape:current-layer="layer1" - showgrid="true" + showgrid="false" inkscape:object-nodes="true" inkscape:window-width="1566" inkscape:window-height="874" diff --git a/src/common/src/Core/fsm.c b/src/common/src/Core/fsm.c index 0fdedb8..660ced8 100644 --- a/src/common/src/Core/fsm.c +++ b/src/common/src/Core/fsm.c @@ -244,28 +244,41 @@ void fsm_update() { fsm_out.tx_on = 1; fsm_out.modulation = 1; + /* Time checks: + * We need to check the total TX_ON duration to decide the text to + * send. This is done with the first check (delay between OPEN2 and + * current state). + * + * We also need to check if we actually entered the QSO state + * recently, otherwise we want to go to ATTENTE. That's why the + * check with QSO is needed. + */ + if (fsm_in.sq) { next_state = FSM_QSO; } else if (fsm_current_state_time_s() > 6 && - state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 5 && - state_delta_ms(FSM_QSO, FSM_ECOUTE) > 1000ul * 5) { + state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 5) { next_state = FSM_ATTENTE; } else if (fsm_current_state_time_s() > 5 && - state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 5 * 60) { + state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 5 * 60 && + state_delta_ms(FSM_QSO, FSM_ECOUTE) < 1000ul * 15) { next_state = FSM_OISIF; } else if (fsm_current_state_time_s() > 5 && - state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 10 * 60) { + state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 10 * 60 && + state_delta_ms(FSM_QSO, FSM_ECOUTE) < 1000ul * 15) { next_state = FSM_TEXTE_73; } else if (fsm_current_state_time_s() > 5 && - state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 15 * 60) { + state_delta_ms(FSM_OPEN2, FSM_ECOUTE) < 1000ul * 15 * 60 && + state_delta_ms(FSM_QSO, FSM_ECOUTE) < 1000ul * 15) { next_state = FSM_TEXTE_HB9G; } else if (fsm_current_state_time_s() > 5 && - state_delta_ms(FSM_OPEN2, FSM_ECOUTE) >= 1000ul * 15 * 60) { + state_delta_ms(FSM_OPEN2, FSM_ECOUTE) >= 1000ul * 15 * 60 && + state_delta_ms(FSM_QSO, FSM_ECOUTE) < 1000ul * 15) { next_state = FSM_TEXTE_LONG; } break; |