Merge pull request #332 from alanbjohnston/beta-extra

Command & Control and Pi Zero 2 updates
beta-usb v1.3.2.4
Alan Johnston 1 year ago committed by GitHub
commit a2153e10f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

20
.gitignore vendored

@ -22,3 +22,23 @@ telem.wav
cw.txt
cwready
logr.txt
command_control
command_control_direwolf
command_count.txt
command_tx
cw0.txt
cw1.txt
cw2.txt
cw3.txt
cw4.txt
cw5.txt
cw6.txt
logc.txt
telem.txt
telem_string.txt
test
transmit_dtmf
uptime
beacon_off
battery_saver

@ -0,0 +1,120 @@
#!/bin/bash
echo -e "\nCommand and Control script for CubeSatSim v1.3.2\n"
FILE=/home/pi/CubeSatSim/command_control
if [ -f "$FILE" ]; then
echo "Radio command and control is ON"
# echo "Turning Command and control to OFF"
# sudo rm /home/pi/CubeSatSim/command_control
# echo "rebooting"
# sudo systemctl stop rpitx
# sudo reboot now
# fi
else
echo "Radio command and control is OFF"
while true
do
sleep 60
done
# exit 1
fi
if [ "$1" = "d" ]; then
echo "debug mode"
debug=1
else
debug=0
fi
echo "Waiting 20 seconds for USB"
sleep 20
FILE=/home/pi/CubeSatSim/command_control_direwolf
if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then
echo "Starting Direwolf DTMF and APRS Command and Control"
if [ "$debug" = "1" ]; then
echo "debug mode"
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
else
direwolf -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
fi
else
if [ -f "$FILE" ]; then
echo "Direwolf mode set but no USB soundcard detected!"
# echo "Trying RTL-FM"
timeout 1 rtl_test &> out.txt
if [[ $(grep "No supported" out.txt) ]] ; then
echo "No RTL-SDR detected. Command and control is OFF"
# sleep 60
exit
else
echo "RTL-SDR detected."
sudo modprobe snd-aloop
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
rtl_fm -M fm -f 435M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 &
if [ "$debug" = "1" ]; then
echo "debug mode"
direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
else
direwolf -r 48000 -c /home/pi/CubeSatSim/groundstation/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
fi
sleep 5
fi
rm out.txt
else
echo "Starting Carrier (squelch) Command and Control"
fi
if [ "$1" = "d" ]; then
echo "debug mode"
python3 /home/pi/CubeSatSim/squelch_cc.py d
else
python3 /home/pi/CubeSatSim/squelch_cc.py
fi
fi
sudo killall -9 direwolf &>/dev/null
sudo killall -9 rtl_fm &>/dev/null

973
config

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
ADEVICE hw:CARD=Device,DEV=0 default
DTMF

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="1 #" delay=0

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="10 #" delay=0

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="3 #" delay=0

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="5 #" delay=0

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="2 #" delay=0

@ -0,0 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
MYCALL AMSAT
CHANNEL 0
MODEM 1200
CBEACON dest="DTMF-3" info="4 #" delay=0

@ -0,0 +1,190 @@
import sys
from os import system
import RPi.GPIO as GPIO
from RPi.GPIO import output
from time import sleep
import logging
logging.basicConfig(format='%(message)s')
# logging.warning('CC-Warning!')
if __name__ == "__main__":
powerPin = 16
txLed = 27
change_mode = False
debug_mode = False
counter = 1
if (len(sys.argv)) > 1:
# print("There are arguments!")
if ('d' == sys.argv[1]):
debug_mode = True
for line in sys.stdin:
# if (debug_mode):
print(line, end =" ")
logging.warning(line)
# if '^c' == line.rstrip():
# break
if ((line.find("MODE=a")) > 0):
system("echo '\nAPRS Mode!!\n'")
mode = 'a'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t1#")) > 0):
system("echo '\nAPRS Mode!!\n'")
mode = 'a'
change_mode = True
if ((line.find("MODE=f")) > 0):
system("echo '\nFSK Mode!!\n'")
mode = 'f'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t2#")) > 0):
system("echo '\nFSK Mode!!\n'")
mode = 'f'
change_mode = True
if ((line.find("MODE=b")) > 0):
system("echo '\nBPSK Mode!!\n'")
mode = 'b'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t3#")) > 0):
system("echo '\nBPSK Mode!!\n'")
mode = 'b'
change_mode = True
if ((line.find("MODE=s")) > 0):
system("echo '\nSSTV Mode!!\n'")
mode = 's'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t4#")) > 0):
system("echo '\nSSTV Mode!!\n'")
mode = 's'
change_mode = True
if ((line.find("MODE=m")) > 0):
system("echo '\nCW Mode!!\n'")
mode = 'm'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t5#")) > 0):
system("echo '\nCW Mode!!\n'")
mode = 'm'
change_mode = True
if ((line.find("MODE=o")) > 0):
system("echo '\nBeacon Mode toggle!!\n'")
mode = 'o'
change_mode = True
counter = (counter + 1) % 2
if ((line.find("DTMF>APDW15:t10#")) > 0):
system("echo '\nBeacon Mode toggle!!\n'")
mode = 'o'
change_mode = True
if (debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(powerPin, GPIO.OUT)
GPIO.setup(txLed, GPIO.OUT)
if (mode == 'f'):
GPIO.output(powerPin, 0) # blink two times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 'b'):
GPIO.output(powerPin, 0) # blink three times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 's'):
GPIO.output(powerPin, 0) # blink four times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 'm'):
GPIO.output(powerPin, 0) # blink five times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1);
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 'a'):
mode = 'a'
GPIO.output(powerPin, 0) # blink one time
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
try:
file = open("/home/pi/CubeSatSim/command_count.txt", "r")
string = file.read()
file.close()
command_count = int(string)
command_count += 1
filec = open("/home/pi/CubeSatSim/command_count.txt", "w")
command_count_string = str(command_count)
print(command_count_string)
string = filec.write(command_count_string)
filec.close()
except:
print("Can't write command_count file!")
print("Command_count: ")
print(command_count)
GPIO.output(txLed, 0)
GPIO.output(powerPin, 0)
system("sudo systemctl stop rpitx")
# system("sudo systemctl stop cubesatsim")
print("\n/home/pi/CubeSatSim/config -" + mode)
system("/home/pi/CubeSatSim/config -" + mode)
change_mode = False
print("Waiting 5 seconds to allow unplug and plug of soundcard")
sleep(5)
print("Done")

