From b2f6d685b5862c772883873f5713b92a3951fe9a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 4 Nov 2022 15:49:02 -0400 Subject: [PATCH 001/105] AUDIO_OUT to 14 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index a33b48fe..db9a3a25 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From 8baee96642edd7caca40eee8f26bfe118cc397e3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 4 Nov 2022 15:51:14 -0400 Subject: [PATCH 002/105] back to 26 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index db9a3a25..a33b48fe 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From ee78670623531c296f484e9080e5fa0beb77a68a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 15 Nov 2022 22:21:55 -0500 Subject: [PATCH 003/105] add picosstvpp --- cubesatsim/cubesatsim.ino | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f7eb55a0..bd57972c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -39,9 +39,10 @@ //#include #include "hardware/gpio.h" #include "hardware/adc.h" -#include "SSTV-Arduino-Scottie1-Library.h" +//#include "SSTV-Arduino-Scottie1-Library.h" #include "LittleFS.h" #include +#include "picosstvpp.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) #include "sstv1.h" @@ -145,8 +146,8 @@ void setup() { */ start_button_isr(); - setup_sstv(); - +// setup_sstv(); + picosstvpp_begin(AUDIO_OUT_PIN); camera_detected = start_camera(); // start_pwm(); @@ -209,6 +210,8 @@ void loop() { } else if (mode == SSTV) { + picosstvpp(); +/* first_time_sstv = false; char image_file[128]; if (first_time_sstv) { @@ -260,6 +263,7 @@ void loop() { if (debug_mode) Serial.println("\nImage sent!"); +*/ } else Serial.println("Unknown mode!"); @@ -547,8 +551,8 @@ void transmit_off() { } } - else if (mode == SSTV) - sstv_end(); +// else if (mode == SSTV) +// sstv_end(); else if (mode == CW) cw_stop = true; } @@ -656,7 +660,7 @@ void config_telem() { bufLen = 1000; } else if (mode == SSTV) { Serial.println("\nConfiguring for SSTV"); - set_sstv_pin(AUDIO_OUT_PIN); +// set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; frameTime = 5000; bufLen = 1000; @@ -4114,8 +4118,8 @@ void serial_input() { break; } - if ((mode == SSTV) && prompt) // stop SSTV if need to prompt for input - sstv_end(); +// if ((mode == SSTV) && prompt) // stop SSTV if need to prompt for input +// sstv_end(); if (new_mode != mode) transmit_off(); From 0a0d5e7ffba04140bd37e8d0077ef3b1c5e7e361 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 15 Nov 2022 22:46:44 -0500 Subject: [PATCH 004/105] added reformat --- cubesatsim/cubesatsim.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index bd57972c..e0794688 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -77,6 +77,9 @@ void setup() { set_sys_clock_khz(133000, true); Serial.begin(115200); + + LittleFS.begin(); + LittleFS.reformat(); read_mode(); @@ -104,7 +107,7 @@ void setup() { // detect Pi Zero using 3.3V // if Pi is present, run Payload OK software - load_files(); +// load_files(); /* pinMode(PI_3V3_PIN, INPUT); Serial.print("Pi 3.3V: "); From 08303aa5bdbb77b112b4e2154a58551611689742 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 15 Nov 2022 22:47:27 -0500 Subject: [PATCH 005/105] formaat --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index e0794688..64aa303e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -79,7 +79,7 @@ void setup() { Serial.begin(115200); LittleFS.begin(); - LittleFS.reformat(); + LittleFS.format(); read_mode(); From 59a946454072e5ff88c7cbd41e09cd7818978114 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 08:57:54 -0500 Subject: [PATCH 006/105] add jpeg_decode and load_files --- cubesatsim/cubesatsim.ino | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 64aa303e..9ea27bc0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -107,7 +107,7 @@ void setup() { // detect Pi Zero using 3.3V // if Pi is present, run Payload OK software -// load_files(); + load_files(); /* pinMode(PI_3V3_PIN, INPUT); Serial.print("Pi 3.3V: "); @@ -212,9 +212,7 @@ void loop() { } } else if (mode == SSTV) - { - picosstvpp(); -/* + { first_time_sstv = false; char image_file[128]; if (first_time_sstv) { @@ -242,11 +240,11 @@ void loop() { char output_file2[] = "/cam2.bin"; jpeg_decode(image_file, output_file2, true); // debug_mode); show_dir(); - char telem_display[] = " BATT: STATUS: TEMP: "; - char output_file[] = "/cam.bin"; +// char telem_display[] = " BATT: STATUS: TEMP: "; +// char output_file[] = "/cam.bin"; digitalWrite(PTT_PIN, HIGH); // shouldn't need this but - rotate_image(output_file2, output_file, telem_display); - show_dir(); +// rotate_image(output_file2, output_file, telem_display); +// show_dir(); if (debug_mode) Serial.println("Start transmit!!!"); @@ -255,7 +253,8 @@ void loop() { digitalWrite(LED_BUILTIN, HIGH); digitalWrite(MAIN_LED_BLUE, HIGH); - scottie1_transmit_file(output_file, debug_mode); +// scottie1_transmit_file(output_file, debug_mode); + picosstvpp(); if (debug_mode) Serial.println("Stop transmit!"); @@ -266,7 +265,7 @@ void loop() { if (debug_mode) Serial.println("\nImage sent!"); -*/ + } else Serial.println("Unknown mode!"); From 139b356902f0befdc81b855cfb8dd934c542730e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 09:36:44 -0500 Subject: [PATCH 007/105] remove format of flash space --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 9ea27bc0..5a056397 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -79,7 +79,7 @@ void setup() { Serial.begin(115200); LittleFS.begin(); - LittleFS.format(); +// LittleFS.format(); // only format if files of size 0 keep showing up read_mode(); From e31dadca68765f578f80fe0986b3a7c918f6f22f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 09:38:36 -0500 Subject: [PATCH 008/105] cam.bin --- cubesatsim/cubesatsim.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5a056397..a73f179f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -238,10 +238,11 @@ void loop() { // LittleFS.remove("/cam.bin"); show_dir(); char output_file2[] = "/cam2.bin"; - jpeg_decode(image_file, output_file2, true); // debug_mode); + char output_file[] = "/cam.bin"; + jpeg_decode(image_file, output_file, true); // debug_mode); show_dir(); // char telem_display[] = " BATT: STATUS: TEMP: "; -// char output_file[] = "/cam.bin"; + digitalWrite(PTT_PIN, HIGH); // shouldn't need this but // rotate_image(output_file2, output_file, telem_display); // show_dir(); From 78e7a4202f84503a998c10dccf9d55dbc48a0303 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 09:55:41 -0500 Subject: [PATCH 009/105] add play_pwm_file --- cubesatsim/cubesatsim.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index a73f179f..123d8a5a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -246,6 +246,8 @@ void loop() { digitalWrite(PTT_PIN, HIGH); // shouldn't need this but // rotate_image(output_file2, output_file, telem_display); // show_dir(); + + picosstvpp(); if (debug_mode) Serial.println("Start transmit!!!"); @@ -255,7 +257,8 @@ void loop() { digitalWrite(MAIN_LED_BLUE, HIGH); // scottie1_transmit_file(output_file, debug_mode); - picosstvpp(); + + play_pwm_file(); if (debug_mode) Serial.println("Stop transmit!"); From 7e39b270679c887c548c117e6c1ad9d7ad0557d2 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 11:16:53 -0500 Subject: [PATCH 010/105] changed AUDIO_OUT_PIN for testing --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index a33b48fe..90cc115e 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 27 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From 82f8e096c68475999388d52ab9839e6ff2153d54 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 12:50:48 -0500 Subject: [PATCH 011/105] don't set system clock to 133 --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 123d8a5a..1862e4f6 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -74,7 +74,7 @@ extern bool start_camera(); void setup() { - set_sys_clock_khz(133000, true); +// set_sys_clock_khz(133000, true); Serial.begin(115200); From 0d339179c514fe704f215d8ffa80ea0c67218e9f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 21:26:10 -0500 Subject: [PATCH 012/105] renamed --- cubesatsim/sstv2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/sstv2.h b/cubesatsim/sstv2.h index 912c833a..3a79b3dc 100644 --- a/cubesatsim/sstv2.h +++ b/cubesatsim/sstv2.h @@ -23,7 +23,8 @@ */ #include -const uint8_t sstv_image_2_320_x_240[] PROGMEM = { +//const uint8_t sstv_image_2_320_x_240[] PROGMEM = { +const uint8_t sstv_image_1_320_x_240[] PROGMEM = { 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x8F, 0x00, 0x8F, 0x00, 0x00, 0xFF, 0xE2, 0x10, 0x08, 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0F, 0xF8, 0x61, 0x70, 0x70, 0x6C, 0x02, 0x10, From 15210a4d57f7565e724ccfb9b582217aa77c1240 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 21:26:53 -0500 Subject: [PATCH 013/105] other sstv image --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 1862e4f6..6ac6e751 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -45,8 +45,8 @@ #include "picosstvpp.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) -#include "sstv1.h" -//#include "sstv2.h" +//#include "sstv1.h" +#include "sstv2.h" Adafruit_INA219 ina219_1_0x40; Adafruit_INA219 ina219_1_0x41(0x41); From 848d06c6bfa6b4e71845401cf2fae71986d8adbe Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 16 Nov 2022 21:35:37 -0500 Subject: [PATCH 014/105] force load of sstv image 1 --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 6ac6e751..b6655b8f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3966,7 +3966,8 @@ void load_files() { File f; f = LittleFS.open("sstv_image_1_320_x_240.jpg", "r"); - if (f) { +// if (f) { + if (false) { Serial.println("Image sstv_image_1_320_x_240.jpg already in FS"); f.close(); } else { From d316e35353271823df6be94c534ee57572f45d81 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 09:48:03 -0500 Subject: [PATCH 015/105] add back in sstv_end, hardcode SSTV to pin 26 --- cubesatsim/cubesatsim.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b6655b8f..63b38f46 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -150,7 +150,7 @@ void setup() { start_button_isr(); // setup_sstv(); - picosstvpp_begin(AUDIO_OUT_PIN); + picosstvpp_begin(26); camera_detected = start_camera(); // start_pwm(); @@ -258,7 +258,7 @@ void loop() { // scottie1_transmit_file(output_file, debug_mode); - play_pwm_file(); + play_pwm_file(26); if (debug_mode) Serial.println("Stop transmit!"); @@ -557,8 +557,8 @@ void transmit_off() { } } -// else if (mode == SSTV) -// sstv_end(); + else if (mode == SSTV) + sstv_end(); else if (mode == CW) cw_stop = true; } @@ -4125,8 +4125,8 @@ void serial_input() { break; } -// if ((mode == SSTV) && prompt) // stop SSTV if need to prompt for input -// sstv_end(); + if ((mode == SSTV) && prompt) // stop SSTV if need to prompt for input + sstv_end(); if (new_mode != mode) transmit_off(); From 0ca16f2701aa4012a93cb246cabee0b43cd66006 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 15:28:47 -0500 Subject: [PATCH 016/105] no clockgen button_isr start_isr --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 63b38f46..aaf5c93b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -96,7 +96,7 @@ void setup() { config_gpio(); - start_clockgen(); +/// start_clockgen(); EEPROM.begin(512); @@ -147,7 +147,7 @@ void setup() { configure_wifi(); } */ - start_button_isr(); +/// start_button_isr(); // setup_sstv(); picosstvpp_begin(26); @@ -166,7 +166,7 @@ void setup() { config_telem(); - start_isr(); +// start_isr(); // setup radio depending on mode config_radio(); From f20ee76947c67e88a7a5466d7fadff5e7d7bdf6e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 15:31:41 -0500 Subject: [PATCH 017/105] clockgen back --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index aaf5c93b..54fa7bc3 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -96,7 +96,7 @@ void setup() { config_gpio(); -/// start_clockgen(); + start_clockgen(); EEPROM.begin(512); From b15d6983282e23c9fdbe4240631518700c36b92c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 15:37:03 -0500 Subject: [PATCH 018/105] put back button_isr --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 54fa7bc3..15b57ad8 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -147,7 +147,7 @@ void setup() { configure_wifi(); } */ -/// start_button_isr(); + start_button_isr(); // setup_sstv(); picosstvpp_begin(26); From 250dc4840b6454215f1ccdf88028fc14c99d6c97 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 15:40:06 -0500 Subject: [PATCH 019/105] button_isr off, start_isr on --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 15b57ad8..d43c4125 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -147,7 +147,7 @@ void setup() { configure_wifi(); } */ - start_button_isr(); +// start_button_isr(); // setup_sstv(); picosstvpp_begin(26); @@ -166,7 +166,7 @@ void setup() { config_telem(); -// start_isr(); + start_isr(); // setup radio depending on mode config_radio(); From 60fe68b2309bdaa71d8934bcae11dff72385c8f6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 16:16:55 -0500 Subject: [PATCH 020/105] remove start_isr --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d43c4125..11d4d623 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -166,7 +166,7 @@ void setup() { config_telem(); - start_isr(); +// start_isr(); // setup radio depending on mode config_radio(); From b49eedd2a0e43bba055ac1938fe29d82252093ce Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 16:21:15 -0500 Subject: [PATCH 021/105] start_isr back in --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 11d4d623..d43c4125 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -166,7 +166,7 @@ void setup() { config_telem(); -// start_isr(); + start_isr(); // setup radio depending on mode config_radio(); From 40baf126887e0e31fdb99f8c85da727aa8cc714f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:45:45 -0500 Subject: [PATCH 022/105] start_button back in --- cubesatsim/cubesatsim.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d43c4125..0f055a95 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -165,6 +165,8 @@ void setup() { /**/ config_telem(); + + start_button_isr(); // try before start_isr start_isr(); From 906d36e733de023af28aaeef27d47ff51d74ad91 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:49:07 -0500 Subject: [PATCH 023/105] try TimerHandler2 --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0f055a95..115a8165 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3671,7 +3671,8 @@ void start_button_isr() { Serial.println("Starting pushbutton ISR"); - if (ITimer1.attachInterruptInterval(10000, TimerHandler1)) +// if (ITimer1.attachInterruptInterval(10000, TimerHandler1)) + if (ITimer1.attachInterruptInterval(10000, TimerHandler2)) { if (debug_mode) Serial.print(F("Starting ITimer1 OK, micros() = ")); From 26ac8e6e1addc53ef88b2578f3ab594958a87ab5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:49:41 -0500 Subject: [PATCH 024/105] Timer2 --- cubesatsim/cubesatsim.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 90cc115e..c89f4cfb 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -370,7 +370,8 @@ const char sstv2_filename[] = "/sstv_image_2_320_x_240.jpg"; bool TimerHandler0(struct repeating_timer *t); RPI_PICO_Timer ITimer0(0); -RPI_PICO_Timer ITimer1(1); +//RPI_PICO_Timer ITimer1(1); +RPI_PICO_Timer ITimer1(2); bool timer0_on = false; volatile int timer_counter; From 3bec8d6dbc5dc326ead21cc1ae3ac9a14da5a45f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:50:50 -0500 Subject: [PATCH 025/105] Timer2 --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 115a8165..064c6e33 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3672,7 +3672,7 @@ void start_button_isr() { Serial.println("Starting pushbutton ISR"); // if (ITimer1.attachInterruptInterval(10000, TimerHandler1)) - if (ITimer1.attachInterruptInterval(10000, TimerHandler2)) + if (ITimer2.attachInterruptInterval(10000, TimerHandler1)) { if (debug_mode) Serial.print(F("Starting ITimer1 OK, micros() = ")); From 9a9682c3da391e79c7db255c4959784d9f749d7f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:52:03 -0500 Subject: [PATCH 026/105] Timer2 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index c89f4cfb..41bfefcc 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -371,7 +371,7 @@ const char sstv2_filename[] = "/sstv_image_2_320_x_240.jpg"; bool TimerHandler0(struct repeating_timer *t); RPI_PICO_Timer ITimer0(0); //RPI_PICO_Timer ITimer1(1); -RPI_PICO_Timer ITimer1(2); +RPI_PICO_Timer ITimer2(2); bool timer0_on = false; volatile int timer_counter; From cc276a49a78e37c80d769ae66a7c1ab68973d3b6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:54:48 -0500 Subject: [PATCH 027/105] back to Timer1 --- cubesatsim/cubesatsim.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 41bfefcc..90cc115e 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -370,8 +370,7 @@ const char sstv2_filename[] = "/sstv_image_2_320_x_240.jpg"; bool TimerHandler0(struct repeating_timer *t); RPI_PICO_Timer ITimer0(0); -//RPI_PICO_Timer ITimer1(1); -RPI_PICO_Timer ITimer2(2); +RPI_PICO_Timer ITimer1(1); bool timer0_on = false; volatile int timer_counter; From cbdafd7b7e83ff7827c392ea0803c70224a95d88 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:56:02 -0500 Subject: [PATCH 028/105] Back to Timer1, 10000 instead of 1000 --- cubesatsim/cubesatsim.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 064c6e33..0322591c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3671,8 +3671,7 @@ void start_button_isr() { Serial.println("Starting pushbutton ISR"); -// if (ITimer1.attachInterruptInterval(10000, TimerHandler1)) - if (ITimer2.attachInterruptInterval(10000, TimerHandler1)) + if (ITimer1.attachInterruptInterval(100000, TimerHandler1)) { if (debug_mode) Serial.print(F("Starting ITimer1 OK, micros() = ")); From d6de7490558b9243be984bdb408eaa2b3d198eea Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 22:59:37 -0500 Subject: [PATCH 029/105] set clock at the start --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0322591c..145b6422 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -74,7 +74,7 @@ extern bool start_camera(); void setup() { -// set_sys_clock_khz(133000, true); + set_sys_clock_khz(133000, true); // try it at the start Serial.begin(115200); @@ -3671,7 +3671,7 @@ void start_button_isr() { Serial.println("Starting pushbutton ISR"); - if (ITimer1.attachInterruptInterval(100000, TimerHandler1)) + if (ITimer1.attachInterruptInterval(10000, TimerHandler1)) { if (debug_mode) Serial.print(F("Starting ITimer1 OK, micros() = ")); From 69b1850cd5d8c6ce63001a52fbcbba33767bce94 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 23:11:29 -0500 Subject: [PATCH 030/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 145b6422..50de75c7 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -74,7 +74,7 @@ extern bool start_camera(); void setup() { - set_sys_clock_khz(133000, true); // try it at the start +// set_sys_clock_khz(133000, true); Serial.begin(115200); From 238d429e4d631d4d1061c2fbf4eadcdf46807a1e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 23:20:22 -0500 Subject: [PATCH 031/105] turn off pushbutton isr --- cubesatsim/cubesatsim.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 50de75c7..eeb0543a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -667,6 +667,7 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { + ITimer1.disableTimer(); // turn off pushbutton timer Serial.println("\nConfiguring for SSTV"); // set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; From 1992d9726f2eb9d4284cb4bb3118c92dc4cc2bcb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 23:24:34 -0500 Subject: [PATCH 032/105] AUDIO OUT to 14 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 90cc115e..db9a3a25 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 27 // 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From 073490ef59a24711690838e6e6ba36dad8ddf932 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 23:28:56 -0500 Subject: [PATCH 033/105] stop timer --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index eeb0543a..e87e290c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -667,7 +667,7 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { - ITimer1.disableTimer(); // turn off pushbutton timer + ITimer1.stopTimer(); // turn off pushbutton timer Serial.println("\nConfiguring for SSTV"); // set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; From b28563f6d75c8ab200a8c2fbf04cb70124ba9a1b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 18 Nov 2022 23:34:00 -0500 Subject: [PATCH 034/105] no button_isr --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index e87e290c..11fe8e84 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -166,7 +166,7 @@ void setup() { config_telem(); - start_button_isr(); // try before start_isr +// start_button_isr(); // try before start_isr start_isr(); @@ -667,7 +667,7 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { - ITimer1.stopTimer(); // turn off pushbutton timer +// ITimer1.stopTimer(); // turn off pushbutton timer Serial.println("\nConfiguring for SSTV"); // set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; From ec51b9350d148945cfac008ee290ff5415cf9ccb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 07:07:19 -0500 Subject: [PATCH 035/105] try stop timer again --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 11fe8e84..4040cf18 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -667,7 +667,7 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { -// ITimer1.stopTimer(); // turn off pushbutton timer + ITimer1.stopTimer(); // turn off pushbutton timer Serial.println("\nConfiguring for SSTV"); // set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; From 1635860baaa0db66221dedbe75fe6e64cb38faad Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 07:10:27 -0500 Subject: [PATCH 036/105] button isr back on --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4040cf18..037b67d0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -147,7 +147,7 @@ void setup() { configure_wifi(); } */ -// start_button_isr(); + start_button_isr(); // setup_sstv(); picosstvpp_begin(26); From e1a4ff1a4022c0c18505e4ece131d5b2ba27f6ad Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 07:16:08 -0500 Subject: [PATCH 037/105] worked - try off and on for pwm_play --- cubesatsim/cubesatsim.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 037b67d0..b43c88e9 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -259,9 +259,10 @@ void loop() { digitalWrite(MAIN_LED_BLUE, HIGH); // scottie1_transmit_file(output_file, debug_mode); - + + ITimer1.stopTimer(); // turn off pushbutton timer play_pwm_file(26); - + ITimer1.startTimer(); // turn back on pushbutton timer if (debug_mode) Serial.println("Stop transmit!"); digitalWrite(PTT_PIN, HIGH); // stop transmit @@ -667,7 +668,7 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { - ITimer1.stopTimer(); // turn off pushbutton timer +// ITimer1.stopTimer(); // turn off pushbutton timer Serial.println("\nConfiguring for SSTV"); // set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; From e9c24a2589125a6083afc7f2e14e3a345195560e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 07:17:38 -0500 Subject: [PATCH 038/105] changed to restart timer --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b43c88e9..faab3a1c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -262,7 +262,7 @@ void loop() { ITimer1.stopTimer(); // turn off pushbutton timer play_pwm_file(26); - ITimer1.startTimer(); // turn back on pushbutton timer + ITimer1.restartTimer(); // turn back on pushbutton timer if (debug_mode) Serial.println("Stop transmit!"); digitalWrite(PTT_PIN, HIGH); // stop transmit From 0e09db653a09fe5d840b34083273763953d38148 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 07:54:08 -0500 Subject: [PATCH 039/105] added TimerHandler1 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index db9a3a25..aa21abb6 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -209,7 +209,7 @@ void write_config_file(); void read_mode(); void write_mode(); void start_clockgen(); - +bool TimerHandler1(struct repeating_timer *t); #ifndef STASSID #define STASSID "Pico" From 6b13d7760b39f548bdea3a9829987ff8d21feb77 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 08:09:01 -0500 Subject: [PATCH 040/105] AUDIO OUT back to 26 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index aa21abb6..40f4af08 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 26 // 14 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From b4bb96db2910232d52f27505c9d1e47cb9ec3bf5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 08:13:16 -0500 Subject: [PATCH 041/105] change AUDIO out back to 14 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 40f4af08..aa21abb6 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 26 // 14 // 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From 8d6a359a34c701b2590b1d31a7637f0038837b8b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 08:21:04 -0500 Subject: [PATCH 042/105] back to 26 again, seems to work --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index aa21abb6..adb6b68f 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -73,7 +73,7 @@ #define MAIN_LED_GREEN 20 // Main board LED1 #define MAIN_LED_BLUE 21 // Main board LED1 #define PD_PIN 22 // SR_FRS_05W PD pin - enable -#define AUDIO_OUT_PIN 14 // 26 // SR_FRS_05W audio out pin +#define AUDIO_OUT_PIN 26 // 26 // SR_FRS_05W audio out pin #define AUDIO_IN_PIN 27 // SR_FRS_05W audio in pin #define TEMPERATURE_PIN 28 // Diode temperature analog pin From 284bd7c633683e8cf2abdce42cf4454c25830af6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 09:06:06 -0500 Subject: [PATCH 043/105] v0.32 --- cubesatsim/cubesatsim.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index faab3a1c..cefc4570 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -92,7 +92,7 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.30 starting...\n"); + Serial.println("CubeSatSim Pico v0.32 starting...\n"); config_gpio(); @@ -227,8 +227,10 @@ void loop() { // Serial.println("Got image file"); char camera_file[] = "/cam.jpg"; strcpy(image_file, camera_file); - } else + } else { strcpy(image_file, sstv1_filename); // 2nd stored image + Serial.println("Using image file"); + } } if (debug_mode) { Serial.print("\nSending SSTV image "); From ad63e01ade4e5b833716ff4b1ef47b0dd40bd726 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 09:19:53 -0500 Subject: [PATCH 044/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index cefc4570..3a05ed55 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -229,7 +229,7 @@ void loop() { strcpy(image_file, camera_file); } else { strcpy(image_file, sstv1_filename); // 2nd stored image - Serial.println("Using image file"); + Serial.println("Using stored image file"); } } if (debug_mode) { From 4072f1b9c098e4f8b05f59c9cbe91aea9e34a0d1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 19 Nov 2022 17:38:09 -0500 Subject: [PATCH 045/105] 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 046/105] 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 047/105] 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 048/105] 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 049/105] 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 050/105] 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 051/105] 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 052/105] 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 053/105] 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 054/105] 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 055/105] 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 056/105] 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) From 24f863aeba87f29253cf5af3f506c10fefc77475 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 08:10:20 -0500 Subject: [PATCH 057/105] add prompt at end of loop --- cubesatsim/cubesatsim.ino | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 9f7ef41d..026b562d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -147,7 +147,7 @@ void setup() { configure_wifi(); } */ - start_button_isr(); +/// start_button_isr(); // setup_sstv(); picosstvpp_begin(26); @@ -305,10 +305,10 @@ void loop() { // check to see if the mode has changed if (mode != new_mode) { Serial.println("Changing mode"); - if (mode == SSTV) { - ITimer1.detachInterrupt(); - start_button_isr(); // restart button isr - } +/// 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) @@ -318,6 +318,14 @@ void loop() { config_radio(); sampleTime = (unsigned int) millis(); } + + serial_input(); + +// check for button press + if (digitalRead(MAIN_PB_PIN) == PRESSED) // pushbutton is pressed + process_pushbutton(); + if (BOOTSEL) // boot selector button is pressed on Pico + process_bootsel(); if (prompt) { // Serial.println("Need to prompt for input!"); From 567f84250221678db466f505d0a8091c2f0fcacf Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 08:17:42 -0500 Subject: [PATCH 058/105] start in BPSK --- cubesatsim/cubesatsim.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 026b562d..3d81beb7 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -81,7 +81,9 @@ void setup() { LittleFS.begin(); // LittleFS.format(); // only format if files of size 0 keep showing up - read_mode(); + read_mode(); + + mode = BPSK; // force to BPSK new_mode = mode; From 9ace4a4a88d0af12f553245bf813a390a35f2a6d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 08:27:45 -0500 Subject: [PATCH 059/105] remove stop and start interrupt --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3d81beb7..0992f539 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -265,10 +265,10 @@ void loop() { // scottie1_transmit_file(output_file, debug_mode); // ITimer1.stopTimer(); // turn off pushbutton timer - ITimer1.disableTimer(); // turn off pushbutton timer +/// ITimer1.disableTimer(); // turn off pushbutton timer play_pwm_file(26); // ITimer1.restartTimer(); // turn back on pushbutton timer - ITimer1.enableTimer(); // 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 4513d4323e94f932e1918f0b1f072f228df51c29 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 08:40:02 -0500 Subject: [PATCH 060/105] move button check and new mode check before loop --- cubesatsim/cubesatsim.ino | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0992f539..accbb3b3 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -283,25 +283,18 @@ void loop() { else Serial.println("Unknown mode!"); -// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100 - while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100 - sleep(0.01); // was 0.1 sec - sampleTime = (unsigned int) millis(); + serial_input(); -// delay(2000); -// test_radio(); - - if ((mode == FSK) || (mode == BPSK)) { -// if (!wifi) - digitalWrite(LED_BUILTIN, LOW); - digitalWrite(MAIN_LED_BLUE, LOW); - - // delay(3000); - sleep(0.2); // 2.845); // 3.0); - -// if (!wifi) - digitalWrite(LED_BUILTIN, HIGH); - digitalWrite(MAIN_LED_BLUE, HIGH); +// check for button press + if (digitalRead(MAIN_PB_PIN) == PRESSED) // pushbutton is pressed + process_pushbutton(); + if (BOOTSEL) // boot selector button is pressed on Pico + process_bootsel(); + + if (prompt) { +// Serial.println("Need to prompt for input!"); + prompt_for_input(); + prompt = false; } // check to see if the mode has changed @@ -319,20 +312,27 @@ void loop() { config_telem(); config_radio(); sampleTime = (unsigned int) millis(); - } - - serial_input(); + } -// check for button press - if (digitalRead(MAIN_PB_PIN) == PRESSED) // pushbutton is pressed - process_pushbutton(); - if (BOOTSEL) // boot selector button is pressed on Pico - process_bootsel(); +// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100 + sleep(0.01); // was 0.1 sec + sampleTime = (unsigned int) millis(); - if (prompt) { -// Serial.println("Need to prompt for input!"); - prompt_for_input(); - prompt = false; +// delay(2000); +// test_radio(); + + if ((mode == FSK) || (mode == BPSK)) { +// if (!wifi) + digitalWrite(LED_BUILTIN, LOW); + digitalWrite(MAIN_LED_BLUE, LOW); + + // delay(3000); + sleep(0.2); // 2.845); // 3.0); + +// if (!wifi) + digitalWrite(LED_BUILTIN, HIGH); + digitalWrite(MAIN_LED_BLUE, HIGH); } // Calculate loop time From 44aa328fc25a1d45d4b5ad7284003cbde5f102cb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 08:54:18 -0500 Subject: [PATCH 061/105] move after loop --- cubesatsim/cubesatsim.ino | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index accbb3b3..203016ba 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -282,6 +282,29 @@ void loop() { } else Serial.println("Unknown mode!"); + + +// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100 + while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100 + sleep(0.01); // was 0.1 sec + sampleTime = (unsigned int) millis(); + +// delay(2000); +// test_radio(); + + if ((mode == FSK) || (mode == BPSK)) { +// if (!wifi) + digitalWrite(LED_BUILTIN, LOW); + digitalWrite(MAIN_LED_BLUE, LOW); + + // delay(3000); + sleep(0.2); // 2.845); // 3.0); + +// if (!wifi) + digitalWrite(LED_BUILTIN, HIGH); + digitalWrite(MAIN_LED_BLUE, HIGH); + } + serial_input(); @@ -312,28 +335,7 @@ void loop() { config_telem(); config_radio(); sampleTime = (unsigned int) millis(); - } - -// while ((millis() - sampleTime) < ((unsigned int)samplePeriod)) // - 250)) // was 250 100 - while ((millis() - sampleTime) < ((unsigned int)frameTime)) // - 250)) // was 250 100 - sleep(0.01); // was 0.1 sec - sampleTime = (unsigned int) millis(); - -// delay(2000); -// test_radio(); - - if ((mode == FSK) || (mode == BPSK)) { -// if (!wifi) - digitalWrite(LED_BUILTIN, LOW); - digitalWrite(MAIN_LED_BLUE, LOW); - - // delay(3000); - sleep(0.2); // 2.845); // 3.0); - -// if (!wifi) - digitalWrite(LED_BUILTIN, HIGH); - digitalWrite(MAIN_LED_BLUE, HIGH); - } + } // Calculate loop time if (debug_mode) { From e76da41908ba20cfa0f2c49e4c0441031a53166f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 15:21:24 -0500 Subject: [PATCH 062/105] v0.33 --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 203016ba..a537f823 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -83,7 +83,7 @@ void setup() { read_mode(); - mode = BPSK; // force to BPSK + // mode = BPSK; // force to BPSK new_mode = mode; @@ -94,7 +94,7 @@ void setup() { // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.32 starting...\n"); + Serial.println("CubeSatSim Pico v0.33 starting...\n"); config_gpio(); @@ -273,7 +273,7 @@ void loop() { Serial.println("Stop transmit!"); digitalWrite(PTT_PIN, HIGH); // stop transmit // if (!wifi) - digitalWrite(LED_BUILTIN, HIGH); + digitalWrite(LED_BUILTIN, LOW); digitalWrite(MAIN_LED_BLUE, LOW); if (debug_mode) From 9c09a01cbec57ff310ad39858584de1d635862fe Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 15:39:39 -0500 Subject: [PATCH 063/105] turn of BUILTIN LED after blinking --- cubesatsim/cubesatsim.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index a537f823..8337481a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3408,6 +3408,8 @@ void process_pushbutton() { if (new_mode != mode) transmit_off(); sleep(2.0); + + digitalWrite(LED_BUILTIN, LOW); // make sure built-in LED is off } void process_bootsel() { @@ -3505,6 +3507,8 @@ void process_bootsel() { if (new_mode != mode) transmit_off(); // sleep(2.0); + + digitalWrite(LED_BUILTIN, LOW); // make sure built-in LED is off } void blinkTimes(int blinks) { From e8fcb056938393555d01dd122403beb26ce10acd Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 15:46:29 -0500 Subject: [PATCH 064/105] turn off built in LED in transmit_off --- cubesatsim/cubesatsim.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 8337481a..b42f1166 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -557,6 +557,7 @@ void transmit_off() { if (debug_mode) Serial.println("Transmit off!"); digitalWrite(MAIN_LED_BLUE, LOW); + digitalWrite(LED_BUILTIN, LOW); if ((mode == BPSK) || (mode == FSK)) { digitalWrite(BPSK_CONTROL_A, LOW); digitalWrite(BPSK_CONTROL_B, LOW); From d75f3142585c4e244ba70f06b9f3f8a8fcf33ac3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 15:54:04 -0500 Subject: [PATCH 065/105] added builtin LED on/off on transmit string --- cubesatsim/cubesatsim.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b42f1166..49862dc8 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3898,7 +3898,8 @@ void transmit_string(char *string) { if (debug_mode) Serial.println("Transmit on"); digitalWrite(PD_PIN, HIGH); // Enable SR_FRS - digitalWrite(MAIN_LED_BLUE, HIGH); + digitalWrite(MAIN_LED_BLUE, HIGH); + digitalWrite(LED_BUILTIN, HIGH); digitalWrite(PTT_PIN, LOW); while ((string[j] != '\0') && (j < 256) && !cw_stop) { @@ -3922,7 +3923,8 @@ void transmit_string(char *string) { if (debug_mode) Serial.println("Transmit off"); - digitalWrite(MAIN_LED_BLUE, LOW); + digitalWrite(MAIN_LED_BLUE, LOW); + digitalWrite(LED_BUILTIN, LOW); digitalWrite(PTT_PIN, HIGH); digitalWrite(PD_PIN, LOW); // disable SR_FRS } From ed64607e6262e549e69ca6f85c0c1a6afabb3cb3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 16:08:54 -0500 Subject: [PATCH 066/105] fixed blink() --- cubesatsim/cubesatsim.ino | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 49862dc8..b3b1f53b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3009,33 +3009,11 @@ void blink_setup() void blink(int length) { -#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4) - digitalWrite(PC13, LOW); // turn the LED on (HIGH is the voltage level) -#endif - -#if defined __AVR_ATmega32U4__ - digitalWrite(RXLED, LOW); // set the RX LED ON - TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF -#endif - -#if defined ARDUINO_ARCH_RP2040 - digitalWrite(25, LOW); // set the built-in LED ON -#endif + digitalWrite(LED_BUILTIN, HIGH); // set the built-in LED ON sleep(length/1000.0); // delay(length); // wait for a lenth of time -#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4) - digitalWrite(PC13, HIGH); // turn the LED off by making the voltage LOW -#endif - -#if defined __AVR_ATmega32U4__ - digitalWrite(RXLED, HIGH); // set the RX LED OFF - TXLED0; //TX LED macro to turn LED ON -#endif - -#if defined ARDUINO_ARCH_RP2040 - digitalWrite(25, HIGH); // set the built-in LED off -#endif + digitalWrite(ED_BUILTIN, LOW); // set the built-in LED off } void led_set(int ledPin, bool state) From 2c1c7f472effbe1016c16fc54375834ef4bd4452 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 16:09:39 -0500 Subject: [PATCH 067/105] typo --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b3b1f53b..3e9b6c04 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3013,7 +3013,7 @@ void blink(int length) sleep(length/1000.0); // delay(length); // wait for a lenth of time - digitalWrite(ED_BUILTIN, LOW); // set the built-in LED off + digitalWrite(LED_BUILTIN, LOW); // set the built-in LED off } void led_set(int ledPin, bool state) From 2634ed110f503149bc5b0c8b869323ce8ff2ec0b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 16:38:54 -0500 Subject: [PATCH 068/105] remove blink(50) from read_payload to fix BPSK, FSK LED --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3e9b6c04..f3343f33 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2571,7 +2571,7 @@ void read_payload() // if ((Serial.available() > 0)|| first_time == true) { - blink(50); +// blink(50); char result = Serial.read(); char header[] = "OK BME280 "; char str[100]; @@ -2710,7 +2710,7 @@ void read_payload() if (Serial1.available() > 0) { - blink(50); +// blink(50); char result = Serial1.read(); // Serial1.println(result); From 2436928e6963ec90e97a1e687f0732022af09252 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 16:46:59 -0500 Subject: [PATCH 069/105] turn on transmit LED immediately when switching mode FSK BPSK --- cubesatsim/cubesatsim.ino | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f3343f33..d0b751ea 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -334,6 +334,11 @@ void loop() { sleep(0.5); config_telem(); config_radio(); + if ((mode == FSK) || (mode == BPSK)) { + digitalWrite(LED_BUILTIN, HIGH); + digitalWrite(MAIN_LED_BLUE, HIGH); + } + sampleTime = (unsigned int) millis(); } From 7f0bc8b5653dfb8fed49e4efb44159ddb877d84f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 16:53:43 -0500 Subject: [PATCH 070/105] check for input in CW mode --- cubesatsim/cubesatsim.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d0b751ea..e8fd747e 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3894,12 +3894,15 @@ void transmit_string(char *string) { // Serial.println("space between words"); sleep((6.0 * (float)morse_timing)/1000.0); j++; - + if (Serial.available() || BOOTSEL || !digitalRead(10)) // check for button press of serial input + cw_stop = true; +/* if (prompt) { // Serial.println("Need to prompt for input!"); prompt_for_input(); prompt = false; - } + } +*/ } } cw_stop = false; From fd7ddd73444be812235ac0a3543aaf3d2a1a1728 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 27 Nov 2022 22:08:49 -0500 Subject: [PATCH 071/105] see which enable/disable is happening --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index e8fd747e..3754f224 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -546,7 +546,7 @@ void transmit_on() { clockgen.enableOutputs(true); Serial.println("Enable clock outputs!"); } else { - Serial.println("Enable clock outputs!"); + Serial.println("Enable clock outputs"); } } else if (mode == CW) { @@ -582,7 +582,7 @@ void transmit_off() { clockgen.enableOutputs(false); Serial.println("Disable clock outputs!"); } else { - Serial.println("Disable clock outputs!"); + Serial.println("Disable clock outputs"); } } From 4edcfaebb1f87fe61a9cbf4c680d39cd9b435767 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 15:47:55 -0500 Subject: [PATCH 072/105] remove transmit_off in transmit_callsign --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3754f224..bd149a15 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3871,7 +3871,7 @@ void transmit_callsign(char *callsign) { program_radio(); } */ - transmit_off(); +/// transmit_off(); transmit_string(id); // transmit_on(); } From 5935bedb2e931de3014d24ab93385d13db7f6cea Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:03:32 -0500 Subject: [PATCH 073/105] move config_telem up in change mode --- cubesatsim/cubesatsim.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index bd149a15..715c28da 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -328,11 +328,12 @@ void loop() { /// start_button_isr(); // restart button isr /// } mode = new_mode; // change modes if button pressed - write_mode(); + write_mode(); + config_telem(); if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); - config_telem(); +/// config_telem(); config_radio(); if ((mode == FSK) || (mode == BPSK)) { digitalWrite(LED_BUILTIN, HIGH); From 68c34e90af3de1d0c8ab8b7d5a0d0a8aadbe3427 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:07:36 -0500 Subject: [PATCH 074/105] config_telem depending on FSK or BPSK --- cubesatsim/cubesatsim.ino | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 715c28da..d326a1a3 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -328,12 +328,18 @@ void loop() { /// start_button_isr(); // restart button isr /// } mode = new_mode; // change modes if button pressed - write_mode(); - config_telem(); + write_mode(); + + if (mode == BPSK) + config_telem(); + if (new_mode != CW) transmit_callsign(callsign); - sleep(0.5); -/// config_telem(); + sleep(0.5); + + if (mode == FSK) + config_telem(); + config_radio(); if ((mode == FSK) || (mode == BPSK)) { digitalWrite(LED_BUILTIN, HIGH); From 0553a21f8ed5ac37553bc7dd5baa8ea983db2646 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:12:52 -0500 Subject: [PATCH 075/105] config_telem in usual place for all modes except BPSK --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d326a1a3..cf8fb86b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -331,14 +331,14 @@ void loop() { write_mode(); if (mode == BPSK) - config_telem(); + config_telem(); // run this before cw only for BPSK mode if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); - if (mode == FSK) - config_telem(); + if (mode != BPSK) + config_telem(); // run this here for all other modes config_radio(); if ((mode == FSK) || (mode == BPSK)) { From d9564355f0293fa61bf1ba5bd4abc536827fc369 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:26:32 -0500 Subject: [PATCH 076/105] add cw_stop = false --- cubesatsim/cubesatsim.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index cf8fb86b..957efad5 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -323,6 +323,7 @@ void loop() { // check to see if the mode has changed if (mode != new_mode) { Serial.println("Changing mode"); + cw_stop = false; // enable CW or won't hear CW ID /// if (mode == SSTV) { /// ITimer1.detachInterrupt(); /// start_button_isr(); // restart button isr From 63e68d94904560ed90245b30ea8987b50e6f20c6 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:40:08 -0500 Subject: [PATCH 077/105] also change config for CW -> FSK mode change --- cubesatsim/cubesatsim.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 957efad5..379ca314 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -328,17 +328,21 @@ void loop() { /// ITimer1.detachInterrupt(); /// start_button_isr(); // restart button isr /// } + int old_mode = mode; + bool config_done = false; mode = new_mode; // change modes if button pressed write_mode(); - if (mode == BPSK) + if (mode == BPSK) || ((new_mode == FSK) && (old_mode == CW)) { config_telem(); // run this before cw only for BPSK mode + config_done = true; + } if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); - if (mode != BPSK) + if (!config_done) config_telem(); // run this here for all other modes config_radio(); From daae31d6134c485873eb83f6248a197b579fcfc1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:41:21 -0500 Subject: [PATCH 078/105] typo --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 379ca314..c9b5b74d 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -333,7 +333,7 @@ void loop() { mode = new_mode; // change modes if button pressed write_mode(); - if (mode == BPSK) || ((new_mode == FSK) && (old_mode == CW)) { + if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW)) { config_telem(); // run this before cw only for BPSK mode config_done = true; } From dfbdcbffb9795343bd2f345e2109f7cc5d12b65d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 16:43:38 -0500 Subject: [PATCH 079/105] typo --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index c9b5b74d..5de4af51 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -333,7 +333,7 @@ void loop() { mode = new_mode; // change modes if button pressed write_mode(); - if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW)) { + if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW))) { config_telem(); // run this before cw only for BPSK mode config_done = true; } From adfb3bbd51bd268babb29dc7a252bd0cee23cb44 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Nov 2022 17:04:19 -0500 Subject: [PATCH 080/105] revert CW -> FSK mode change exception --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5de4af51..af1b55f6 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -333,7 +333,8 @@ void loop() { mode = new_mode; // change modes if button pressed write_mode(); - if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW))) { +// if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW))) { + if (mode == BPSK) { config_telem(); // run this before cw only for BPSK mode config_done = true; } From 0a3a6852c0d54ea49238de1fb35ad6a01989fced Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 29 Nov 2022 08:41:53 -0500 Subject: [PATCH 081/105] don't change order for BPSK --- cubesatsim/cubesatsim.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index af1b55f6..7f330827 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -332,13 +332,13 @@ void loop() { bool config_done = false; mode = new_mode; // change modes if button pressed write_mode(); - +/* // if ((mode == BPSK) || ((new_mode == FSK) && (old_mode == CW))) { if (mode == BPSK) { config_telem(); // run this before cw only for BPSK mode config_done = true; } - +*/ if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); From 26f4e16e305a926a457259734692aa4274aca8e7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 29 Nov 2022 09:06:35 -0500 Subject: [PATCH 082/105] restart after mode change --- cubesatsim/cubesatsim.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 7f330827..f0527109 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -338,7 +338,9 @@ void loop() { config_telem(); // run this before cw only for BPSK mode config_done = true; } -*/ +*/ + machine.reset(); // restart Pico + if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); From 3358c3308efbc707a203a4cd6b3b4f9b2862383d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 29 Nov 2022 09:12:29 -0500 Subject: [PATCH 083/105] changed to watchdog --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index f0527109..2a68c109 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -339,7 +339,7 @@ void loop() { config_done = true; } */ - machine.reset(); // restart Pico + watchdog_reboot (0, SRAM_END, 10); // restart Pico if (new_mode != CW) transmit_callsign(callsign); From 36c0caec3eabc86c993a2be0cd5ccd721fea6075 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 29 Nov 2022 09:15:23 -0500 Subject: [PATCH 084/105] add includes --- cubesatsim/cubesatsim.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2a68c109..ea68d477 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -43,6 +43,8 @@ #include "LittleFS.h" #include #include "picosstvpp.h" +#include "pico/bootrom.h" +#include "hardware/watchdog.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" From 62c0c03a02b2aba5b95c49d9a6e5bcc89e222770 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Tue, 29 Nov 2022 09:58:04 -0500 Subject: [PATCH 085/105] removed blinks and delays in startup --- cubesatsim/cubesatsim.ino | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ea68d477..2adfe459 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -92,7 +92,7 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); blinkTimes(1); - sleep(5.0); +/// sleep(5.0); // otherwise, run CubeSatSim Pico code @@ -111,7 +111,7 @@ void setup() { // detect Pi Zero using 3.3V // if Pi is present, run Payload OK software - load_files(); +/// load_files(); /* pinMode(PI_3V3_PIN, INPUT); Serial.print("Pi 3.3V: "); @@ -165,7 +165,8 @@ void setup() { // strcpy(callsign, call); if (mode != CW) transmit_callsign(callsign); - sleep(5.0); +// sleep(5.0); + sleep(1.0); /**/ config_telem(); @@ -2486,7 +2487,7 @@ void start_payload() { Serial.println("Starting payload!"); blink_setup(); - +/* blink(500); sleep(0.25); // delay(250); blink(500); @@ -2497,7 +2498,8 @@ void start_payload() { led_set(blueLED, HIGH); sleep(0.25); // delay(250); led_set(blueLED, LOW); - +*/ + if (bme.begin()) { bmePresent = 1; } else { From da09f8117662fafb764f72300ae7a888d185c8f1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 14:49:26 -0500 Subject: [PATCH 086/105] add one second delay --- cubesatsim/cubesatsim.ino | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2adfe459..b5a2a40a 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -78,7 +78,9 @@ void setup() { // set_sys_clock_khz(133000, true); - Serial.begin(115200); + Serial.begin(115200); + + delay(1000); LittleFS.begin(); // LittleFS.format(); // only format if files of size 0 keep showing up @@ -90,13 +92,13 @@ void setup() { new_mode = mode; pinMode(LED_BUILTIN, OUTPUT); - blinkTimes(1); +// blinkTimes(1); /// sleep(5.0); // otherwise, run CubeSatSim Pico code - Serial.println("CubeSatSim Pico v0.33 starting...\n"); +// Serial.println("CubeSatSim Pico v0.33 starting...\n"); config_gpio(); @@ -128,6 +130,8 @@ void setup() { // pinMode(PI_3V3_PIN, OUTPUT); // digitalWrite(PI_3V3_PIN, HIGH); + + Serial.println("CubeSatSim Pico v0.33 starting...\n"); start_payload(); // above code not working, so forcing it From 92e051eb5dc0f4dd31d753e2ca1c5fc9820cf756 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 14:58:12 -0500 Subject: [PATCH 087/105] added sleep after reboot --- cubesatsim/cubesatsim.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b5a2a40a..0f3cd462 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -348,6 +348,8 @@ void loop() { */ watchdog_reboot (0, SRAM_END, 10); // restart Pico + sleep(20.0); + if (new_mode != CW) transmit_callsign(callsign); sleep(0.5); @@ -4317,7 +4319,9 @@ void prompt_for_input() { case PROMPT_FORMAT: LittleFS.format(); Serial.println("Reboot or power cycle to restart the CubeSatSim"); - while (1) ; // infinite loop + // while (1) ; // infinite loop + watchdog_reboot (0, SRAM_END, 10); // restart Pico + sleep(20.0); break; case PROMPT_PAYLOAD: From c859200a0e8586cbe7f327dc4cf2b617268025ff Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:10:28 -0500 Subject: [PATCH 088/105] added support for reboot PB and BOOTSEL and printing "Reboot" and move v0.33 --- cubesatsim/cubesatsim.ino | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0f3cd462..b71fda7b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -98,7 +98,7 @@ void setup() { // otherwise, run CubeSatSim Pico code -// Serial.println("CubeSatSim Pico v0.33 starting...\n"); + Serial.println("CubeSatSim Pico v0.33 starting...\n"); config_gpio(); @@ -131,7 +131,7 @@ void setup() { // pinMode(PI_3V3_PIN, OUTPUT); // digitalWrite(PI_3V3_PIN, HIGH); - Serial.println("CubeSatSim Pico v0.33 starting...\n"); +// Serial.println("CubeSatSim Pico v0.33 starting...\n"); start_payload(); // above code not working, so forcing it @@ -346,6 +346,7 @@ void loop() { config_done = true; } */ + Serial.println("Rebooting..."); watchdog_reboot (0, SRAM_END, 10); // restart Pico sleep(20.0); @@ -3337,6 +3338,9 @@ void process_pushbutton() { if (pb_value == RELEASED) { Serial.println("PB: Reboot!"); release = TRUE; + + Serial.println("Rebooting..."); + watchdog_reboot (0, SRAM_END, 10); // restart Pico } blinkTimes(1); @@ -3436,6 +3440,9 @@ void process_bootsel() { if (!BOOTSEL) { Serial.println("BOOTSEL: Reboot!"); release = TRUE; + + Serial.println("Rebooting..."); + watchdog_reboot (0, SRAM_END, 10); // restart Pico } blinkTimes(1); @@ -4318,9 +4325,10 @@ void prompt_for_input() { case PROMPT_FORMAT: LittleFS.format(); - Serial.println("Reboot or power cycle to restart the CubeSatSim"); +// Serial.println("Reboot or power cycle to restart the CubeSatSim"); // while (1) ; // infinite loop - watchdog_reboot (0, SRAM_END, 10); // restart Pico + Serial.println("Rebooting..."); + watchdog_reboot (0, SRAM_END, 10); // restart Pico sleep(20.0); break; From d8814c0439132dc42254e686c8812a7257833cda Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:14:30 -0500 Subject: [PATCH 089/105] added PROMPT_REBOOT --- cubesatsim/cubesatsim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index cbca9c76..dfb00def 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -127,6 +127,7 @@ #define PROMPT_PAYLOAD 10 #define PROMPT_TEMP 11 #define PROMPT_FORMAT 12 +#define PROMPT_REBOOT 13 #define PAYLOAD_QUERY 1 #define PAYLOAD_RESET 2 From 99fd7566607e14607527445a8a43a46cd377eda5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:17:24 -0500 Subject: [PATCH 090/105] changed prompt reboot --- cubesatsim/cubesatsim.ino | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b71fda7b..4d1bf5c5 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3338,9 +3338,7 @@ void process_pushbutton() { if (pb_value == RELEASED) { Serial.println("PB: Reboot!"); release = TRUE; - - Serial.println("Rebooting..."); - watchdog_reboot (0, SRAM_END, 10); // restart Pico + prompt = PROMPT_REBOOT; } blinkTimes(1); @@ -3440,9 +3438,7 @@ void process_bootsel() { if (!BOOTSEL) { Serial.println("BOOTSEL: Reboot!"); release = TRUE; - - Serial.println("Rebooting..."); - watchdog_reboot (0, SRAM_END, 10); // restart Pico + prompt = PROMPT_REBOOT; } blinkTimes(1); @@ -4323,6 +4319,12 @@ void prompt_for_input() { read_ina219(); break; + case PROMPT_REBOOT: + Serial.println("Rebooting..."); + watchdog_reboot (0, SRAM_END, 10); // restart Pico + sleep(20.0); + break; + case PROMPT_FORMAT: LittleFS.format(); // Serial.println("Reboot or power cycle to restart the CubeSatSim"); From 4526b314c5ada4d9d867db5c9efb145550b58f3b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:23:23 -0500 Subject: [PATCH 091/105] delay 2000 at start --- cubesatsim/cubesatsim.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4d1bf5c5..ba47fc3f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -80,7 +80,7 @@ void setup() { Serial.begin(115200); - delay(1000); + delay(2000); LittleFS.begin(); // LittleFS.format(); // only format if files of size 0 keep showing up @@ -3413,7 +3413,8 @@ void process_pushbutton() { digitalWrite(MAIN_LED_GREEN, LOW); sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); - sleep(0.5); + sleep(0.5); + sleep_ms(0xffffff); } if (new_mode != mode) @@ -3514,7 +3515,7 @@ void process_bootsel() { sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); sleep(0.5); - + sleep_ms(0xffffff); } if (new_mode != mode) transmit_off(); From 77653fa2af2f581dd1ba26fa9cf30bf179fc02bf Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:47:21 -0500 Subject: [PATCH 092/105] add sleep dormant --- cubesatsim/cubesatsim.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ba47fc3f..d33aa460 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -45,6 +45,7 @@ #include "picosstvpp.h" #include "pico/bootrom.h" #include "hardware/watchdog.h" +#include "pico/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" @@ -3414,7 +3415,7 @@ void process_pushbutton() { sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); sleep(0.5); - sleep_ms(0xffffff); + sleep_goto_dormant_until_pin(14, true, true); } if (new_mode != mode) @@ -3515,7 +3516,7 @@ void process_bootsel() { sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); sleep(0.5); - sleep_ms(0xffffff); + sleep_goto_dormant_until_pin(14, true, true); } if (new_mode != mode) transmit_off(); From e5bdabb6c53aa36a68523af622a8982018548534 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:48:35 -0500 Subject: [PATCH 093/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d33aa460..c9193152 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -45,7 +45,7 @@ #include "picosstvpp.h" #include "pico/bootrom.h" #include "hardware/watchdog.h" -#include "pico/sleep.h" +#include "pico_sleep/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" From 79d6f2c78a33bc7ab6a0a7bddee4aa95737e0b1f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:52:29 -0500 Subject: [PATCH 094/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index c9193152..d14a8047 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -45,7 +45,8 @@ #include "picosstvpp.h" #include "pico/bootrom.h" #include "hardware/watchdog.h" -#include "pico_sleep/sleep.h" +#include "pico/stdlib.h" +#include "pico/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" From 6c319506c9c9785eb00cd45497711a8f3c8624c3 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:53:07 -0500 Subject: [PATCH 095/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index d14a8047..8b1101b4 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -46,7 +46,7 @@ #include "pico/bootrom.h" #include "hardware/watchdog.h" #include "pico/stdlib.h" -#include "pico/sleep.h" +#include "pico_extras/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" From 661049872e6dc0c29ebcfb85c80ec36597079f5f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:54:33 -0500 Subject: [PATCH 096/105] Update cubesatsim.ino --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 8b1101b4..26a6c9d9 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -46,7 +46,7 @@ #include "pico/bootrom.h" #include "hardware/watchdog.h" #include "pico/stdlib.h" -#include "pico_extras/sleep.h" +#include "pico_sleep/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" From 2a04bb54b343c1c9815ac497683b54893d0e568d Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 15:55:43 -0500 Subject: [PATCH 097/105] removed shutdown --- cubesatsim/cubesatsim.ino | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 26a6c9d9..11fdd5b0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -45,8 +45,6 @@ #include "picosstvpp.h" #include "pico/bootrom.h" #include "hardware/watchdog.h" -#include "pico/stdlib.h" -#include "pico_sleep/sleep.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) //#include "sstv1.h" @@ -3416,8 +3414,7 @@ void process_pushbutton() { sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); sleep(0.5); - sleep_goto_dormant_until_pin(14, true, true); - + } if (new_mode != mode) transmit_off(); @@ -3517,8 +3514,7 @@ void process_bootsel() { sleep(0.5); digitalWrite(MAIN_LED_GREEN, HIGH); sleep(0.5); - sleep_goto_dormant_until_pin(14, true, true); - } + } if (new_mode != mode) transmit_off(); // sleep(2.0); From f4b2fb0a6491d9d669597022ca40a93847c8b2cf Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:02:57 -0500 Subject: [PATCH 098/105] added void load_sstv_image_1_as_cam_dot_jpg() and 2 --- cubesatsim/cubesatsim.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index dfb00def..f3b69de1 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -212,6 +212,8 @@ void read_mode(); void write_mode(); void start_clockgen(); bool TimerHandler1(struct repeating_timer *t); +void load_sstv_image_1_as_cam_dot_jpg(); +void load_sstv_image_2_as_cam_dot_jpg(); #ifndef STASSID #define STASSID "Pico" From 3d8b09f29df2a42fa58b992d18b3d071f09a0390 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:06:36 -0500 Subject: [PATCH 099/105] added void load_sstv_image_1_as_cam_dot_jpg() --- cubesatsim/cubesatsim.ino | 45 ++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 11fdd5b0..2b6880b5 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -234,25 +234,30 @@ void loop() { if (camera_detected = get_camera_image()) { Serial.println("Getting image file"); // Serial.println("Got image file"); - char camera_file[] = "/cam.jpg"; - strcpy(image_file, camera_file); +// char camera_file[] = "/cam.jpg"; +// strcpy(image_file, camera_file); } else { - strcpy(image_file, sstv1_filename); // 2nd stored image - Serial.println("Using stored image file"); +// strcpy(image_file, sstv1_filename); // 2nd stored image + Serial.println("Using stored image file"); + load_sstv_image_1_as_cam_dot_jpg(); } - } + } +/* if (debug_mode) { Serial.print("\nSending SSTV image "); print_string(image_file); } +*/ // send_sstv("/cam.raw"); // send_sstv(image_file); // LittleFS.remove("/cam.bin"); - show_dir(); - char output_file2[] = "/cam2.bin"; + show_dir(); + char input_file[] = "/cam.jpg"; +// char output_file2[] = "/cam2.bin"; char output_file[] = "/cam.bin"; - jpeg_decode(image_file, output_file, true); // debug_mode); +// jpeg_decode(image_file, output_file, true); // debug_mode); + jpeg_decode(input_file, output_file, true); // debug_mode); show_dir(); // char telem_display[] = " BATT: STATUS: TEMP: "; @@ -4005,6 +4010,26 @@ void show_dir() { Serial.println(">"); } +void load_sstv_image_1_as_cam_dot_jpg() { + Serial.println("Loading image sstv_image_1_320_x_240.jpg into FS"); + f = LittleFS.open("cam.jpg", "w+"); + if (f.write(sstv_image_1_320_x_240, sizeof(sstv_image_1_320_x_240)) < sizeof(sstv_image_1_320_x_240)) { + Serial.println("Loading image failed. Is Flash Size (FS) set to 1MB?"); + delay(2000); + } + f.close(); +} + +void load_sstv_image_2_as_cam_dot_jpg() { + Serial.println("Loading image sstv_image_2_320_x_240.jpg into FS"); + f = LittleFS.open("cam.jpg", "w+"); + if (f.write(sstv_image_2_320_x_240, sizeof(sstv_image_2_320_x_240)) < sizeof(sstv_image_2_320_x_240)) { + Serial.println("Loading image failed. Is Flash Size (FS) set to 1MB?"); + delay(2000); + } + f.close(); +} + void load_files() { LittleFS.begin(); File f; @@ -4018,7 +4043,7 @@ void load_files() { Serial.println("Loading image sstv_image_1_320_x_240.jpg into FS"); f = LittleFS.open("sstv_image_1_320_x_240.jpg", "w+"); if (f.write(sstv_image_1_320_x_240, sizeof(sstv_image_1_320_x_240)) < sizeof(sstv_image_1_320_x_240)) { - Serial.println("Loading image failed. Is Flash Size (FS) set to 512kB?"); + Serial.println("Loading image failed. Is Flash Size (FS) set to 1MB?"); delay(2000); } f.close(); @@ -4032,7 +4057,7 @@ void load_files() { Serial.println("Loading image sstv_image_2_320_x_240.jpg into FS"); f = LittleFS.open("sstv_image_2_320_x_240.jpg", "w+"); if (f.write(sstv_image_2_320_x_240, sizeof(sstv_image_2_320_x_240)) < sizeof(sstv_image_2_320_x_240)) { - Serial.println("Loading image failed. Is Flash Size (FS) set to 512kB?"); + Serial.println("Loading image failed. Is Flash Size (FS) set to 1MB?"); delay(2000); } f.close(); From bef5da729f7112a2169ae17300dc93add1bf025a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:08:11 -0500 Subject: [PATCH 100/105] typos --- cubesatsim/cubesatsim.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2b6880b5..3a0abe07 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4010,7 +4010,9 @@ void show_dir() { Serial.println(">"); } -void load_sstv_image_1_as_cam_dot_jpg() { +void load_sstv_image_1_as_cam_dot_jpg() { + LittleFS.begin(); + File f; Serial.println("Loading image sstv_image_1_320_x_240.jpg into FS"); f = LittleFS.open("cam.jpg", "w+"); if (f.write(sstv_image_1_320_x_240, sizeof(sstv_image_1_320_x_240)) < sizeof(sstv_image_1_320_x_240)) { @@ -4021,6 +4023,8 @@ void load_sstv_image_1_as_cam_dot_jpg() { } void load_sstv_image_2_as_cam_dot_jpg() { + LittleFS.begin(); + File f; Serial.println("Loading image sstv_image_2_320_x_240.jpg into FS"); f = LittleFS.open("cam.jpg", "w+"); if (f.write(sstv_image_2_320_x_240, sizeof(sstv_image_2_320_x_240)) < sizeof(sstv_image_2_320_x_240)) { From 83c7db44de3011190ed110b3eded7b2cb0cb83e1 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:09:04 -0500 Subject: [PATCH 101/105] added back sstv1.h --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3a0abe07..7174f044 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -47,7 +47,7 @@ #include "hardware/watchdog.h" // jpg files to be stored in flash storage on Pico (FS 512kB setting) -//#include "sstv1.h" +#include "sstv1.h" #include "sstv2.h" Adafruit_INA219 ina219_1_0x40; From a1f0c4714be9d48a41aaf5b12343df360bcc506f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:09:48 -0500 Subject: [PATCH 102/105] changed back to image_2 --- cubesatsim/sstv2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cubesatsim/sstv2.h b/cubesatsim/sstv2.h index 3a79b3dc..d8e6cb32 100644 --- a/cubesatsim/sstv2.h +++ b/cubesatsim/sstv2.h @@ -23,8 +23,8 @@ */ #include -//const uint8_t sstv_image_2_320_x_240[] PROGMEM = { -const uint8_t sstv_image_1_320_x_240[] PROGMEM = { +const uint8_t sstv_image_2_320_x_240[] PROGMEM = { +//const uint8_t sstv_image_1_320_x_240[] PROGMEM = { 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x8F, 0x00, 0x8F, 0x00, 0x00, 0xFF, 0xE2, 0x10, 0x08, 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0F, 0xF8, 0x61, 0x70, 0x70, 0x6C, 0x02, 0x10, From 054176e712a57060afdc424a8e211f298ba92cae Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 30 Nov 2022 16:14:23 -0500 Subject: [PATCH 103/105] turn back on first time on SSTV --- cubesatsim/cubesatsim.ino | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 7174f044..4d4500b8 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -224,11 +224,13 @@ void loop() { } else if (mode == SSTV) { - first_time_sstv = false; +// first_time_sstv = false; char image_file[128]; if (first_time_sstv) { // if (false) { // turn this off for now - strcpy(image_file, sstv1_filename); +// strcpy(image_file, sstv1_filename); + Serial.println("Using stored image file"); + load_sstv_image_1_as_cam_dot_jpg(); first_time_sstv = false; } else { if (camera_detected = get_camera_image()) { @@ -239,7 +241,7 @@ void loop() { } else { // strcpy(image_file, sstv1_filename); // 2nd stored image Serial.println("Using stored image file"); - load_sstv_image_1_as_cam_dot_jpg(); + load_sstv_image_2_as_cam_dot_jpg(); } } /* From 5f202fa5234a50117a98d5cf207d85f9ef5e6334 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 2 Dec 2022 15:14:23 -0500 Subject: [PATCH 104/105] set sys clock to 133 --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4d4500b8..4a161f14 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -76,7 +76,7 @@ extern bool start_camera(); void setup() { -// set_sys_clock_khz(133000, true); + set_sys_clock_khz(133000, true); Serial.begin(115200); From 12a410053c9bf2e79217eec09dc3aa5b1c630d23 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 3 Dec 2022 10:23:01 -0500 Subject: [PATCH 105/105] delay 5, print blink --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 4d4500b8..afb74420 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -80,7 +80,7 @@ void setup() { Serial.begin(115200); - delay(2000); + delay(5000); LittleFS.begin(); // LittleFS.format(); // only format if files of size 0 keep showing up @@ -3561,6 +3561,7 @@ void config_gpio() { // set LEDs and blink once // if (!wifi) + Serial.println("Blinking pins"); pinMode(LED_BUILTIN, OUTPUT); // Set LED pin to output pinMode(MAIN_LED_GREEN, OUTPUT); // Set Main Green LED pin to output blink_pin(MAIN_LED_GREEN, 150);