Merge pull request #369 from alanbjohnston/fc-c2c

More enhancements
pull/370/head
Alan Johnston 6 months ago committed by GitHub
commit 4f81dd82be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,6 @@
#!/bin/bash #!/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 FILE=/home/pi/CubeSatSim/sim.cfg
if [ -f "$FILE" ]; then if [ -f "$FILE" ]; then
@ -56,7 +56,7 @@ sudo dpkg -i debian-template/wiringpi-2.61-1.deb
cd cd
#changed to python3-smbus #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 sudo pip3 install --upgrade setuptools
@ -95,13 +95,35 @@ git clone https://github.com/alanbjohnston/pi-power-button.git
cd pi-power-button cd pi-power-button
git checkout master git checkout 7-modes
./script/install ./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 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 git clone https://github.com/alanbjohnston/PiSSTVpp.git
cd PiSSTVpp cd PiSSTVpp
@ -143,6 +165,8 @@ sudo cp ~/CubeSatSim/systemd/command.service /etc/systemd/system/command.service
sudo systemctl enable command 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/config.txt /boot/config.txt.0
sudo cp /boot/cmdline.txt /boot/cmdline.txt.0 sudo cp /boot/cmdline.txt /boot/cmdline.txt.0

@ -629,16 +629,24 @@ int main(int argc, char * argv[]) {
token = strtok(NULL, space); token = strtok(NULL, space);
} }
} }
if (voltage[map[BAT]] == 0.0) if (voltage[map[BAT]] == 0.0) // No BAT Board
batteryVoltage = 4.5; 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 { 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 if (sim_mode && !sim_config) { // if Voltage sensor on Battery board is present, exit simulated telemetry mode
sim_mode = FALSE; sim_mode = FALSE;
fprintf(stderr, "Turning off sim_mode since battery sensor is present\n"); 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
} }
@ -815,9 +823,9 @@ int main(int argc, char * argv[]) {
fclose(cpuTempSensor); fclose(cpuTempSensor);
} }
#ifdef DEBUG_LOGGING // #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 // #endif
if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode) if ((batteryCurrent > currentThreshold) && (batteryVoltage < (voltageThreshold + 0.15)) && !sim_mode && !hab_mode)
{ {
@ -2263,6 +2271,7 @@ if (setting == ON) {
pclose(command); pclose(command);
fprintf(stderr,"Turning Safe Mode ON\n"); 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)) { if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r"); command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command); pclose(command);
@ -2279,6 +2288,7 @@ if (setting == ON) {
FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r"); FILE *command = popen("rm /home/pi/CubeSatSim/battery_saver", "r");
pclose(command); pclose(command);
fprintf(stderr,"Turning Battery saver mode OFF\n"); fprintf(stderr,"Turning Battery saver mode OFF\n");
battery_saver_mode = OFF;
if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) { if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r"); command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command); pclose(command);

@ -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[MINUS_X] = MINUS_Y;
map[PLUS_Z] = MINUS_X; map[PLUS_Z] = MINUS_X;
map[MINUS_Y] = PLUS_Z; map[MINUS_Y] = PLUS_Z;

@ -316,11 +316,11 @@ if __name__ == "__main__":
print print
# print(callsign) # print(callsign)
print(sq) print(sq)
if sq == '8': # if sq == '8':
print("squelch set to 8, no command input!") # print("squelch set to 8, no command input!")
no_command = True # no_command = True
else: # else:
no_command = False no_command = False
print(no_command) print(no_command)
except: except:
callsign = "AMSAT" callsign = "AMSAT"
@ -399,13 +399,17 @@ if __name__ == "__main__":
# output (ptt, 1) # output (ptt, 1)
# output(pd, 0) # output(pd, 0)
# else: # else:
if (True): if (no_command):
if (debug_mode == 1): 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") 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: 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") 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) output(txLed, txLedOff)

Loading…
Cancel
Save

Powered by TurnKey Linux.