@ -39,22 +39,27 @@ sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev l
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
# wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
# sudo dpkg -i wiringpi-latest.deb
cd
git clone https://github.com/alanbjohnston/WiringPi
cd WiringPi
./build debian
sudo dpkg -i debian-template/wiringpi-2.61-1.deb
cd
#changed to python3-smbus
sudo apt install -y python3-pip python3-smbus
sudo apt install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 libtiff5 python3-pil python3-serial
sudo pip3 install --upgrade setuptools
sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
cd ~/CubeSatSim
git pull --no-rebase
@ -88,7 +93,7 @@ git clone https://github.com/alanbjohnston/pi-power-button.git
cd pi-power-button
git checkout reboot-mode-change
git checkout reboot-mode-change-beta
./script/install
@ -128,6 +133,10 @@ sudo cp ~/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
sudo systemctl enable rpitx
sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service
sudo systemctl enable command
sudo cp /boot/config.txt /boot/config.txt.0
sudo cp /boot/cmdline.txt /boot/cmdline.txt.0
@ -239,15 +248,17 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch
if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency
if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency
if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode
if [ -z "$10" ] ; then n10="0" ; changed=1 ; else n10=$10 ; fi # rx pl code
if [ -z "$11" ] ; then n11="0" ; changed=1 ; else n11=$11 ; fi # tx pl code
if [ $changed -eq 1 ]; then
echo -e "Current sim.cfg configuration file:"
echo
echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $10 $11 > /home/pi/CubeSatSim/sim.cfg
echo
fi

6
log

@ -5,7 +5,11 @@ echo -e "\nLog file script for CubeSatSim\n"
if [ "$1" = "-r" ]; then
sudo journalctl -a -u rpitx > /home/pi/CubeSatSim/logr.txt
cat /home/pi/CubeSatSim/logr.txt
echo -e "\nLog file also saved as /home/pi/CubeSatSim/logr.txt"
echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logr.txt"
elif [ "$1" = "-c" ]; then
sudo journalctl -a -u command > /home/pi/CubeSatSim/logc.txt
cat /home/pi/CubeSatSim/logc.txt
echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
else
sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
cat /home/pi/CubeSatSim/log.txt

193
main.c

