aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fsm/cw.c4
-rw-r--r--src/fsm/fsm.c26
-rw-r--r--src/fsm/fsm.h2
-rw-r--r--src/fsm/main.c2
4 files changed, 27 insertions, 7 deletions
diff --git a/src/fsm/cw.c b/src/fsm/cw.c
index da83383..d17a892 100644
--- a/src/fsm/cw.c
+++ b/src/fsm/cw.c
@@ -250,8 +250,8 @@ static void cw_task(void *pvParameters)
cw_transmit_ongoing = 1;
- const int samples_per_dit = (cw_samplerate * 10) /
- cw_fill_msg_current.dit_duration;
+ const int samples_per_dit =
+ (cw_samplerate * cw_fill_msg_current.dit_duration) / 1000;
// Angular frequency of NCO
const float omega = 2.0f * FLOAT_PI * cw_fill_msg_current.freq /
diff --git a/src/fsm/fsm.c b/src/fsm/fsm.c
index 8b7f105..88211d8 100644
--- a/src/fsm/fsm.c
+++ b/src/fsm/fsm.c
@@ -92,8 +92,8 @@ void fsm_update() {
fsm_out.tx_on = 0;
fsm_out.modulation = 0;
fsm_out.cw_trigger = 0;
- fsm_out.cw_speed = 23;
- fsm_out.cw_frequency = 500;
+ fsm_out.cw_dit_duration = 50;
+ fsm_out.cw_frequency = 960;
// other output signals keep their value
switch (current_state) {
@@ -135,6 +135,11 @@ void fsm_update() {
fsm_out.tx_on = 1;
fsm_out.modulation = 1;
fsm_out.cw_msg = fsm_select_letter();
+ if (fsm_out.cw_msg[0] == 'G') {
+ // The letter 'G' is a bit different
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
+ }
fsm_out.cw_trigger = 1;
if (fsm_in.cw_done) {
@@ -217,6 +222,8 @@ void fsm_update() {
case FSM_TEXTE_73:
fsm_out.tx_on = 1;
fsm_out.modulation = 1;
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
fsm_out.cw_msg = "73";
fsm_out.cw_trigger = 1;
@@ -231,6 +238,8 @@ void fsm_update() {
case FSM_TEXTE_HB9G:
fsm_out.tx_on = 1;
fsm_out.modulation = 1;
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
fsm_out.cw_msg = "HB9G";
fsm_out.cw_trigger = 1;
@@ -246,6 +255,9 @@ void fsm_update() {
fsm_out.tx_on = 1;
fsm_out.modulation = 1;
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
+
if (random_bool()) {
fsm_out.cw_msg = "HB9G 1628M";
}
@@ -265,6 +277,9 @@ void fsm_update() {
case FSM_BALISE_LONGUE:
fsm_out.tx_on = 1;
+ fsm_out.cw_frequency = 588;
+ fsm_out.cw_dit_duration = 110;
+
// TODO transmit humidity
// TODO read voltage
if (fsm_in.wind_generator_ok) {
@@ -289,6 +304,9 @@ void fsm_update() {
case FSM_BALISE_SPECIALE:
fsm_out.tx_on = 1;
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
+
// TODO read voltage
if (fsm_in.wind_generator_ok) {
fsm_out.cw_msg = "HB9G U 10V5 73";
@@ -309,6 +327,9 @@ void fsm_update() {
case FSM_BALISE_COURTE:
fsm_out.tx_on = 1;
+ fsm_out.cw_frequency = 696;
+ fsm_out.cw_dit_duration = 70;
+
{
int rand = random_bool() * 2 + random_bool();
@@ -341,7 +362,6 @@ void fsm_update() {
}
-
if (next_state != current_state) {
timestamp_state[next_state] = timestamp_now();
}
diff --git a/src/fsm/fsm.h b/src/fsm/fsm.h
index 62f86a7..110f6bf 100644
--- a/src/fsm/fsm.h
+++ b/src/fsm/fsm.h
@@ -80,7 +80,7 @@ struct fsm_output_signals_t {
/* Signals to the CW generator */
const char* cw_msg; // The message to transmit
int cw_frequency; // What audio frequency for the CW message
- int cw_speed; // CW speed
+ int cw_dit_duration;// CW speed, dit duration in ms
int cw_trigger; // Set to true to trigger a transmission
};
diff --git a/src/fsm/main.c b/src/fsm/main.c
index 655ab45..9ae21fa 100644
--- a/src/fsm/main.c
+++ b/src/fsm/main.c
@@ -273,7 +273,7 @@ static void exercise_fsm(void *pvParameters)
// Add message to CW generator only on rising edge of trigger
if (fsm_out.cw_trigger && !cw_last_trigger) {
- cw_push_message(fsm_out.cw_msg, 140 /*fsm_out.cw_speed*/, fsm_out.cw_frequency);
+ cw_push_message(fsm_out.cw_msg, fsm_out.cw_dit_duration, fsm_out.cw_frequency);
}
cw_last_trigger = fsm_out.cw_trigger;