From 1d814f075a9d8aec5d2b415a55c4b9de3285e0c2 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 07:53:36 -0400 Subject: [PATCH 01/16] removed extra char call --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 5f099534..78c506ca 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -217,7 +217,7 @@ int uart_fd; int reset_count = 0; float uptime_sec = 1000; long int uptime = 1000; -char call[5]; +//char call[5]; char sim_yes[10]; int mode = BPSK; // SSTV; From 35b553c3ee004d66a81fc400dd2db27e2f6ebc55 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 08:21:25 -0400 Subject: [PATCH 02/16] added CW telemetry mode --- cubesatsim/cubesatsim.ino | 51 +++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2980ff04..eea89b36 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -160,16 +160,17 @@ void loop() { read_payload(); // encode as digits (APRS or CW mode) or binary (DUV FSK) - if ((mode == BPSK) || (mode == FSK)) - { + if ((mode == BPSK) || (mode == FSK)) { get_tlm_fox(); } - else if (mode == AFSK) - { - send_packet(); - } - else if (mode == SSTV) - { + else if ((mode == AFSK) || (mode == CW)) { + get_tlm_a07(); + if (mode == AFSK) { + send_packet(); + } else if (mode == CW) { + send_cw(); + } + else if (mode == SSTV) { Serial.println("\nSending SSTV image!"); send_sstv("/cam.raw"); Serial.println("\nImage sent!"); @@ -262,11 +263,12 @@ void read_reset_count() { } } -void send_packet() { -// encode telemetry - get_tlm_ao7(); - +void send_packet() { // digitalWrite(LED_BUILTIN, LOW); + + char str[1000]; + strcat(str, payload_str); + set_status(str); Serial.println("Sending APRS packet!"); transmit_on(); @@ -289,6 +291,23 @@ void transmit_on() { Serial.println("No transmit!"); } +void send_cw() { + char de[] = " HI HI DE "; + char telem[1000]; + char space[] = " "; + + Serial.println("Sending CW packet!"); + + strcpy(telem, de); + strcat(telem, callsign); + strcat(telem, space); + strcat(telem, payload_str); + print_string(telem); + Serial.println(strlen(telem)); + + transmit_string(telem); +} + void transmit_off() { digitalWrite(PTT_PIN, HIGH); Serial.println("Transmit off!"); @@ -495,10 +514,10 @@ void get_tlm_ao7() { strcat(str, tlm_str); } // print_string(str); - strcat(str, payload_str); +// strcat(str, payload_str); // print_string(str); // Serial.println(strlen(str)); - set_status(str); +// set_status(str); // } } @@ -2978,6 +2997,7 @@ void process_pushbutton() { pb_value = digitalRead(MAIN_PB_PIN); if ((pb_value == RELEASED) && (release == FALSE)) { Serial.println("PB: Switch to CW"); + new_mode = CW; release = TRUE; } @@ -3075,6 +3095,7 @@ void process_bootsel() { // pb_value = digitalRead(MAIN_PB_PIN); if ((!BOOTSEL) && (release == FALSE)) { Serial.println("BOOTSEL: Switch to CW"); + new_mode = CW; release = TRUE; } @@ -3436,9 +3457,7 @@ void transmit_callsign(char *callsign) { strcat(id, callsign); Serial.print("Transmitting id: "); print_string(id); -// transmit_on(); transmit_string(id); -// transmit_off(); } void transmit_string(char *string) { From 04af7395ffd213bbf46c70ccd553d6c3dbc395b7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 08:30:05 -0400 Subject: [PATCH 03/16] fixed simulate telem --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 78c506ca..4df185ff 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -142,7 +142,7 @@ void transmit_on(); void transmit_off(); void config_telem(); void config_simulated_telem(); -void generate_simualted_telem(); +void generate_simulated_telem(); void process_pushbutton(); void blinkTimes(int blinks); void blink_pin(int pin, int duration); From e75dfe099ba543f9c04d5f303c9b0e77d2203be8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 08:31:16 -0400 Subject: [PATCH 04/16] added missing } --- cubesatsim/cubesatsim.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index eea89b36..0d707bb4 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -164,11 +164,12 @@ void loop() { get_tlm_fox(); } else if ((mode == AFSK) || (mode == CW)) { - get_tlm_a07(); + get_tlm_ao7(); if (mode == AFSK) { send_packet(); } else if (mode == CW) { - send_cw(); + send_cw(); + } } else if (mode == SSTV) { Serial.println("\nSending SSTV image!"); From 0dd5f22c5f6880e9b62997fa457040e586f2d9d5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 08:36:12 -0400 Subject: [PATCH 05/16] added tlm and payload str --- cubesatsim/cubesatsim.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 4df185ff..b0e3425b 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -186,6 +186,8 @@ long time_start; short int buffer[BUFFER_SIZE]; // 50000]; //BUFFER_SIZE]; // ctr is an int // 100000]; // 50000]; // 25000]; // 10240]; // was 2336400]; // max size for 10 frames count of BPSK //short int buffer[(WAV_DATA_LENGTH/8)]; //FILE *sopen(const char *program); +char tlm_str[1000]; +char payload_str[100]; #define S_RATE (200) // (8000) //(48000) // (44100) From 8ffd3e3eeb89b7bc61aab09159779548d4f9b5ee Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 08:41:35 -0400 Subject: [PATCH 06/16] added tlm_str --- cubesatsim/cubesatsim.ino | 40 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0d707bb4..7d981cfe 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -49,8 +49,6 @@ Adafruit_INA219 ina219_2_0x41(0x41); Adafruit_INA219 ina219_2_0x44(0x44); Adafruit_INA219 ina219_2_0x45(0x45); -char payload_str[100]; - WiFiServer server(port); WiFiClient client; @@ -267,7 +265,10 @@ void read_reset_count() { void send_packet() { // digitalWrite(LED_BUILTIN, LOW); - char str[1000]; + char str[1000]; + char header_str[] = "hi hi "; + strcpy(str, header_str); + strcpy(str, tlm_str); strcat(str, payload_str); set_status(str); @@ -277,21 +278,6 @@ void send_packet() { transmit_off(); } -void transmit_on() { - if ((mode == AFSK) || (mode == SSTV)) { - Serial.println("Transmit on!"); - digitalWrite(MAIN_LED_BLUE, HIGH); - digitalWrite(PTT_PIN, LOW); - } - else if (mode == BPSK) { - Serial.println("Transmit on!"); - pwm_set_gpio_level(BPSK_PWM_A_PIN, (config.top + 1) * 0.5); - pwm_set_gpio_level(BPSK_PWM_B_PIN, (config.top + 1) * 0.5); - } - else - Serial.println("No transmit!"); -} - void send_cw() { char de[] = " HI HI DE "; char telem[1000]; @@ -302,6 +288,8 @@ void send_cw() { strcpy(telem, de); strcat(telem, callsign); strcat(telem, space); + strcat(telem, tlm_str); + strcat(telem, space); strcat(telem, payload_str); print_string(telem); Serial.println(strlen(telem)); @@ -309,6 +297,21 @@ void send_cw() { transmit_string(telem); } +void transmit_on() { + if ((mode == AFSK) || (mode == SSTV)) { + Serial.println("Transmit on!"); + digitalWrite(MAIN_LED_BLUE, HIGH); + digitalWrite(PTT_PIN, LOW); + } + else if (mode == BPSK) { + Serial.println("Transmit on!"); + pwm_set_gpio_level(BPSK_PWM_A_PIN, (config.top + 1) * 0.5); + pwm_set_gpio_level(BPSK_PWM_B_PIN, (config.top + 1) * 0.5); + } + else + Serial.println("No transmit!"); +} + void transmit_off() { digitalWrite(PTT_PIN, HIGH); Serial.println("Transmit off!"); @@ -500,7 +503,6 @@ void get_tlm_ao7() { Serial.println(" "); */ char str[1000]; - char tlm_str[1000]; int channel; char header_str[] = "hi hi "; strcpy(str, header_str); From 955d8db97afa94270f67dc1aaa48f15aee6a7f79 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:03:46 -0400 Subject: [PATCH 07/16] prints in CW --- cubesatsim/cubesatsim.ino | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 7d981cfe..4594a48b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -505,16 +505,16 @@ void get_tlm_ao7() { char str[1000]; int channel; char header_str[] = "hi hi "; - strcpy(str, header_str); + strcpy(tlm_str, header_str); for (channel = 1; channel < 7; channel++) { - sprintf(tlm_str, "%d%d%d %d%d%d %d%d%d %d%d%d ", + sprintf(tlm, "%d%d%d %d%d%d %d%d%d %d%d%d ", channel, upper_digit(tlm[channel][1]), lower_digit(tlm[channel][1]), channel, upper_digit(tlm[channel][2]), lower_digit(tlm[channel][2]), channel, upper_digit(tlm[channel][3]), lower_digit(tlm[channel][3]), channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); // printf("%s",tlm_str); - strcat(str, tlm_str); + strcat(tlm_str, str); } // print_string(str); // strcat(str, payload_str); @@ -3464,18 +3464,21 @@ void transmit_callsign(char *callsign) { } void transmit_string(char *string) { - int i = 0; + int j = 0; Serial.println("Transmit on"); digitalWrite(PD_PIN, HIGH); // Enable SR_FRS digitalWrite(MAIN_LED_BLUE, HIGH); digitalWrite(PTT_PIN, LOW); - while ((string[i] != '\0') && (i < 256)) { - if (string[i] != ' ') - transmit_char(string[i++]); + while ((string[j] != '\0') && (j < 256)) { + Serial.print("j = "); + Serial.println(j); + if (string[j] != ' ') + transmit_char(string[j++]); else { + Serial.println("space between words); sleep((6.0 * (float)morse_timing)/1000.0); - i++; + j++; } } Serial.println("Transmit off"); @@ -3487,12 +3490,14 @@ void transmit_string(char *string) { void transmit_char(char character) { int i = 0; while ((morse_table[(toupper(character) - '0') % 44][i] != 0) && (i < 5)) { + Serial.print("i = "); + Serial.println(i); // Serial.print(morse_table[(toupper(character) - '0') % 44][i]); transmit_cw(morse_freq, morse_table[(toupper(character) - '0') % 44][i++] * morse_timing); sleep((float)(morse_timing)/1000.0); } sleep((float)(morse_timing * 3.0)/1000.0); -// Serial.println(" "); + Serial.println("space between characters"); } From 1b63bb8469121e4846be56a400d3c89d4df024c7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:08:44 -0400 Subject: [PATCH 08/16] typo --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4594a48b..7e75ed8e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3476,7 +3476,7 @@ void transmit_string(char *string) { if (string[j] != ' ') transmit_char(string[j++]); else { - Serial.println("space between words); + Serial.println("space between words"); sleep((6.0 * (float)morse_timing)/1000.0); j++; } From c944b051b8515d660247a8934dd35a3eca8098b3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:12:22 -0400 Subject: [PATCH 09/16] fixed str --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 7e75ed8e..9ff60aae 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -508,13 +508,13 @@ void get_tlm_ao7() { strcpy(tlm_str, header_str); for (channel = 1; channel < 7; channel++) { - sprintf(tlm, "%d%d%d %d%d%d %d%d%d %d%d%d ", + sprintf(str, "%d%d%d %d%d%d %d%d%d %d%d%d ", channel, upper_digit(tlm[channel][1]), lower_digit(tlm[channel][1]), channel, upper_digit(tlm[channel][2]), lower_digit(tlm[channel][2]), channel, upper_digit(tlm[channel][3]), lower_digit(tlm[channel][3]), channel, upper_digit(tlm[channel][4]), lower_digit(tlm[channel][4])); - // printf("%s",tlm_str); - strcat(tlm_str, str); + // printf("%s",str); + strcat(tlm_str, str); } // print_string(str); // strcat(str, payload_str); From ce1bb083420ca01a19ef612eb4dace106f7b01fb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:29:19 -0400 Subject: [PATCH 10/16] added extra column in morse table --- cubesatsim/cubesatsim.h | 88 ++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index b0e3425b..38bad8d9 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -312,50 +312,50 @@ bool timer0_on = false; char callsign[20]; int morse_timing = 60; // ms for a dit int morse_freq = 1800; // Hz -int morse_table[44][5] = { // 0-9, A-Z only by (ASCII - 48) - { 3, 3, 3, 3, 3 }, // 0 - { 1, 3, 3, 3, 3 }, // 1 - { 1, 1, 3, 3, 3 }, // 2 - { 1, 1, 1, 3, 3 }, // 3 - { 1, 1, 1, 1, 3 }, // 4 - { 1, 1, 1, 1, 1 }, // 5 - { 3, 1, 1, 1, 1 }, // 6 - { 3, 3, 1, 1, 1 }, // 7 - { 3, 3, 3, 1, 1 }, // 8 - { 3, 3, 3, 3, 1 }, // 9 - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 0, 0, 0, 0, 0 }, // - - { 1, 3, 0, 0, 0 }, // A - { 3, 1, 1, 1, 0 }, // B - { 3, 1, 3, 1, 0 }, // C - { 3, 1, 1, 0, 0 }, // D - { 1, 0, 0, 0, 0 }, // E - { 1, 1, 3, 1, 0 }, // F - { 3, 3, 1, 0, 0 }, // G - { 1, 1, 1, 1, 0 }, // H - { 1, 1, 0, 0, 0 }, // I - { 1, 3, 3, 3, 0 }, // J - { 3, 1, 3, 0, 0 }, // K - { 1, 3, 1, 1, 0 }, // L - { 3, 3, 0, 0, 0 }, // M - { 3, 1, 0, 0, 0 }, // N - { 3, 3, 3, 0, 0 }, // O - { 1, 3, 3, 1, 0 }, // P - { 3, 3, 1, 3, 0 }, // Q - { 1, 3, 1, 0, 0 }, // R - { 1, 1, 1, 0, 0 }, // S - { 3, 0, 0, 0, 0 }, // T - { 1, 1, 3, 0, 0 }, // U - { 1, 1, 1, 3, 0 }, // V - { 1, 3, 3, 0, 0 }, // W - { 3, 1, 1, 3, 0 }, // X - { 3, 1, 3, 3, 0 }, // Y - { 3, 3, 1, 1, 0 } // Z +int morse_table[44][6] = { // 0-9, A-Z only by (ASCII - 48) + { 3, 3, 3, 3, 3, 0 }, // 0 + { 1, 3, 3, 3, 3, 0 }, // 1 + { 1, 1, 3, 3, 3, 0 }, // 2 + { 1, 1, 1, 3, 3, 0 }, // 3 + { 1, 1, 1, 1, 3, 0 }, // 4 + { 1, 1, 1, 1, 1, 0 }, // 5 + { 3, 1, 1, 1, 1, 0 }, // 6 + { 3, 3, 1, 1, 1, 0 }, // 7 + { 3, 3, 3, 1, 1, 0 }, // 8 + { 3, 3, 3, 3, 1, 0 }, // 9 + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 0, 0, 0, 0, 0, 0 }, // - + { 1, 3, 0, 0, 0, 0 }, // A + { 3, 1, 1, 1, 0, 0 }, // B + { 3, 1, 3, 1, 0, 0 }, // C + { 3, 1, 1, 0, 0, 0 }, // D + { 1, 0, 0, 0, 0, 0 }, // E + { 1, 1, 3, 1, 0, 0 }, // F + { 3, 3, 1, 0, 0, 0 }, // G + { 1, 1, 1, 1, 0, 0 }, // H + { 1, 1, 0, 0, 0, 0 }, // I + { 1, 3, 3, 3, 0, 0 }, // J + { 3, 1, 3, 0, 0, 0 }, // K + { 1, 3, 1, 1, 0, 0 }, // L + { 3, 3, 0, 0, 0, 0 }, // M + { 3, 1, 0, 0, 0, 0 }, // N + { 3, 3, 3, 0, 0, 0 }, // O + { 1, 3, 3, 1, 0, 0 }, // P + { 3, 3, 1, 3, 0, 0 }, // Q + { 1, 3, 1, 0, 0, 0 }, // R + { 1, 1, 1, 0, 0, 0 }, // S + { 3, 0, 0, 0, 0, 0 }, // T + { 1, 1, 3, 0, 0, 0 }, // U + { 1, 1, 1, 3, 0, 0 }, // V + { 1, 3, 3, 0, 0, 0 }, // W + { 3, 1, 1, 3, 0, 0 }, // X + { 3, 1, 3, 3, 0, 0 }, // Y + { 3, 3, 1, 1, 0, 0 } // Z }; From 8ea74740ccb46b27363cd5aa63839a595c1dd9f1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:30:58 -0400 Subject: [PATCH 11/16] removed i < 5 since it didn't work --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 9ff60aae..5b438366 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3489,7 +3489,7 @@ void transmit_string(char *string) { void transmit_char(char character) { int i = 0; - while ((morse_table[(toupper(character) - '0') % 44][i] != 0) && (i < 5)) { + while (morse_table[(toupper(character) - '0') % 44][i] != 0) { Serial.print("i = "); Serial.println(i); // Serial.print(morse_table[(toupper(character) - '0') % 44][i]); From ec800855567c48b60799aee5bc357b581bc12627 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:39:56 -0400 Subject: [PATCH 12/16] don't transmit callsign if CW mode --- cubesatsim/cubesatsim.ino | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5b438366..89cf06eb 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -131,7 +131,8 @@ void setup() { /**/ Serial.println("Transmitting callsign"); strcpy(callsign, call); - transmit_callsign(callsign); + if (mode != CW) + transmit_callsign(callsign); sleep(5.0); /**/ @@ -203,7 +204,8 @@ void loop() { Serial.println("Changing mode"); mode = new_mode; // change modes if button pressed - transmit_callsign(callsign); + if (new_mode != CW) + transmit_callsign(callsign); sleep(0.5); config_telem(); config_radio(); @@ -3471,12 +3473,12 @@ void transmit_string(char *string) { digitalWrite(PTT_PIN, LOW); while ((string[j] != '\0') && (j < 256)) { - Serial.print("j = "); - Serial.println(j); +// Serial.print("j = "); +// Serial.println(j); if (string[j] != ' ') transmit_char(string[j++]); else { - Serial.println("space between words"); +// Serial.println("space between words"); sleep((6.0 * (float)morse_timing)/1000.0); j++; } @@ -3490,14 +3492,14 @@ void transmit_string(char *string) { void transmit_char(char character) { int i = 0; while (morse_table[(toupper(character) - '0') % 44][i] != 0) { - Serial.print("i = "); - Serial.println(i); +// Serial.print("i = "); +// Serial.println(i); // Serial.print(morse_table[(toupper(character) - '0') % 44][i]); transmit_cw(morse_freq, morse_table[(toupper(character) - '0') % 44][i++] * morse_timing); sleep((float)(morse_timing)/1000.0); } sleep((float)(morse_timing * 3.0)/1000.0); - Serial.println("space between characters"); +// Serial.println("space between characters"); } From 45595d2f9e98faefa60f6fce5e47d0a013c24565 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 09:46:11 -0400 Subject: [PATCH 13/16] don't send hi hi first in CW, don't send payload --- cubesatsim/cubesatsim.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 89cf06eb..35ea322d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -281,7 +281,7 @@ void send_packet() { } void send_cw() { - char de[] = " HI HI DE "; + char de[] = " DE "; char telem[1000]; char space[] = " "; @@ -290,9 +290,7 @@ void send_cw() { strcpy(telem, de); strcat(telem, callsign); strcat(telem, space); - strcat(telem, tlm_str); - strcat(telem, space); - strcat(telem, payload_str); + strcat(telem, tlm_str); // don't send payload since it isn't encoded and has "." print_string(telem); Serial.println(strlen(telem)); From 0c90935597f3ea578f7a153a39e1e2ebec0c2ce5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 10:57:35 -0400 Subject: [PATCH 14/16] added cw_stop to exit CW mode --- cubesatsim/cubesatsim.ino | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 35ea322d..c87581c2 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -298,16 +298,20 @@ void send_cw() { } void transmit_on() { - if ((mode == AFSK) || (mode == SSTV)) { + if (mode == SSTV) { Serial.println("Transmit on!"); digitalWrite(MAIN_LED_BLUE, HIGH); - digitalWrite(PTT_PIN, LOW); - } + digitalWrite(PTT_PIN, LOW); + } else if (mode == BPSK) { Serial.println("Transmit on!"); pwm_set_gpio_level(BPSK_PWM_A_PIN, (config.top + 1) * 0.5); pwm_set_gpio_level(BPSK_PWM_B_PIN, (config.top + 1) * 0.5); } + else if (mode == CW) { + // Serial.println("Transmit on!"); + cw_stop = false; + } else Serial.println("No transmit!"); } @@ -321,8 +325,10 @@ void transmit_off() { pwm_set_gpio_level(BPSK_PWM_A_PIN, 0); pwm_set_gpio_level(BPSK_PWM_B_PIN, 0); } - if (mode == SSTV) + else if (mode == SSTV) sstv_end(); + else if (mode == CW) + cw_stop = true; } void config_telem() { @@ -3470,7 +3476,7 @@ void transmit_string(char *string) { digitalWrite(MAIN_LED_BLUE, HIGH); digitalWrite(PTT_PIN, LOW); - while ((string[j] != '\0') && (j < 256)) { + while ((string[j] != '\0') && (j < 256) && !cw_stop) { // Serial.print("j = "); // Serial.println(j); if (string[j] != ' ') From f035fc1835b4d6d5cceaeca1b74224c0b60eedc8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 10:57:48 -0400 Subject: [PATCH 15/16] added cw_stop to exit CW mode --- cubesatsim/cubesatsim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 38bad8d9..86c50494 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -295,6 +295,7 @@ int sample_rate; int buffer_size; long micro_timer; int ready = FALSE; +bool cw_stop = false; #define PRESSED 0 #define HELD 0 From 44347ba3a270533a47973e1c02a7427a773f7896 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 7 Aug 2022 11:11:15 -0400 Subject: [PATCH 16/16] put transmit_on back on for APRS --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index c87581c2..b5fb3d8d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -298,7 +298,7 @@ void send_cw() { } void transmit_on() { - if (mode == SSTV) { + if ((mode == SSTV) || (mode == AFSK)) { // this isn't quite right for APRS - should only do when sending APRS packet Serial.println("Transmit on!"); digitalWrite(MAIN_LED_BLUE, HIGH); digitalWrite(PTT_PIN, LOW);