aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-12-31 14:55:01 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-12-31 14:55:01 +0100
commit7849f19829d233858de4c2156f87be57bc51d774 (patch)
tree83582ce0394b0c46877a0a3edc7f9d4377b69780
parent6f00ffb0f016413522bd54dc9e44beb92864df02 (diff)
downloadglutte-o-matic-7849f19829d233858de4c2156f87be57bc51d774.tar.gz
glutte-o-matic-7849f19829d233858de4c2156f87be57bc51d774.tar.bz2
glutte-o-matic-7849f19829d233858de4c2156f87be57bc51d774.zip
Refactor CW call into #define
-rw-r--r--src/common/Core/fsm.c22
-rw-r--r--src/simulator/Makefile2
2 files changed, 13 insertions, 11 deletions
diff --git a/src/common/Core/fsm.c b/src/common/Core/fsm.c
index 47c349d..c78a187 100644
--- a/src/common/Core/fsm.c
+++ b/src/common/Core/fsm.c
@@ -65,6 +65,8 @@ static void balise_message_clear(void)
// Reset the counter if the QSO was 10m too long
#define SHORT_BEACON_RESET_IF_QSO (60 * 10)
+#define CALL "HB9G"
+
/* At least 1 second predelay for CW, ensures the receivers had enough time
* time to open their squelch before the first letter gets transmitted
*/
@@ -430,7 +432,7 @@ void fsm_update() {
fsm_out.msg_frequency = 696;
fsm_out.cw_dit_duration = 70;
// No need for CW_PREDELAY, since we are already transmitting
- fsm_out.msg = " HB9G" CW_POSTDELAY;
+ fsm_out.msg = " " CALL CW_POSTDELAY;
fsm_out.cw_psk_trigger = 1;
if (fsm_in.sq) {
@@ -452,10 +454,10 @@ void fsm_update() {
// No need for CW_PREDELAY, since we are already transmitting
if (random_bool()) {
- fsm_out.msg = " HB9G 1628M" CW_POSTDELAY;
+ fsm_out.msg = " " CALL " 1628M" CW_POSTDELAY;
}
else {
- fsm_out.msg = " HB9G JN36BK" CW_POSTDELAY;
+ fsm_out.msg = " " CALL " JN36BK" CW_POSTDELAY;
}
fsm_out.cw_psk_trigger = 1;
@@ -511,7 +513,7 @@ void fsm_update() {
size_t len = 0;
len += snprintf(balise_message + len, BALISE_MESSAGE_LEN-len-1,
- CW_PREDELAY "HB9G JN36BK U %dV%01d ",
+ CW_PREDELAY CALL " JN36BK U %dV%01d ",
supply_decivolts / 10,
supply_decivolts % 10);
@@ -629,7 +631,7 @@ void fsm_update() {
size_t len = 0;
len += snprintf(balise_message+len, BALISE_MESSAGE_LEN-len-1,
- CW_PREDELAY "HB9G U %dV%01d ",
+ CW_PREDELAY CALL " U %dV%01d ",
supply_decivolts / 10,
supply_decivolts % 10);
@@ -681,22 +683,22 @@ void fsm_update() {
fsm_out.cw_dit_duration = 70;
if (fsm_in.bonne_annee) {
- fsm_out.msg = CW_PREDELAY "HB9G BONNE ANNEE" CW_POSTDELAY;
+ fsm_out.msg = CW_PREDELAY CALL " BONNE ANNEE" CW_POSTDELAY;
}
else {
int rand = random_bool() * 2 + random_bool();
if (rand == 0) {
- fsm_out.msg = CW_PREDELAY "HB9G" CW_POSTDELAY;
+ fsm_out.msg = CW_PREDELAY CALL CW_POSTDELAY;
}
else if (rand == 1) {
- fsm_out.msg = CW_PREDELAY "HB9G JN36BK" CW_POSTDELAY;
+ fsm_out.msg = CW_PREDELAY CALL " JN36BK" CW_POSTDELAY;
}
else if (rand == 2) {
- fsm_out.msg = CW_PREDELAY "HB9G 1628M" CW_POSTDELAY;
+ fsm_out.msg = CW_PREDELAY CALL " 1628M" CW_POSTDELAY;
}
else {
- fsm_out.msg = CW_PREDELAY "HB9G JN36BK 1628M" CW_POSTDELAY;
+ fsm_out.msg = CW_PREDELAY CALL " JN36BK 1628M" CW_POSTDELAY;
}
}
fsm_out.cw_psk_trigger = 1;
diff --git a/src/simulator/Makefile b/src/simulator/Makefile
index a93e741..40b113b 100644
--- a/src/simulator/Makefile
+++ b/src/simulator/Makefile
@@ -82,7 +82,7 @@ endif
# MAX_NUMBER_OF_TASKS = max pthreads used in the POSIX port.
# Default value is 64 (_POSIX_THREAD_THREADS_MAX), the minimum number required by POSIX.
-CFLAGS += -DMAX_NUMBER_OF_TASKS=300 -DSIMULATOR
+CFLAGS += -DMAX_NUMBER_OF_TASKS=300 -DSIMULATOR -fsanitize=undefined
CFLAGS += $(INCLUDES) $(CWARNS) -O2