@ -19,28 +19,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
//#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry
int main(int argc, char * argv[]) {
char resbuffer[1000];
const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'";
// const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'";
const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'";
FILE *file_test = sopen(testStr); // see if Pi Zero 2
fgets(resbuffer, 1000, file_test);
fprintf(stderr, "Pi test result: %s\n", resbuffer);
fclose(file_test);
FILE * uptime_file = fopen("/proc/uptime", "r");
fscanf(uptime_file, "%f", & uptime_sec);
printf("Uptime sec: %f \n", uptime_sec);
fclose(uptime_file);
fprintf(stderr, " %x ", resbuffer[0]);
fprintf(stderr, " %x \n", resbuffer[1]);
if ((resbuffer[0] == '9') && (resbuffer[1] == '0'))
if ((resbuffer[0] != '9') || (resbuffer[1] != '0') || (resbuffer[2] != '0') || (resbuffer[3] != '0'))
{
sleep(5); // try sleep at start to help boot
// voltageThreshold = 3.7;
printf("Pi Zero 2 detected\n");
fprintf(stderr, "Pi Zero not detected (could be Pi Zero 2)\n");
pi_zero_2_offset = 500;
if (uptime_sec < 30.0) {
FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r");
pclose(rpitx_stop);
fprintf(stderr, "Sleep 5 sec");
sleep(5); // try sleep at start to help boot
}
}
else {
fprintf(stderr,"Pi Zero detected\n");
FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r");
if (command_file == NULL) {
pi_zero_2_offset = 500;
fprintf(stderr,"Command and control is OFF\n");
} else {
command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r");
if (command_file == NULL) {
pi_zero_2_offset = 500;
fprintf(stderr,"Command and control Carrier (squelch) is ON\n");
}
}
if (uptime_sec < 30.0) {
FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r");
pclose(rpitx_stop);
fprintf(stderr,"Sleep 10 sec");
sleep(10);
}
}
printf("\n\nCubeSatSim v1.3.2 starting...\n\n");
@ -59,11 +89,11 @@ int main(int argc, char * argv[]) {
// char * cfg_buf[100];
fscanf(config_file, "%s %d %f %f %s %d %s %s %s",
call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes);
fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d",
call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx, hab_yes, & rx_pl, & tx_pl);
fclose(config_file);
fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s\n",
call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes);
fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d\n",
call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl);
fprintf(stderr, "Transmit on %s Receive on %s\n", tx, rx);
@ -99,8 +129,11 @@ int main(int argc, char * argv[]) {
}
// FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r");
FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r");
pclose(rpitx_stop);
// FILE * rpitx_stop = popen("sudo systemctl restart rpitx", "r");
// FILE * cc_start = popen("/home/pi/CubeSatSim/command &", "r");
// pclose(cc_start);
// FILE * file_deletes = popen("sudo rm /home/pi/CubeSatSim/ready /home/pi/CubeSatSim/cwready > /dev/null", "r");
// pclose(file_deletes);
@ -176,6 +209,12 @@ int main(int argc, char * argv[]) {
} else if ( mode_string == 'm') {
mode = CW;
printf("Mode is CW\n");
} else if ( mode_string == 'e') {
mode = REPEATER;
printf("Mode is Repeater\n");
} else if ( mode_string == 'n') {
mode = TXCOMMAND;
printf("Mode is Transmit Command\n");
} else {
printf("Mode is FSK\n");
}
@ -240,9 +279,23 @@ int main(int argc, char * argv[]) {
pclose(file);
}
txLed = 0; // defaults for vB3 board without TFB
txLedOn = LOW;
txLedOff = HIGH;
txLed = 2;
txLedOn = HIGH;
txLedOff = LOW;
vB5 = TRUE;
onLed = 27;
onLedOn = HIGH;
onLedOff = LOW;
pinMode(26, INPUT);
pullUpDnControl(26, PUD_UP);
if (digitalRead(26) != HIGH) {
printf("v1 Present with UHF BPF\n");
transmit = TRUE;
}
/*
if (!ax5043) {
pinMode(2, INPUT);
pullUpDnControl(2, PUD_UP);
@ -306,15 +359,16 @@ int main(int argc, char * argv[]) {
}
}
}
pinMode(txLed, OUTPUT);
digitalWrite(txLed, txLedOff);
*/
// pinMode(txLed, OUTPUT);
// digitalWrite(txLed, txLedOff);
#ifdef DEBUG_LOGGING
printf("Tx LED Off\n");
// printf("Tx LED Off\n");
#endif
pinMode(onLed, OUTPUT);
digitalWrite(onLed, onLedOn);
// pinMode(onLed, OUTPUT);
// digitalWrite(onLed, onLedOn);
#ifdef DEBUG_LOGGING
printf("Power LED On\n");
// printf("Power LED On\n");
#endif
/*
if (mode == SSTV) {
@ -325,7 +379,7 @@ int main(int argc, char * argv[]) {
}
*/
config_file = fopen("sim.cfg", "w");
fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes);
fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d", call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl);
// fprintf(config_file, "%s %d", call, reset_count);
fclose(config_file);
config_file = fopen("sim.cfg", "r");
@ -361,7 +415,7 @@ int main(int argc, char * argv[]) {
char camera_present[] = "supported=1 detected=1";
// printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present));
camera = (strstr( (const char *)& cmdbuffer, camera_present) != NULL) ? ON : OFF;
// printf("Camera result:%s camera: %d \n", & cmdbuffer1, camera);
printf("Camera result:%s camera: %d \n", & cmdbuffer, camera);
pclose(file4);
#ifdef DEBUG_LOGGING
@ -369,16 +423,19 @@ int main(int argc, char * argv[]) {
#endif
FILE * file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1", "r");
file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r");
//file5 = popen("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1", "r");
pclose(file5);
if (!ax5043) // don't test for payload if AX5043 is present
{
payload = OFF;
fprintf(stderr,"Opening serial\n");
if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600
printf("Serial opened to Pico\n");
// payload = ON;
fprintf(stderr,"Serial opened to Pico\n");
// payload = ON;
payload = get_payload_serial(FALSE);
fprintf(stderr,"Get_payload_status: %d \n", payload); // not debug
} else {
fprintf(stderr, "Unable to open UART: %s\n -> Did you configure /boot/config.txt and /boot/cmdline.txt?\n", strerror(errno));
}
@ -433,11 +490,11 @@ int main(int argc, char * argv[]) {
eclipse_time -= period / 2; // if starting in eclipse, shorten interval
}
tx_freq_hz -= tx_channel * 50000;
// tx_freq_hz -= tx_channel * 50000;
if (transmit == FALSE) {
fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n");
fprintf(stderr, "\nNo CubeSatSim Low Pass Filter detected. No transmissions after the CW ID.\n");
fprintf(stderr, " See http://cubesatsim.org/wiki for info about building a CubeSatSim\n\n");
}
@ -535,8 +592,7 @@ int main(int argc, char * argv[]) {
other_min[i] = 1000.0;
other_max[i] = -1000.0;
}
long int loopTime;
loopTime = millis();
while (loop-- != 0) {
@ -556,20 +612,16 @@ int main(int argc, char * argv[]) {
uptime = (int) (uptime_sec + 0.5);
// printf("Uptime sec: %f \n", uptime_sec);
// #ifdef DEBUG_LOGGING
printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime);
// printf("INFO: Reset Count: %d Uptime since Reset: %ld \n", reset_count, uptime);
// #endif
fclose(uptime_file);
printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0);
fflush(stdout);
loopTime = millis();
{
int count1;
char * token;
fputc('\n', file1);
fgets(cmdbuffer, 1000, file1);
fprintf(stderr, "Python read Result: %s\n", cmdbuffer);
// fprintf(stderr, "Python read Result: %s\n", cmdbuffer);
// serialPuts(uart_fd, cmdbuffer); // write INA data to Pico over serial
@ -613,20 +665,20 @@ int main(int argc, char * argv[]) {
payload = get_payload_serial(FALSE);
printf("get_payload_status: %d \n", payload); // not debug
fflush(stdout);
printf("String: %s\n", buffer2);
// printf("String: %s\n", buffer2);
fflush(stdout);
strcpy(sensor_payload, buffer2);
printf(" Response from STEM Payload board: %s\n", sensor_payload);
// printf(" Response from STEM Payload board: %s\n", sensor_payload);
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a");
printf("Writing payload string\n");
// printf("Writing payload string\n");
time_t timeStamp;
time(&timeStamp); // get timestamp
// printf("Timestamp: %s\n", ctime(&timeStamp));
char timeStampNoNl[31], bat_string[31];
snprintf(timeStampNoNl, 30, "%.24s", ctime(&timeStamp));
printf("TimeStamp: %s\n", timeStampNoNl);
// printf("TimeStamp: %s\n", timeStampNoNl);
snprintf(bat_string, 30, "BAT %4.2f %5.1f", batteryVoltage, batteryCurrent);
fprintf(telem_file, "%s %s %s\n", timeStampNoNl, bat_string, sensor_payload); // write telemetry string to telem.txt file
fclose(telem_file);
@ -643,7 +695,7 @@ int main(int argc, char * argv[]) {
if (token != NULL) {
sensor[count1] = (float) atof(token);
// #ifdef DEBUG_LOGGING
printf("sensor: %f ", sensor[count1]); // print sensor data
// printf("sensor: %f ", sensor[count1]); // print sensor data
// #endif
token = strtok(NULL, space);
}
@ -672,8 +724,8 @@ int main(int argc, char * argv[]) {
if ((millis() - newGpsTime) > 60000) {
longitude += rnd_float(-0.05, 0.05) / 100.0; // was .05
latitude += rnd_float(-0.05, 0.05) / 100.0;
printf("GPS Location with Rnd: %f, %f \n", latitude, longitude);
printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude));
// printf("GPS Location with Rnd: %f, %f \n", latitude, longitude);
// printf("GPS Location with Rnd: APRS %07.2f, %08.2f \n", toAprsFormat(latitude), toAprsFormat(longitude));
newGpsTime = millis();
}
@ -773,7 +825,7 @@ int main(int argc, char * argv[]) {
}
#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);
// 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)
@ -800,7 +852,11 @@ int main(int argc, char * argv[]) {
fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);
digitalWrite(txLed, txLedOff);
digitalWrite(onLed, onLedOff);
FILE * file6;
file6 = popen("echo 'shutdown due to low battery voltage!' | wall", "r");
pclose(file6);
sleep(1);
digitalWrite(onLed, onLedOn);
sleep(1);
@ -810,7 +866,6 @@ int main(int argc, char * argv[]) {
sleep(1);
digitalWrite(onLed, onLedOff);
FILE * file6; // = popen("/home/pi/CubeSatSim/log > shutdown_log.txt", "r");
file6 = popen("sudo shutdown -h now > /dev/null 2>&1", "r");
pclose(file6);
sleep(10);
@ -819,7 +874,7 @@ int main(int argc, char * argv[]) {
FILE * fp = fopen("/home/pi/CubeSatSim/telem_string.txt", "w");
if (fp != NULL) {
printf("Writing telem_string.txt\n");
// printf("Writing telem_string.txt\n");
if (batteryVoltage != 4.5)
fprintf(fp, "BAT %4.2fV %5.1fmA\n", batteryVoltage, batteryCurrent);
else
@ -839,17 +894,17 @@ int main(int argc, char * argv[]) {
if ((mode == AFSK) || (mode == CW)) {
get_tlm();
sleep(25);
fprintf(stderr, "INFO: Sleeping for 25 sec\n");
// fprintf(stderr, "INFO: Sleeping for 25 sec\n");
int rand_sleep = (int)rnd_float(0.0, 5.0);
sleep(rand_sleep);
fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep);
// fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep);
} else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK
get_tlm_fox();
} else { // SSTV
fprintf(stderr, "Sleeping\n");
sleep(50);
// fprintf(stderr, "Sleeping\n");
sleep(30);
}
#ifdef DEBUG_LOGGING
@ -862,17 +917,17 @@ int main(int argc, char * argv[]) {
#ifdef DEBUG_LOGGING
// printf("Tx LED On 1\n");
#endif
printf("Sleeping to allow BPSK transmission to finish.\n");
// printf("Sleeping to allow BPSK transmission to finish.\n");
sleep((unsigned int)(loop_count * 5));
printf("Done sleeping\n");
// printf("Done sleeping\n");
// digitalWrite(txLed, txLedOff);
#ifdef DEBUG_LOGGING
// printf("Tx LED Off\n");
#endif
} else if (mode == FSK) {
printf("Sleeping to allow FSK transmission to finish.\n");
// printf("Sleeping to allow FSK transmission to finish.\n");
sleep((unsigned int)loop_count);
printf("Done sleeping\n");
// printf("Done sleeping\n");
}
return 0;
@ -1182,19 +1237,23 @@ void get_tlm_fox() {
/**/
// while ((millis() - sampleTime) < (unsigned int)samplePeriod)
int startSleep = millis();
if ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100 500 for FSK
if ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100 500 for FSK
// sleep(2.0); // 0.5); // 25); // initial period
sleep(1.0); // 0.5); // 25); // initial period
while ((millis() - sampleTime) < ((unsigned int)frameTime - 250)) // was 250 100
while ((millis() - sampleTime) < ((unsigned int)frameTime - 750 + pi_zero_2_offset)) // was 250 100
sleep(0.1); // 25); // 0.5); // 25);
// sleep((unsigned int)sleepTime);
/**/
printf("Sleep period: %d\n", millis() - startSleep);
printf("Start sleep %d Sleep period: %d while period: %d\n", startSleep, millis() - startSleep, (unsigned int)frameTime - 750 + pi_zero_2_offset);
fflush(stdout);
sampleTime = (unsigned int) millis();
} else
printf("first time - no sleep\n");
printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime)/1000.0);
fflush(stdout);
loopTime = millis();
// if (mode == FSK)
{ // just moved
@ -1222,7 +1281,7 @@ void get_tlm_fox() {
if (mode == FSK)
{
if (loop % 32 == 0) { // was 8
printf("Sending MIN frame \n");
// printf("Sending MIN frame \n");
frm_type = 0x03;
for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) {
if (count1 < 3)
@ -1236,7 +1295,7 @@ void get_tlm_fox() {
}
}
if ((loop + 16) % 32 == 0) { // was 8
printf("Sending MAX frame \n");
// printf("Sending MAX frame \n");
frm_type = 0x02;
for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) {
if (count1 < 3)
@ -1480,7 +1539,7 @@ void get_tlm_fox() {
} else
printf("Error opening command_count.txt!\n");
printf("Command count: %d\n", groundCommandCount);
// printf("Command count: %d\n", groundCommandCount);
int status = STEMBoardFailure + SafeMode * 2 + sim_mode * 4 + PayloadFailure1 * 8 +
(i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256;
@ -1735,14 +1794,14 @@ void get_tlm_fox() {
// printf("Sending %d buffer bytes over socket after %d ms!\n", ctr, (long unsigned int)millis() - start);
start = millis();
int sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0);
printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret);
// printf("socket send 1 %d ms bytes: %d \n\n", (unsigned int)millis() - start, sock_ret);
fflush(stdout);
if (sock_ret < (ctr * 2 + 2)) {
// printf("Not resending\n");
sleep(0.5);
sock_ret = send(sock, &buffer[sock_ret], (unsigned int)(ctr * 2 + 2 - sock_ret), 0);
printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret);
// printf("socket send 2 %d ms bytes: %d \n\n", millis() - start, sock_ret);
}
loop_count++;
@ -1766,7 +1825,7 @@ void get_tlm_fox() {
{
start = millis(); // send frame until buffer fills
sock_ret = send(sock, buffer, (unsigned int)(ctr * 2 + 2), 0);
printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret);
// printf("socket send %d in %d ms bytes: %d \n\n",times + 2, (unsigned int)millis() - start, sock_ret);
if ((millis() - start) > 500) {
printf("Buffer over filled!\n");
@ -2140,6 +2199,8 @@ if (setting == ON) {
fprintf(stderr,"Turning Safe Mode ON\n");
fprintf(stderr,"Turning Battery saver mode ON\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
pclose(command);
sleep(60);
@ -2154,6 +2215,8 @@ if (setting == ON) {
pclose(command);
fprintf(stderr,"Turning Battery saver mode OFF\n");
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
pclose(command);
sleep(60);

@ -105,6 +105,8 @@ FILE *telem_file;
#define BPSK 3
#define SSTV 4
#define CW 5
#define REPEATER 11
#define TXCOMMAND 12
int rpitxStatus = -1;
@ -132,6 +134,8 @@ char sim_yes[10];
char hab_yes[10];
int squelch = 3; // default squelch
char rx[12], tx[12];
int tx_pl = 0;
int rx_pl = 0;
int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, syncBits, syncWord, parityLen, samples, frameCnt, samplePeriod;
float sleepTime;
@ -182,10 +186,13 @@ int start_flag_detected = FALSE;
int start_flag_complete = FALSE;
int end_flag_detected = FALSE;
int jpeg_start = 0;
#define CAMERA_TIMEOUT 2000 // 10000 // 20000 // Payload timeout in milli seconds
#define CAMERA_TIMEOUT 2000 // 1500 // 2000 // 10000 // 20000 // Payload timeout in milli seconds
void battery_saver(int setting);
int battery_saver_check();
int battery_saver_check();
int pi_zero_2_offset = 0;
int hab_mode = FALSE;
int battery_saver_mode = FALSE;
long int loopTime;

@ -9,52 +9,7 @@ from time import sleep
import sys
from os import system
from PIL import Image, ImageDraw, ImageFont, ImageColor
import serial
def command_control_check():
global command_control
global no_command
global debug_mode
global command_count
output(pd, 1)
output(ptt, 1)
sleep(1)
if (no_command == False and GPIO.input(squelch) == False):
print("carrier received!")
# command_tx = not command_tx
# print(command_tx)
try:
command_count += 1
filec = open("/home/pi/CubeSatSim/command_count.txt", "w")
command_count_string = str(command_count)
print(command_count_string)
string = filec.write(command_count_string)
filec.close()
except:
if (debug_mode == 1):
print("Can't write command_count file!")
print("Command_count: ")
print(command_count)
increment_mode()
# if (command_tx == True):
# print("Turning on transmit")
# system("echo > command_tx True")
# output(txLed, txLedOn)
# sleep(0.5)
# output(txLed, txLedff)
# else:
# print("Turning off transmit")
# system("echo > command_tx False")
else:
print("No carrier received!")
output(pd, 0)
# sleep(1)
import serial
def battery_saver_check():
try:
@ -188,6 +143,7 @@ ptt = 20
txc_pin = 7
squelch = 6
green = 16
powerPin = 16
command_tx = True
@ -198,32 +154,18 @@ GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(txc_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(green, GPIO.OUT)
GPIO.output(powerPin, 1)
transmit = False
txLed = 27
txLedOn = 1
txLedOff = 0
if GPIO.input(12) == False:
print("Version is v1 with UHF BPF")
transmit = True
txLed = 27
txLedOn = 1
txLedOff = 0
elif GPIO.input(27) == False:
print("Version is TFB")
print("Version is v1 with UHF LPF")
transmit = True
txLed = 22
txLedOn = 0
txLedOff = 1
elif GPIO.input(13) == False:
print("Version is v1 with VHF BPF")
print("VHF transmit not implemented yet")
# transmit = True
txLed = 27
txLedOn = 1
txLedOff = 0
else:
print("No BPF")
txLed = 27
txLedOn = 1
txLedOff = 0
print("No LPF")
# GPIO.setup(txLed, GPIO.OUT)
# output(txLed, txLedOff)
@ -259,36 +201,59 @@ print(txLed)
debug_mode = 0 #no debugging rpitx
if __name__ == "__main__":
skip = False
if __name__ == "__main__":
mode = "y"
if (len(sys.argv)) > 1:
# print("There are arguments!")
if (('d' == sys.argv[1]) or ('-d' in sys.argv[1])):
debug_mode = 1
elif (('x' == sys.argv[1]) or ('-x' in sys.argv[1])):
mode = "x"
print("Forcing APRS mode")
elif (('s' == sys.argv[1]) or ('-s' in sys.argv[1])):
skip = True
print("Skipping delay and CW ID")
print(transmit)
try:
file = open("/home/pi/CubeSatSim/.mode")
mode = file.read(1)
system("cat /proc/uptime > /home/pi/CubeSatSim/uptime")
file = open("/home/pi/CubeSatSim/uptime")
up = file.read().split(" ")[0]
print(up)
uptime = float(up)
print(uptime)
if (uptime < 45):
print("Uptime < 45 seconds")
else:
print("Uptime > 45 seconds")
skip = True
file.close()
except:
mode = "f"
if (debug_mode == 1):
print("Can't open .mode file, defaulting to FSK")
print("Can't open /proc/uptime")
if ( mode == "y"):
try:
file = open("/home/pi/CubeSatSim/.mode")
mode = file.read(1)
except:
mode = "f"
if (debug_mode == 1):
print("Can't open .mode file, defaulting to FSK")
print("Mode is: ")
print(mode)
try:
file = open("/home/pi/CubeSatSim/command_tx")
char = file.read(1)
if (char == 'T'):
command_tx = True
else:
command_tx = False
file = open("/home/pi/CubeSatSim/beacon_off")
file.close()
command_tx = False
except:
command_tx = True
if (debug_mode == 1):
print("Can't open command_tx file, defaulting to True")
print("Can't open beacon_off file, defaulting to False")
print("Command_tx: ")
print(command_tx)
@ -306,6 +271,12 @@ if __name__ == "__main__":
file.close()
print("Command_count: ")
print(command_count)
tx_value = '0'
rx_value = '0'
sq = '0'
tx = '434.9000'
rx = '435.0000'
try:
file = open("/home/pi/CubeSatSim/sim.cfg")
@ -314,26 +285,31 @@ if __name__ == "__main__":
callsign = config[0]
if len(config) > 5:
sq = config[5]
else:
sq = '0'
print(sq)
if len(config) > 6:
# tx = config[6]
txf = float(config[6])
print(txf)
# print(txf)
# print( "{:.4f}".format(txf))
tx = "{:.4f}".format(txf)
print(tx)
else:
tx = '434.9000'
if len(config) > 7:
# rx = config[7]
rxf = float(config[7])
print(rxf)
# print(rxf)
# print( "{:.4f}".format(rxf))
rx = "{:.4f}".format(rxf)
print(rx)
else:
rx = '435.0000'
if len(config) > 9:
rxpl = float(config[9])
# print(rxpl)
# print( "{:.0f}".format(rxpl))
rxpl_value = "{:.0f}".format(rxpl)
print(rxpl_value)
if len(config) > 10:
txpl = float(config[10])
# print(txpl)
# print( "{:.0f}".format(txpl))
txpl_value = "{:.0f}".format(txpl)
print(txpl_value)
print(config)
print
# print(callsign)
@ -362,12 +338,16 @@ if __name__ == "__main__":
else:
print("command and control is activated")
no_command = False
# system("/home/pi/CubeSatSim/command &")
system("sudo systemctl start command")
except:
print("command and control not activated")
no_command = True
print(callsign)
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
print(txLed)
print(txLedOn)
GPIO.setup(txLed, GPIO.OUT)
print("Programming FM module!\n");
@ -376,26 +356,31 @@ if __name__ == "__main__":
try:
ser = serial.Serial("/dev/ttyAMA0", 9600)
print(ser.portstr)
uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n"
# uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n"
uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n"
print(uhf_string)
for i in range(6):
# ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n")
ser.write(uhf_string.encode())
sleep(0.1)
ser.close()
except:
print("Error in serial write")
ser.close()
output(pd, 0)
sleep(10) # delay so cubesatsim code catches up
# if (mode != 'x') and (skip == False):
# sleep(10) # delay so cubesatsim code catches up
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")
command_control_check()
# command_control_check()
# if (mode != 'a') and (command_tx == True):
# if (mode != ) and (command_tx == True):
# if (command_tx == True):
if (mode != 'm'):
if ((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's')) and (command_tx == True) and (skip == False):
# battery_saver_mode
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# if (txc):
# output(pd, 1)
@ -426,10 +411,20 @@ if __name__ == "__main__":
# if (len(sys.argv)) > 1:
# print("There are arguments!")
if (mode == 'a'):
command_control_check()
# output(pd, 1)
print("AFSK")
if (mode == 'a') or (mode == 'x') or (mode == 'n'):
# command_control_check()
output(pd, 1)
output(ptt, 1)
if (mode == 'a'):
print("AFSK")
else:
GPIO.output(powerPin, 0)
print("Transmit APRS Commands")
# while True:
# sleep(0.1)
if (mode != 'n'):
system("touch /home/pi/CubeSatSim/ready")
while True:
try:
f = open("/home/pi/CubeSatSim/ready")
@ -439,6 +434,8 @@ if __name__ == "__main__":
system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1")
system("cat /home/pi/CubeSatSim/t.txt")
if (command_tx == True):
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# output(pd, 1)
# output (ptt, 0)
@ -446,15 +443,16 @@ if __name__ == "__main__":
#
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
sleep(0.1) # add delay before transmit
output (ptt, 0)
sleep(0.3) # add even more time at start
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/telem.wav")
sleep(0.2) # add more time at end
output (ptt, 1)
output(pd, 0)
else:
# output(pd, 0)
else:
system("echo 'AMSAT-11>APCSS:010101/hi hi ' >> t.txt")
if (debug_mode == 1):
system("gen_packets -o /home/pi/CubeSatSim/telem.wav /home/pi/CubeSatSim/t.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/telem.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:
@ -472,13 +470,15 @@ if __name__ == "__main__":
sleep(0.5)
except:
command_control_check()
# command_control_check()
sleep(1)
elif (mode == 'm'):
system("touch /home/pi/CubeSatSim/cwready")
print("CW")
while True:
command_control_check()
# command_control_check()
output (pd, 1)
output (ptt, 1)
try:
f = open("/home/pi/CubeSatSim/cwready")
f.close()
@ -490,10 +490,12 @@ if __name__ == "__main__":
system(command)
## chan = chan + 1
if (command_tx == True):
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
if (txc):
output (pd, 1)
# output (pd, 1)
sleep(0.3)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav")
@ -507,15 +509,18 @@ if __name__ == "__main__":
system("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)
command_control_check()
# command_control_check()
sleep(2)
f.close()
sleep(5)
sleep(10)
except:
command_control_check()
# command_control_check()
sleep(1)
elif (mode == 's'):
print("SSTV")
command_control_check()
# command_control_check()
output (ptt, 1)
output(pd, 1)
try:
# from picamera import PiCamera
# from pysstv.sstv import SSTV
@ -541,19 +546,21 @@ if __name__ == "__main__":
file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
print("First SSTV stored image detected")
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
command_control_check()
# command_control_check()
if (command_tx == True):
print ("Sending SSTV image")
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav")
output (ptt, 1)
output(pd, 0)
# output(pd, 0)
else:
if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3")
@ -566,7 +573,7 @@ if __name__ == "__main__":
except:
print("image 2 did not load - copy from CubeSatSim/sstv directory")
while 1:
command_control_check()
# command_control_check()
system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
print("Photo taken")
@ -594,24 +601,26 @@ if __name__ == "__main__":
draw.text((120, 10), telem_string, font=font2, fill='white')
img.save(file)
command_control_check()
# command_control_check()
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/camera_out.jpg")
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1")
command_control_check()
# command_control_check()
if (command_tx == True):
print ("Sending SSTV image")
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/camera_out.jpg.wav")
output(ptt, 1)
output (pd, 0)
# output (pd, 0)
else:
if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3")
@ -623,30 +632,32 @@ if __name__ == "__main__":
# output(pd, 0)
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1")
sleep(1)
sleep(10)
else:
try:
command_control_check()
# command_control_check()
file = open("/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg")
print("First SSTV stored image detected")
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg")
command_control_check()
# command_control_check()
if (command_tx == True):
print ("Sending SSTV image")
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav")
output(ptt, 1)
output (pd, 0)
# output (pd, 0)
else:
if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3")
@ -660,7 +671,7 @@ if __name__ == "__main__":
except:
print("image 1 did not load - copy from CubeSatSim/sstv directory")
try:
command_control_check()
# command_control_check()
file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
print("Second SSTV stored image detected")
@ -668,19 +679,21 @@ if __name__ == "__main__":
while 1:
command_control_check()
# command_control_check()
if (command_tx == True):
print ("Sending SSTV image")
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav")
output(ptt, 1)
output (pd, 0)
# output (pd, 0)
else:
if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3")
@ -690,38 +703,46 @@ if __name__ == "__main__":
output(txLed, txLedOff)
# output (ptt, 1)
# output(pd, 0)
sleep(5)
sleep(10)
except:
print("image 2 did not load - copy from CubeSatSim/sstv directory")
if (txc == False):
if (command_tx == True):
system("(while true; do (sleep 5 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &")
system("(while true; do (sleep 10 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &")
while 1:
if (command_tx == True):
command_control_check()
# command_control_check()
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# battery_saver_check()
if (txc):
output(pd, 1)
# output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv.wav")
output(ptt, 1)
output (pd, 0)
# output (pd, 0)
else:
sleep(60)
output(txLed, txLedOff)
# output (ptt, 1)
# output(pd, 0)
sleep(1)
sleep(10)
elif (mode == 'b'):
command_control_check()
# command_control_check()
print("BPSK")
print("turn on FM rx")
output(pd, 1)
output(ptt, 1)
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
GPIO.setup(txLed, GPIO.OUT)
if (command_tx == True):
# system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f 434.9e6 -t float &")
system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &")
@ -733,16 +754,55 @@ if __name__ == "__main__":
# output(txLed, txLedOn)
# sleep(0.03)
# output(txLed, txLedOff)
command_control_check()
# command_control_check()
if (command_tx == True):
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# print(txLed)
# print(txLedOn)
sleep(4.2)
elif (mode == 'e'): # code based on https://zr6aic.blogspot.com/2016/11/creating-2m-fm-repeater-with-raspberry.html
print("Repeater")
print("Stopping command and control")
system("sudo systemctl stop command")
print("turn on FM rx")
output(pd, 1)
output(ptt, 1)
GPIO.output(powerPin, 0)
while True:
sleep(0.5)
if (GPIO.input(squelch) == False):
print("Carrier detected, starting repeater")
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# system("arecord -D hw:CARD=Device,DEV=0 | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &")
## system("arecord -D hw:CARD=Device,DEV=0 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &")
system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 16000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 &")
sleep(1)
system("sudo arecord -D plughw:1 -r48000 -fS16_LE -c1 | nc localhost 8011 &")
GPIO.output(powerPin, 1)
sleep(0.5)
GPIO.output(powerPin, 0)
while (GPIO.input(squelch) == False):
sleep(1)
print("No carrier detected, stopping repeater")
output(txLed, txLedOff)
system("sudo killall -9 arecord")
system("sudo killall -9 nc")
system("sudo killall -9 rpitx")
else:
print("FSK")
print("turn on FM rx")
output(pd, 1)
output(ptt, 1)
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
GPIO.setup(txLed, GPIO.OUT)
if (command_tx == True):
system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f " + tx + "e3 &")
print("Turning LED on/off and listening for carrier")
@ -753,11 +813,15 @@ if __name__ == "__main__":
# output(txLed, txLedOn)
# sleep(0.03)
# output(txLed, txLedOff)
command_control_check()
# command_control_check()
if (command_tx == True):
GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi Zero 2 and Pi 4
GPIO.setup(txLed, GPIO.OUT)
output(txLed, txLedOn)
# print(txLed)
# print(txLedOn)
sleep(4.2)
else:
print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the BPF.")
print("No Low Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the LPF.")
while 1:
sleep(5)

@ -0,0 +1,196 @@
import RPi.GPIO as GPIO
from RPi.GPIO import output
from time import sleep
from os import system
import sys
def command_control_check():
# global command_control
# global no_command
global debug_mode
command_count = 0
global squelch
global txLed
# output(pd, 1)
# output(ptt, 1)
# sleep(1)
# if (no_command == False and GPIO.input(squelch) == False):
if GPIO.input(squelch) == False:
print("carrier received!")
# command_tx = not command_tx
# print(command_tx)
try:
file = open("/home/pi/CubeSatSim/command_count.txt", "r")
string = file.read()
file.close()
command_count = int(string)
command_count += 1
filec = open("/home/pi/CubeSatSim/command_count.txt", "w")
command_count_string = str(command_count)
print(command_count_string)
string = filec.write(command_count_string)
filec.close()
except:
print("Can't write command_count file!")
print("Command_count: ")
print(command_count)
increment_mode()
# if (command_tx == True):
# print("Turning on transmit")
# system("echo > command_tx True")
# output(txLed, txLedOn)
# sleep(0.5)
# output(txLed, txLedff)
# else:
# print("Turning off transmit")
# system("echo > command_tx False")
## else:
## print("No carrier received!")
# output(pd, 0)
# sleep(1)
def increment_mode():
global debug_mode
print("increment mode")
powerPin = 16
try:
file = open("/home/pi/CubeSatSim/.mode")
mode = file.read(1)
except:
# mode = "f"
# if (debug_mode == 1):
print("Can't open .mode file") # , defaulting to FSK")
file.close()
print("Mode is: ")
print(mode)
if (mode == 'a'):
mode = 'f'
GPIO.output(powerPin, 0) # blink two times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 'f'):
mode = 'b'
GPIO.output(powerPin, 0) # blink three times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 'b'):
mode = 's'
GPIO.output(powerPin, 0) # blink four times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
elif (mode == 's'):
mode = 'm'
GPIO.output(powerPin, 0) # blink five times
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1);
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(0.1)
GPIO.output(powerPin, 0)
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
else:
mode = 'a'
GPIO.output(powerPin, 0) # blink one time
sleep(0.1)
GPIO.output(powerPin, 1)
sleep(1)
try:
print("/home/pi/CubeSatSim/config -" + mode)
if (debug_mode == False):
GPIO.setwarnings(False)
GPIO.output(txLed, 0)
GPIO.output(powerPin, 0)
system("sudo systemctl stop rpitx")
system("sudo systemctl stop cubesatsim")
system("/home/pi/CubeSatSim/config -" + mode)
print("Changing mode now")
# file = open("/home/pi/CubeSatSim/.mode", "w")
# count_string = str(command_count)
# file.write(mode)
# file.close()
# print(".mode file written")
# print("sudo reboot -h now")
# GPIO.setwarnings(False)
# GPIO.setup(powerPin, GPIO.OUT)
# GPIO.output(powerPin, 0);
# system("reboot -h now")
# release = True;
# system("/home/pi/CubeSatSim/config -" + mode)
# system("reboot -h now")
print(" ")
# sleep(10);
except:
print("can't change mode")
print("Squelch Command and Control active")
debug_mode = False
if (len(sys.argv)) > 1:
# print("There are arguments!")
if ('d' == sys.argv[1]):
debug_mode = True
print("Debug mode - mode changes not made")
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
squelch = 6
powerPin = 16
txLed = 27
GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected
GPIO.setup(powerPin, GPIO.OUT)
GPIO.setup(txLed, GPIO.OUT)
while True:
command_control_check()
sleep(0.5)

@ -0,0 +1,14 @@
[Unit]
Description=Command service
[Service]
TimeoutStopSec=5
ExecStart=/home/pi/CubeSatSim/command
WorkingDirectory=/home/pi/CubeSatSim
StandardOutput=inherit
StandardError=inherit
Restart=always
User=root
[Install]
WantedBy=default.target

@ -10,7 +10,7 @@ StandardError=inherit
Restart=always
User=root
CPUAccounting=true
CPUQuota=5%
CPUQuota=7%
[Install]
WantedBy=default.target

152
update

@ -2,13 +2,24 @@
echo -e "\nupdate script for CubeSatSim v1.3.2\n"
if [ "$1" = "n" ] ; then
# if [ -z "$2" ] ; then
noreboot=1
else
noreboot=0
fi
# echo "No reboot"
# echo $noreboot
sudo rm /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/id.txt /home/pi/CubeSatSim/cw.txt > /dev/null 2>&1
if [ "$1" = "u" ]; then
sudo apt-get update && sudo apt-get dist-upgrade -y
# sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get update -y
sudo apt-get install -y wiringpi git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom
sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom
fi
@ -56,6 +67,8 @@ else
echo "no changes to cubesatsim.service."
fi
sudo systemctl disable rpitx
if [[ $(diff systemd/rpitx.service /etc/systemd/system/rpitx.service) ]]; then
echo "changed rpitx.service."
sudo cp /home/pi/CubeSatSim/systemd/rpitx.service /etc/systemd/system/rpitx.service
@ -64,6 +77,24 @@ else
echo "no changes to rpitx.service."
fi
sudo systemctl disable rpitx
FILE=/etc/systemd/system/command.service
if [ -f "$FILE" ]; then
if [[ $(diff systemd/command.service /etc/systemd/system/command.service) ]]; then
echo "changed command.service."
sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service
FLAG=1
else
echo "no change to command.service."
fi
else
echo "creating command.service."
sudo cp /home/pi/CubeSatSim/systemd/command.service /etc/systemd/system/command.service
sudo systemctl enable command
FLAG=1
fi
FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
if [ ! -f "$FILE" ]; then
echo "Copying SSTV image 1."
@ -84,7 +115,8 @@ fi
if [ ! -d "/home/pi/PiSSTVpp" ]; then
sudo apt-get update && sudo apt-get dist-upgrade -y
# sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get update -y
sudo apt-get install -y python-picamera python3-picamera build-essential libgd-dev libmagic-dev
@ -131,11 +163,66 @@ if [ ! -d "/home/pi/PiSSTVpp" ]; then
fi
if [ ! -d "/home/pi/rpitx" ]; then
cd
git clone https://github.com/alanbjohnston/rpitx.git
cd rpitx
./install.sh
cd
else
if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then
echo "rpitx already updated"
else
echo "updating rpitx"
cd /home/pi/rpitx
git pull
./update.sh
cd
fi
fi
if [ ! -d "/home/pi/WiringPi" ]; then
cd
git clone https://github.com/PinkFreud/WiringPi
cd WiringPi
./build debian
sudo dpkg -i debian-template/wiringpi-2.61-1.deb
cd
cd CubeSatSim
make debug
FLAG=1
cd
fi
cd /home/pi/pi-power-button
# git checkout reboot-mode-change
git checkout reboot-mode-change-beta > .updated_b
git pull --no-rebase > .updated_p
grep 'error' /home/pi/pi-power-button/.updated_b
if [[ $(grep 'error' /home/pi/pi-power-button/.updated_b) ]]; then
echo "pi-power-button switching to beta branch"
git pull
git checkout reboot-mode-change-beta
script/install
FLAG=1
fi
git pull --no-rebase > .updated_p
grep 'changed' /home/pi/pi-power-button/.updated_p
if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then
@ -192,9 +279,10 @@ git pull --no-rebase > .updated_p
git checkout reboot-mode-change
script/install
sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 -y
sudo pip3 install pillow
# sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get update -y
sudo apt-get install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libopenjp2-7 libtiff5 python3-pil
sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow
fi
@ -231,6 +319,7 @@ git pull --no-rebase > .updated_p
changed=0
value=`cat /home/pi/CubeSatSim/sim.cfg`
# echo "$value"
echo "$value" > /dev/null
set -- $value
@ -243,32 +332,41 @@ if [ -z "$6" ] ; then n6="3" ; changed=1 ; else n6=$6 ; fi # squelch
if [ -z "$7" ] ; then n7="434.9000" ; changed=1 ; else n7=$7 ; fi # transmit frequency
if [ -z "$8" ] ; then n8="435.0000" ; changed=1 ; else n8=$8 ; fi # receive frequency
if [ -z "$9" ] ; then n9="no" ; changed=1 ; else n9=$9 ; fi # hab mode
if [ -z "${10}" ] ; then m1="0" ; changed=1 ; else m1=${10} ; fi # rx pl code
if [ -z "${11}" ] ; then m2="0" ; changed=1 ; else m2=${11} ; fi # tx pl code
if [ $changed -eq 1 ]; then
echo -e "Current sim.cfg configuration file:"
echo
echo $1 $2 $3 $4 $5 $6 $7 $8 $9
echo -e "\nCubeSatSim configuraation sim.cfg file updated to: \n"
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11}
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
echo
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 > /home/pi/CubeSatSim/sim.cfg
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2
echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 > /home/pi/CubeSatSim/sim.cfg
echo
fi
if [ $FLAG -eq 1 ]; then
echo "systemctl daemon-reload and reboot"
sudo systemctl daemon-reload
sudo reboot -h now
# sudo systemctl restart cubesatsim
if [ "$noreboot" = "0" ] ; then
if [ $FLAG -eq 1 ]; then
echo "systemctl daemon-reload and reboot"
sudo systemctl daemon-reload
sudo reboot -h now
# sudo cubesatsim
else
grep 'changed' /home/pi/CubeSatSim/.updated
if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then
echo "reboot due to code changes " | wall
sudo reboot -h now
# sudo cubesatsim
else
echo "nothing to do."
fi
fi
else
grep 'changed' /home/pi/CubeSatSim/.updated
if [[ $(grep 'changed' /home/pi/CubeSatSim/.updated) ]]; then
echo "reboot"
sudo reboot -h now
# sudo systemctl restart cubesatsim
else
echo "nothing to do."
fi
if [ $FLAG -eq 1 ]; then
echo "reboot needed for changes to take effect"
fi
fi
echo "CubeSatSim update complete."
echo "CubeSatSim update complete."

Loading…
Cancel
Save

Powered by TurnKey Linux.