From 22826263196327535f7bfb9cbbfb251af13eb302 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:05:52 -0400 Subject: [PATCH 01/10] Update transmit.py add C to CW ID if C2C enabled --- transmit.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/transmit.py b/transmit.py index 5923afc4..51a39434 100644 --- a/transmit.py +++ b/transmit.py @@ -399,14 +399,18 @@ if __name__ == "__main__": # output (ptt, 1) # output(pd, 0) # else: - if (True): + if (no_command): if (debug_mode == 1): -# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") else: -# system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") - + else: + if (debug_mode == 1): + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") + else: + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") + + output(txLed, txLedOff) sleep(1) From ab08e868873c55ccab620d5b83f8c2076a5d8210 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:25:56 -0400 Subject: [PATCH 02/10] Update install copy updates into install --- install | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/install b/install index 7294539d..374a68e5 100755 --- a/install +++ b/install @@ -56,7 +56,7 @@ sudo dpkg -i debian-template/wiringpi-2.61-1.deb cd #changed to python3-smbus -sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial +sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial libusb-1.0 sudo pip3 install --upgrade setuptools @@ -95,13 +95,35 @@ git clone https://github.com/alanbjohnston/pi-power-button.git cd pi-power-button -git checkout master +git checkout 7-modes ./script/install +cd +echo "Installing SSDV for FunCube mode" +git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FunCube images +cd ssdv +make cd +echo "Installing fctelem binary v0.2 for FunCube mode" +mkdir /home/pi/fctelem +mkdir /home/pi/fctelem/public_html +cd fctelem +wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip +unzip fctelem.zip + +cd +echo "Installing fcdctl to set FunCubeDongle Pro gain" +# sudo rm /var/lib/dpkg/info/python3-pip.list +# sudo apt install python3-pip --reinstall +# sudo apt-get install -y python3-smbus libusb-1.0 +cd +git clone https://github.com/csete/fcdctl.git +cd fcdctl +make fcdpp + git clone https://github.com/alanbjohnston/PiSSTVpp.git cd PiSSTVpp @@ -143,6 +165,8 @@ sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service sudo systemctl enable command +sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf + sudo cp /boot/config.txt /boot/config.txt.0 sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 From 3717993ae58e9e5180fca195d1b51cfb4497e4cf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:29:15 -0400 Subject: [PATCH 03/10] Update install change version to v2.1 --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 374a68e5..535fad29 100755 --- a/install +++ b/install @@ -1,6 +1,6 @@ #!/bin/bash -echo -e "\ninstallation script for CubeSatSim v2.0\n" +echo -e "\ninstallation script for CubeSatSim v2.1\n" FILE=/home/pi/CubeSatSim/sim.cfg if [ -f "$FILE" ]; then From 1afbb83910ae04332c3b10e5f1ae735e37d04d5b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:31:23 -0400 Subject: [PATCH 04/10] Update telem.c version 2.1 --- telem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telem.c b/telem.c index 7afceef2..1fc534a5 100644 --- a/telem.c +++ b/telem.c @@ -15,7 +15,7 @@ int main(int argc, char *argv[]) { } } - printf("CubeSatSim v2.0 INA219 Voltage and Current Telemetry\n"); + printf("CubeSatSim v2.1 INA219 Voltage and Current Telemetry\n"); map[MINUS_X] = MINUS_Y; map[PLUS_Z] = MINUS_X; map[MINUS_Y] = PLUS_Z; From e28ebc129ade56cfb4d1dfb6ad59839c95eb8ed9 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 31 May 2025 16:44:01 -0400 Subject: [PATCH 05/10] Update main.c support just BAT2 present --- main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 7db64594..e3418019 100644 --- a/main.c +++ b/main.c @@ -629,16 +629,24 @@ int main(int argc, char * argv[]) { token = strtok(NULL, space); } } - if (voltage[map[BAT]] == 0.0) - batteryVoltage = 4.5; + if (voltage[map[BAT]] == 0.0) // No BAT Board + if (voltage[map[BAT2]] == 0.0) // No BAT2 Board + batteryVoltage = 4.5; + else: + batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present + if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode + sim_mode = FALSE; + fprintf(stderr, "Turning off sim_mode since battery sensor 2 is present\n"); + } + } else { - batteryVoltage = voltage[map[BAT]]; + batteryVoltage = voltage[map[BAT]]; // BAT Board present if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode sim_mode = FALSE; fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); } } - batteryCurrent = current[map[BAT]]; + batteryCurrent = current[map[BAT]] + current[map[BAT2]]; // Sum BAT and BAT2 currents } From 0dadbc9ae57ab23dbb2ef7c0201d60b10539fbed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 09:54:44 -0400 Subject: [PATCH 06/10] Update main.c missing { --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index e3418019..677610ab 100644 --- a/main.c +++ b/main.c @@ -632,7 +632,7 @@ int main(int argc, char * argv[]) { if (voltage[map[BAT]] == 0.0) // No BAT Board if (voltage[map[BAT2]] == 0.0) // No BAT2 Board batteryVoltage = 4.5; - else: + else { batteryVoltage = voltage[map[BAT2]]; // only BAT2 Board present if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode sim_mode = FALSE; From 34c7db6a49a870494e63965465ae1a48af6ad057 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 10:14:11 -0400 Subject: [PATCH 07/10] Update main.c print thresholds --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 677610ab..fcf8e600 100644 --- a/main.c +++ b/main.c @@ -823,9 +823,9 @@ int main(int argc, char * argv[]) { fclose(cpuTempSensor); } - #ifdef DEBUG_LOGGING -// fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); - #endif +// #ifdef DEBUG_LOGGING + fprintf(stderr, "INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n", batteryVoltage, voltageThreshold, batteryCurrent, currentThreshold); +// #endif if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) { From 29b823f5ee643473673eabe931c953dd56b9c086 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 11:22:20 -0400 Subject: [PATCH 08/10] Update main.c change battery_saver_mode variable --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index fcf8e600..7ef1b269 100644 --- a/main.c +++ b/main.c @@ -2270,7 +2270,8 @@ if (setting == ON) { FILE *command = popen("touch /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); fprintf(stderr,"Turning Safe Mode ON\n"); - fprintf(stderr,"Turning Battery saver mode ON\n"); + fprintf(stderr,"Turning Battery saver mode ON\n"); + battery_saver_mode = ON; if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); pclose(command); @@ -2287,6 +2288,7 @@ if (setting == ON) { FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r"); pclose(command); fprintf(stderr,"Turning Battery saver mode OFF\n"); + battery_saver_mode = OFF; if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); pclose(command); From c38c3e6dcf895bcd30f8381060d294dfdd37b651 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 11:42:37 -0400 Subject: [PATCH 09/10] Update transmit.py don't turn off C2C if squelch is 8 --- transmit.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/transmit.py b/transmit.py index 51a39434..907f8fcc 100644 --- a/transmit.py +++ b/transmit.py @@ -316,11 +316,11 @@ if __name__ == "__main__": print # print(callsign) print(sq) - if sq == '8': - print("squelch set to 8, no command input!") - no_command = True - else: - no_command = False +# if sq == '8': +# print("squelch set to 8, no command input!") +# no_command = True +# else: + no_command = False print(no_command) except: callsign = "AMSAT" From e5b7b12341962deef62d11bdf73a04ee8e8d8727 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Mon, 9 Jun 2025 13:25:52 -0400 Subject: [PATCH 10/10] Update transmit.py extra space before C --- transmit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transmit.py b/transmit.py index 907f8fcc..778a525c 100644 --- a/transmit.py +++ b/transmit.py @@ -406,9 +406,9 @@ if __name__ == "__main__": system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") else: if (debug_mode == 1): - system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3") else: - system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") + system("echo 'hi hi de " + callsign + " C" + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1") output(txLed, txLedOff)