diff options
author | Maximilien Cuony <maximilien@theglu.org> | 2016-06-15 19:38:01 +0200 |
---|---|---|
committer | Maximilien Cuony <maximilien@theglu.org> | 2016-06-15 19:38:01 +0200 |
commit | beacdd1f9292626f39833dabaf2e0936f3d8d6a7 (patch) | |
tree | b41e914f296acb40446c109cd3fc7f379d9db853 /src | |
parent | 730140d594dd38834212c11db3f4e6332f0404c7 (diff) | |
download | glutte-o-matic-beacdd1f9292626f39833dabaf2e0936f3d8d6a7.tar.gz glutte-o-matic-beacdd1f9292626f39833dabaf2e0936f3d8d6a7.tar.bz2 glutte-o-matic-beacdd1f9292626f39833dabaf2e0936f3d8d6a7.zip |
FSM_BALISE_COURTE_OPEN
Diffstat (limited to 'src')
-rw-r--r-- | src/common/includes/Core/fsm.h | 1 | ||||
-rw-r--r-- | src/common/src/Core/fsm.c | 27 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/common/includes/Core/fsm.h b/src/common/includes/Core/fsm.h index 94698b4..80fc5a1 100644 --- a/src/common/includes/Core/fsm.h +++ b/src/common/includes/Core/fsm.h @@ -44,6 +44,7 @@ enum fsm_state_e { FSM_BALISE_LONGUE, // Full-length 2-hour beacon FSM_BALISE_SPECIALE, // 2-hour beacon when in QRP or with high power return mode FSM_BALISE_COURTE, // Short intermittent beacon + FSM_BALISE_COURTE_OPEN, // Short intermittent beacon, need to switch to OPEN _NUM_FSM_STATES // Dummy state to count the number of states }; diff --git a/src/common/src/Core/fsm.c b/src/common/src/Core/fsm.c index a6a0b7c..3ec15a1 100644 --- a/src/common/src/Core/fsm.c +++ b/src/common/src/Core/fsm.c @@ -45,7 +45,6 @@ static int last_supply_voltage_decivolts = 0; #define CW_MESSAGE_BALISE_LEN 64 static char cw_message_balise[CW_MESSAGE_BALISE_LEN]; -static int short_balise_got_sq = 0; void fsm_init() { memset(&fsm_in, 0, sizeof(fsm_in)); @@ -124,14 +123,13 @@ void fsm_update() { next_state = FSM_BALISE_SPECIALE; } else { - next_state = FSM_BALISE_COURTE; + next_state = FSM_BALISE_LONGUE; } } else if (!fsm_in.qrp && fsm_current_state_time_s() > 20 * 60) { next_state = FSM_BALISE_COURTE; } - short_balise_got_sq = 0; break; case FSM_OPEN1: @@ -384,6 +382,8 @@ void fsm_update() { break; case FSM_BALISE_COURTE: + case FSM_BALISE_COURTE_OPEN: + fsm_out.tx_on = 1; fsm_out.msg_frequency = 696; @@ -407,13 +407,19 @@ void fsm_update() { } fsm_out.cw_psk31_trigger = 1; - if (fsm_in.sq) { - short_balise_got_sq = 1; - } + if (current_state == FSM_BALISE_COURTE) { - if (fsm_in.cw_psk31_done) { + if (fsm_in.sq) { + next_state = FSM_BALISE_COURTE_OPEN; + } else { + if (fsm_in.cw_psk31_done) { + next_state = FSM_OISIF; + } + } + + } else { //FSM_BALISE_COURTE_OPEN - if (short_balise_got_sq) { + if (fsm_in.cw_psk31_done) { if (fsm_in.sq) { next_state = FSM_OPEN1; @@ -421,10 +427,9 @@ void fsm_update() { next_state = FSM_OPEN2; } - } else { - next_state = FSM_OISIF; } } + break; default: // Should never happen @@ -466,6 +471,8 @@ void fsm_update() { fsm_state_switched("FSM_BALISE_SPECIALE"); break; case FSM_BALISE_COURTE: fsm_state_switched("FSM_BALISE_COURTE"); break; + case FSM_BALISE_COURTE_OPEN: + fsm_state_switched("FSM_BALISE_COURTE_OPEN"); break; default: fsm_state_switched("ERROR!"); break; } |