From 8bca060fa0a5e367b2cfe04732c7dbf9b9a6b9b4 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 14:58:25 -0400 Subject: [PATCH 1/9] disable outputs up to 5 times --- cubesatsim/cubesatsim.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index a482dfdd..95407f2a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -511,8 +511,11 @@ void transmit_off() { digitalWrite(BPSK_CONTROL_B, LOW); // pwm_set_gpio_level(BPSK_PWM_A_PIN, 0); // pwm_set_gpio_level(BPSK_PWM_B_PIN, 0); - Serial.println("Disable clock outputs"); - clockgen.enableOutputs(false); + + for (int i = 0; ((i < 5) && (!clockgen.enableOutputs(false))); i++) { + Serial.println("Disable clock outputs"); + } +// clockgen.enableOutputs(false) } else if (mode == SSTV) sstv_end(); From 9d7184dccecb44911e909f1b604b0db5ed16e7fd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 15:04:08 -0400 Subject: [PATCH 2/9] use while --- cubesatsim/cubesatsim.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 95407f2a..8035364d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -511,8 +511,11 @@ void transmit_off() { digitalWrite(BPSK_CONTROL_B, LOW); // pwm_set_gpio_level(BPSK_PWM_A_PIN, 0); // pwm_set_gpio_level(BPSK_PWM_B_PIN, 0); - - for (int i = 0; ((i < 5) && (!clockgen.enableOutputs(false))); i++) { + int ret = 1; + int i = 0; +// for (int i = 0; ((i < 5) && (!clockgen.enableOutputs(false))); i++) { + while ((i++ < 5) && (ret != 0)) { + ret = clockgen.enableOutputs(false); Serial.println("Disable clock outputs"); } // clockgen.enableOutputs(false) From 5d339c870cc69cdb3251e5bc4a4ed8418c4db418 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 15:15:25 -0400 Subject: [PATCH 3/9] ! --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 8035364d..5ce25240 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -516,7 +516,7 @@ void transmit_off() { // for (int i = 0; ((i < 5) && (!clockgen.enableOutputs(false))); i++) { while ((i++ < 5) && (ret != 0)) { ret = clockgen.enableOutputs(false); - Serial.println("Disable clock outputs"); + Serial.println("Disable clock outputs!"); } // clockgen.enableOutputs(false) } From 3850c08d115499e659fbe2517846844576e195b7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 15:27:07 -0400 Subject: [PATCH 4/9] added 5 times for other clockgen commands --- cubesatsim/cubesatsim.ino | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5ce25240..589f3d52 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -490,8 +490,12 @@ void transmit_on() { 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); - Serial.println("Enable clock outputs"); - clockgen.enableOutputs(true); + int ret = 1; + int i = 0; + while ((i++ < 5) && (ret != 0)) { + ret = clockgen.enableOutputs(true); + Serial.println("Enable clock outputs!"); + } } else if (mode == CW) { // Serial.println("Transmit on!"); @@ -513,7 +517,6 @@ void transmit_off() { // pwm_set_gpio_level(BPSK_PWM_B_PIN, 0); int ret = 1; int i = 0; -// for (int i = 0; ((i < 5) && (!clockgen.enableOutputs(false))); i++) { while ((i++ < 5) && (ret != 0)) { ret = clockgen.enableOutputs(false); Serial.println("Disable clock outputs!"); @@ -2123,15 +2126,24 @@ void config_radio() program_radio(); } else if (mode == BPSK) { + + int ret = 1; + int i = 0; + while ((i++ < 5) && (ret != 0)) { + ret = clockgen.setClockBPSK(); + Serial.println("Config clock for BPSK"); + } - clockgen.setClockBPSK(); - Serial.println("Config clock for BPSK"); transmit_on(); } else if (mode == FSK) {// || (mode == SSTV)) - clockgen.setClockFSK(); - Serial.println("Config clock for FSK"); + int ret = 1; + int i = 0; + while ((i++ < 5) && (ret != 0)) { + ret = clockgen.setClockFSK(); + Serial.println("Config clock for FSK"); + } transmit_on(); } } From ac056f45cf7b66b16dc757952be85deaed7c4141 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 15:44:21 -0400 Subject: [PATCH 5/9] back to 434.9 --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 589f3d52..8780c3bf 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4275,7 +4275,7 @@ void program_radio() { // mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,0,8,0,0\r"); // mySerial.println("AT+DMOSETGROUP=0,432.2510,432.2510,0,8,0,0\r"); // mySerial.println("AT+DMOSETGROUP=0,432.2500,432.2500,0,8,0,0\r"); - mySerial.println("AT+DMOSETGROUP=0,434.9100,434.9100,0,8,0,0\r"); + mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,0,8,0,0\r"); // sleep(0.5); mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 From 57164d49fab7bdf0c2da883b12bf352d0db1151f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 16:01:54 -0400 Subject: [PATCH 6/9] changed to start_clockgen --- cubesatsim/cubesatsim.ino | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 8780c3bf..668316fd 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -490,12 +490,18 @@ void transmit_on() { 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); +/* int ret = 1; int i = 0; while ((i++ < 5) && (ret != 0)) { ret = clockgen.enableOutputs(true); Serial.println("Enable clock outputs!"); - } + } +*/ + if (!clockgen.enableOutputs(trie)) { + start_clockgen(); + clockgen.enableOutputs(true); + } } else if (mode == CW) { // Serial.println("Transmit on!"); @@ -515,6 +521,7 @@ void transmit_off() { digitalWrite(BPSK_CONTROL_B, LOW); // pwm_set_gpio_level(BPSK_PWM_A_PIN, 0); // pwm_set_gpio_level(BPSK_PWM_B_PIN, 0); +/* int ret = 1; int i = 0; while ((i++ < 5) && (ret != 0)) { @@ -522,6 +529,12 @@ void transmit_off() { Serial.println("Disable clock outputs!"); } // clockgen.enableOutputs(false) +*/ + if (!clockgen.enableOutputs(false)) { + start_clockgen(); + clockgen.enableOutputs(false); + } + } else if (mode == SSTV) sstv_end(); @@ -2126,24 +2139,34 @@ void config_radio() program_radio(); } else if (mode == BPSK) { - +/* int ret = 1; int i = 0; while ((i++ < 5) && (ret != 0)) { ret = clockgen.setClockBPSK(); Serial.println("Config clock for BPSK"); } +*/ + if (!clockgen.setClockBPSK()) { + start_clockgen(); + clockgen.setClockBPSK(); + } transmit_on(); } else if (mode == FSK) {// || (mode == SSTV)) - +/* int ret = 1; int i = 0; while ((i++ < 5) && (ret != 0)) { ret = clockgen.setClockFSK(); Serial.println("Config clock for FSK"); - } + } +*/ + if (!clockgen.setClockFSK()) { + start_clockgen(); + clockgen.setClockFSK(); + } transmit_on(); } } From aab9eda7f7bf9ba3340687c8c5db7e6002e63011 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 16:02:48 -0400 Subject: [PATCH 7/9] typo --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 668316fd..19af4596 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -498,7 +498,7 @@ void transmit_on() { Serial.println("Enable clock outputs!"); } */ - if (!clockgen.enableOutputs(trie)) { + if (!clockgen.enableOutputs(true)) { start_clockgen(); clockgen.enableOutputs(true); } From 0f7ce6892ff4ebf163073503851cae445b2cde1c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 16:08:05 -0400 Subject: [PATCH 8/9] changed !clockgen to clockgen --- cubesatsim/cubesatsim.ino | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 19af4596..bf4c172f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -498,8 +498,12 @@ void transmit_on() { Serial.println("Enable clock outputs!"); } */ - if (!clockgen.enableOutputs(true)) { + if (clockgen.enableOutputs(true)) { start_clockgen(); + if (mode == BPSK) + clockgen.setClockBPSK(); + else + clockgen.setClockFSK(); clockgen.enableOutputs(true); } } @@ -530,8 +534,8 @@ void transmit_off() { } // clockgen.enableOutputs(false) */ - if (!clockgen.enableOutputs(false)) { - start_clockgen(); + if (clockgen.enableOutputs(false)) { + start_clockgen(); clockgen.enableOutputs(false); } @@ -2148,7 +2152,7 @@ void config_radio() } */ - if (!clockgen.setClockBPSK()) { + if (clockgen.setClockBPSK()) { start_clockgen(); clockgen.setClockBPSK(); } @@ -2163,7 +2167,7 @@ void config_radio() Serial.println("Config clock for FSK"); } */ - if (!clockgen.setClockFSK()) { + if (clockgen.setClockFSK()) { start_clockgen(); clockgen.setClockFSK(); } From bb63a41c705fb8795fe99f831ddb2818a0c3abfe Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 18 Sep 2022 16:21:10 -0400 Subject: [PATCH 9/9] added clockgen prints --- cubesatsim/cubesatsim.ino | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index bf4c172f..4bddb94a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -505,7 +505,10 @@ void transmit_on() { else clockgen.setClockFSK(); clockgen.enableOutputs(true); - } + Serial.println("Enable clock outputs!"); + } else { + Serial.println("Enable clock outputs!"); + } } else if (mode == CW) { // Serial.println("Transmit on!"); @@ -537,6 +540,9 @@ void transmit_off() { if (clockgen.enableOutputs(false)) { start_clockgen(); clockgen.enableOutputs(false); + Serial.println("Disable clock outputs!"); + } else { + Serial.println("Disable clock outputs!"); } } @@ -2155,6 +2161,9 @@ void config_radio() if (clockgen.setClockBPSK()) { start_clockgen(); clockgen.setClockBPSK(); + Serial.println("Config clock for BPSK"); + } else { + Serial.println("Config clock for BPSK"); } transmit_on(); } @@ -2170,6 +2179,9 @@ void config_radio() if (clockgen.setClockFSK()) { start_clockgen(); clockgen.setClockFSK(); + Serial.println("Config clock for FSK"); + } else { + Serial.println("Config clock for FSK"); } transmit_on(); }