From 7751c9808beedc251dad604b9ca96a7f79e98d8c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:23:54 -0400 Subject: [PATCH 01/41] v0.40 print, add frequency offset menu item and config file --- cubesatsim/cubesatsim.ino | 42 ++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 9fcd7781..fc402da6 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -108,7 +108,7 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.39 starting...\n"); + Serial.println("CubeSatSim Pico v0.40 starting...\n"); /**/ if (check_for_wifi()) { @@ -419,8 +419,7 @@ void read_config_file() { // sprintf(buff, "%d\n", cnt); sprintf(buff, "%s %d", "AMSAT", 0); config_file.write(buff, strlen(buff)); - - + config_file.close(); config_file = LittleFS.open("/sim.cfg", "r"); @@ -429,10 +428,10 @@ void read_config_file() { // char * cfg_buf[100]; config_file.read((uint8_t *)buff, 255); // sscanf(buff, "%d", &cnt); - sscanf(buff, "%s %d %f %f %s", callsign, & reset_count, & lat_file, & long_file, sim_yes); + sscanf(buff, "%s %d %f %f %s %d", callsign, & reset_count, & lat_file, & long_file, sim_yes, & frequency_offset); config_file.close(); - if (debug_mode) - Serial.printf("Config file /sim.cfg contains %s %d %f %f %s\n", callsign, reset_count, lat_file, long_file, sim_yes); +// if (debug_mode) + Serial.printf("Config file /sim.cfg contains %s %d %f %f %s %d\n", callsign, reset_count, lat_file, long_file, sim_yes, frequency_offset); reset_count = (reset_count + 1) % 0xffff; @@ -472,7 +471,7 @@ void write_config_file() { else strcpy(sim_yes, "no"); - sprintf(buff, "%s %d %f %f %s", callsign, reset_count, latitude, longitude, sim_yes); + sprintf(buff, "%s %d %f %f %s %d", callsign, reset_count, latitude, longitude, sim_yes, frequency_offset); Serial.println("Writing string "); // if (debug_mode) print_string(buff); @@ -4494,11 +4493,12 @@ void prompt_for_input() { Serial.println("l Change Lat and Lon"); Serial.println("? Query sensors"); Serial.println("v Read INA219 voltage and current"); - Serial.println("o Read diode temperature"); + Serial.println("o Read diode temperature"); + Serial.println("O Set frequency offset"); Serial.println("d Change debug mode"); Serial.println("w Connect to WiFi\n"); - Serial.printf("Software version v0.39 \nConfig file /sim.cfg contains %s %d %f %f %s\n\n", callsign, reset_count, lat_file, long_file, sim_yes); + Serial.printf("Software version v0.40 \nConfig file /sim.cfg contains %s %d %f %f %s\n\n", callsign, reset_count, lat_file, long_file, sim_yes); switch(mode) { @@ -4679,6 +4679,30 @@ void prompt_for_input() { sampleTime = (unsigned int) millis(); break; + case PROMPT_OFFSET: + if (frequency_offset != 0) + Serial.println("Frequency offset is currently on"); + else + Serial.println("Frequency offset is currently off"); + Serial.println("Do you want Frequency offset on (y/n)"); + get_serial_char(); + if ((serial_string[0] == 'y') || (serial_string[0] == 'Y')) { + Serial.println("Turning Frequency offset on"); + frequency_offset = -25000; // set frequency offset + write_config_file(); +// config_radio(); + + } else if ((serial_string[0] == 'n') || (serial_string[0] == 'N')) { + Serial.println("Turning Frequency offset off"); + frequency_offset = 0; // turn off frequency offset + write_config_file(); +// config_radio(); + + } else + Serial.println("No change to frequency offset."); + break; + + case PROMPT_DEBUG: Serial.print("Changing Debug Mode to "); debug_mode = !debug_mode; From 6c72578b98f9d7347b8c66bb0afe81e5ab01f935 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:23:55 -0400 Subject: [PATCH 02/41] added PROMPT_OFFSET and frequency_offset --- cubesatsim/cubesatsim.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 4bdcb82c..bf8f3f22 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -78,7 +78,7 @@ #define TEMPERATURE_PIN 28 // Diode temperature analog pin #define PORT 8080 -#define FREQUENCY_OFFSET 0 +//#define FREQUENCY_OFFSET 0 #define TRUE 1 #define FALSE 0 @@ -131,6 +131,7 @@ #define PROMPT_I2CSCAN 14 #define PROMPT_WIFI 15 #define PROMPT_CAMERA 16 +#define PROMPT_OFFSET 17 #define PAYLOAD_QUERY 1 #define PAYLOAD_RESET 2 @@ -224,6 +225,7 @@ void load_sstv_image_2_as_cam_dot_jpg(); void get_input(); void transmit_led(bool status); void reset_min_max(); +int frequency_offset = 0; #ifndef STASSID #define STASSID "Pico" From a4500889b4668620db2285a3e4f22fa212eff90b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:26:25 -0400 Subject: [PATCH 03/41] remove FREQUENCY_OFFSET --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index bf8f3f22..3c5e94ab 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -146,7 +146,7 @@ float get_cpu_temp(); //#define WAV_DATA_LENGTH (50000 * 8) -uint32_t tx_freq_hz = 434900000 + FREQUENCY_OFFSET; +uint32_t tx_freq_hz = 434900000; // + FREQUENCY_OFFSET; //uint8_t data[1024]; uint32_t tx_channel = 0; From 0e94460b5af81f8a8daa0ce3a8e1bab30f4c9a74 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:30:34 -0400 Subject: [PATCH 04/41] set PROMPT_OFFSET for 'O' --- cubesatsim/cubesatsim.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index fc402da6..b8c46ff9 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4414,11 +4414,15 @@ void serial_input() { break; case 'o': - case 'O': Serial.println("Read diode temperature"); prompt = PROMPT_TEMP; break; + case 'O': + Serial.println("Set frequency offset"); + prompt = PROMPT_OFFSET; + break; + case 'l': case 'L': Serial.println("Change the Latitude and Longitude"); From 371c3e6d9a1386437710a7ef2bbd2db8edaeb5d5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:39:36 -0400 Subject: [PATCH 05/41] add program radio based on frequency_offset, change to -15000 Hz --- cubesatsim/cubesatsim.ino | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b8c46ff9..59a332da 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -8,7 +8,7 @@ * (at your option) any later version. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY; without even the implied warranty ofF * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * @@ -4692,13 +4692,15 @@ void prompt_for_input() { get_serial_char(); if ((serial_string[0] == 'y') || (serial_string[0] == 'Y')) { Serial.println("Turning Frequency offset on"); - frequency_offset = -25000; // set frequency offset - write_config_file(); + frequency_offset = -15000; // set frequency offset + write_config_file(); + program_radio(); // config_radio(); } else if ((serial_string[0] == 'n') || (serial_string[0] == 'N')) { Serial.println("Turning Frequency offset off"); - frequency_offset = 0; // turn off frequency offset + frequency_offset = 0; // turn off frequency offset + program_radio(); write_config_file(); // config_radio(); @@ -4954,15 +4956,19 @@ void program_radio() { mySerial.begin(9600); for (int i = 0; i < 5; i++) { - sleep(0.5); // delay(500); + sleep(0.5); // delay(500); // Serial1.println("AT+DMOSETGROUP=0,434.9100,434.9100,1,2,1,1\r"); // mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,1,2,1,1\r"); // 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.9000,434.9000,0,8,0,0\r"); - sleep(0.5); - mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 + if (frequency_offset == 0) + mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,0,8,0,0\r"); + else + mySerial.println("AT+DMOSETGROUP=0,434.8500,434.8500,0,8,0,0\r"); + + sleep(0.5); + mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 } } From 11c569c97117f92ef46201a939d8f169d28cbfc5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:47:30 -0400 Subject: [PATCH 06/41] change to 434.875 --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 59a332da..513e96b2 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4502,7 +4502,7 @@ void prompt_for_input() { Serial.println("d Change debug mode"); Serial.println("w Connect to WiFi\n"); - Serial.printf("Software version v0.40 \nConfig file /sim.cfg contains %s %d %f %f %s\n\n", callsign, reset_count, lat_file, long_file, sim_yes); + Serial.printf("Software version v0.40 \nConfig file /sim.cfg contains %s %d %f %f %s %d\n\n", callsign, reset_count, lat_file, long_file, sim_yes, frequency_offset); switch(mode) { @@ -4692,7 +4692,7 @@ void prompt_for_input() { get_serial_char(); if ((serial_string[0] == 'y') || (serial_string[0] == 'Y')) { Serial.println("Turning Frequency offset on"); - frequency_offset = -15000; // set frequency offset + frequency_offset = -7500; // set frequency offset write_config_file(); program_radio(); // config_radio(); @@ -4965,7 +4965,7 @@ void program_radio() { if (frequency_offset == 0) mySerial.println("AT+DMOSETGROUP=0,434.9000,434.9000,0,8,0,0\r"); else - mySerial.println("AT+DMOSETGROUP=0,434.8500,434.8500,0,8,0,0\r"); + mySerial.println("AT+DMOSETGROUP=0,434.8750,434.8750,0,8,0,0\r"); sleep(0.5); mySerial.println("AT+DMOSETMIC=8,0\r"); // was 8 From 9fc1bd0e83d435bff5811b61bb97e515618b6c94 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:49:12 -0400 Subject: [PATCH 07/41] try restart after offset --- cubesatsim/cubesatsim.ino | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 513e96b2..f722572c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4670,19 +4670,6 @@ void prompt_for_input() { write_config_file(); break; - case PROMPT_RESTART: - prompt = false; -// Serial.println("Restart not yet implemented"); - start_payload(); -// start_ina219(); - if ((mode != CW) || (!filter_present)) - transmit_callsign(callsign); - sleep(0.5); - config_telem(); - config_radio(); - sampleTime = (unsigned int) millis(); - break; - case PROMPT_OFFSET: if (frequency_offset != 0) Serial.println("Frequency offset is currently on"); @@ -4706,9 +4693,21 @@ void prompt_for_input() { } else Serial.println("No change to frequency offset."); - break; - + // break; // continue and restart + case PROMPT_RESTART: + prompt = false; +// Serial.println("Restart not yet implemented"); + start_payload(); +// start_ina219(); + if ((mode != CW) || (!filter_present)) + transmit_callsign(callsign); + sleep(0.5); + config_telem(); + config_radio(); + sampleTime = (unsigned int) millis(); + break; + case PROMPT_DEBUG: Serial.print("Changing Debug Mode to "); debug_mode = !debug_mode; From 033844072593770d5d3514420f6bf74481963b01 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:55:00 -0400 Subject: [PATCH 08/41] reboot after offset change --- cubesatsim/cubesatsim.ino | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f722572c..febde82b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4640,13 +4640,6 @@ void prompt_for_input() { voltage_read = true; read_ina219(); break; - - case PROMPT_REBOOT: - Serial.println("Rebooting..."); - Serial.flush(); - watchdog_reboot (0, SRAM_END, 500); // restart Pico - sleep(20.0); - break; case PROMPT_FORMAT: LittleFS.format(); @@ -4682,18 +4675,29 @@ void prompt_for_input() { frequency_offset = -7500; // set frequency offset write_config_file(); program_radio(); -// config_radio(); - + Serial.println("Rebooting..."); + Serial.flush(); + watchdog_reboot (0, SRAM_END, 500); // restart Pico + sleep(20.0); } else if ((serial_string[0] == 'n') || (serial_string[0] == 'N')) { Serial.println("Turning Frequency offset off"); frequency_offset = 0; // turn off frequency offset program_radio(); write_config_file(); -// config_radio(); - + Serial.println("Rebooting..."); + Serial.flush(); + watchdog_reboot (0, SRAM_END, 500); // restart Pico + sleep(20.0); } else Serial.println("No change to frequency offset."); - // break; // continue and restart + break; + + case PROMPT_REBOOT: + Serial.println("Rebooting..."); + Serial.flush(); + watchdog_reboot (0, SRAM_END, 500); // restart Pico + sleep(20.0); + break; case PROMPT_RESTART: prompt = false; From 73195dbbde2036cd5475bfe0ca6d0fd49ff8d245 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 08:59:53 -0400 Subject: [PATCH 09/41] changed to -15kHz offset --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index febde82b..67265767 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4672,7 +4672,7 @@ void prompt_for_input() { get_serial_char(); if ((serial_string[0] == 'y') || (serial_string[0] == 'Y')) { Serial.println("Turning Frequency offset on"); - frequency_offset = -7500; // set frequency offset + frequency_offset = -15000; // set frequency offset write_config_file(); program_radio(); Serial.println("Rebooting..."); From e11b69a0b09a9038019a2505210cd6f06f68ade4 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 09:35:36 -0400 Subject: [PATCH 10/41] added freq_offset parameter to clockgen --- cubesatsim/cubesatsim.ino | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 67265767..f97f0422 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -553,9 +553,9 @@ void transmit_on() { if (clockgen.enableOutputs(true)) { start_clockgen(); if (mode == BPSK) - clockgen.setClockBPSK(); + clockgen.setClockBPSK(frequency_offset); else - clockgen.setClockFSK(); + clockgen.setClockFSK(frequency_offset); clockgen.enableOutputs(true); Serial.println("Enable clock outputs!"); } else { @@ -2223,9 +2223,9 @@ void config_radio() digitalWrite(PD_PIN, HIGH); // Enable SR_FRS else { start_clockgen(); - if (clockgen.setClockFSK()) { + if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); - clockgen.setClockFSK(); + clockgen.setClockFSK(frequency_offset); Serial.println("Config clock for CW without SR_FRS!"); } else { Serial.println("Config clock for CW without SR_FRS"); @@ -2247,9 +2247,9 @@ void config_radio() } */ - if (clockgen.setClockBPSK()) { + if (clockgen.setClockBPSK(frequency_offset)) { start_clockgen(); - clockgen.setClockBPSK(); + clockgen.setClockBPSK(frequency_offset); Serial.println("Config clock for BPSK"); } else { Serial.println("Config clock for BPSK"); @@ -2265,9 +2265,9 @@ void config_radio() Serial.println("Config clock for FSK"); } */ - if (clockgen.setClockFSK()) { + if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); - clockgen.setClockFSK(); + clockgen.setClockFSK(frequency_offset); Serial.println("Config clock for FSK"); } else { Serial.println("Config clock for FSK"); From 54234dbad03302046c58c7144d50ad9aa3d3a7fb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 7 Apr 2023 09:38:54 -0400 Subject: [PATCH 11/41] typo --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f97f0422..4b46ca01 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4135,9 +4135,9 @@ void transmit_callsign(char *callsign) { if (!sr_frs_present) { start_clockgen(); - if (clockgen.setClockFSK()) { + if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); - clockgen.setClockFSK(); + clockgen.setClockFSK(frequency_offset); Serial.println("Config clock for CW without SR_FRS!"); } else { Serial.println("Config clock for CW without SR_FRS"); From d00562f07d64e6d1ef5f2507b513b35244a6b0c0 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 08:36:46 -0400 Subject: [PATCH 12/41] try Wire1 for clockgen --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4b46ca01..1bdd9309 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5021,7 +5021,7 @@ void write_mode(int save_mode) { void start_clockgen() { - if (clockgen.begin() != ERROR_NONE) + if (clockgen.begin(&Wire1) != ERROR_NONE) { /* There was a problem detecting the IC ... check your connections */ Serial.println("No Si5351 detected ... Check your wiring or I2C ADDR!"); From fda08799615c433078d9ad3dec5b175295d57627 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 08:42:26 -0400 Subject: [PATCH 13/41] add Wire1.begin --- cubesatsim/cubesatsim.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 1bdd9309..912f5506 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5020,6 +5020,10 @@ void write_mode(int save_mode) { } void start_clockgen() { + +// Wire1.setSDA(8); +// Wire1.setSCL(9); + Wire1.begin(); if (clockgen.begin(&Wire1) != ERROR_NONE) { From 099aed69eb6911305e9b76c3c6961daf6a7f8a10 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 08:46:43 -0400 Subject: [PATCH 14/41] set SCL2 and SDA2 for Wire1 --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 912f5506..ae168125 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5021,8 +5021,8 @@ void write_mode(int save_mode) { void start_clockgen() { -// Wire1.setSDA(8); -// Wire1.setSCL(9); + Wire1.setSDA(SDA2); + Wire1.setSCL(SCL2); Wire1.begin(); if (clockgen.begin(&Wire1) != ERROR_NONE) From 0e4027bb77180a15df0f34f725900503975b6e83 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 08:50:27 -0400 Subject: [PATCH 15/41] set Wire1 2 and 3 --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ae168125..0889461f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5021,8 +5021,8 @@ void write_mode(int save_mode) { void start_clockgen() { - Wire1.setSDA(SDA2); - Wire1.setSCL(SCL2); + Wire1.setSDA(2); + Wire1.setSCL(3); Wire1.begin(); if (clockgen.begin(&Wire1) != ERROR_NONE) From 99266fbda9d94e8172f2b39422a306511e2479c7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 08:53:39 -0400 Subject: [PATCH 16/41] only once Wire1.begin --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0889461f..0b1887bf 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3208,9 +3208,9 @@ void start_ina219() { i2c_bus1 = i2c_1 || i2c2 || i2c3; - Wire1.setSDA(2); - Wire1.setSCL(3); - Wire1.begin(); +// Wire1.setSDA(2); +// Wire1.setSCL(3); +// Wire1.begin(); if (!(i2c5 = ina219_2_0x40.begin(&Wire1))) // check i2c bus 2 Serial.println("I2C +Z sensor (bus 2 0x40) not found"); From 9fc02fbebace51c5a770f40365eb42927695bc4b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 09:36:32 -0400 Subject: [PATCH 17/41] try i2c bus 1 for clockgen, then try bus 2 if fails. --- cubesatsim/cubesatsim.ino | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0b1887bf..5122c335 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5025,11 +5025,17 @@ void start_clockgen() { Wire1.setSCL(3); Wire1.begin(); - if (clockgen.begin(&Wire1) != ERROR_NONE) + if (clockgen.begin(&Wire) != ERROR_NONE) { /* There was a problem detecting the IC ... check your connections */ - Serial.println("No Si5351 detected ... Check your wiring or I2C ADDR!"); - return; + Serial.println("No Si5351 detected on bus 1"); + + if (clockgen.begin(&Wire1) != ERROR_NONE) + { + /* There was a problem detecting the IC ... check your connections */ + Serial.println("No Si5351 detected on bus 2 ... Check your wiring or I2C ADDR!"); + return; + } } Serial.println("Starting clockgen frequency 434.9 MHz"); From 7f395309ee6d6831f00c8159fe70d079437f9a1e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 09:39:18 -0400 Subject: [PATCH 18/41] print which bus clockgen detected --- cubesatsim/cubesatsim.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5122c335..ec89395b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5035,8 +5035,12 @@ void start_clockgen() { /* There was a problem detecting the IC ... check your connections */ Serial.println("No Si5351 detected on bus 2 ... Check your wiring or I2C ADDR!"); return; - } - } + } else + Serial.println("Si5351 detected on bus 2"); + + } else + Serial.println("Si5351 detected on bus 1"); + Serial.println("Starting clockgen frequency 434.9 MHz"); From 2dc3f427eb5c036b5ef32f4fa581b057a6355490 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 09:47:08 -0400 Subject: [PATCH 19/41] go back to Wire if no clockgen to avoid crash --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ec89395b..07c21bf2 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -5033,7 +5033,8 @@ void start_clockgen() { if (clockgen.begin(&Wire1) != ERROR_NONE) { /* There was a problem detecting the IC ... check your connections */ - Serial.println("No Si5351 detected on bus 2 ... Check your wiring or I2C ADDR!"); + Serial.println("No Si5351 detected on bus 2 ... Check your wiring or I2C ADDR!"); + clockgen.begin(&Wire); // go back to Wire so that it doesn't lock up with no clockgen return; } else Serial.println("Si5351 detected on bus 2"); From 9da56e3f407e4723f176c8191161ce21999eac94 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 09:55:31 -0400 Subject: [PATCH 20/41] changed version to v0.41 --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 07c21bf2..09360c32 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -108,7 +108,7 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.40 starting...\n"); + Serial.println("CubeSatSim Pico v0.41 starting...\n"); /**/ if (check_for_wifi()) { @@ -4502,7 +4502,7 @@ void prompt_for_input() { Serial.println("d Change debug mode"); Serial.println("w Connect to WiFi\n"); - Serial.printf("Software version v0.40 \nConfig file /sim.cfg contains %s %d %f %f %s %d\n\n", callsign, reset_count, lat_file, long_file, sim_yes, frequency_offset); + Serial.printf("Software version v0.41 \nConfig file /sim.cfg contains %s %d %f %f %s %d\n\n", callsign, reset_count, lat_file, long_file, sim_yes, frequency_offset); switch(mode) { From 19ebdd58d0d834b0d89706a71a2b19e4170521b6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 15:11:29 -0400 Subject: [PATCH 21/41] added clockgen_present --- cubesatsim/cubesatsim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 3c5e94ab..c54fe30c 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -376,6 +376,7 @@ bool voltage_read = false; bool ina219_started = false; bool camera_detected = false; bool rotate_flag = true; +bool clockgen_present = false; int led_builtin_pin; From 9bdc0e24c3743245504aad7a87e8a9af8df14047 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 15:22:15 -0400 Subject: [PATCH 22/41] only set clock if clockgen_present --- cubesatsim/cubesatsim.ino | 68 +++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 09360c32..9d2d704a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -549,7 +549,7 @@ void transmit_on() { ret = clockgen.enableOutputs(true); Serial.println("Enable clock outputs!"); } -*/ +*/ if (clockgen_present) { if (clockgen.enableOutputs(true)) { start_clockgen(); if (mode == BPSK) @@ -561,6 +561,7 @@ void transmit_on() { } else { Serial.println("Enable clock outputs"); } + } } else if (mode == CW) { // Serial.println("Transmit on!"); @@ -589,7 +590,7 @@ void transmit_off() { Serial.println("Disable clock outputs!"); } // clockgen.enableOutputs(false) -*/ +*/ if (clockgen_present) { if (clockgen.enableOutputs(false)) { start_clockgen(); clockgen.enableOutputs(false); @@ -597,6 +598,7 @@ void transmit_off() { } else { Serial.println("Disable clock outputs"); } + } } else if (mode == SSTV) @@ -2222,7 +2224,8 @@ void config_radio() if (sr_frs_present) digitalWrite(PD_PIN, HIGH); // Enable SR_FRS else { - start_clockgen(); + start_clockgen(); + if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); clockgen.setClockFSK(frequency_offset); @@ -2233,7 +2236,8 @@ void config_radio() digitalWrite(PD_PIN, LOW); // disable SR_FRS clockgen.enableOutputs(false); digitalWrite(BPSK_CONTROL_B, LOW); - digitalWrite(BPSK_CONTROL_A, LOW); + digitalWrite(BPSK_CONTROL_A, LOW); + } } @@ -2246,7 +2250,7 @@ void config_radio() Serial.println("Config clock for BPSK"); } */ - + if (clockgen_present) { if (clockgen.setClockBPSK(frequency_offset)) { start_clockgen(); clockgen.setClockBPSK(frequency_offset); @@ -2254,6 +2258,7 @@ void config_radio() } else { Serial.println("Config clock for BPSK"); } + } transmit_on(); } else if (mode == FSK) {// || (mode == SSTV)) @@ -2264,14 +2269,15 @@ void config_radio() ret = clockgen.setClockFSK(); Serial.println("Config clock for FSK"); } -*/ +*/ if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); clockgen.setClockFSK(frequency_offset); Serial.println("Config clock for FSK"); } else { Serial.println("Config clock for FSK"); - } + } + } transmit_on(); } @@ -4098,14 +4104,19 @@ void transmit_cw(int freq, float duration) { // freq in Hz, duration in millise digitalWrite(AUDIO_OUT_PIN, LOW); } else { + // Serial.println("No sr_frs present!"); unsigned long start = micros(); -// clockgen.enableOutputs(true); - clockgen.enableOutputOnly(0); - digitalWrite(BPSK_CONTROL_A, HIGH); +// clockgen.enableOutputs(true); + if (clockgen_present) { + clockgen.enableOutputOnly(0); + digitalWrite(BPSK_CONTROL_A, HIGH); + } while((micros() - start) < duration_us) { } - digitalWrite(BPSK_CONTROL_A, LOW); - clockgen.enableOutputs(false); + if (clockgen_present) + digitalWrite(BPSK_CONTROL_A, LOW); + clockgen.enableOutputs(false); + } } // if (!wifi) @@ -4134,18 +4145,22 @@ void transmit_callsign(char *callsign) { print_string(id); if (!sr_frs_present) { - start_clockgen(); + start_clockgen(); + if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); - clockgen.setClockFSK(frequency_offset); + if (clockgen_present) + clockgen.setClockFSK(frequency_offset); Serial.println("Config clock for CW without SR_FRS!"); } else { Serial.println("Config clock for CW without SR_FRS"); } - digitalWrite(PD_PIN, LOW); // disable SR_FRS - clockgen.enableOutputs(false); - digitalWrite(BPSK_CONTROL_B, LOW); - digitalWrite(BPSK_CONTROL_A, LOW); + digitalWrite(PD_PIN, LOW); // disable SR_FRS + if (clockgen_present) { + clockgen.enableOutputs(false); + digitalWrite(BPSK_CONTROL_B, LOW); + digitalWrite(BPSK_CONTROL_A, LOW); + } } /* if (reset_count == 0) { @@ -5020,6 +5035,7 @@ void write_mode(int save_mode) { } void start_clockgen() { + clockgen_present = false; Wire1.setSDA(2); Wire1.setSCL(3); @@ -5036,18 +5052,22 @@ void start_clockgen() { Serial.println("No Si5351 detected on bus 2 ... Check your wiring or I2C ADDR!"); clockgen.begin(&Wire); // go back to Wire so that it doesn't lock up with no clockgen return; - } else + } else { Serial.println("Si5351 detected on bus 2"); + clockgen_present = true; + } - } else + } else { Serial.println("Si5351 detected on bus 1"); + clockgen_present = true; + } - - Serial.println("Starting clockgen frequency 434.9 MHz"); + if (clockgen_present) { + Serial.println("Starting clockgen frequency 434.9 MHz"); // clockgen.setClockFSK(); // default to FSK - clockgen.enableOutputs(false); - + clockgen.enableOutputs(false); + } } void get_input() { From 6310a36d3b9937f6c0fb094bc50a9c40ade49d1b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 15:29:55 -0400 Subject: [PATCH 23/41] missing { --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 9d2d704a..73618d78 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4113,7 +4113,7 @@ void transmit_cw(int freq, float duration) { // freq in Hz, duration in millise digitalWrite(BPSK_CONTROL_A, HIGH); } while((micros() - start) < duration_us) { } - if (clockgen_present) + if (clockgen_present) { digitalWrite(BPSK_CONTROL_A, LOW); clockgen.enableOutputs(false); } From 1a97c7a26314f8e46bd3604cae1e8b8707cbba00 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:35:06 -0400 Subject: [PATCH 24/41] add another clockgen_present --- cubesatsim/cubesatsim.ino | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 73618d78..6624a171 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4147,14 +4147,16 @@ void transmit_callsign(char *callsign) { if (!sr_frs_present) { start_clockgen(); - if (clockgen.setClockFSK(frequency_offset)) { - start_clockgen(); - if (clockgen_present) - clockgen.setClockFSK(frequency_offset); - Serial.println("Config clock for CW without SR_FRS!"); - } else { - Serial.println("Config clock for CW without SR_FRS"); - } + if (clockgen_present) { + if (clockgen.setClockFSK(frequency_offset)) { + start_clockgen(); + if (clockgen_present) + clockgen.setClockFSK(frequency_offset); + Serial.println("Config clock for CW without SR_FRS!"); + } else { + Serial.println("Config clock for CW without SR_FRS"); + } + } digitalWrite(PD_PIN, LOW); // disable SR_FRS if (clockgen_present) { clockgen.enableOutputs(false); From 46d27d401b019ef7cdd67fd6104f506ed70dd279 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:40:39 -0400 Subject: [PATCH 25/41] print before and after clockgen start --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 6624a171..71c1785a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4145,8 +4145,9 @@ void transmit_callsign(char *callsign) { print_string(id); if (!sr_frs_present) { + Serial.println("before start"); start_clockgen(); - + Serial.println("after start"); if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); From a341cf1f494f5b148e2a5a738e73993971d1f067 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:44:10 -0400 Subject: [PATCH 26/41] remove clockgen start in cw id --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 71c1785a..f13945dd 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4145,9 +4145,9 @@ void transmit_callsign(char *callsign) { print_string(id); if (!sr_frs_present) { - Serial.println("before start"); - start_clockgen(); - Serial.println("after start"); +// Serial.println("before start"); +// start_clockgen(); +// Serial.println("after start"); if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); From a54c2d47a2b01476adb5a5dc59507831eb517350 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:47:12 -0400 Subject: [PATCH 27/41] add blink at start --- cubesatsim/cubesatsim.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f13945dd..bdd5ad64 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -125,6 +125,8 @@ void setup() { config_gpio(); + blink(50) + get_input(); start_clockgen(); From 940ff31847d99dd619d93d7b6c32faab1cb3bb97 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:47:58 -0400 Subject: [PATCH 28/41] missing ; --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index bdd5ad64..355ea917 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -125,7 +125,7 @@ void setup() { config_gpio(); - blink(50) + blink(50); get_input(); From d0d842f2d821ed311a62e0c2ec6d1772dd6e314d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:52:13 -0400 Subject: [PATCH 29/41] move blink to very start --- cubesatsim/cubesatsim.ino | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 355ea917..74ad13f0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -91,6 +91,21 @@ void setup() { Serial.begin(115200); +/**/ + if (check_for_wifi()) { + wifi = true; + led_builtin_pin = LED_BUILTIN; // use default GPIO for Pico W + pinMode(LED_BUILTIN, OUTPUT); +// configure_wifi(); + } else { + led_builtin_pin = 25; // manually set GPIO 25 for Pico board +// pinMode(25, OUTPUT); + pinMode(led_builtin_pin, OUTPUT); + } +/**/ + + blink(50); + delay(10000); LittleFS.begin(); @@ -108,25 +123,10 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.41 starting...\n"); - -/**/ - if (check_for_wifi()) { - wifi = true; - led_builtin_pin = LED_BUILTIN; // use default GPIO for Pico W - pinMode(LED_BUILTIN, OUTPUT); -// configure_wifi(); - } else { - led_builtin_pin = 25; // manually set GPIO 25 for Pico board -// pinMode(25, OUTPUT); - pinMode(led_builtin_pin, OUTPUT); - } -/**/ + Serial.println("CubeSatSim Pico v0.41 starting...\n"); config_gpio(); - blink(50); - get_input(); start_clockgen(); From a95ecff80dc86c98ac77fd4ecdb2fc7ef028f20a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:55:57 -0400 Subject: [PATCH 30/41] remove prints in check for wifi --- cubesatsim/cubesatsim.ino | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 74ad13f0..ac51d919 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -129,6 +129,12 @@ void setup() { get_input(); + if (wifi) + Serial.println("\nPico W detected!\n"); + else + Serial.println("\nPico detected!\n"); + + start_clockgen(); EEPROM.begin(512); @@ -3960,11 +3966,11 @@ bool check_for_wifi() { // if (result < 0x100) { if (result < 0x10) { - Serial.println("\nPico W detected!\n"); +// Serial.println("\nPico W detected!\n"); return(true); } else { - Serial.println("\nPico detected!\n"); +// Serial.println("\nPico detected!\n"); return(false); } } From 5cb8a10439bfeb757f7501b94a16a82d511e320f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 18:59:32 -0400 Subject: [PATCH 31/41] move config_gpio earlier --- cubesatsim/cubesatsim.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ac51d919..3fb5a67e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -90,7 +90,8 @@ void setup() { set_sys_clock_khz(133000, true); Serial.begin(115200); - + + config_gpio(); /**/ if (check_for_wifi()) { wifi = true; @@ -125,7 +126,7 @@ void setup() { Serial.println("CubeSatSim Pico v0.41 starting...\n"); - config_gpio(); +//// config_gpio(); get_input(); @@ -3734,6 +3735,7 @@ void config_gpio() { Serial.println(digitalRead(PI_3V3_PIN)); if (digitalRead(PI_3V3_PIN) == HIGH) { // { + delay(10000); Serial.print("Pi Zero present, so running Payload OK code instead of CubeSatSim code."); start_payload(); while(true) { From 51825357a40a617ea455dc72328feaf5d3491d14 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 19:32:41 -0400 Subject: [PATCH 32/41] removed +Bat --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3fb5a67e..118d447e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2386,7 +2386,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("+Bat (1 0x44) Voltage: "); + Serial.print("Bat (1 0x44) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); From 396e57c50bf8567fb5b1f89271f6f721d3e525b3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 14 Apr 2023 22:04:51 -0400 Subject: [PATCH 33/41] extra space --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 118d447e..19c625de 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2386,7 +2386,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("Bat (1 0x44) Voltage: "); + Serial.print("Bat (1 0x44) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); From 0a9f6ca9c1640472f9eeb0766f8ebb8bde619fca Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 14:26:14 -0400 Subject: [PATCH 34/41] test with SR_FRS not present --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 19c625de..436a2bff 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3778,8 +3778,8 @@ void config_gpio() { else Serial.println("BPF not present - no transmitting after CW ID"); - if (digitalRead(TXC_PIN) == FALSE) { -// if (true) { // force SR_FRS not present +// if (digitalRead(TXC_PIN) == FALSE) { + if (true) { // force SR_FRS not present Serial.println("SR_FRS present"); sr_frs_present = true; } From 60166187e4ae58e1fe1dce0e1ff105b9a3724a56 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 14:29:32 -0400 Subject: [PATCH 35/41] sr frs not present --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 436a2bff..3034cf1e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3779,7 +3779,7 @@ void config_gpio() { Serial.println("BPF not present - no transmitting after CW ID"); // if (digitalRead(TXC_PIN) == FALSE) { - if (true) { // force SR_FRS not present + if (false) { // force SR_FRS not present Serial.println("SR_FRS present"); sr_frs_present = true; } From 81d73c69fba3131be10f1232c0256011c28df70f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 14:35:08 -0400 Subject: [PATCH 36/41] in config_radio, only start if not running --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3034cf1e..b537666e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2233,7 +2233,8 @@ void config_radio() if (sr_frs_present) digitalWrite(PD_PIN, HIGH); // Enable SR_FRS else { - start_clockgen(); + if (!clockgen_present) + start_clockgen(); if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { start_clockgen(); From 7ec04bf71588a4ebff69a6c9cd0959afafcfb62b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 14:52:40 -0400 Subject: [PATCH 37/41] in config_radio, don't do clock start if cw mode --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b537666e..0247b248 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2233,7 +2233,8 @@ void config_radio() if (sr_frs_present) digitalWrite(PD_PIN, HIGH); // Enable SR_FRS else { - if (!clockgen_present) +// if (!clockgen_present) + if (mode != CW) start_clockgen(); if (clockgen_present) { if (clockgen.setClockFSK(frequency_offset)) { From c36cbe802e2fc201e40aa0098c3f57696fc3fd39 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 14:59:04 -0400 Subject: [PATCH 38/41] try no disable on cw with clockgen --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0247b248..89f0d346 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4127,7 +4127,7 @@ void transmit_cw(int freq, float duration) { // freq in Hz, duration in millise while((micros() - start) < duration_us) { } if (clockgen_present) { digitalWrite(BPSK_CONTROL_A, LOW); - clockgen.enableOutputs(false); +////// clockgen.enableOutputs(false); } } From 390eb2d27048073a62d07f3f5258cb7d7d8b9b5f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 15:01:25 -0400 Subject: [PATCH 39/41] revert --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 89f0d346..0247b248 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4127,7 +4127,7 @@ void transmit_cw(int freq, float duration) { // freq in Hz, duration in millise while((micros() - start) < duration_us) { } if (clockgen_present) { digitalWrite(BPSK_CONTROL_A, LOW); -////// clockgen.enableOutputs(false); + clockgen.enableOutputs(false); } } From 90b90f3fb8a9063cec7ba4c40b06b59e80a93d2e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 15:06:42 -0400 Subject: [PATCH 40/41] back to fr_srs present --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0247b248..595ae25e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3780,8 +3780,8 @@ void config_gpio() { else Serial.println("BPF not present - no transmitting after CW ID"); -// if (digitalRead(TXC_PIN) == FALSE) { - if (false) { // force SR_FRS not present + if (digitalRead(TXC_PIN) == FALSE) { +// if (false) { // force SR_FRS not present Serial.println("SR_FRS present"); sr_frs_present = true; } From 68da86c2e6cf6d113aa536a30413e61a1f02f45f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 15 Apr 2023 17:21:39 -0400 Subject: [PATCH 41/41] 40 second get serial prompt timeout --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 595ae25e..f9eb8db9 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4915,7 +4915,7 @@ void get_serial_string() { int input = 0; int i = 0; unsigned int elapsed_time = (unsigned int) millis(); - while ((input != '\n') && (input!= '\r') && (i < 128) && ((millis() - elapsed_time) < 20000)) { + while ((input != '\n') && (input!= '\r') && (i < 128) && ((millis() - elapsed_time) < 40000)) { // was 20 if (Serial.available() > 0) { input = Serial.read(); if ((input != '\n') && (input!= '\r')) {