From 4072f1b9c098e4f8b05f59c9cbe91aea9e34a0d1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:38:09 -0500 Subject: [PATCH 01/12] add F format option --- cubesatsim/cubesatsim.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3a05ed55..3bd637a2 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4050,8 +4050,15 @@ void serial_input() { new_mode = CW; break; - case 'f': case 'F': + Serial.println("Format flash memory"); + LittleFS.format(); + read_mode(); + new_mode = mode; + read_config_files(); + load_files(); + break; + case 'f': Serial.println("Change to FSK mode"); new_mode = FSK; break; From 01375d71398f85c4a0688ba62a72aeca096b19a5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:41:21 -0500 Subject: [PATCH 02/12] read config file --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3bd637a2..3b1c762c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4055,7 +4055,7 @@ void serial_input() { LittleFS.format(); read_mode(); new_mode = mode; - read_config_files(); + read_config_file(); load_files(); break; case 'f': From 1e3e350470a0d942158293c06e7e136fce25e543 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:44:54 -0500 Subject: [PATCH 03/12] set mode to FSK after format --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3b1c762c..d65c8eb0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4054,7 +4054,7 @@ void serial_input() { Serial.println("Format flash memory"); LittleFS.format(); read_mode(); - new_mode = mode; + new_mode = FSK; read_config_file(); load_files(); break; From 8d4577d25e0e30e32178cc8124df5e4bd66fdc1d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:49:53 -0500 Subject: [PATCH 04/12] write mode after format --- cubesatsim/cubesatsim.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d65c8eb0..eed851e5 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4053,8 +4053,9 @@ void serial_input() { case 'F': Serial.println("Format flash memory"); LittleFS.format(); - read_mode(); - new_mode = FSK; + mode = FSK; + new_mode = mode; + write_mode(); read_config_file(); load_files(); break; From 1d4e558835b36506957bbeba7810a61ae0611279 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:54:09 -0500 Subject: [PATCH 05/12] infinite loop after reformat --- cubesatsim/cubesatsim.ino | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index eed851e5..724d2e53 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4051,13 +4051,11 @@ void serial_input() { break; case 'F': - Serial.println("Format flash memory"); + Serial.println("Formatting flash memory"); LittleFS.format(); - mode = FSK; - new_mode = mode; - write_mode(); - read_config_file(); - load_files(); + Serial.println("Reboot or power cycle to restart the CubeSatSim"); + while (1) ; // infinite loop + break; case 'f': Serial.println("Change to FSK mode"); From 64f5af5f8325af6e1930121115c93f9209ef939a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:59:32 -0500 Subject: [PATCH 06/12] added PROMPT_FORMAT --- cubesatsim/cubesatsim.ino | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 724d2e53..31d76544 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4052,10 +4052,7 @@ void serial_input() { case 'F': Serial.println("Formatting flash memory"); - LittleFS.format(); - Serial.println("Reboot or power cycle to restart the CubeSatSim"); - while (1) ; // infinite loop - + prompt = PROMPT_FORMAT; break; case 'f': Serial.println("Change to FSK mode"); @@ -4283,6 +4280,12 @@ void prompt_for_input() { read_ina219(); break; + case PROMPT_FORMAT: + LittleFS.format(); + Serial.println("Reboot or power cycle to restart the CubeSatSim"); + while (1) ; // infinite loop + break; + case PROMPT_PAYLOAD: Serial.println("Resetting the Payload"); payload_command = PAYLOAD_RESET; From bd3f89254dd8a779203d70531af96f6894b3a8b9 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 18:00:05 -0500 Subject: [PATCH 07/12] added PROMPT_FORMAT --- cubesatsim/cubesatsim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index adb6b68f..cbca9c76 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -126,6 +126,7 @@ #define PROMPT_VOLTAGE 9 #define PROMPT_PAYLOAD 10 #define PROMPT_TEMP 11 +#define PROMPT_FORMAT 12 #define PAYLOAD_QUERY 1 #define PAYLOAD_RESET 2 From 85a7179534bec0a6593ba79df9c02b78d9c2214e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 18:09:35 -0500 Subject: [PATCH 08/12] default mode is FSK like v1 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index cbca9c76..985aed7f 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -274,7 +274,7 @@ long int uptime = 1000; //char call[5]; char sim_yes[10]; -int mode = BPSK; // SSTV; +int mode = FSK; // BPSK; // SSTV; volatile int new_mode; int bitRate, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; From 2b5f7d0311ac65df4c84855a741c811eea16d896 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 18:11:21 -0500 Subject: [PATCH 09/12] back to default mode of BPSK --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 985aed7f..cbca9c76 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -274,7 +274,7 @@ long int uptime = 1000; //char call[5]; char sim_yes[10]; -int mode = FSK; // BPSK; // SSTV; +int mode = BPSK; // SSTV; volatile int new_mode; int bitRate, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod; float sleepTime; From 2b75354cfd4ac3ede2628d659861eb3f87c852f5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Nov 2022 09:40:53 -0500 Subject: [PATCH 10/12] changed to disable enable timer for play_pwm --- cubesatsim/cubesatsim.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 31d76544..08aa3c03 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -262,9 +262,11 @@ void loop() { // scottie1_transmit_file(output_file, debug_mode); - ITimer1.stopTimer(); // turn off pushbutton timer +// ITimer1.stopTimer(); // turn off pushbutton timer + ITimer1.disableTimer(); // turn off pushbutton timer play_pwm_file(26); - ITimer1.restartTimer(); // turn back on pushbutton timer +// ITimer1.restartTimer(); // turn back on pushbutton timer + ITimer1.enableTimer(); // turn back on pushbutton timer if (debug_mode) Serial.println("Stop transmit!"); digitalWrite(PTT_PIN, HIGH); // stop transmit From 3b67b85b14eeb2bad843eee3716c9cdec8979845 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Nov 2022 09:46:50 -0500 Subject: [PATCH 11/12] restart button isr after SSTV mode --- cubesatsim/cubesatsim.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 08aa3c03..daf77215 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -305,7 +305,9 @@ void loop() { // check to see if the mode has changed if (mode != new_mode) { Serial.println("Changing mode"); - mode = new_mode; // change modes if button pressed + if (mode == SSTV) + start_button_isr(); // restart button isr + mode = new_mode; // change modes if button pressed write_mode(); if (new_mode != CW) transmit_callsign(callsign); From 601b739298b8c234044e2e7f9b98bcc7767f2bad Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 20 Nov 2022 09:58:20 -0500 Subject: [PATCH 12/12] detach interrupt then restart button isr --- cubesatsim/cubesatsim.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index daf77215..9f7ef41d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -305,8 +305,10 @@ void loop() { // check to see if the mode has changed if (mode != new_mode) { Serial.println("Changing mode"); - if (mode == SSTV) + if (mode == SSTV) { + ITimer1.detachInterrupt(); start_button_isr(); // restart button isr + } mode = new_mode; // change modes if button pressed write_mode(); if (new_mode != CW)