aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-03-02 18:13:44 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-03-02 18:13:44 +0100
commit3555e921a0c743dbc2cc10d8655827be975c61e0 (patch)
tree69a577151d8cd8f3e47c65810acf096a4a5061e7 /src
parente8a97355d045c78399949b734728afd688254022 (diff)
downloadglutte-o-matic-3555e921a0c743dbc2cc10d8655827be975c61e0.tar.gz
glutte-o-matic-3555e921a0c743dbc2cc10d8655827be975c61e0.tar.bz2
glutte-o-matic-3555e921a0c743dbc2cc10d8655827be975c61e0.zip
Make 1750 detector work in simulator FSM
Diffstat (limited to 'src')
-rw-r--r--src/common/src/Core/fsm.c26
-rw-r--r--src/common/src/Core/main.c4
-rw-r--r--src/simulator/src/GPIO/pio.c4
-rw-r--r--src/simulator/src/Gui/gui.c2
4 files changed, 9 insertions, 27 deletions
diff --git a/src/common/src/Core/fsm.c b/src/common/src/Core/fsm.c
index 735b8d6..38546b0 100644
--- a/src/common/src/Core/fsm.c
+++ b/src/common/src/Core/fsm.c
@@ -31,12 +31,6 @@
#include "GPIO/temperature.h"
#include "GPIO/analog.h"
-/* Set this flag to 1 to disable the usage of the 1750 signal in the FSM.
- * This is used because the external 1750Hz detector is broken, and we temporarily
- * want to run the repeater in open-through-carrier mode.
- */
-#define BUG_1750_BROKEN 1
-
static struct fsm_input_signals_t fsm_in;
static struct fsm_output_signals_t fsm_out;
@@ -179,7 +173,7 @@ static const char* fsm_select_letter(void) {
else if (fsm_in.qrp) {
return letter_qrp;
}
- else if (fsm_in.sstv_mode || sstv_state == SSTV_FSM_ON) {
+ else if (fsm_in.fax_mode || sstv_state == SSTV_FSM_ON) {
return letter_sstv;
}
@@ -218,15 +212,9 @@ void fsm_update() {
short_beacon_counter_s++;
}
-#if defined(BUG_1750_BROKEN)
- if (fsm_in.sq) {
+ if ((fsm_in.sq && fsm_in.det_1750) | (fsm_in.sq && sstv_state == SSTV_FSM_ON)) {
next_state = FSM_OPEN1;
}
-#else
- if (fsm_in.tone_1750 | (fsm_in.sq && sstv_state == SSTV_FSM_ON)) {
- next_state = FSM_OPEN1;
- }
-#endif
else if (balise_state == BALISE_FSM_PENDING) {
short_beacon_counter_s = 0;
next_state = select_grande_balise();
@@ -242,15 +230,9 @@ void fsm_update() {
/* Do not enable TX_ON here, otherwise we could get stuck transmitting
* forever if SQ never goes low.
*/
-#if defined(BUG_1750_BROKEN)
- if (!fsm_in.sq) {
- next_state = FSM_OPEN2;
- }
-#else
- if (!fsm_in.sq && !fsm_in.tone_1750) {
+ if (!fsm_in.sq && !fsm_in.det_1750) {
next_state = FSM_OPEN2;
}
-#endif
break;
case FSM_OPEN2:
@@ -654,7 +636,7 @@ void fsm_sstv_update() {
switch (sstv_state) {
case SSTV_FSM_OFF:
- if (fsm_in.sq && fsm_in.sstv_mode) {
+ if (fsm_in.sq && fsm_in.fax_mode) {
next_state = SSTV_FSM_ON;
}
break;
diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c
index 18c25b2..d303e09 100644
--- a/src/common/src/Core/main.c
+++ b/src/common/src/Core/main.c
@@ -55,6 +55,8 @@ static int tm_trigger_button = 0;
static struct fsm_input_signals_t fsm_input;
static int hour_is_even = 0;
+extern int TONE_1750_DETECTED;
+
/* Threshold for SWR measurement */
const int swr_refl_threshold = 10; // mV
@@ -560,7 +562,7 @@ static void exercise_fsm(void __attribute__ ((unused))*pvParameters)
}
#warning "TODO: from tone detector"
- fsm_input.det_1750 = 0;
+ fsm_input.det_1750 = TONE_1750_DETECTED;
fsm_input.fax_mode = 0;
fsm_input.swr_high = swr_error_flag;
diff --git a/src/simulator/src/GPIO/pio.c b/src/simulator/src/GPIO/pio.c
index a8622c2..75c8705 100644
--- a/src/simulator/src/GPIO/pio.c
+++ b/src/simulator/src/GPIO/pio.c
@@ -59,14 +59,12 @@ void pio_set_gps_epps(int on) {
}
void pio_set_fsm_signals(struct fsm_input_signals_t* sig) {
-
+ sig->button_1750 = gui_in_1750_n ? 0 : 1;
sig->qrp = gui_in_qrp_n ? 0 : 1;
- sig->tone_1750 = gui_in_1750_n ? 0 : 1;
sig->sq = gui_in_sq_n ? 0 : 1;
sig->discrim_u = gui_in_u ? 1 : 0;
sig->discrim_d = gui_in_d ? 1 : 0;
sig->wind_generator_ok = gui_in_replie ? 0 : 1;
- sig->sstv_mode = gui_in_fax_n ? 0 : 1;
}
diff --git a/src/simulator/src/Gui/gui.c b/src/simulator/src/Gui/gui.c
index 4458920..fd4fe7a 100644
--- a/src/simulator/src/Gui/gui.c
+++ b/src/simulator/src/Gui/gui.c
@@ -738,7 +738,7 @@ void main_gui() {
c = color_off;
}
- nk_label_colored(ctx, "1750_n", NK_TEXT_LEFT, c);
+ nk_label_colored(ctx, "1750 btn", NK_TEXT_LEFT, c);
nk_checkbox_label(ctx, "", &in_1750_n);
if (nk_button_label(ctx, "", NK_BUTTON_REPEATER)) {