diff --git a/.gitignore b/.gitignore
index 04810931..ad3de7d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,3 +47,13 @@ logt.txt
telem.txt.bk
failure_mode.txt
sim_mode_auto
+direwolf-pacsatsim-tmp.conf
+groundstation/direwolf-pacsat-tmp.conf
+tlm.bin
+frequency.txt
+freq.txt
+logb.txt
+logo.txt
+logp.txt
+hotspot.ini
+camera.jpg
diff --git a/OliveTin/config.yaml b/OliveTin/config.yaml
new file mode 100644
index 00000000..8c01eea5
--- /dev/null
+++ b/OliveTin/config.yaml
@@ -0,0 +1,689 @@
+showNavigation: false
+pageTitle: CubeSatSim Dashboard
+logLevel: "INFO"
+showFooter: false
+additionalNavigationLinks:
+ - title: CubeSatSim Wiki
+ url: https://CubeSatSim.org/wiki
+ target: _blank
+
+ - title: CubeSatSim Code
+ url: https://CubeSatSim.org/code
+ target: _blank
+
+ - title: CubeSatSim YouTube Videos
+ url: https://www.youtube.com/@ku2y
+ target: _blank
+
+actions:
+ - title: "Show CubeSatSim Config"
+ shell: /home/pi/CubeSatSim/config
+ icon: logs
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Show All Commands"
+ shell: /home/pi/CubeSatSim/config -h
+ icon: logs
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "General CubeSatSim Config"
+ shell: /home/pi/CubeSatSim/config {{ config }}
+ icon: "⚙" # gear
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: config
+ type: ascii_sentence
+
+ - title: "Change Mode to APRS"
+ shell: /home/pi/CubeSatSim/config -a
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to FSK"
+ shell: /home/pi/CubeSatSim/config -f
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to BPSK"
+ shell: /home/pi/CubeSatSim/config -b
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to SSTV"
+ shell: /home/pi/CubeSatSim/config -s
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to CW"
+ shell: /home/pi/CubeSatSim/config -m
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to Repeater"
+ shell: /home/pi/CubeSatSim/config -e
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to FUNcube"
+ shell: /home/pi/CubeSatSim/config -j
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Mode to Pacsat"
+ shell: /home/pi/CubeSatSim/config -G
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Change Mode to Pacsat Ground Station"
+ shell: /home/pi/CubeSatSim/config -I
+ icon: "🛰" # satellite
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Turn Battery Saver Mode ON"
+ shell: bash -c "/home/pi/CubeSatSim/config -B yes"
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Battery Saver Mode OFF"
+ shell: bash -c "/home/pi/CubeSatSim/config -B no"
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Doppler Mode OFF"
+ shell: /home/pi/CubeSatSim/config -K no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Simulated Doppler Mode ON"
+ shell: /home/pi/CubeSatSim/config -K sim
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Radio Control Doppler Mode ON"
+ shell: /home/pi/CubeSatSim/config -K rig
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change TX and RX Frequency"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -F {{ tx }} {{ rx }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: tx
+ type: ascii_sentence
+ - name: rx
+ type: ascii_sentence
+
+ - title: "Connect to WiFi using SSID and Password"
+ icon: "🛜" # wireless
+ shell: echo "If this works, this web page won't work again until you connect to the new WiFi network!" && echo && sudo nmcli device wifi rescan && sleep 1 && sudo nmcli device wifi connect "{{ wifi_ssid }}" password "{{ wifi_password }}" && sudo reboot now
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: wifi_ssid
+ type: ascii_sentence
+ - name: wifi_password
+ type: ascii_sentence
+
+ - title: "Change Hostname and Restart"
+ icon: "🛜" # wireless
+ shell: echo "If this works, this web page won't work again until you connect using the new host name after the restart!" && echo && sudo hostnamectl set-hostname {{ hostname }} && sudo reboot now
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: hostname
+ type: ascii_sentence
+
+ - title: "Ping a Host or IP address"
+ icon: "🛜" # wireless
+# shell: echo "This will run for 15 seconds" && ping {{ hostname_or_ip_address }}
+ shell: ping {{ hostname_or_ip_address }}
+ onclick: execution-dialog
+ timeout: 15
+ arguments:
+ - name: hostname_or_ip_address
+ type: ascii_sentence
+
+ - title: "See Running Processes"
+ icon: logs
+# shell: echo "This command will timeout after 15 seconds" && top
+ shell: top -b -n 1 2>&1
+ onclick: execution-dialog
+ timeout: 15
+
+ - title: "CubeSatSim Directory"
+ icon: logs
+ shell: ls -all /home/pi/CubeSatSim
+ onclick: execution-dialog
+ timeout: 15
+
+ - title: "Show PiOS Boot Files"
+ icon: logs
+ shell: /home/pi/CubeSatSim/config -w
+ onclick: execution-dialog
+ timeout: 15
+
+
+ - title: "Show Available WiFi Networks"
+ icon: "🛜" # wireless
+ shell: sudo nmcli device wifi rescan && nmcli device wifi list
+ onclick: execution-dialog
+ timeout: 10
+
+# - title: "Signin to Raspberry Pi Connect"
+# icon: "🍓" # strawberry
+# shell: sudo su pi - rpi-connect signin
+# onclick: execution-dialog
+# timeout: 60
+
+# - title: "Signout of Raspberry Pi Connect"
+# icon: "🍓" # strawberry
+# shell: sudo su pi - rpi-connect signout
+# onclick: execution-dialog
+# timeout: 10
+
+# - title: "Status of Raspberry Pi Connect"
+# icon: "🍓" # strawberry
+# shell: sudo su pi - rpi-connect doctor
+# onclick: execution-dialog
+# timeout: 60
+
+ - title: "Show Network Configuration"
+ icon: "🛜" # wireless
+ shell: ifconfig
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "List Audio Devices Speakers and Microphones"
+ icon: "🔉" # speaker
+ shell: aplay -l && arecord -l
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "List USB Devices"
+ icon: logs
+ shell: lsusb
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Set PL (Private Line) CTCSS/CDCSS"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -P {{ pl_rx }} {{ pl_tx }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: pl_rx
+ type: ascii_sentence
+ - name: pl_tx
+ type: ascii_sentence
+
+ - title: "Change Callsign"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -c {{ callsign }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: callsign
+ type: ascii_sentence
+
+ - title: "Change Latitude and Longitude"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -l {{ latitude }} {{ longitude }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: latitude
+ type: ascii_sentence
+ - name: longitude
+ type: ascii_sentence
+
+ - title: "Realtime CubeSatSim Log"
+ shell: /home/pi/CubeSatSim/log -d r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "CubeSatSim Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -d
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Transmit Log"
+ shell: /home/pi/CubeSatSim/log -t r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Transmit Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -t
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Frequency Control Log"
+ shell: /home/pi/CubeSatSim/log -r r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Frequency Control Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Frequency Display Log"
+ shell: /home/pi/CubeSatSim/log -f r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Frequency Display Log"
+ shell: /home/pi/CubeSatSim/log -f
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Pacsat Log"
+ shell: /home/pi/CubeSatSim/log -p r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Pacsat Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -p
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Pushbutton Log"
+ shell: /home/pi/CubeSatSim/log -b r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Pushbutton Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -b
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Command and Control Log"
+ shell: /home/pi/CubeSatSim/log -c r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Command and Control Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -c
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Realtime Web (OliveTin) Log"
+ shell: /home/pi/CubeSatSim/log -o r
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Web (OliveTin) Log"
+ shell: echo "If this log file is too long, it might timeout. If that happens, try the Realtime Log instead" && /home/pi/CubeSatSim/log -o
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Update CubeSatSim Software"
+ shell: echo "This will take tens of minutes and only works if connected to internet. It might timeout and need to be run again. You should restart when finished!" && sudo su pi - /home/pi/CubeSatSim/update
+ icon: "⏳"
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Update CubeSatSim Software to Branch"
+ shell: echo "This will take tens of minutes and only works if connected to internet. It might timeout and need to be run again. You should restart when finished!" && sudo su pi - /home/pi/CubeSatSim/update {{ branch }}
+ icon: "⏳"
+ onclick: execution-dialog
+ timeout: 600
+ arguments:
+ - name: branch
+ type: ascii_sentence
+
+ - title: "Restart CubeSatSim"
+ shell: echo "Restarting CubeSatSim now!" && sudo reboot now
+ icon: restart
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Shutdown CubeSatSim"
+ shell: echo "Shutting Down CubeSatSim now!" && sudo shutdown now
+ icon: restart
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Restart CubeSatSim Software"
+ shell: /home/pi/CubeSatSim/config -i
+ icon: restart
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Scan I2C Bus"
+ shell: /home/pi/CubeSatSim/config -S
+ icon: logs
+ onclick: execution-dialog
+ timeout: 600
+
+ - title: "Clear Logs and Restart"
+ shell: /home/pi/CubeSatSim/config -C
+ icon: restart
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Display Squelch"
+ shell: /home/pi/CubeSatSim/config -Q
+ icon: logs
+ onclick: execution-dialog
+ timeout: 15
+
+ - title: "Display Payload Sensor Data"
+ shell: /home/pi/CubeSatSim/config -p
+ icon: logs
+ onclick: execution-dialog
+ timeout: 15
+
+ - title: "Display Voltage and Current Data"
+ shell: /home/pi/CubeSatSim/config -v
+ icon: logs
+ onclick: execution-dialog
+ timeout: 15
+
+ - title: "Reset the Pacsat Configuration"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -k
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Reset the Commands Count"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -R yes
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Simulated Telemetry ON"
+ shell: /home/pi/CubeSatSim/config -t yes
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Simulated Telemetry OFF"
+ shell: /home/pi/CubeSatSim/config -t no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Balloon Mode ON"
+ shell: /home/pi/CubeSatSim/config -H yes
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Balloon Mode OFF"
+ shell: /home/pi/CubeSatSim/config -H no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Next Mode or Failure Mode"
+ shell: /home/pi/CubeSatSim/config -N
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn gpsd ON"
+ shell: /home/pi/CubeSatSim/config -u yes
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Turn gpsd OFF"
+ shell: /home/pi/CubeSatSim/config -u no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 30
+
+ - title: "Turn Command and Control ON"
+ shell: /home/pi/CubeSatSim/config -T yes
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Command and Control OFF"
+ shell: /home/pi/CubeSatSim/config -T no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Command and Control Direwolf ON"
+ shell: /home/pi/CubeSatSim/config -d yes
+ icon: "🟢" # green ball
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Command and Control Direwolf OFF"
+ shell: /home/pi/CubeSatSim/config -d no
+ icon: "❌" # red X
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Set FoxTelem Reset Count"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -r {{ resets }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: resets
+ type: ascii_sentence
+
+ - title: "Set Squelch Level"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -q {{ squelch }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: squelch
+ type: ascii_sentence
+
+ - title: "Set Microphone Level for Command and Control"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -L {{ mic_level }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: mic_level
+ type: ascii_sentence
+
+ - title: "Set Simulated Failure Mode"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -M {{ failure_mode }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: failure_mode
+ type: ascii_sentence
+
+ - title: "Set maxcpus Value"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -V {{ maxcpus_value }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: maxcpus_value
+ type: ascii_sentence
+
+ - title: "Turn Simulated Failure Mode OFF"
+ icon: "❌" # red X
+ shell: /home/pi/CubeSatSim/config -M 0
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Turn Random Simulated Failure Mode ON"
+ icon: "🟢" # green ball
+ shell: /home/pi/CubeSatSim/config -U yes {{ random_time_in_seconds }}
+ onclick: execution-dialog
+ timeout: 10
+ arguments:
+ - name: random_time_in_seconds
+ type: ascii_sentence
+
+ - title: "Turn Random Simulated Failure Mode OFF"
+ icon: "❌" # red X
+ shell: /home/pi/CubeSatSim/config -U no
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Change Telemetry Beacon Transmit State"
+ icon: "⚙" # gear
+ shell: /home/pi/CubeSatSim/config -o
+ onclick: execution-dialog
+ timeout: 10
+
+ - title: "Take Camera Photo for PacSat"
+ shell: /home/pi/CubeSatSim/config -z
+ icon: "📷" # camera
+ onclick: execution-dialog
+ timeout: 30
+
+
+ - title: "Raspberry Pi Software and Hardware"
+ shell: hostnamectl && echo && cat /sys/firmware/devicetree/base/model && echo
+ icon: logs
+ onclick: execution-dialog
+ timeout: 30
+
+
+dashboards:
+ - title: CubeSatSim Dashboard
+ contents:
+ - title: Show Configuration
+ contents:
+ - title: "Show CubeSatSim Config"
+ - title: Mode Changes
+ contents:
+ - title: "Change Mode to APRS"
+ - title: "Change Mode to FSK"
+ - title: "Change Mode to BPSK"
+ - title: "Change Mode to SSTV"
+ - title: "Change Mode to CW"
+ - title: "Change Mode to FUNcube"
+ - title: "Change Mode to Repeater"
+ - title: "Change Mode to Pacsat"
+ - title: "Change Mode to Pacsat Ground Station"
+
+ - title: Settings
+ contents:
+ - title: "Change Callsign"
+ - title: "Change Latitude and Longitude"
+ - title: "Change TX and RX Frequency"
+ - title: "Set FoxTelem Reset Count"
+ - title: "Set Squelch Level"
+ - title: "Set PL (Private Line) CTCSS/CDCSS"
+ - title: "Reset the Commands Count"
+ - title: "Reset the Pacsat Configuration"
+ - title: "Change Telemetry Beacon Transmit State"
+ - title: "Set Microphone Level for Command and Control"
+ - title: "Turn Simulated Telemetry ON"
+ - title: "Turn Simulated Telemetry OFF"
+ - title: "Set Simulated Failure Mode"
+ - title: "Turn Simulated Failure Mode OFF"
+ - title: "Turn Random Simulated Failure Mode ON"
+ - title: "Turn Random Simulated Failure Mode OFF"
+ - title: "Next Mode or Failure Mode"
+ - title: "Turn Simulated Doppler Mode ON"
+ - title: "Turn Radio Control Doppler Mode ON"
+ - title: "Turn Doppler Mode OFF"
+ - title: "Turn Command and Control ON"
+ - title: "Turn Command and Control OFF"
+ - title: "Turn Command and Control Direwolf ON"
+ - title: "Turn Command and Control Direwolf OFF"
+ - title: "Turn Battery Saver Mode ON"
+ - title: "Turn Battery Saver Mode OFF"
+ - title: "Turn Balloon Mode ON"
+ - title: "Turn Balloon Mode OFF"
+ - title: "Turn gpsd ON"
+ - title: "Turn gpsd OFF"
+ - title: "Set maxcpus Value"
+ - title: "Show All Commands"
+ - title: "General CubeSatSim Config"
+ - title: "Take Camera Photo for PacSat"
+
+ - title: Logs
+ contents:
+ - title: Static Logs
+ contents:
+ - title: "CubeSatSim Log"
+ - title: "Transmit Log"
+ - title: "Command and Control Log"
+ - title: "Pacsat Log"
+ - title: "Frequency Control Log"
+ - title: "Frequency Display Log"
+ - title: "Pushbutton Log"
+ - title: "Web (OliveTin) Log"
+ - title: Realtime Logs
+ contents:
+ - title: "Realtime CubeSatSim Log"
+ - title: "Realtime Transmit Log"
+ - title: "Realtime Command and Control Log"
+ - title: "Realtime Pacsat Log"
+ - title: "Realtime Frequency Control Log"
+ - title: "Realtime Frequency Display Log"
+ - title: "Realtime Pushbutton Log"
+ - title: "Realtime Web (OliveTin) Log"
+
+ - title: Diagnostics
+ contents:
+ - title: "Scan I2C Bus"
+ - title: "Display Squelch"
+ - title: "Display Payload Sensor Data"
+ - title: "Display Voltage and Current Data"
+ - title: "List Audio Devices Speakers and Microphones"
+ - title: "List USB Devices"
+
+ - title: Utilitites
+ contents:
+ - title: "Update CubeSatSim Software"
+ - title: "Update CubeSatSim Software to Branch"
+ - title: "Restart CubeSatSim"
+ - title: "Shutdown CubeSatSim"
+ - title: "Restart CubeSatSim Software"
+ - title: "Clear Logs and Restart"
+ - title: "Connect to WiFi using SSID and Password"
+ - title: "Change Hostname and Restart"
+ - title: "Show Network Configuration"
+ - title: "Show Available WiFi Networks"
+ - title: "Ping a Host or IP address"
+ - title: "See Running Processes"
+ - title: "Show PiOS Boot Files"
+ - title: "CubeSatSim Directory"
+ - title: "Raspberry Pi Software and Hardware"
+# - title: "Signin to Raspberry Pi Connect" # OliveTin needs to run as pi
+# - title: "Signout of Raspberry Pi Connect"
+# - title: "Status of Raspberry Pi Connect"
+
+
diff --git a/Welcome_Message.txt b/Welcome_Message.txt
new file mode 100644
index 00000000..1d699a01
--- /dev/null
+++ b/Welcome_Message.txt
@@ -0,0 +1,18 @@
+Welcome!
+
+Hello, and welcome to the CubeSatSim Pacsat Simulator!
+
+Here's what you can do with your PacSatSim:
+
+1. Downlink a Message by clicking on the message then the "FILE" button. When it is Downlinked, the Message will show as "New". If you double click on it you can view it and save it to your computer using the 'Export' button.
+2. Uplink a Message using the "New Msg" button. Under "Select Type" select "ASCII", type your message and then "Send"
+3. Reply to a Message by first Downlinking the message using the "FILE" button, then opening the Message and selecting "Reply" then "Send"
+4. Uplink a File using the "New Msg" button. Under "Select Type" select "JPG" or "BINARY". Remember the link is just 1200 bps, so don't try to Uplink anything larger than a few kilobytes. You could Downlink the SSTV image and try Uplinking it.
+5. Send a Command using the "Command" button. Under "Type" select "File System". Under "Commands" you can try "Pacsat Broadcast" then try setting "stop" or "start" then click "Send" to send the Command. Or under "Type" select "File Uploads". You can select "Off" or "All Stations" and click "Send" to send the Command. You can restore using config -k
+6. You can clear the current Pacsat Directory. You can always restore the default Directory contents running CubeSatSim/config -k and selecting Option 4 Reset PacSat Satellite. Using the "Command" button, select "Delete Folder Contents" then select "PACSAT dir" and then "Send" to send the Command.
+
+You can post questions and comments on the CubeSatSim Discussions Board https://github.com/alanbjohnston/CubeSatSim/discussions
+
+73,
+Alan
+KU2Y
diff --git a/asound.conf b/asound.conf
index cf3cc9a0..82947c47 100644
--- a/asound.conf
+++ b/asound.conf
@@ -22,6 +22,7 @@ pcm.softvol {
pcm.shared_speaker {
type dmix
ipc_key 1024
+ ipc_perm 0666
slave {
pcm "hw:CARD=Device,DEV=0"
rate 48000
@@ -32,15 +33,28 @@ pcm.shared_speaker {
}
# Recording with input mixing
-pcm.shared_mic {
+pcm.shared_mic_raw {
type dsnoop
+
ipc_key 2048
+ ipc_perm 0666
+
slave {
pcm "hw:CARD=Device,DEV=0"
-# channels 1
+ channels 1
rate 48000
- period_time 0
period_size 1024
buffer_size 4096
}
}
+
+pcm.shared_mic {
+ type softvol
+
+ slave.pcm "shared_mic_raw"
+
+ control {
+ name "MicVolume"
+ card 2
+ }
+}
diff --git a/command b/command
index f4c96b1d..b6e53239 100755
--- a/command
+++ b/command
@@ -1,9 +1,17 @@
#!/bin/bash
-echo -e "\nCommand and Control script for CubeSatSim v2.1\n"
+echo -e "\nCommand and Control script for CubeSatSim v2.3\n"
sudo modprobe snd-aloop
+sudo modprobe snd-aloop
+
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+
+MODE=$1
+
FILE=/home/pi/CubeSatSim/command_control
if [ -f "$FILE" ]; then
echo "Radio command and control is ON"
@@ -52,17 +60,19 @@ fi
FILE=/home/pi/CubeSatSim/command_control_direwolf
if [[ $(arecord -l | grep "USB Audio Device") ]] && [ -f "$FILE" ]; then
+ /home/pi/CubeSatSim/config -L -1
+
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
+ direwolf -D3 -r 48000 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | /home/pi/venv/bin/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
+ direwolf -D3 -r 48000 -c /home/pi/CubeSatSim/direwolf-cc.conf -t 0l | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
fi
else
@@ -107,11 +117,11 @@ else
# echo "debug mode"
-# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
+# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py d
# else
-# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
+# direwolf -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf.conf -t 0l | /home/pi/venv/bin/python3 /home/pi/CubeSatSim/dtmf_aprs_cc.py
# fi
@@ -124,17 +134,32 @@ else
fi
- if [ "$1" = "d" ]; then
-
- echo "debug mode"
-
- python3 /home/pi/CubeSatSim/squelch_cc.py d
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+ MODE=$1
+
+ if [ ! "$MODE" = "P" ] && [ ! "$MODE" = "P" ] ; then
+
+ if [ "$1" = "d" ]; then
+
+ echo "debug mode"
+
+ /home/pi/venv/bin/python3 /home/pi/CubeSatSim/squelch_cc.py d
+
+ else
+
+ /home/pi/venv/bin/python3 /home/pi/CubeSatSim/squelch_cc.py
+
+ fi
+
else
-
- python3 /home/pi/CubeSatSim/squelch_cc.py
-
- fi
+
+ echo "Not running Carrier (squelch) Command and Control since PacSat or PacSat Ground Station mode!"
+ sleep 60
+
+ fi
fi
sudo killall -9 direwolf &>/dev/null
diff --git a/config b/config
index 134819d1..dbaea133 100755
--- a/config
+++ b/config
@@ -43,6 +43,9 @@ function transmit_command {
j)
number=7
;;
+ p)
+ number=8
+ ;;
o)
number=10
;;
@@ -91,8 +94,21 @@ function check_restart {
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
+ MODE=$1
- if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+ if [ "${14}" = "sim" ] || [ "${14}" = "rig" ] ; then
+ DOPPLER=1
+ else
+ DOPPLER=0
+ fi
+
+# if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+# reboot=1
+#el
+ if [ "$MODE" == "f" ] || [ "$MODE" == "b" ] || [ "$MODE" == "e" ] || [ "$MODE" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
@@ -101,6 +117,8 @@ function check_restart {
reboot=1
# echo "Need to reboot"
fi
+ elif [ "$MODE" == "m" ] && [ "$DOPPLER" == "1" ] ; then
+ reboot=1
else
restart=1
# echo "Need to restart"
@@ -108,27 +126,38 @@ function check_restart {
}
echo
-echo "CubeSatSim v2.2 configuration tool"
+echo "CubeSatSim v2.3 configuration tool"
echo
# echo $1
# echo $2
# echo
+param1=$1
+param2=$2
+param3=$3
+param4=$4
+
sudo modprobe snd-aloop
-# if [ "$2" = "n" ] ; then
-if [ -z "$2" ] ; then
- noreboot=0
+if [ "$2" = "-n" ] ; then
+# if [ -z "$2" ] ; then
+ echo "Reboot disabled"
+ noreboot=1
+ param2=""
else
- if [ "$2" = "n" ] ; then
- echo "Reboot disabled"
- noreboot=1
- else
- fail=$2
- fi
-
+ noreboot=0
fi
+#else
+# if [ "$2" = "-n" ] ; then
+# echo "Reboot disabled"
+# noreboot=1
+# else
+# fail=$2
+# fi
+#
+# fi
+
# echo "No reboot"
# echo $noreboot
@@ -139,6 +168,7 @@ if [ "$1" = "" ]; then
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
+ MODE=$1
if [ "$1" = "a" ]; then
echo "Mode is APRS"
@@ -162,6 +192,10 @@ if [ "$1" = "" ]; then
else
echo -n "APRS"
fi
+ elif [ "$1" = "p" ]; then
+ echo "Mode is Pacsat"
+ elif [ "$1" = "P" ]; then
+ echo "Mode is Pacsat Ground Station"
else
echo
fi
@@ -249,13 +283,52 @@ if [ "$1" = "" ]; then
echo "Random Failure Mode is OFF"
fi
- echo -n "TX Frequency is: "
- echo -n ${7}
- echo -n " MHz, RX Frequency is: "
- echo -n ${8}
- echo " MHz"
+HAB=$9
+SQUELCH=$6
+RXPL=${10}
+TXPL=${11}
- if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
+# echo ${14}
+ if [[ ( "${14}" == "sim" || "${14}" == "rig" ) && ( "$MODE" == "f" || "$MODE" == "b" || "$MODE" == "j" || "$MODE" == "G") ]] ; then
+ echo "Doppler frequency shift is ON but not active in this mode (only APRS, CW, SSTV, Pacsat, and Repeater modes)"
+ echo -n "TX Frequency is approximately: "
+ echo -n ${7}
+ echo -n " MHz, RX Frequency is: "
+ echo -n ${8}
+ echo " MHz"
+ elif [ "${14}" = "sim" ] ; then
+ echo "Simulated Doppler frequency shift enabled"
+ echo -n "Current TX and RX Frequency (Hz) is: "
+ cat /home/pi/CubeSatSim/frequency.txt
+ echo
+# echo -n ${7}
+# echo -n " MHz, RX Frequency is: "
+# echo -n ${8}
+# echo " MHz"
+ elif [ "${14}" = "rig" ] ; then
+ echo "Radio Control Doppler frequency shift enabled"
+ echo -n "Current TX Frequency (Hz) is: "
+ head -n 1 /home/pi/CubeSatSim/frequency.txt | cut -d ' ' -f 1
+ echo -n "Current RX Frequency (Hz) is: "
+ head -n 1 /home/pi/CubeSatSim/frequency.txt | cut -d ' ' -f 2
+ elif [[ ( "$MODE" == "f" || "$MODE" == "b" || "$MODE" == "j") ]] ; then
+ echo "Doppler frequency shift is OFF"
+ echo -n "TX Frequency is approximately: "
+ echo -n ${7}
+ echo -n " MHz, RX Frequency is: "
+ echo -n ${8}
+ echo " MHz"
+ else
+ echo "Doppler frequency shift is OFF"
+ echo -n "TX Frequency is: "
+ echo -n ${7}
+ echo -n " MHz, RX Frequency is: "
+ echo -n ${8}
+ echo " MHz"
+
+ fi
+
+ if [ "$HAB" = "yes" ] || [ "$HAB" = "y" ]; then
echo "Balloon mode is ON"
else
echo "Balloon mode is OFF"
@@ -270,8 +343,13 @@ if [ "$1" = "" ]; then
# cat /home/pi/CubeSatSim/command_tx
# echo
- echo -n "Squelch level is: "
- echo $6
+# echo $MODE
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Squelch is off since Pacsat or Pacsat Ground Station mode"
+ else
+ echo -n "Squelch level is: "
+ echo $SQUELCH
+ fi
# echo
FILE=/home/pi/CubeSatSim/command_control
@@ -282,10 +360,18 @@ if [ "$1" = "" ]; then
if [ -f "$FILE" ]; then
echo "Radio DTMF/APRS command and control is ON"
else
- echo "Radio carrier command and control is ON"
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Radio carrier command and control is off since Pacsat or Pacsat Ground Station mode"
+ else
+ echo "Radio carrier command and control is ON"
+ fi
fi
else
- echo "Radio carrier command and control is ON"
+ if [ "$MODE" = "p" ] || [ "$MODE" = "P" ] ; then
+ echo "Radio carrier command and control is off since Pacsat or Pacsat Ground Station mode"
+ else
+ echo "Radio carrier command and control is ON"
+ fi
fi
else
echo "Radio command and control is OFF"
@@ -294,10 +380,10 @@ if [ "$1" = "" ]; then
# echo
echo -n "RX PL code is: "
- echo -n ${10}
+ echo -n $RXPL
# echo
echo -n " TX PL code is: "
- echo ${11}
+ echo $TXPL
# echo
FILE=/home/pi/CubeSatSim/battery_saver
@@ -315,11 +401,47 @@ if [ "$1" = "" ]; then
echo "Transmit beacon telemetry is ON"
fi
+ if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+ else
+ echo "No USB Sound Card detected"
+ soundcard=0
+ fi
+
+ gpio -g mode 7 up
+ if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "FM TXC is present"
+ txc=1
+ else
+ echo "FM TXC not present"
+ txc=0
+ fi
+
+ if [[ $(lsusb | grep "RTL") ]] ; then
+ echo "RTL-SDR detected"
+ rtl=1
+ else
+ echo "No RTL-SDR detected"
+ rtl=0
+ fi
+
+#if [[ $(grep '11.' /etc/debian_version) ]]; then
+if [[ $(grep 'bullseye' /etc/os-release) ]]; then
+ echo "Pi OS is Bullseye (Debian 11)"
+elif [[ $(grep 'bookworm' /etc/os-release) ]]; then
+ echo "Pi OS is Bookworm (Debian 12)"
+elif [[ $(grep 'trixie' /etc/os-release) ]]; then
+ echo "Pi OS is Trixie (Debian 13)"
+fi
+
+
echo
echo -e "Current sim.cfg configuration file:"
# echo
- echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
+# echo $1 $2 $3 $4 $5 $SQUELCH $7 $8 $HAB $RXPL $TXPL ${12} ${13} ${14}
+ cat /home/pi/CubeSatSim/sim.cfg
echo
echo "To change, include an OPTION"
@@ -364,7 +486,22 @@ elif [ "$1" = "-m" ]; then
else
echo "changing CubeSatSim to CW mode"
- check_restart
+
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+ if [ "${14}" = "sim" ] || [ "${14}" = "rig" ] ; then
+ DOPPLER=1
+ else
+ DOPPLER=0
+ fi
+
+ if [ "$DOPPLER" = "1" ] ; then
+ restart=1
+ else
+ check_restart
+ fi
+
sudo echo "m" > /home/pi/CubeSatSim/.mode
fi
@@ -383,7 +520,11 @@ elif [ "$1" = "-f" ]; then
echo "changing CubeSatSim to FSK mode"
sudo echo "f" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-b" ]; then
@@ -400,7 +541,11 @@ elif [ "$1" = "-b" ]; then
echo "changing CubeSatSim to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-s" ]; then
@@ -423,29 +568,32 @@ elif [ "$1" = "-s" ]; then
elif [ "$1" = "-t" ]; then
- echo
- echo "Editing the Simulated Telemetry setting in"
- echo "the configuration file for CubeSatSim"
+ echo "Setting the Simulated Telemetry setting"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
- if [ "$5" = "yes" ] || [ "$5" = "y" ]; then
- echo "Simulated Telemetry is ON"
+ if [ -z "$param2" ] ; then
+
+ if [ "$5" = "yes" ] || [ "$5" = "y" ]; then
+ echo "Simulated Telemetry is ON"
+ else
+ echo "Simulated Telemetry is OFF"
+ fi
+
+ echo
+
+ # $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} ${14}
+
+ echo "Do you want Simulated Telemetry ON (y/n) "
+ read sim
+ echo
else
- echo "Simulated Telemetry is OFF"
+ sim="$param2"
fi
-
- echo
-
-# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13}
-
- echo "Do you want Simulated Telemetry ON (y/n) "
- read sim
- echo
-
+
if [ "$sim" = "y" ] || [ "$sim" = "yes" ] ; then
sim="yes"
echo "Simulated Telemetry is ON"
@@ -454,27 +602,21 @@ elif [ "$1" = "-t" ]; then
echo "Simulated Telemetry is OFF"
echo "-1" > /home/pi/CubeSatSim/failure_mode.txt # make sure to turn off any simulated failures
fi
-
+
# echo
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
# echo
- echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13}
- echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo $1 $2 $3 $4 $sim $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
echo
-## echo "Rebooting CubeSatSim with new configuration file"
-## echo
- reboot=1
-## sudo reboot now
-# sudo restart cubesatsim
+ restart=1
elif [ "$1" = "-c" ]; then
- echo
- echo "Editing the CALLSIGN in the"
- echo "configuration file for CubeSatSim"
+ echo "Setting the CALLSIGN"
echo
- echo "Return keeps current value."
+
# echo -e "Current sim.cfg configuration file:"
# echo
@@ -482,46 +624,39 @@ elif [ "$1" = "-c" ]; then
echo "$value" > /dev/null
set -- $value
- echo "Current value of CALLSIGN is"
- echo $1
+ oldcallsign="$1"
+
+ echo "Current value of CALLSIGN is" $oldcallsign
echo
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13}
+# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} ${14}
- echo "Enter callsign in all capitals: "
- read callsign
+ if [ -z "$param2" ] ; then
- if [ -z $callsign ] ; then
+ echo "Return keeps current value."
+
+ echo "Enter callsign in all capitals: "
+ read callsign
+ else
+ callsign="$param2"
+ fi
+
+ if [ -z $callsign ] ; then
callsign="$1"
echo "Keeping value of" $callsign
- norestart=1
else
-
+ restart=1
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
- echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
- fi
-
- if [ "$norestart" = "1" ]; then
- echo
- else
- echo
-## echo "Rebooting CubeSatSim with new configuration file"
-## echo
- reboot=1
-## sudo reboot now
-# sudo systemctl restart cubesatsim
+ echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo $callsign $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
fi
elif [ "$1" = "-r" ]; then
- echo
- echo "Editing the Reset Count in the"
- echo "configuration file for CubeSatSim"
+ echo "Set the Reset Count for FoxTelem"
echo
- echo "Return keeps current value."
# echo -e "Current sim.cfg configuration file:"
# echo
@@ -530,15 +665,19 @@ elif [ "$1" = "-r" ]; then
set -- $value
echo
- echo "Current value of Reset Count is"
- echo $2
+ echo "Current value of Reset Count is" $2
echo
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
-
- echo -e "Enter Reset Count (integer): "
+# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
- read resets
+ if [ -z "$param2" ] ; then
+ echo "Return keeps current value."
+ echo -e "Enter Reset Count (integer): "
+ read resets
+ else
+ resets="$param2"
+ echo "Reset Count set to" $param2
+ fi
if [ -z $resets ] ; then
resets="$2"
@@ -554,29 +693,22 @@ elif [ "$1" = "-r" ]; then
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
- echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo $1 $resets $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
fi
if [ "$norestart" = "1" ]; then
echo
else
-## echo
-## echo "Rebooting CubeSatSim with new configuration file"
-## echo
- reboot=1
-## sudo reboot now
-# sudo systemctl restart cubesatsim
+ restart=1
fi
elif [ "$1" = "-l" ]; then
- echo
echo "Editing latitude and longitude in the"
echo "configuration file for CubeSatSim"
echo "(Only used for APRS telemetry)"
echo
- echo "Return keeps current value."
# echo -e "Current sim.cfg configuration file:"
# echo
@@ -585,69 +717,78 @@ elif [ "$1" = "-l" ]; then
set -- $value
echo
- echo "Current value of latitude is"
- echo $3
+ echo "Current value of latitude is" $3
echo
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
+# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
- echo -e "Enter latitude (decimal degrees, positive is north): "
+ if [ -z "$param2" ] ; then
- read lat
+ echo "Return keeps current value."
+ echo
+ echo -e "Enter latitude (decimal degrees, positive is north): "
+
+ read lat
+
+ if [ -z $lat ] ; then
+
+ lat="$3"
+ echo "Keeping value of" $lat
+ fi
+
+ echo
+ echo "Current value of longitude is" $4
+ echo
+
+ echo -e "Enter longitude (decimal degrees, positive is east): "
+
+ read long
+
+ if [ -z $long ] ; then
+
+ long="$4"
+ echo "Keeping value of" $long
+ fi
- if [ -z $lat ] ; then
- lat="$3"
- echo "Keeping value of" $lat
+ else
+ lat="$param2"
+ echo "Changing Latitude to" $lat
+ if [ -z "$param3" ] ; then
+ lon="$3"
+ echo "Keeping Longitude of" $lon
+ else
+ long="$param3"
+ echo "Changing Longitude to" $long
+ fi
fi
- if ! [[ $lat =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+ if ! [[ $long =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
echo "Error: not a number!"
- lat="$3"
- echo "Keeping value of" $lat
- fi
-
- echo
- echo "Current value of longitude is"
- echo $4
- echo
-
- echo -e "Enter longitude (decimal degrees, positive is east): "
-
- read long
-
- if [ -z $long ] ; then
-
long="$4"
echo "Keeping value of" $long
- fi
+ fi
- if ! [[ $long =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+ if ! [[ $lat =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
echo "Error: not a number!"
- long="$4"
- echo "Keeping value of" $long
+ lat="$3"
+ echo "Keeping value of" $lat
fi
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
- echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo $1 $2 $lat $long $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
if [ "$norestart" = "1" ]; then
echo
else
-## echo
-## echo "Rebooting CubeSatSim with new configuration file"
-## echo
- reboot=1
-## sudo reboot now
-# sudo systemctl restart cubesatsim
+ restart=1
fi
elif [ "$1" = "-S" ]; then
- echo
echo "Scan both I2C buses on the Raspberry Pi"
echo
@@ -662,13 +803,13 @@ elif [ "$1" = "-S" ]; then
elif [ "$1" = "-C" ]; then
- echo
echo "Clear logs"
echo
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
sudo systemctl stop command
+ sudo systemctl stop pacsatsim
sudo mv -f /home/pi/CubeSatSim/telem.txt /home/pi/CubeSatSim/telem.txt.bk
@@ -685,67 +826,95 @@ elif [ "$1" = "-T" ]; then
echo "Change command and control state"
echo
- FILE=/home/pi/CubeSatSim/command_control
- if [ -f "$FILE" ]; then
- echo "Radio command and control is ON"
- echo
- echo "Do you want to turn command and control to OFF (y/n) "
- read reset
- echo
+ if [ -z "$param2" ] ; then
+ FILE=/home/pi/CubeSatSim/command_control
+ if [ -f "$FILE" ]; then
+ echo "Radio command and control is ON"
+ echo
+ echo "Do you want to turn command and control to OFF (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "Turning command and control OFF"
+ sudo rm /home/pi/CubeSatSim/command_control > /dev/null 2>&1
+ # reboot=1
+ echo "restarting command and control"
+ sudo systemctl restart command
+ echo "restarting transmit"
+ sudo systemctl restart transmit
+ ## sudo reboot now
+ fi
+
+ else
+ echo "Radio command and control is OFF"
+ echo
+ echo "Do you want to set command and control to ON (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+ if [ "$1" != "n" ] ; then
+ echo "Turning command and control ON"
+
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+
+ echo -n "RX Frequency is: "
+ echo -n ${8}
+ echo " MHz"
+ echo
+
+ sudo touch /home/pi/CubeSatSim/command_control
+ echo "restarting command and control"
+ # reboot=1
+ sudo systemctl restart command
+ echo "restarting transmit"
+ sudo systemctl restart transmit
+ ## sudo reboot now
+ else
+ echo "Can't turn on Command and control in Transmit Commands mode."
+ fi
+ fi
+
+ fi
+ else
+ reset="$param2"
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "Turning command and control ON"
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+
+ echo -n "RX Frequency is: "
+ echo -n ${8}
+ echo " MHz"
+ echo
+
+ sudo touch /home/pi/CubeSatSim/command_control
+ echo "restarting command and control"
+ sudo systemctl restart command
+ echo "restarting transmit"
+ sudo systemctl restart transmit
+ else
echo "Turning command and control OFF"
sudo rm /home/pi/CubeSatSim/command_control > /dev/null 2>&1
-# reboot=1
echo "restarting command and control"
sudo systemctl restart command
echo "restarting transmit"
sudo systemctl restart transmit
-## sudo reboot now
- fi
-
- else
- echo "Radio command and control is OFF"
- echo
- echo "Do you want to set command and control to ON (y/n) "
- read reset
- echo
-
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
-
- value=`cat /home/pi/CubeSatSim/.mode`
- echo "$value" > /dev/null
- set -- $value
-
- if [ "$1" != "n" ] ; then
- echo "Turning command and control ON"
-
- value=`cat /home/pi/CubeSatSim/sim.cfg`
- echo "$value" > /dev/null
- set -- $value
-
- echo -n "RX Frequency is: "
- echo -n ${8}
- echo " MHz"
- echo
-
- sudo touch /home/pi/CubeSatSim/command_control
- echo "restarting command and control"
-# reboot=1
- sudo systemctl restart command
- echo "restarting transmit"
- sudo systemctl restart transmit
-## sudo reboot now
- else
- echo "Can't turn on Command and control in Transmit Commands mode."
- fi
fi
-
fi
elif [ "$1" = "-d" ]; then
- echo
echo "Change command and control Direwolf state"
echo
if [[ $(arecord -l | grep card) ]]; then
@@ -755,71 +924,75 @@ elif [ "$1" = "-d" ]; then
echo "Direwolf will not run unless one is plugged in."
fi
- FILE=/home/pi/CubeSatSim/command_control_direwolf
- if [ -f "$FILE" ]; then
- echo "Radio command and control with Direwolf for DTMF and APRS is ON"
- echo
- echo "Do you want to turn Direwolf OFF and do Carrier command and control (y/n) "
- read reset
- echo
-
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Command and control Direwolf set to OFF"
- sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null 2>&1
-# reboot=1
-## echo "rebooting"
- sudo systemctl restart command
-## sudo reboot now
+ if [ -z "$param2" ] ; then
+
+ FILE=/home/pi/CubeSatSim/command_control_direwolf
+ if [ -f "$FILE" ]; then
+ echo "Radio command and control with Direwolf for DTMF and APRS is ON"
+ echo
+ echo "Do you want to turn Direwolf OFF and do Carrier command and control (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "Command and control Direwolf set to OFF"
+ sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null 2>&1
+ sudo systemctl restart command
+ fi
+
+ else
+ echo "Radio command and control with Direwolf for DTMF and APRS is OFF so carrier command and control is enabled"
+ echo
+ echo "Do you want to set command and control with Direwolf for DTMF and APRS to ON (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "Command and control Direwolf set to ON"
+ sudo touch /home/pi/CubeSatSim/command_control_direwolf
+ sudo systemctl restart command
+ if [[ $(arecord -l | grep card) ]]; then
+ restart=1
+ fi
+ fi
+
fi
- else
- echo "Radio command and control with Direwolf for DTMF and APRS is OFF so carrier command and control is enabled"
- echo
- echo "Do you want to set command and control with Direwolf for DTMF and APRS to ON (y/n) "
- read reset
- echo
-
+ FILE=/home/pi/CubeSatSim/command_control
+ if [ -f "$FILE" ]; then
+ echo
+ else
+ echo "Radio command and control is OFF"
+ echo
+ echo "Do you want to set command and control to ON (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "Command and control set to ON"
+ sudo touch /home/pi/CubeSatSim/command_control
+ echo "restarting command and control"
+ sudo systemctl restart command
+ fi
+ fi
+ else
+ reset="$param2"
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "Command and control Direwolf set to ON"
sudo touch /home/pi/CubeSatSim/command_control_direwolf
-## echo "rebooting"
-# reboot=1
sudo systemctl restart command
if [[ $(arecord -l | grep card) ]]; then
restart=1
-### echo "restarting cubesatsim software"
-### sudo systemctl restart cubesatsim
fi
-## sudo reboot now
- fi
-
- fi
-
- FILE=/home/pi/CubeSatSim/command_control
- if [ -f "$FILE" ]; then
- echo
-
- else
- echo "Radio command and control is OFF"
- echo
- echo "Do you want to set command and control to ON (y/n) "
- read reset
- echo
-
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Command and control set to ON"
- sudo touch /home/pi/CubeSatSim/command_control
- echo "restarting command and control"
-# reboot=1
+ else
+ echo "Command and control Direwolf set to OFF"
+ sudo rm /home/pi/CubeSatSim/command_control_direwolf > /dev/null 2>&1
sudo systemctl restart command
-## sudo reboot now
fi
-
fi
elif [ "$1" = "-D" ]; then
- echo
echo "Change Transmit Commands state"
echo
@@ -851,49 +1024,60 @@ elif [ "$1" = "-D" ]; then
elif [ "$1" = "-R" ]; then
- echo
echo "Reset the Commands Count in the file command_count.txt"
echo
- echo "Current commands count is:"
- cat /home/pi/CubeSatSim/commands_count.txt
- echo
+ if [ -z "$param2" ] ; then
- echo "Do you want to reset the commands count to zero (y/n) "
- read reset
- echo
+ echo "Current commands count is:"
+ cat /home/pi/CubeSatSim/command_count.txt
+ echo
+ echo "Do you want to reset the commands count to zero (y/n) "
+ read reset
+ echo
+ else
+ reset="$param2"
+ fi
+
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
sudo rm /home/pi/CubeSatSim/command_count.txt > /dev/null 2>&1
echo "Commands count reset to 0"
- echo "0" > /home/pi/CubeSatSim/command_count.txt
+ echo -n "0" > /home/pi/CubeSatSim/command_count.txt
else
echo "Commands count not reset"
fi
elif [ "$1" = "-B" ]; then
- echo
echo "Manually setting Safe Mode (battery saver mode)"
echo
-
- FILE=/home/pi/CubeSatSim/battery_saver
- if [ -f "$FILE" ]; then
- echo "Safe Mode! Battery saver mode is ON."
- mode=1
- else
- echo "Safe Mode is OFF."
- echo "Battery saver mode is OFF."
- mode=0
- fi
-
- echo
-
- echo "Do you want Safe Mode (battery saver mode) ON (y/n) "
- read saver
- echo
-## reboot=0
+ if [ -z "$param2" ] ; then
+ FILE=/home/pi/CubeSatSim/battery_saver
+ if [ -f "$FILE" ]; then
+ echo "Safe Mode! Battery saver mode is ON."
+ mode=1
+ else
+ echo "Safe Mode is OFF."
+ echo "Battery saver mode is OFF."
+ mode=0
+ fi
+
+ echo
+
+ echo "Do you want Safe Mode (battery saver mode) ON (y/n) "
+ read saver
+ echo
+ else
+ FILE=/home/pi/CubeSatSim/battery_saver
+ if [ -f "$FILE" ]; then
+ mode=1
+ else
+ mode=0
+ fi
+ saver="$param2"
+ fi
if [ "$saver" = "y" ] || [ "$saver" = "yes" ] ; then
if [ "$mode" = "0" ] ; then
@@ -928,34 +1112,34 @@ elif [ "$1" = "-B" ]; then
elif [ "$1" = "-q" ]; then
- echo
- echo "Editing the Squelch setting in"
- echo "the configuration file for CubeSatSim"
+ echo "Setting the Squelch setting"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
- echo
- echo "Current value of squelch is"
- echo $6
- echo
-
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
-
- echo -e "Enter squelch (integer 1 - 8): "
+ if [ -z "$param2" ] ; then
- read sq
+ echo
+ echo "Current value of squelch is" $6
+ echo
+
+ # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+
+ echo -e "Enter squelch (integer 1 - 8): "
+
+ read sq
+ else
+ sq="$param2"
+ fi
if [ -z $sq ] ; then
-
sq="$6"
echo "Keeping value of" $lat
fi
if ! [[ $sq =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
-
echo "Error: not a number!"
sq="$6"
echo "Keeping value of" $sq
@@ -964,8 +1148,8 @@ elif [ "$1" = "-q" ]; then
# echo
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
# echo
- echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} ${12} ${13}
- echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $5 $sq $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo $1 $2 $3 $4 $4 $sq $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
echo
echo "Restarting CubeSatSim with new configuration file"
## echo
@@ -976,128 +1160,164 @@ elif [ "$1" = "-q" ]; then
elif [ "$1" = "-Q" ]; then
-# echo
echo "Reading current Squelch for 10 seconds"
- echo "Squelch is active low (0 means squelch broken)"
+ echo "Squelch is active low (0 means squelch broken, received a signal)"
echo
timeout 10 bash -c -- 'while true; do (gpio read 22 && sleep 1); done'
elif [ "$1" = "-P" ]; then
- echo
- echo "Editing the PL (Private Line) CTCSS/CDCSS setting in"
- echo "the configuration file for CubeSatSim"
+ echo "Setting the PL (Private Line) CTCSS/CDCSS setting"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
- echo
- echo "Current value of RX PL is"
- echo ${10}
- echo "Current value of TX PL is"
- echo ${11}
- echo
-
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
-
- echo -e "Enter RX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)"
-
- read rxpl
+ if [ -z "$param2" ] ; then
- if [ -z $rxpl ] ; then
-
- rxpl="${10}"
- echo "Keeping value of" $rxpl
- else
- restart=1
- fi
-
- if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+ echo
+ echo "Current value of RX PL is" ${10}
+ echo "Current value of TX PL is" ${11}
+ echo
+
+ # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+
+ echo -e "Enter RX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)"
+
+ read rxpl
+
+ if [ -z $rxpl ] ; then
+
+ rxpl="${10}"
+ echo "Keeping value of" $rxpl
+ else
+ restart=1
+ fi
+
+ if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+
+ echo "Error: not a number!"
+ rxpl="${10}"
+ echo "Keeping value of" $rxpl
+ else
+ restart=1
+ fi
+
+ echo -e "Enter TX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)"
+
+ read txpl
+
+ if [ -z $txpl ] ; then
+
+ txpl="${11}"
+ echo "Keeping value of" $txpl
+ fi
+
+ if ! [[ $txpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+
+ echo "Error: not a number!"
+ txpl="${11}"
+ echo "Keeping value of" $txpl
+ fi
- echo "Error: not a number!"
- rxpl="${10}"
- echo "Keeping value of" $rxpl
else
- restart=1
- fi
-
- echo -e "Enter TX PL value integer 0: None, 01-38: CTCSS (analog, 39-121:CDCSS (digital)"
-
- read txpl
-
- if [ -z $txpl ] ; then
-
- txpl="${11}"
- echo "Keeping value of" $txpl
+ rxpl="$param2"
+ echo "Changing RX PL to" $rxpl
+ if ! [[ $rxpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+
+ echo "Error: not a number!"
+ rxpl="${10}"
+ echo "Keeping value of" $rxpl
+ else
+ restart=1
+ fi
+ if [ -z "$param3" ] ; then
+ txpl="${11}"
+ else
+ txpl="$param3"
+ echo "Changing TX PL to" $txpl
+ if ! [[ $txpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
+ echo "Error: not a number!"
+ txpl="${11}"
+ echo "Keeping value of" $txpl
+ fi
+ fi
fi
- if ! [[ $txpl =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
-
- echo "Error: not a number!"
- txpl="${11}"
- echo "Keeping value of" $txpl
- fi
-
# echo
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
# echo
- echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13}
- echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13} ${14}
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $rxpl $txpl ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
echo
## echo "Rebooting CubeSatSim with new configuration file"
## echo
- reboot=1
+ restart=1
## sudo reboot now
# sudo systemctl restart cubesatsim
elif [ "$1" = "-F" ]; then
- echo
- echo "Editing the tx and rx frequency in the"
- echo "configuration file for CubeSatSim"
+ echo "Editing the TX and RX frequency"
echo
- echo "Return keeps current value."
-# echo -e "Current sim.cfg configuration file:"
-# echo
-
+
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
- echo "Current value of tx is"
- echo $7
- echo
- echo "Current value of rx is"
- echo $8
- echo
-
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
+ if [ -z "$param2" ] ; then
- echo "Enter tx frequency as 4XX.XXXX: "
- read tx
+ echo "Current value of TX frequency is" $7 "MHz"
+ echo
+
+ # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
- if [ -z $tx ] ; then
+ echo "Return keeps current value."
+
+ echo "Enter TX frequency in MHz (2m or 70cm band): "
+ read tx
+
+ if [ -z $tx ] ; then
+
+ tx="$7"
+ echo "Keeping value of" $tx "MHz"
+ fi
+ echo
+ echo "Current value of RX frequency is" $8 "MHz"
+ echo
+ echo "Enter RX frequency in MHz (70cm band only): "
+ read rx
+
+ if [ -z $rx ] ; then
+
+ rx="$8"
+ echo "Keeping RX value of" $rx "MHz"
+ fi
- tx="$7"
- echo "Keeping value of" $tx
+ else
+ tx="$param2"
+ echo "Changing TX frequency to" $tx "MHz"
+ if [ -z "$param3" ] ; then
+ rx="$8"
+ echo "Keeping RX value of" $rx "MHz"
+ else
+ rx="$param3"
+ echo "Changing RX frequency to" $rx "MHz"
+ fi
fi
- echo "Enter rx frequency as 4XX.XXXX: "
- read rx
-
- if [ -z $rx ] ; then
-
- rx="$8"
- echo "Keeping value of" $rx
- fi
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13}
- echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13} ${14}
+ echo $1 $2 $3 $4 $5 $6 $tx $rx $9 ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
+
+ rxf=$(echo "$rx * 1000000" | bc)
+ txf=$(echo "$tx * 1000000" | bc)
+ echo $txf $rxf
+ echo $txf $rxf > /home/pi/CubeSatSim/frequency.txt
echo
echo "Restarting CubeSatSim with new configuration file"
@@ -1119,8 +1339,9 @@ elif [ "$1" = "-o" ]; then
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
+ MODE=$1
- if [ "$1" == "n" ]; then
+ if [ "$MODE" == "n" ]; then
transmit_command "o"
@@ -1128,67 +1349,52 @@ elif [ "$1" = "-o" ]; then
echo
echo "Change telemetry beacon transmit state"
echo
-
+
FILE=/home/pi/CubeSatSim/beacon_off
if [ -f "$FILE" ]; then
- echo "Transmit beacon telemetry is off"
-# echo
-# echo "Do you want to turn beacon telemetry ON (y/n) "
-# read reset
-
- reset="y"
+ echo "Transmit beacon telemetry is off"
echo
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Turn beacon telemetry ON"
- sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1
- sudo systemctl restart transmit
- # restart=1
- fi
-
+ echo "Turn beacon telemetry ON"
+ sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1
+ sudo systemctl restart transmit
else
- echo "Transmit beacon telemetry is on"
-# echo
-# echo "Do you want to turn beacon telemetry OFF (y/n) "
-# read reset
- reset="y"
+ echo "Transmit beacon telemetry is on"
echo
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "Turn beacon telemetry OFF"
- touch /home/pi/CubeSatSim/beacon_off
- sudo systemctl restart transmit
- # restart=1
- fi
+ echo "Turn beacon telemetry OFF"
+ touch /home/pi/CubeSatSim/beacon_off
+ sudo systemctl restart transmit
fi
sleep 3
fi
-elif [ "$1" = "-H" ]; then
-
-# echo
- echo "Editing the Balloon mode setting in"
- echo "the configuration file for CubeSatSim"
- echo
-
- value=`cat /home/pi/CubeSatSim/sim.cfg`
- echo "$value" > /dev/null
- set -- $value
-
- if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
- echo "Balloon mode is ON"
- else
- echo "Balloon mode is OFF"
- fi
-
+elif [ "$1" = "-H" ]; then
+
+ echo "Setting Balloon mode"
echo
-# echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
- echo "Do you want Balloon mode ON (y/n) "
- read hab
- echo
+ if [ -z "$param2" ] ; then
+ if [ "$9" = "yes" ] || [ "$9" = "y" ]; then
+ echo "Balloon mode is ON"
+ else
+ echo "Balloon mode is OFF"
+ fi
+
+ echo
+
+ # echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo "Do you want Balloon mode ON (y/n) "
+ read hab
+ echo
+ else
+ hab="$param2"
+ fi
if [ "$hab" = "y" ] || [ "$hab" = "yes" ] ; then
hab="yes"
echo "Balloon mode is ON"
@@ -1200,8 +1406,8 @@ elif [ "$1" = "-H" ]; then
# echo
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
# echo
- echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13}
- echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13} > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13} ${14}
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $hab ${10} ${11} ${12} ${13} ${14} > /home/pi/CubeSatSim/sim.cfg
echo
## echo "Rebooting CubeSatSim with new configuration file"
## echo
@@ -1223,6 +1429,7 @@ elif [ "$1" = "-v" ]; then
echo "Real-time output from the INA219 voltage and current sensors:"
echo
+ /home/pi/CubeSatSim/venv.sh
/home/pi/CubeSatSim/telem
elif [ "$1" = "-e" ]; then
@@ -1239,7 +1446,11 @@ elif [ "$1" = "-e" ]; then
echo "changing CubeSatSim to Repeater mode"
sudo echo "e" > /home/pi/CubeSatSim/.mode
- restart=1
+ if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ reboot=1
+ else
+ restart=1
+ fi
fi
elif [ "$1" = "-n" ]; then
@@ -1262,6 +1473,10 @@ elif [ "$1" = "-n" ]; then
echo "Switching to mode "$new
sudo echo $new > /home/pi/CubeSatSim/.mode
restart=1
+ elif [ "$1" = "p" ] || [ "$1" = "P" ] ; then
+ echo "Switching to Pacsat mode"
+ sudo echo $new > /home/pi/CubeSatSim/.mode
+ reboot=1
else
echo "Switching to BPSK mode"
sudo echo "b" > /home/pi/CubeSatSim/.mode
@@ -1314,7 +1529,7 @@ elif [ "$1" = "-A" ]; then
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
- sudo python3 -u /home/pi/CubeSatSim/transmit.py x > /dev/null 2>&1 & # Force APRS mode
+# sudo python3 -u /home/pi/CubeSatSim/transmit.py x > /dev/null 2>&1 & # Force APRS mode
fi
sudo systemctl stop command
@@ -1323,7 +1538,7 @@ elif [ "$1" = "-A" ]; then
while [ "$MODE" != "x" ];
do
- echo "Enter the mode to change: a=APRS, f=FSK, b=BPSK, s=SSTV, m=CW, e=Repeater, j=FUNcube, o=Beacon on/off x=Exit this mode"
+ echo "Enter the mode to change: a=APRS, f=FSK, b=BPSK, s=SSTV, m=CW, e=Repeater, j=FUNcube, p=Pacsat, o=Beacon on/off x=Exit this mode"
read MODE
if [ "$MODE" != "x" ]; then
@@ -1345,17 +1560,43 @@ elif [ "$1" = "-A" ]; then
elif [ "$1" = "-L" ]; then
- echo
- echo "Setting microphone level for command and control"
+ echo "MicVolume level for Command and Control and Pacsat"
echo
- echo -e "Enter microphone level in percentage (integer 0 - 100): "
+ CARDUSB=$(aplay -l | grep "Device" | grep -oP '(?<=card )\d{1,2}')
+ USBCARD=${CARDUSB:0:1}
+
+ CARD=$(grep -oP '(?<=card )\d{1,2}' /etc/asound.conf)
+
+ if [ -z $USBCARD ] ; then
+ echo "No USB sound card detected"
+ else
+ echo "USB sound card is card" $USBCARD
+ echo "asound.conf is card" $CARD
+ if [ ! "$USBCARD" == "$CARD" ] ; then
+ echo "Change card number in /etc/asound.conf"
+ sudo sed -i "s/card $CARD/card $USBCARD/g" /etc/asound.conf
+ echo "/etc/asound.conf has been updated to:"
+ cat /etc/asound.conf
+ echo "reinitializing alsa"
+ sudo alsactl init
+ fi
+ fi
+
+ echo "Current MicVolume setting is:"
+ value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c $USBCARD sget 'MicVolume'
+ echo
- read mic
+ if [ -z "$param2" ] ; then
+ echo -e "Enter MicVolume level (percent 0 - 100): "
+ read mic
+ else
+ mic="$param2"
+ fi
- if ! [ -z $mic ] && [[ $mic =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] ; then
- echo "Updating mic level"
- value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c ${2:0:1} set Mic $mic%
+ if ! [ -z $mic ] && [[ $mic =~ ^[+]?[0-9]+([.][0-9]+)?$ ]] ; then
+ echo "Updating mic level to" $mic "%"
+ value=`arecord -l | grep "card"` && echo "$value" > /dev/null && set -- $value && amixer -c $USBCARD sset 'MicVolume' $mic%
else
echo "Not updating mic level"
fi
@@ -1370,9 +1611,21 @@ elif [ "$1" = "-g" ]; then
if [ "$rset" = "y" ] || [ "$rset" = "yes" ] ; then
- echo "Resetting and shutting down."
+ echo "Resetting"
+
+ sudo systemctl stop cubesatsim
+ sudo systemctl stop transmit
+ sudo systemctl stop command
+ sudo systemctl stop pacsatsim
+ sudo systemctl stop frequency
+ sudo systemctl stop pushbutton
+ sudo systemctl stop OliveTin
+
+ /home/pi/CubeSatSim/config -L 75
+
+ echo "AMSAT 0 0 0 no 3 434.9 435 no 0 0 no 60 no" > /home/pi/CubeSatSim/sim.cfg
- echo "AMSAT 0 0 0 no 3 434.9 435 no 0 0" > /home/pi/CubeSatSim/sim.cfg
+ echo "434900000 435000000" > /home/pi/CubeSatSim/frequency.txt
sudo echo "b" > /home/pi/CubeSatSim/.mode
@@ -1383,25 +1636,45 @@ elif [ "$1" = "-g" ]; then
sudo touch /home/pi/CubeSatSim/command_control_direwolf
sudo rm /home/pi/CubeSatSim/beacon_off > /dev/null 2>&1
+
+ sudo rm /home/pi/CubeSatSim/command_count.txt
- sudo echo "0" > /home/pi/CubeSatSim/command_count.txt
+ echo -n "0" > /home/pi/CubeSatSim/command_count.txt
sudo rm /home/pi/CubeSatSim/failure_mode.txt > /dev/null 2>&1
- sudo systemctl stop cubesatsim
- sudo systemctl stop transmit
- sudo systemctl stop command
+ sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null 2>&1
+
+ cp /home/pi/CubeSatSim/hotspot_ini /home/pi/CubeSatSim/hotspot.ini
+
+ rpi-connect signout
sudo mv -f /home/pi/CubeSatSim/telem.txt /home/pi/CubeSatSim/telem.txt.bk
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
- rm -rf ~/.config/chromium/Singleton*
+ rm -rf ~/.config/chromium/Singleton* > /dev/null 2>&1
cat /dev/null > ~/.bash_history && history -c
- sudo shutdown now
+ sudo systemctl stop pacsatsim &>/dev/null
+ sudo rm -r /home/pi/PacSat > /dev/null 2>&1
+
+ sudo rm -r /home/pi/PacSatGround > /dev/null 2>&1
+
+ sudo rm -r /home/pi/PacSatGroundLoop > /dev/null 2>&1
+
+ sudo rm /home/pi/CubeSatSim/camera.jpg > /dev/null 2>&1
+
+ if [ "$noreboot" = "0" ] ; then
+ echo "Shutting down."
+ sudo shutdown now
+ else
+ echo
+ echo "Shutdown or reboot to complete the operation."
+ echo
+ fi
# reboot=1
else
@@ -1428,10 +1701,11 @@ elif [ "$1" = "-j" ]; then
elif [ "$1" = "-M" ]; then
- if [ $fail ]; then
- MODE=$fail
- else
+# if [ $fail ]; then
+# MODE=$fail
+# else
+ if [ -z "$param2" ] ; then
FILE=/home/pi/CubeSatSim/failure_mode.txt
if [ -f "$FILE" ]; then
if [[ $(grep "\-1" $FILE) ]]; then
@@ -1504,19 +1778,14 @@ elif [ "$1" = "-M" ]; then
echo "Enter the failure number to set: 0 - 11"
read MODE
echo
+ else
+ MODE="$param2"
+# echo "Setting Simulated Failure" $MODE
fi
if [ "$MODE" = "0" ]; then
echo "Setting No Simulated Failure"
MODE=-1
-# elif [ "$MODE" = "12" ]; then
-
-# if [ "$norestart" = "1" ]; then
-# echo
-# else
-# reboot=1
-# fi
-
else
case $MODE in
1)
@@ -1561,7 +1830,7 @@ elif [ "$1" = "-M" ]; then
# echo $MODE
echo
- sudo rm /home/pi/CubeSatSim/failure_mode.txt
+ sudo rm /home/pi/CubeSatSim/failure_mode.txt &>/dev/null
echo $MODE > /home/pi/CubeSatSim/failure_mode.txt
echo "Changing simulated failure mode to $MODE" | wall
@@ -1618,6 +1887,14 @@ elif [ "$1" = "-N" ]; then
echo "Current mode is FUNcube"
echo "Next mode is Repeater"
/home/pi/CubeSatSim/config -e
+ elif [ "$1" = "e" ]; then
+ echo "Current mode is Repeater"
+ echo "Next mode is Pacsat"
+ /home/pi/CubeSatSim/config -G
+ elif [ "$1" = "p" ]; then
+ echo "Current mode is Pacsat"
+ echo "Next mode is APRS"
+ /home/pi/CubeSatSim/config -a
else
echo "Unknown mode"
fi
@@ -1635,45 +1912,60 @@ elif [ "$1" = "-N" ]; then
elif [ "$1" = "-U" ]; then
- echo
- echo "Changing the Random Simulated Failure setting in"
- echo "the configuration file for CubeSatSim"
+ echo "Changing the Random Simulated Failure setting"
echo
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
- if [ "${12}" = "yes" ] || [ "${12}" = "y" ]; then
- echo "Random Simulated Failure is ON"
+ if [ -z "$param2" ] ; then
+
+ if [ "${12}" = "yes" ] || [ "${12}" = "y" ]; then
+ echo "Random Simulated Failure is ON"
+ else
+ echo "Random Simulated Failure is OFF"
+ fi
+
+ echo
+
+ # $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} ${14}
+
+ echo "Do you want Random Simulated Failure ON (y/n) "
+ read sim
+ echo
else
- echo "Random Simulated Failure is OFF"
+ sim="$param2"
fi
-
- echo
-
-# $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13}
- echo "Do you want Random Simulated Failure ON (y/n) "
- read sim
- echo
-
if [ "$sim" = "y" ] || [ "$sim" = "yes" ] ; then
sim="yes"
echo "Random Simulated Failure is ON"
- echo
- echo "A new random failure is selected every"
- echo ${13} "seconds."
- echo
- echo "Enter a new value or Return keeps current value."
-
- echo "Enter time in seconds (integer): "
+ echo
- read time
+
+ if [ -z "$param3" ] ; then
+
+ echo "A new random failure is selected every"
+ echo ${13} "seconds."
+ echo
+ echo "Enter a new value or Return keeps current value."
+
+ echo "Enter time in seconds (integer): "
+
+ read time
+ else
+ if [ "$sim" != "0" ] ; then
+ time="$param3"
+ echo "Set Random Simulated Failure Time to" $time
+ else
+ time=""
+ fi
+ fi
if [ -z $time ] ; then
time="${13}"
- echo "Keeping value of " $time " seconds"
+ echo "Keeping value of" $time "seconds"
fi
if ! [[ $time =~ ^[0-9]+$ ]] ; then
@@ -1681,7 +1973,7 @@ elif [ "$1" = "-U" ]; then
time="${13}"
echo "Keeping value of" $time
fi
-
+
else
sim="no"
echo "Random Simulated Failure is OFF"
@@ -1692,60 +1984,383 @@ elif [ "$1" = "-U" ]; then
# echo
echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
# echo
- echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time
- echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time > /home/pi/CubeSatSim/sim.cfg
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time ${14}
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $sim $time ${14} > /home/pi/CubeSatSim/sim.cfg
echo
if [ "${12}" != "$sim" ] || [ "${13}" != "$time" ] ; then
- reboot=1
+ restart=1
fi
elif [ "$1" = "-u" ]; then
- echo
- echo "Change gpsd state"
+ echo "Change gpsd State"
echo
+ echo "Note: this is just for a GPS module connected to J12 on the CubeSatSim Lite board."
+ echo "If your GPS module is connected to J12 on the CubeSatSim Main board, always keep gpsd inactive."
+ echo
- if [[ $(sudo systemctl is-active gpsd.socket | grep inactive) ]]; then
- echo "gpsd is inactive"
- echo
- echo "Do you want to turn gpsd to ON (y/n) "
- read reset
- echo
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+ MODE=$1
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "gpsd set to ON"
- sudo systemctl enable gpsd
- sudo systemctl enable gpsd.socket
- echo
- echo "Here is the current gpsd configuration /etc/default/gpsd which will work with many GPS modules:"
- echo
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+ if [ "${14}" = "sim" ] || [ "${14}" = "rig" ] ; then
+ DOPPLER=1
+ else
+ DOPPLER=0
+ fi
- cat /etc/default/gpsd
+ if [ -z "$param2" ] ; then
+ if [[ $(sudo systemctl is-active gpsd.socket | grep inactive) ]]; then
+ echo "gpsd is inactive"
+
+ if [ "$DOPPLER" = "0" ] ; then
+ echo
+ echo "Do you want to turn gpsd to ON (y/n) "
+ read reset
+ echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "gpsd set to ON"
+ sudo systemctl enable gpsd
+ sudo systemctl enable gpsd.socket
+ echo
+ echo "Here is the current gpsd configuration /etc/default/gpsd which will work with many GPS modules:"
+ echo
+
+ cat /etc/default/gpsd
+
+ echo
+ echo "To change this configuration edit the file with sudo nano /etc/default/gpsd then restart gpsd."
+ echo
+ echo "To monitor your gps device, use the gpsmon command."
+ echo
+ reboot=1
+ fi
+ else
+ echo
+ echo "gpsd cannot be turned on with Doppler mode. "
+ echo "To turn on gpsd, first turn off Doppler mode."
+ echo
+ fi
+
+ else
+ echo "gpsd is active"
echo
- echo "To change this configuration edit the file with sudo nano /etc/default/gpsd then restart gpsd."
- echo
- echo "To monitor your gps device, use the gpsmon command."
+ echo "Do you want to turn gpsd to OFF (y/n) "
+ read reset
echo
+
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ echo "gpsd set to OFF"
+ sudo systemctl disable gpsd
+ sudo systemctl disable gpsd.socket
+ reboot=1
+ fi
+
+ fi
+ else
+ reset="$param2"
+ if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
+ if [ "$DOPPLER" = "0" ] ; then
+ echo "gpsd set to ON"
+ sudo systemctl enable gpsd
+ sudo systemctl enable gpsd.socket
+ echo
+ echo "Here is the current gpsd configuration /etc/default/gpsd which will work with many GPS modules:"
+ echo
+
+ cat /etc/default/gpsd
+
+ echo
+ echo "To change this configuration edit the file with sudo nano /etc/default/gpsd then restart gpsd."
+ echo
+ echo "To monitor your gps device, use the gpsmon command."
+ echo
+ reboot=1
+ else
+ echo
+ echo "gpsd cannot be turned on with Doppler mode. "
+ echo "To turn on gpsd, first turn off Doppler mode."
+ echo
+ sudo systemctl disable gpsd
+ sudo systemctl disable gpsd.socket
+ fi
+
+ else
+ echo "gpsd set to OFF"
+ sudo systemctl disable gpsd
+ sudo systemctl disable gpsd.socket
reboot=1
fi
+ fi
- else
- echo "gpsd is active"
+elif [ "$1" = "-G" ]; then
+
+ echo "Changing to Pacsat mode"
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+# echo "changing CubeSatSim to Pacsat mode"
+
+ reboot=1
+ sudo echo "p" > /home/pi/CubeSatSim/.mode
+
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+
+ if [ "${7}" != "434.9" ] && [ "${7}" != "434.900" ] ; then
+ echo "The default transmit frequency of 434.9 MHz is NOT set."
echo
- echo "Do you want to turn gpsd to OFF (y/n) "
- read reset
+ echo "To change the transmit frequency (for example to 434.9 MHz) use the CubeSatSim/config -F command."
+ sleep 5
+
+# read input
+# echo
+#
+# if [ "$input" = "y" ] || [ "$input" = "yes" ] ; then
+# /home/pi/CubeSatSim/config -F n
+# fi
+ fi
+
+elif [ "$1" = "-I" ]; then
+
+ echo "Changing to Pacsat Ground Station mode"
+ echo
+ echo "Run the Pacsat Ground Station in the Desktop"
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+# echo "changing CubeSatSim to Pacsat mode"
+
+# reboot=1
+ check_restart
+ sudo echo "P" > /home/pi/CubeSatSim/.mode
+
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+
+ if [ "${7}" = "434.9" ] && [ "${8}" = "435" ]; then
+ echo "The default transmit frequency of 434.9 MHz is set"
echo
+ echo "To change it (for example to 435 MHz) use the CubeSatSim/config -F command."
- if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
- echo "gpsd set to OFF"
- sudo systemctl disable gpsd
- sudo systemctl disable gpsd.socket
-reboot=1
+# read input
+# echo
+#
+# if [ "$input" = "y" ] || [ "$input" = "yes" ] ; then
+# /home/pi/CubeSatSim/config -F n
+# fi
+ fi
+
+elif [ "$1" = "-k" ]; then
+
+ echo "Reset Pacsat configuration"
+ echo
+ sudo systemctl stop pacsatsim &>/dev/null
+ sudo rm -r /home/pi/PacSat
+ reboot=1
+# sudo systemctl restart pacsatsim
+
+elif [ "$1" = "-K" ]; then
+
+ echo "Setting the Doppler frequency shift mode setting"
+ echo
+
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ echo "$value" > /dev/null
+ set -- $value
+
+ if [ -z "$param2" ] ; then
+
+ doppler="${14}"
+
+ if [ "${14}" = "sim" ] ; then
+ echo "Simulated Doppler frequency shift mode enabled"
+ elif [ "${14}" = "rig" ] ; then
+ echo "Radio Control Doppler frequency shift mode enabled"
+ else
+ echo "Doppler frequency shift is OFF"
+ fi
+
+ echo
+
+ # $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${12} ${13} ${14}
+
+ echo "Do you want Doppler frequency shift ON (y/n) "
+ read sim
+ echo
+
+ if [ "$sim" = "y" ] || [ "$sim" = "yes" ] ; then
+ doppler="yes"
+ echo "Do you want Simulated Doppler shift (sim) or Radio Control Doppler (rig)"
+ echo "Enter sim or rig"
+ read doppler
+
+ if [ "$doppler" = "sim" ] ; then
+ echo "Simulated Doppler frequency shift mode enabled"
+ elif [ "$doppler" = "rig" ] ; then
+ echo "Radio Control Doppler frequency shift mode enabled"
+ else
+ doppler="no"
+ echo "sim or rig not entered. Doppler frequency shift is OFF"
+ fi
+ else
+ doppler="no"
+ echo " Doppler frequency shift is OFF"
+ fi
+ else
+ doppler="$param2"
+ if [ "$doppler" = "sim" ] ; then
+ echo "Simulated Doppler frequency shift mode enabled"
+ elif [ "$doppler" = "rig" ] ; then
+ echo "Radio Control Doppler frequency shift mode enabled"
+ else
+ echo "Doppler frequency shift is OFF"
+ doppler="no"
+ fi
+ fi
+
+# echo
+ echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
+# echo
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} $doppler
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} $doppler > /home/pi/CubeSatSim/sim.cfg
+ echo
+
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+# if [[ ( "$doppler" == "y" || "$doppler" == "yes" ) && ( "$1" == "m" ) && ( "$doppler" == "no" ) ]] ; then
+# reboot=1
+# else
+ restart=1
+# fi
+
+elif [ "$1" = "-V" ]; then
+
+ echo "Changing the maxcpus setting"
+ echo
+
+ if [[ $(grep 'bullseye' /etc/os-release) ]]; then
+ echo "Pi OS is Bullseye (Debian 11)"
+ CMDLINE=/boot/cmdline.txt
+ elif [[ $(grep 'bookworm' /etc/os-release) ]]; then
+ echo "Pi OS is Bookworm (Debian 12)"
+ CMDLINE=/boot/firmware/cmdline.txt
+ else
+ echo "Pi OS is Trixie (Debian 13) or later"
+ CMDLINE=/boot/firmware/cmdline.txt
+ fi
+
+ CPUS=$(cat $CMDLINE| grep -oP 'maxcpus=\K\d+')
+
+ if [ -z "$param2" ] ; then
+
+ if [ -z "$CPUS" ] ; then
+ echo "No current maxcpus is set"
+ else
+ echo "Current maxcpus="$CPUS
+ fi
+ echo
+ echo "How many CPUs do you want to set (1-3) ?"
+ echo "Return keeps current value."
+ echo "0 removes any maxcpus setting"
+
+ NEWCPU="-1"
+ read NEWCPU
+
+ if [ -z $NEWCPU ] ; then
+ echo "No change to maxcpus"
+ elif [ $NEWCPU == "0" ] ; then
+ echo "Removing maxcpus setting"
+ sudo sed -i "s/maxcpus=$CPUS //g" $CMDLINE
+ echo "This change will happen after you reboot"
+ elif [ $NEWCPU == "1" ] || [ $NEWCPU == "2" ] || [ $NEWCPU == "3" ] ; then
+ echo "Setting maxcpus="$NEWCPU
+ if [ -z "$CPUS" ] ; then
+ sudo sed -i "s/console=tty1 r/console=tty1 maxcpus=$NEWCPU r/g" $CMDLINE
+ else
+ sudo sed -i "s/maxcpus=$CPUS/maxcpus=$NEWCPU/g" $CMDLINE
+ fi
+ echo "This change will happen after you reboot"
+ else
+ echo "Invalid maxcpus setting. No change made."
+ fi
+
+ else
+
+ if [ "$param2" == "1" ] || [ "$param2" == "2" ] || [ "$param2" == "3" ] ; then
+ echo "Setting maxcpus="$param2
+ if [ -z "$CPUS" ] ; then
+ sudo sed -i "s/console=tty1 r/console=tty1 maxcpus=$param2 r/g" $CMDLINE
+ else
+ sudo sed -i "s/maxcpus=$CPUS/maxcpus=$param2/g" $CMDLINE
+ fi
+ echo "This change will happen after you reboot"
+ elif [ "$param2" == "0" ] ; then
+ echo "Removing maxcpus setting"
+ sudo sed -i "s/maxcpus=$CPUS //g" $CMDLINE
+ echo "This change will happen after you reboot"
+ else
+ echo "invalid maxcpus value. No change mode."
fi
+ fi
+
+elif [ "$1" = "-w" ]; then
+ echo "Showing PiOS Boot Files"
+ echo
+ if [[ $(grep 'bullseye' /etc/os-release) ]]; then
+ echo "Pi OS is Bullseye (Debian 11)"
+ CMDLINE=/boot/cmdline.txt
+ CONFIG=/boot/config.txt
+ elif [[ $(grep 'bookworm' /etc/os-release) ]]; then
+ echo "Pi OS is Bookworm (Debian 12)"
+ CMDLINE=/boot/firmware/cmdline.txt
+ CONFIG=/boot/firmware/config.txt
+ elif [[ $(grep 'trixie' /etc/os-release) ]]; then
+ echo "Pi OS is Trixie (Debian 13)"
+ CMDLINE=/boot/firmware/cmdline.txt
+ CONFIG=/boot/firmware/config.txt
+ fi
+
+ echo
+ echo "cat" $CMDLINE
+ echo
+ echo
+ cat $CMDLINE
+ echo
+ echo "cat" $CONFIG
+ echo
+ cat $CONFIG
+ echo
+
+elif [ "$1" = "-z" ]; then
+
+ if [[ $(grep 'bullseye' /etc/os-release) ]]; then
+ echo "Pi OS is Bullseye (Debian 11)"
+ raspistill -n -o /home/pi/CubeSatSim/camera.jpg -w 86 -h 64 -q 70 &>/dev/null
+ elif [[ $(grep 'bookworm' /etc/os-release) ]]; then
+ echo "Pi OS is Bookworm (Debian 12)"
+ rpicam-still -n -o /home/pi/CubeSatSim/camera.jpg --width 86 --height 64 -q 70 &>/dev/null
+ elif [[ $(grep 'trixie' /etc/os-release) ]]; then
+ echo "Pi OS is Trixie (Debian 13)"
+ rpicam-still -n -o /home/pi/CubeSatSim/camera.jpg --width 86 --height 64 -q 70 &>/dev/null
fi
+
+ echo "Taking camera image and copying to pacsat img directory"
+ cp /home/pi/CubeSatSim/camera.jpg /home/pi/PacSat/pacsat/img/camera.jpg
elif [ "$1" = "-h" ]; then
@@ -1759,16 +2374,18 @@ elif [ "$1" = "-h" ]; then
echo " -f Change to FSK/DUV mode"
echo " -b Change to BPSK mode"
echo " -s Change to SSTV mode"
- echo " -j Change to FUNcube mode"
- echo " -n Change to Transmit Commands mode"
echo " -e Change to Repeater mode"
+ echo " -j Change to FUNcube mode"
+ echo " -G Change to Pacsat mode"
+ echo " -I Change to Pacsat Ground Station mode"
+ echo " -n Change to Transmit Commands mode"
echo " -i Restart CubeSatsim software"
echo " -c Change the CALLSIGN in the configuration file sim.cfg"
echo " -t Change the Simulated Telemetry setting in sim.cfg"
echo " -r Change the Resets Count in the configuration file sim.cfg"
echo " -l Change the Latitude and Longitude in the configuration file sim.cfg"
echo " -S Scan both I2C buses on the Raspberry Pi"
- echo " -C Clear logs"
+ echo " -C Clear logs and reboot"
echo " -T Change command and control state"
echo " -d Change command and control Direwolf state"
echo " -R Change the Commands Count in the file command_count.txt"
@@ -1779,7 +2396,7 @@ elif [ "$1" = "-h" ]; then
echo " -H Change the Balloon (HAB) mode"
echo " -p Display payload sensor data for 3 seconds"
echo " -v Display voltage and current data"
- echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for RX and TX"
+ echo " -P Change the PL (Private Line) CTCSS/CDCSS codes for FM RX and TX"
echo " -A Transmit APRS control packets to control another CubeSatSim"
echo " -D Change Transmit Commands state APRS or DTMF"
echo " -o Change telemetry beacon transmit state"
@@ -1789,6 +2406,12 @@ elif [ "$1" = "-h" ]; then
echo " -U Change the random failure mode setting"
echo " -N Set next mode or failure"
echo " -u Change gpsd state"
+ echo " -k Reset the Pacsat Configuration"
+ echo " -K Change the Doppler frequency shift setting"
+ echo " -V Set the maximum CPUs"
+ echo " -w Show PiOS boot files"
+ echo " -z Take camera image for PacSat"
+
echo
exit
@@ -1812,7 +2435,7 @@ if [ "$reboot" = "1" ] ; then
if [ "$noreboot" = "0" ] ; then
echo 'Reboot due to config change!' | wall
echo "Rebooting"
- sudo systemctl stop transmit
+ sudo systemctl stop transmit &>/dev/null
sudo reboot now
else
echo "Reboot needed for changes to take effect"
@@ -1823,8 +2446,8 @@ if [ "$restart" = "1" ] ; then
if [ "$reboot" = "0" ] ; then
echo "Restarting"
# sudo systemctl stop transmit
- sudo systemctl restart cubesatsim
- sudo systemctl restart transmit
+ sudo systemctl restart cubesatsim &>/dev/null
+ sudo systemctl restart transmit &>/dev/null
else
echo "Restart needed for changes to take effect"
fi
diff --git a/direwolf-cc.conf b/direwolf-cc.conf
index 26f8805b..d6baa9ef 100644
--- a/direwolf-cc.conf
+++ b/direwolf-cc.conf
@@ -1,2 +1,9 @@
ADEVICE shared_mic hw:CARD=Loopback,DEV=1
DTMF
+MYCALL AMSAT
+CHANNEL 0
+MODEM 1200
+FULLDUP OFF
+#TXDELAY 0
+AGWPORT 8200
+KISSPORT 8203
diff --git a/direwolf/direwolf-pacsatsim.conf b/direwolf/direwolf-pacsatsim.conf
new file mode 100644
index 00000000..8353c396
--- /dev/null
+++ b/direwolf/direwolf-pacsatsim.conf
@@ -0,0 +1,9 @@
+CHANNEL 0
+MODEM 1200
+DWAIT 0
+SLOTTIME 10
+PERSIST 63
+TXDELAY 30
+TXTAIL 10
+FULLDUP OFF
+DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE
diff --git a/direwolf/direwolf-transmit-dtmf.conf b/direwolf/direwolf-transmit-dtmf.conf
index a2fdd69c..f5853dff 100644
--- a/direwolf/direwolf-transmit-dtmf.conf
+++ b/direwolf/direwolf-transmit-dtmf.conf
@@ -1,4 +1,5 @@
ADEVICE hw:CARD=Loopback,DEV=0 hw:CARD=Headphones,DEV=0
+PTT GPIO 20
MYCALL AMSAT
CHANNEL 0
MODEM 1200
diff --git a/direwolf/direwolf.conf b/direwolf/direwolf.conf
deleted file mode 100644
index 701d80b4..00000000
--- a/direwolf/direwolf.conf
+++ /dev/null
@@ -1 +0,0 @@
-ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0
diff --git a/dtmf_aprs_cc.py b/dtmf_aprs_cc.py
index cfa58788..34ae0a7b 100644
--- a/dtmf_aprs_cc.py
+++ b/dtmf_aprs_cc.py
@@ -1,15 +1,20 @@
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!')
+def blink(times):
+ for i in range(times):
+ system("gpio write 27 0")
+ sleep(0.1)
+ system("gpio write 27 1")
+ sleep(0.1)
+
if __name__ == "__main__":
powerPin = 16
- txLed = 27
+ txLed = 17
change_mode = False
debug_mode = False
counter = 1
@@ -17,252 +22,178 @@ if __name__ == "__main__":
# 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
- 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
- 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
- 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
- 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
- if ((line.find("DTMF>APDW15:t5#")) > 0):
- system("echo '\nCW Mode!!\n'")
- mode = 'm'
- change_mode = True
- if ((line.find("MODE=e")) > 0):
- system("echo '\nRepeater Mode!!\n'")
- mode = 'e'
- change_mode = True
- if ((line.find("DTMF>APDW15:t6#")) > 0):
- system("echo '\nRepeater Mode!!\n'")
- mode = 'e'
- change_mode = True
- if ((line.find("MODE=j")) > 0):
- system("echo '\nFUNcube Mode!!\n'")
- mode = 'j'
- change_mode = True
- if ((line.find("DTMF>APDW15:t7#")) > 0):
- system("echo '\nFUNcube Mode!!\n'")
- mode = 'j'
- change_mode = True
- if ((line.find("MODE=n")) > 0):
- system("echo '\nTransmit Commands Mode!!\n'")
- mode = 'n'
- change_mode = True
- if ((line.find("DTMF>APDW15:t11#")) > 0):
- system("echo '\nTransmit Commands Mode!!\n'")
- mode = 'n'
- change_mode = True
- if ((line.find("MODE=o")) > 0):
- counter = (counter + 1) % 2 # Direwolf prints it twice, only do once
- if (counter == 1):
- system("echo '\nBeacon Mode toggle!!\n'")
- mode = 'o'
- change_mode = True
- counter = 1
- 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
- if (debug_mode == False) and (change_mode == True): # 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)
+ while True:
+ try:
+ for line in sys.stdin:
+ # if (debug_mode):
+ print(line, end =" ")
+ logging.warning(line)
+
+ # if '^c' == line.rstrip():
+ # break
- 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)
+ if ((line.find("MODE=a")) > 0):
+ system("echo '\nAPRS Mode!!\n'")
+ mode = 'a'
+ change_mode = True
+
+ elif ((line.find(":t1#")) > 0):
+ system("echo '\nAPRS Mode!!\n'")
+ mode = 'a'
+ change_mode = True
+ elif ((line.find("MODE=f")) > 0):
+ system("echo '\nFSK Mode!!\n'")
+ mode = 'f'
+ change_mode = True
+
+ elif ((line.find(":t2#")) > 0):
+ system("echo '\nFSK Mode!!\n'")
+ mode = 'f'
+ change_mode = True
+
+ elif ((line.find("MODE=b")) > 0):
+ system("echo '\nBPSK Mode!!\n'")
+ mode = 'b'
+ change_mode = True
+
+ elif ((line.find(":t3#")) > 0):
+ system("echo '\nBPSK Mode!!\n'")
+ mode = 'b'
+ change_mode = True
+
+ elif ((line.find("MODE=s")) > 0):
+ system("echo '\nSSTV Mode!!\n'")
+ mode = 's'
+ change_mode = True
+
+ elif ((line.find(":t4#")) > 0):
+ system("echo '\nSSTV Mode!!\n'")
+ mode = 's'
+ change_mode = True
+
+ elif ((line.find("MODE=m")) > 0):
+ system("echo '\nCW Mode!!\n'")
+ mode = 'm'
+ change_mode = True
+
+ elif ((line.find(":t5#")) > 0):
+ system("echo '\nCW Mode!!\n'")
+ mode = 'm'
+ change_mode = True
+
+ elif ((line.find("MODE=e")) > 0):
+ system("echo '\nRepeater Mode!!\n'")
+ mode = 'e'
+ change_mode = True
- elif (mode == 'e'):
- GPIO.output(powerPin, 0) # blink six 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(0.1)
- GPIO.output(powerPin, 0)
- sleep(0.1)
- GPIO.output(powerPin, 1)
- sleep(1)
+ elif ((line.find(":t6#")) > 0):
+ system("echo '\nRepeater Mode!!\n'")
+ mode = 'e'
+ change_mode = True
+
+ elif ((line.find("MODE=j")) > 0):
+ system("echo '\nFUNcube Mode!!\n'")
+ mode = 'j'
+ change_mode = True
+
+ elif ((line.find(":t7#")) > 0):
+ system("echo '\nFUNcube Mode!!\n'")
+ mode = 'j'
+ change_mode = True
+
+ elif ((line.find("MODE=G")) > 0):
+ system("echo '\nPacSatSim Mode!!\n'")
+ mode = 'G'
+ change_mode = True
+
+ elif ((line.find(":t8#")) > 0):
+ system("echo '\nPacSatSim Mode!!\n'")
+ mode = 'G'
+ change_mode = True
+
+ elif ((line.find("MODE=n")) > 0):
+ system("echo '\nTransmit Commands Mode!!\n'")
+ mode = 'n'
+ change_mode = True
+
+ elif ((line.find(":t11#")) > 0):
+ system("echo '\nTransmit Commands Mode!!\n'")
+ mode = 'n'
+ change_mode = True
- elif (mode == 'j'):
- GPIO.output(powerPin, 0) # blink seven 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(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 transmit")
-# system("sudo systemctl stop cubesatsim")
-
- print("\n/home/pi/CubeSatSim/config -" + mode)
- system("/home/pi/CubeSatSim/config -" + mode)
+ elif ((line.find("MODE=o")) > 0):
+ system("echo '\nBeacon Mode toggle!!\n'")
+ mode = 'o'
+ change_mode = True
+# counter = (counter + 1) % 2
+
+ elif ((line.find(":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
+
+ if (mode == 'f'):
+ blink(2)
+ sleep(1)
+
+ elif (mode == 'b'):
+ blink(3)
+ sleep(1)
+
+ elif (mode == 's'):
+ blink(4)
+ sleep(1)
+
+ elif (mode == 'm'):
+ blink(5)
+ sleep(1)
+
+ elif (mode == 'e'):
+ blink(6)
+ sleep(1)
+
+ elif (mode == 'j'):
+ blink(7)
+ sleep(1)
+
+ elif (mode == 'p'):
+ blink(8)
+ sleep(1)
+
+ elif (mode == 'a'):
+ blink(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)
+ system("gpio write " + str(txLed) + " 0")
+ system("gpio write " + str(powerPin) + " 0")
+ system("sudo systemctl stop transmit")
+ # system("sudo systemctl stop cubesatsim")
+
+ print("\n/home/pi/CubeSatSim/config -" + mode)
+ system("/home/pi/CubeSatSim/config -" + mode)
+
+ change_mode = False
+ except:
+ print("Error reading line (probably due to UTF-8 issue)")
-
- change_mode = False
-
print("Waiting 5 seconds to allow unplug and plug of soundcard")
sleep(5)
print("Done")
diff --git a/frequency.py b/frequency.py
new file mode 100644
index 00000000..e46f8821
--- /dev/null
+++ b/frequency.py
@@ -0,0 +1,869 @@
+#!/usr/bin/env python
+
+#import subprocess
+import time
+from time import sleep
+#import os
+import sys
+from os import system
+
+def check_frequency():
+
+ global tx_doppler_freq_hz
+ global rx_doppler_freq_hz
+ tx_OK = False
+ rx_OK = False
+
+ if tx_doppler_freq_hz > 450000000:
+ tx_doppler_freq_hz = 435200000
+ elif (tx_doppler_freq_hz < 420000000) and (tx_doppler_freq_hz > 148000000):
+ tx_doppler_freq_hz = 434700000
+ elif (tx_doppler_freq_hz < 144000000):
+ tx_doppler_freq_hz = 434600000
+ else:
+ tx_OK = True
+
+ if rx_doppler_freq_hz > 450000000:
+ rx_doppler_freq_hz = 435200000
+ elif (rx_doppler_freq_hz < 420000000) and (rx_doppler_freq_hz > 148000000):
+ rx_doppler_freq_hz = 434700000
+ elif (rx_doppler_freq_hz < 144000000):
+ rx_doppler_freq_hz = 434600000
+ else:
+ rx_OK = True
+
+ if (tx_OK != True) or (rx_OK != True):
+ print("Error - frequency out of range!")
+
+iss_doppler_passes = {
+ 88: [
+ {"time_sec": 1, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 2, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 3, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 4, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 5, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 6, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 7, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 8, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 9, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 10, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 11, "doppler_434_khz": 9987, "doppler_144_khz": 3329},
+ {"time_sec": 12, "doppler_434_khz": 9986, "doppler_144_khz": 3329},
+ {"time_sec": 13, "doppler_434_khz": 9986, "doppler_144_khz": 3329},
+ {"time_sec": 14, "doppler_434_khz": 9986, "doppler_144_khz": 3329},
+ {"time_sec": 15, "doppler_434_khz": 9986, "doppler_144_khz": 3329},
+ {"time_sec": 16, "doppler_434_khz": 9986, "doppler_144_khz": 3329},
+ {"time_sec": 17, "doppler_434_khz": 9985, "doppler_144_khz": 3328},
+ {"time_sec": 18, "doppler_434_khz": 9985, "doppler_144_khz": 3328},
+ {"time_sec": 19, "doppler_434_khz": 9985, "doppler_144_khz": 3328},
+ {"time_sec": 20, "doppler_434_khz": 9985, "doppler_144_khz": 3328},
+ {"time_sec": 21, "doppler_434_khz": 9984, "doppler_144_khz": 3328},
+ {"time_sec": 22, "doppler_434_khz": 9984, "doppler_144_khz": 3328},
+ {"time_sec": 23, "doppler_434_khz": 9984, "doppler_144_khz": 3328},
+ {"time_sec": 24, "doppler_434_khz": 9984, "doppler_144_khz": 3328},
+ {"time_sec": 25, "doppler_434_khz": 9983, "doppler_144_khz": 3328},
+ {"time_sec": 26, "doppler_434_khz": 9983, "doppler_144_khz": 3328},
+ {"time_sec": 27, "doppler_434_khz": 9983, "doppler_144_khz": 3328},
+ {"time_sec": 28, "doppler_434_khz": 9982, "doppler_144_khz": 3327},
+ {"time_sec": 29, "doppler_434_khz": 9982, "doppler_144_khz": 3327},
+ {"time_sec": 30, "doppler_434_khz": 9982, "doppler_144_khz": 3327},
+ {"time_sec": 31, "doppler_434_khz": 9981, "doppler_144_khz": 3327},
+ {"time_sec": 32, "doppler_434_khz": 9981, "doppler_144_khz": 3327},
+ {"time_sec": 33, "doppler_434_khz": 9980, "doppler_144_khz": 3327},
+ {"time_sec": 34, "doppler_434_khz": 9980, "doppler_144_khz": 3327},
+ {"time_sec": 35, "doppler_434_khz": 9979, "doppler_144_khz": 3326},
+ {"time_sec": 36, "doppler_434_khz": 9979, "doppler_144_khz": 3326},
+ {"time_sec": 37, "doppler_434_khz": 9978, "doppler_144_khz": 3326},
+ {"time_sec": 38, "doppler_434_khz": 9978, "doppler_144_khz": 3326},
+ {"time_sec": 39, "doppler_434_khz": 9977, "doppler_144_khz": 3326},
+ {"time_sec": 40, "doppler_434_khz": 9977, "doppler_144_khz": 3326},
+ {"time_sec": 41, "doppler_434_khz": 9976, "doppler_144_khz": 3325},
+ {"time_sec": 42, "doppler_434_khz": 9975, "doppler_144_khz": 3325},
+ {"time_sec": 43, "doppler_434_khz": 9975, "doppler_144_khz": 3325},
+ {"time_sec": 44, "doppler_434_khz": 9974, "doppler_144_khz": 3325},
+ {"time_sec": 45, "doppler_434_khz": 9973, "doppler_144_khz": 3324},
+ {"time_sec": 46, "doppler_434_khz": 9973, "doppler_144_khz": 3324},
+ {"time_sec": 47, "doppler_434_khz": 9972, "doppler_144_khz": 3324},
+ {"time_sec": 48, "doppler_434_khz": 9972, "doppler_144_khz": 3324},
+ {"time_sec": 49, "doppler_434_khz": 9971, "doppler_144_khz": 3324},
+ {"time_sec": 50, "doppler_434_khz": 9970, "doppler_144_khz": 3323},
+ {"time_sec": 51, "doppler_434_khz": 9969, "doppler_144_khz": 3323},
+ {"time_sec": 52, "doppler_434_khz": 9969, "doppler_144_khz": 3323},
+ {"time_sec": 53, "doppler_434_khz": 9968, "doppler_144_khz": 3323},
+ {"time_sec": 54, "doppler_434_khz": 9967, "doppler_144_khz": 3322},
+ {"time_sec": 55, "doppler_434_khz": 9966, "doppler_144_khz": 3322},
+ {"time_sec": 56, "doppler_434_khz": 9966, "doppler_144_khz": 3322},
+ {"time_sec": 57, "doppler_434_khz": 9964, "doppler_144_khz": 3321},
+ {"time_sec": 58, "doppler_434_khz": 9963, "doppler_144_khz": 3321},
+ {"time_sec": 59, "doppler_434_khz": 9963, "doppler_144_khz": 3321},
+ {"time_sec": 60, "doppler_434_khz": 9962, "doppler_144_khz": 3321},
+ {"time_sec": 61, "doppler_434_khz": 9961, "doppler_144_khz": 3320},
+ {"time_sec": 62, "doppler_434_khz": 9959, "doppler_144_khz": 3320},
+ {"time_sec": 63, "doppler_434_khz": 9959, "doppler_144_khz": 3320},
+ {"time_sec": 64, "doppler_434_khz": 9958, "doppler_144_khz": 3319},
+ {"time_sec": 65, "doppler_434_khz": 9957, "doppler_144_khz": 3319},
+ {"time_sec": 66, "doppler_434_khz": 9955, "doppler_144_khz": 3318},
+ {"time_sec": 67, "doppler_434_khz": 9954, "doppler_144_khz": 3318},
+ {"time_sec": 68, "doppler_434_khz": 9953, "doppler_144_khz": 3318},
+ {"time_sec": 69, "doppler_434_khz": 9952, "doppler_144_khz": 3317},
+ {"time_sec": 70, "doppler_434_khz": 9951, "doppler_144_khz": 3317},
+ {"time_sec": 71, "doppler_434_khz": 9950, "doppler_144_khz": 3317},
+ {"time_sec": 72, "doppler_434_khz": 9949, "doppler_144_khz": 3316},
+ {"time_sec": 73, "doppler_434_khz": 9948, "doppler_144_khz": 3316},
+ {"time_sec": 74, "doppler_434_khz": 9946, "doppler_144_khz": 3315},
+ {"time_sec": 75, "doppler_434_khz": 9945, "doppler_144_khz": 3315},
+ {"time_sec": 76, "doppler_434_khz": 9943, "doppler_144_khz": 3314},
+ {"time_sec": 77, "doppler_434_khz": 9942, "doppler_144_khz": 3314},
+ {"time_sec": 78, "doppler_434_khz": 9941, "doppler_144_khz": 3314},
+ {"time_sec": 79, "doppler_434_khz": 9939, "doppler_144_khz": 3313},
+ {"time_sec": 80, "doppler_434_khz": 9938, "doppler_144_khz": 3313},
+ {"time_sec": 81, "doppler_434_khz": 9937, "doppler_144_khz": 3312},
+ {"time_sec": 82, "doppler_434_khz": 9936, "doppler_144_khz": 3312},
+ {"time_sec": 83, "doppler_434_khz": 9933, "doppler_144_khz": 3311},
+ {"time_sec": 84, "doppler_434_khz": 9932, "doppler_144_khz": 3311},
+ {"time_sec": 85, "doppler_434_khz": 9931, "doppler_144_khz": 3310},
+ {"time_sec": 86, "doppler_434_khz": 9929, "doppler_144_khz": 3310},
+ {"time_sec": 87, "doppler_434_khz": 9927, "doppler_144_khz": 3309},
+ {"time_sec": 88, "doppler_434_khz": 9925, "doppler_144_khz": 3308},
+ {"time_sec": 89, "doppler_434_khz": 9924, "doppler_144_khz": 3308},
+ {"time_sec": 90, "doppler_434_khz": 9923, "doppler_144_khz": 3308},
+ {"time_sec": 91, "doppler_434_khz": 9920, "doppler_144_khz": 3307},
+ {"time_sec": 92, "doppler_434_khz": 9918, "doppler_144_khz": 3306},
+ {"time_sec": 93, "doppler_434_khz": 9917, "doppler_144_khz": 3306},
+ {"time_sec": 94, "doppler_434_khz": 9915, "doppler_144_khz": 3305},
+ {"time_sec": 95, "doppler_434_khz": 9912, "doppler_144_khz": 3304},
+ {"time_sec": 96, "doppler_434_khz": 9911, "doppler_144_khz": 3304},
+ {"time_sec": 97, "doppler_434_khz": 9909, "doppler_144_khz": 3303},
+ {"time_sec": 98, "doppler_434_khz": 9907, "doppler_144_khz": 3302},
+ {"time_sec": 99, "doppler_434_khz": 9906, "doppler_144_khz": 3302},
+ {"time_sec": 100, "doppler_434_khz": 9903, "doppler_144_khz": 3301},
+ {"time_sec": 101, "doppler_434_khz": 9901, "doppler_144_khz": 3300},
+ {"time_sec": 102, "doppler_434_khz": 9899, "doppler_144_khz": 3300},
+ {"time_sec": 103, "doppler_434_khz": 9897, "doppler_144_khz": 3299},
+ {"time_sec": 104, "doppler_434_khz": 9894, "doppler_144_khz": 3298},
+ {"time_sec": 105, "doppler_434_khz": 9892, "doppler_144_khz": 3297},
+ {"time_sec": 106, "doppler_434_khz": 9890, "doppler_144_khz": 3297},
+ {"time_sec": 107, "doppler_434_khz": 9888, "doppler_144_khz": 3296},
+ {"time_sec": 108, "doppler_434_khz": 9884, "doppler_144_khz": 3295},
+ {"time_sec": 109, "doppler_434_khz": 9882, "doppler_144_khz": 3294},
+ {"time_sec": 110, "doppler_434_khz": 9880, "doppler_144_khz": 3293},
+ {"time_sec": 111, "doppler_434_khz": 9878, "doppler_144_khz": 3293},
+ {"time_sec": 112, "doppler_434_khz": 9874, "doppler_144_khz": 3291},
+ {"time_sec": 113, "doppler_434_khz": 9872, "doppler_144_khz": 3291},
+ {"time_sec": 114, "doppler_434_khz": 9870, "doppler_144_khz": 3290},
+ {"time_sec": 115, "doppler_434_khz": 9868, "doppler_144_khz": 3289},
+ {"time_sec": 116, "doppler_434_khz": 9864, "doppler_144_khz": 3288},
+ {"time_sec": 117, "doppler_434_khz": 9861, "doppler_144_khz": 3287},
+ {"time_sec": 118, "doppler_434_khz": 9859, "doppler_144_khz": 3286},
+ {"time_sec": 119, "doppler_434_khz": 9857, "doppler_144_khz": 3286},
+ {"time_sec": 120, "doppler_434_khz": 9852, "doppler_144_khz": 3284},
+ {"time_sec": 121, "doppler_434_khz": 9850, "doppler_144_khz": 3283},
+ {"time_sec": 122, "doppler_434_khz": 9847, "doppler_144_khz": 3282},
+ {"time_sec": 123, "doppler_434_khz": 9845, "doppler_144_khz": 3282},
+ {"time_sec": 124, "doppler_434_khz": 9842, "doppler_144_khz": 3281},
+ {"time_sec": 125, "doppler_434_khz": 9837, "doppler_144_khz": 3279},
+ {"time_sec": 126, "doppler_434_khz": 9834, "doppler_144_khz": 3278},
+ {"time_sec": 127, "doppler_434_khz": 9832, "doppler_144_khz": 3277},
+ {"time_sec": 128, "doppler_434_khz": 9829, "doppler_144_khz": 3276},
+ {"time_sec": 129, "doppler_434_khz": 9823, "doppler_144_khz": 3274},
+ {"time_sec": 130, "doppler_434_khz": 9821, "doppler_144_khz": 3274},
+ {"time_sec": 131, "doppler_434_khz": 9818, "doppler_144_khz": 3273},
+ {"time_sec": 132, "doppler_434_khz": 9815, "doppler_144_khz": 3272},
+ {"time_sec": 133, "doppler_434_khz": 9812, "doppler_144_khz": 3271},
+ {"time_sec": 134, "doppler_434_khz": 9806, "doppler_144_khz": 3269},
+ {"time_sec": 135, "doppler_434_khz": 9803, "doppler_144_khz": 3268},
+ {"time_sec": 136, "doppler_434_khz": 9800, "doppler_144_khz": 3267},
+ {"time_sec": 137, "doppler_434_khz": 9796, "doppler_144_khz": 3265},
+ {"time_sec": 138, "doppler_434_khz": 9790, "doppler_144_khz": 3263},
+ {"time_sec": 139, "doppler_434_khz": 9787, "doppler_144_khz": 3262},
+ {"time_sec": 140, "doppler_434_khz": 9783, "doppler_144_khz": 3261},
+ {"time_sec": 141, "doppler_434_khz": 9780, "doppler_144_khz": 3260},
+ {"time_sec": 142, "doppler_434_khz": 9773, "doppler_144_khz": 3258},
+ {"time_sec": 143, "doppler_434_khz": 9769, "doppler_144_khz": 3256},
+ {"time_sec": 144, "doppler_434_khz": 9766, "doppler_144_khz": 3255},
+ {"time_sec": 145, "doppler_434_khz": 9762, "doppler_144_khz": 3254},
+ {"time_sec": 146, "doppler_434_khz": 9759, "doppler_144_khz": 3253},
+ {"time_sec": 147, "doppler_434_khz": 9751, "doppler_144_khz": 3250},
+ {"time_sec": 148, "doppler_434_khz": 9747, "doppler_144_khz": 3249},
+ {"time_sec": 149, "doppler_434_khz": 9743, "doppler_144_khz": 3248},
+ {"time_sec": 150, "doppler_434_khz": 9739, "doppler_144_khz": 3246},
+ {"time_sec": 151, "doppler_434_khz": 9731, "doppler_144_khz": 3244},
+ {"time_sec": 152, "doppler_434_khz": 9727, "doppler_144_khz": 3242},
+ {"time_sec": 153, "doppler_434_khz": 9723, "doppler_144_khz": 3241},
+ {"time_sec": 154, "doppler_434_khz": 9719, "doppler_144_khz": 3240},
+ {"time_sec": 155, "doppler_434_khz": 9715, "doppler_144_khz": 3238},
+ {"time_sec": 156, "doppler_434_khz": 9706, "doppler_144_khz": 3235},
+ {"time_sec": 157, "doppler_434_khz": 9701, "doppler_144_khz": 3234},
+ {"time_sec": 158, "doppler_434_khz": 9697, "doppler_144_khz": 3232},
+ {"time_sec": 159, "doppler_434_khz": 9692, "doppler_144_khz": 3231},
+ {"time_sec": 160, "doppler_434_khz": 9683, "doppler_144_khz": 3228},
+ {"time_sec": 161, "doppler_434_khz": 9678, "doppler_144_khz": 3226},
+ {"time_sec": 162, "doppler_434_khz": 9673, "doppler_144_khz": 3224},
+ {"time_sec": 163, "doppler_434_khz": 9668, "doppler_144_khz": 3223},
+ {"time_sec": 164, "doppler_434_khz": 9658, "doppler_144_khz": 3219},
+ {"time_sec": 165, "doppler_434_khz": 9653, "doppler_144_khz": 3218},
+ {"time_sec": 166, "doppler_434_khz": 9647, "doppler_144_khz": 3216},
+ {"time_sec": 167, "doppler_434_khz": 9642, "doppler_144_khz": 3214},
+ {"time_sec": 168, "doppler_434_khz": 9637, "doppler_144_khz": 3212},
+ {"time_sec": 169, "doppler_434_khz": 9626, "doppler_144_khz": 3209},
+ {"time_sec": 170, "doppler_434_khz": 9620, "doppler_144_khz": 3207},
+ {"time_sec": 171, "doppler_434_khz": 9614, "doppler_144_khz": 3205},
+ {"time_sec": 172, "doppler_434_khz": 9608, "doppler_144_khz": 3203},
+ {"time_sec": 173, "doppler_434_khz": 9597, "doppler_144_khz": 3199},
+ {"time_sec": 174, "doppler_434_khz": 9590, "doppler_144_khz": 3197},
+ {"time_sec": 175, "doppler_434_khz": 9584, "doppler_144_khz": 3195},
+ {"time_sec": 176, "doppler_434_khz": 9578, "doppler_144_khz": 3193},
+ {"time_sec": 177, "doppler_434_khz": 9572, "doppler_144_khz": 3191},
+ {"time_sec": 178, "doppler_434_khz": 9559, "doppler_144_khz": 3186},
+ {"time_sec": 179, "doppler_434_khz": 9552, "doppler_144_khz": 3184},
+ {"time_sec": 180, "doppler_434_khz": 9545, "doppler_144_khz": 3182},
+ {"time_sec": 181, "doppler_434_khz": 9539, "doppler_144_khz": 3180},
+ {"time_sec": 182, "doppler_434_khz": 9525, "doppler_144_khz": 3175},
+ {"time_sec": 183, "doppler_434_khz": 9518, "doppler_144_khz": 3173},
+ {"time_sec": 184, "doppler_434_khz": 9510, "doppler_144_khz": 3170},
+ {"time_sec": 185, "doppler_434_khz": 9503, "doppler_144_khz": 3168},
+ {"time_sec": 186, "doppler_434_khz": 9488, "doppler_144_khz": 3163},
+ {"time_sec": 187, "doppler_434_khz": 9480, "doppler_144_khz": 3160},
+ {"time_sec": 188, "doppler_434_khz": 9472, "doppler_144_khz": 3157},
+ {"time_sec": 189, "doppler_434_khz": 9464, "doppler_144_khz": 3155},
+ {"time_sec": 190, "doppler_434_khz": 9456, "doppler_144_khz": 3152},
+ {"time_sec": 191, "doppler_434_khz": 9440, "doppler_144_khz": 3147},
+ {"time_sec": 192, "doppler_434_khz": 9432, "doppler_144_khz": 3144},
+ {"time_sec": 193, "doppler_434_khz": 9423, "doppler_144_khz": 3141},
+ {"time_sec": 194, "doppler_434_khz": 9414, "doppler_144_khz": 3138},
+ {"time_sec": 195, "doppler_434_khz": 9396, "doppler_144_khz": 3132},
+ {"time_sec": 196, "doppler_434_khz": 9387, "doppler_144_khz": 3129},
+ {"time_sec": 197, "doppler_434_khz": 9378, "doppler_144_khz": 3126},
+ {"time_sec": 198, "doppler_434_khz": 9369, "doppler_144_khz": 3123},
+ {"time_sec": 199, "doppler_434_khz": 9349, "doppler_144_khz": 3116},
+ {"time_sec": 200, "doppler_434_khz": 9339, "doppler_144_khz": 3113},
+ {"time_sec": 201, "doppler_434_khz": 9329, "doppler_144_khz": 3110},
+ {"time_sec": 202, "doppler_434_khz": 9318, "doppler_144_khz": 3106},
+ {"time_sec": 203, "doppler_434_khz": 9308, "doppler_144_khz": 3103},
+ {"time_sec": 204, "doppler_434_khz": 9287, "doppler_144_khz": 3096},
+ {"time_sec": 205, "doppler_434_khz": 9276, "doppler_144_khz": 3092},
+ {"time_sec": 206, "doppler_434_khz": 9265, "doppler_144_khz": 3088},
+ {"time_sec": 207, "doppler_434_khz": 9254, "doppler_144_khz": 3085},
+ {"time_sec": 208, "doppler_434_khz": 9230, "doppler_144_khz": 3077},
+ {"time_sec": 209, "doppler_434_khz": 9218, "doppler_144_khz": 3073},
+ {"time_sec": 210, "doppler_434_khz": 9206, "doppler_144_khz": 3069},
+ {"time_sec": 211, "doppler_434_khz": 9194, "doppler_144_khz": 3065},
+ {"time_sec": 212, "doppler_434_khz": 9182, "doppler_144_khz": 3061},
+ {"time_sec": 213, "doppler_434_khz": 9156, "doppler_144_khz": 3052},
+ {"time_sec": 214, "doppler_434_khz": 9143, "doppler_144_khz": 3048},
+ {"time_sec": 215, "doppler_434_khz": 9130, "doppler_144_khz": 3043},
+ {"time_sec": 216, "doppler_434_khz": 9116, "doppler_144_khz": 3039},
+ {"time_sec": 217, "doppler_434_khz": 9088, "doppler_144_khz": 3029},
+ {"time_sec": 218, "doppler_434_khz": 9074, "doppler_144_khz": 3025},
+ {"time_sec": 219, "doppler_434_khz": 9060, "doppler_144_khz": 3020},
+ {"time_sec": 220, "doppler_434_khz": 9045, "doppler_144_khz": 3015},
+ {"time_sec": 221, "doppler_434_khz": 9015, "doppler_144_khz": 3005},
+ {"time_sec": 222, "doppler_434_khz": 8999, "doppler_144_khz": 3000},
+ {"time_sec": 223, "doppler_434_khz": 8983, "doppler_144_khz": 2994},
+ {"time_sec": 224, "doppler_434_khz": 8967, "doppler_144_khz": 2989},
+ {"time_sec": 225, "doppler_434_khz": 8951, "doppler_144_khz": 2984},
+ {"time_sec": 226, "doppler_434_khz": 8917, "doppler_144_khz": 2972},
+ {"time_sec": 227, "doppler_434_khz": 8900, "doppler_144_khz": 2967},
+ {"time_sec": 228, "doppler_434_khz": 8882, "doppler_144_khz": 2961},
+ {"time_sec": 229, "doppler_434_khz": 8865, "doppler_144_khz": 2955},
+ {"time_sec": 230, "doppler_434_khz": 8828, "doppler_144_khz": 2943},
+ {"time_sec": 231, "doppler_434_khz": 8809, "doppler_144_khz": 2936},
+ {"time_sec": 232, "doppler_434_khz": 8790, "doppler_144_khz": 2930},
+ {"time_sec": 233, "doppler_434_khz": 8770, "doppler_144_khz": 2923},
+ {"time_sec": 234, "doppler_434_khz": 8730, "doppler_144_khz": 2910},
+ {"time_sec": 235, "doppler_434_khz": 8709, "doppler_144_khz": 2903},
+ {"time_sec": 236, "doppler_434_khz": 8688, "doppler_144_khz": 2896},
+ {"time_sec": 237, "doppler_434_khz": 8665, "doppler_144_khz": 2888},
+ {"time_sec": 238, "doppler_434_khz": 8643, "doppler_144_khz": 2881},
+ {"time_sec": 239, "doppler_434_khz": 8597, "doppler_144_khz": 2866},
+ {"time_sec": 240, "doppler_434_khz": 8574, "doppler_144_khz": 2858},
+ {"time_sec": 241, "doppler_434_khz": 8550, "doppler_144_khz": 2850},
+ {"time_sec": 242, "doppler_434_khz": 8526, "doppler_144_khz": 2842},
+ {"time_sec": 243, "doppler_434_khz": 8476, "doppler_144_khz": 2825},
+ {"time_sec": 244, "doppler_434_khz": 8450, "doppler_144_khz": 2817},
+ {"time_sec": 245, "doppler_434_khz": 8423, "doppler_144_khz": 2808},
+ {"time_sec": 246, "doppler_434_khz": 8397, "doppler_144_khz": 2799},
+ {"time_sec": 247, "doppler_434_khz": 8370, "doppler_144_khz": 2790},
+ {"time_sec": 248, "doppler_434_khz": 8314, "doppler_144_khz": 2771},
+ {"time_sec": 249, "doppler_434_khz": 8286, "doppler_144_khz": 2762},
+ {"time_sec": 250, "doppler_434_khz": 8256, "doppler_144_khz": 2752},
+ {"time_sec": 251, "doppler_434_khz": 8226, "doppler_144_khz": 2742},
+ {"time_sec": 252, "doppler_434_khz": 8164, "doppler_144_khz": 2721},
+ {"time_sec": 253, "doppler_434_khz": 8133, "doppler_144_khz": 2711},
+ {"time_sec": 254, "doppler_434_khz": 8101, "doppler_144_khz": 2700},
+ {"time_sec": 255, "doppler_434_khz": 8068, "doppler_144_khz": 2689},
+ {"time_sec": 256, "doppler_434_khz": 8034, "doppler_144_khz": 2678},
+ {"time_sec": 257, "doppler_434_khz": 7965, "doppler_144_khz": 2655},
+ {"time_sec": 258, "doppler_434_khz": 7929, "doppler_144_khz": 2643},
+ {"time_sec": 259, "doppler_434_khz": 7893, "doppler_144_khz": 2631},
+ {"time_sec": 260, "doppler_434_khz": 7856, "doppler_144_khz": 2619},
+ {"time_sec": 261, "doppler_434_khz": 7779, "doppler_144_khz": 2593},
+ {"time_sec": 262, "doppler_434_khz": 7740, "doppler_144_khz": 2580},
+ {"time_sec": 263, "doppler_434_khz": 7699, "doppler_144_khz": 2566},
+ {"time_sec": 264, "doppler_434_khz": 7658, "doppler_144_khz": 2553},
+ {"time_sec": 265, "doppler_434_khz": 7574, "doppler_144_khz": 2525},
+ {"time_sec": 266, "doppler_434_khz": 7530, "doppler_144_khz": 2510},
+ {"time_sec": 267, "doppler_434_khz": 7485, "doppler_144_khz": 2495},
+ {"time_sec": 268, "doppler_434_khz": 7440, "doppler_144_khz": 2480},
+ {"time_sec": 269, "doppler_434_khz": 7394, "doppler_144_khz": 2465},
+ {"time_sec": 270, "doppler_434_khz": 7298, "doppler_144_khz": 2433},
+ {"time_sec": 271, "doppler_434_khz": 7248, "doppler_144_khz": 2416},
+ {"time_sec": 272, "doppler_434_khz": 7198, "doppler_144_khz": 2399},
+ {"time_sec": 273, "doppler_434_khz": 7143, "doppler_144_khz": 2381},
+ {"time_sec": 274, "doppler_434_khz": 7037, "doppler_144_khz": 2346},
+ {"time_sec": 275, "doppler_434_khz": 6982, "doppler_144_khz": 2327},
+ {"time_sec": 276, "doppler_434_khz": 6927, "doppler_144_khz": 2309},
+ {"time_sec": 277, "doppler_434_khz": 6870, "doppler_144_khz": 2290},
+ {"time_sec": 278, "doppler_434_khz": 6812, "doppler_144_khz": 2271},
+ {"time_sec": 279, "doppler_434_khz": 6693, "doppler_144_khz": 2231},
+ {"time_sec": 280, "doppler_434_khz": 6631, "doppler_144_khz": 2210},
+ {"time_sec": 281, "doppler_434_khz": 6568, "doppler_144_khz": 2189},
+ {"time_sec": 282, "doppler_434_khz": 6504, "doppler_144_khz": 2168},
+ {"time_sec": 283, "doppler_434_khz": 6373, "doppler_144_khz": 2124},
+ {"time_sec": 284, "doppler_434_khz": 6305, "doppler_144_khz": 2102},
+ {"time_sec": 285, "doppler_434_khz": 6235, "doppler_144_khz": 2078},
+ {"time_sec": 286, "doppler_434_khz": 6165, "doppler_144_khz": 2055},
+ {"time_sec": 287, "doppler_434_khz": 6020, "doppler_144_khz": 2007},
+ {"time_sec": 288, "doppler_434_khz": 5945, "doppler_144_khz": 1982},
+ {"time_sec": 289, "doppler_434_khz": 5868, "doppler_144_khz": 1956},
+ {"time_sec": 290, "doppler_434_khz": 5791, "doppler_144_khz": 1930},
+ {"time_sec": 291, "doppler_434_khz": 5711, "doppler_144_khz": 1904},
+ {"time_sec": 292, "doppler_434_khz": 5548, "doppler_144_khz": 1849},
+ {"time_sec": 293, "doppler_434_khz": 5464, "doppler_144_khz": 1821},
+ {"time_sec": 294, "doppler_434_khz": 5379, "doppler_144_khz": 1793},
+ {"time_sec": 295, "doppler_434_khz": 5292, "doppler_144_khz": 1764},
+ {"time_sec": 296, "doppler_434_khz": 5113, "doppler_144_khz": 1704},
+ {"time_sec": 297, "doppler_434_khz": 5022, "doppler_144_khz": 1674},
+ {"time_sec": 298, "doppler_434_khz": 4928, "doppler_144_khz": 1643},
+ {"time_sec": 299, "doppler_434_khz": 4834, "doppler_144_khz": 1611},
+ {"time_sec": 300, "doppler_434_khz": 4640, "doppler_144_khz": 1547},
+ {"time_sec": 301, "doppler_434_khz": 4540, "doppler_144_khz": 1513},
+ {"time_sec": 302, "doppler_434_khz": 4438, "doppler_144_khz": 1479},
+ {"time_sec": 303, "doppler_434_khz": 4334, "doppler_144_khz": 1445},
+ {"time_sec": 304, "doppler_434_khz": 4229, "doppler_144_khz": 1410},
+ {"time_sec": 305, "doppler_434_khz": 4016, "doppler_144_khz": 1339},
+ {"time_sec": 306, "doppler_434_khz": 3907, "doppler_144_khz": 1302},
+ {"time_sec": 307, "doppler_434_khz": 3796, "doppler_144_khz": 1265},
+ {"time_sec": 308, "doppler_434_khz": 3684, "doppler_144_khz": 1228},
+ {"time_sec": 309, "doppler_434_khz": 3448, "doppler_144_khz": 1149},
+ {"time_sec": 310, "doppler_434_khz": 3330, "doppler_144_khz": 1110},
+ {"time_sec": 311, "doppler_434_khz": 3212, "doppler_144_khz": 1071},
+ {"time_sec": 312, "doppler_434_khz": 3091, "doppler_144_khz": 1030},
+ {"time_sec": 313, "doppler_434_khz": 2969, "doppler_144_khz": 990},
+ {"time_sec": 314, "doppler_434_khz": 2722, "doppler_144_khz": 907},
+ {"time_sec": 315, "doppler_434_khz": 2595, "doppler_144_khz": 865},
+ {"time_sec": 316, "doppler_434_khz": 2466, "doppler_144_khz": 822},
+ {"time_sec": 317, "doppler_434_khz": 2337, "doppler_144_khz": 779},
+ {"time_sec": 318, "doppler_434_khz": 2206, "doppler_144_khz": 735},
+ {"time_sec": 319, "doppler_434_khz": 1941, "doppler_144_khz": 647},
+ {"time_sec": 320, "doppler_434_khz": 1807, "doppler_144_khz": 602},
+ {"time_sec": 321, "doppler_434_khz": 1672, "doppler_144_khz": 557},
+ {"time_sec": 322, "doppler_434_khz": 1536, "doppler_144_khz": 512},
+ {"time_sec": 323, "doppler_434_khz": 1395, "doppler_144_khz": 465},
+ {"time_sec": 324, "doppler_434_khz": 1119, "doppler_144_khz": 373},
+ {"time_sec": 325, "doppler_434_khz": 979, "doppler_144_khz": 326},
+ {"time_sec": 326, "doppler_434_khz": 839, "doppler_144_khz": 280},
+ {"time_sec": 327, "doppler_434_khz": 699, "doppler_144_khz": 233},
+ {"time_sec": 328, "doppler_434_khz": 418, "doppler_144_khz": 139},
+ {"time_sec": 329, "doppler_434_khz": 277, "doppler_144_khz": 92},
+ {"time_sec": 330, "doppler_434_khz": 137, "doppler_144_khz": 46},
+ {"time_sec": 331, "doppler_434_khz": -2, "doppler_144_khz": 0},
+ {"time_sec": 332, "doppler_434_khz": -143, "doppler_144_khz": -47},
+ {"time_sec": 333, "doppler_434_khz": -427, "doppler_144_khz": -142},
+ {"time_sec": 334, "doppler_434_khz": -569, "doppler_144_khz": -189},
+ {"time_sec": 335, "doppler_434_khz": -709, "doppler_144_khz": -236},
+ {"time_sec": 336, "doppler_434_khz": -848, "doppler_144_khz": -282},
+ {"time_sec": 337, "doppler_434_khz": -987, "doppler_144_khz": -328},
+ {"time_sec": 338, "doppler_434_khz": -1263, "doppler_144_khz": -420},
+ {"time_sec": 339, "doppler_434_khz": -1400, "doppler_144_khz": -466},
+ {"time_sec": 340, "doppler_434_khz": -1537, "doppler_144_khz": -512},
+ {"time_sec": 341, "doppler_434_khz": -1672, "doppler_144_khz": -557},
+ {"time_sec": 342, "doppler_434_khz": -1806, "doppler_144_khz": -601},
+ {"time_sec": 343, "doppler_434_khz": -2072, "doppler_144_khz": -690},
+ {"time_sec": 344, "doppler_434_khz": -2204, "doppler_144_khz": -734},
+ {"time_sec": 345, "doppler_434_khz": -2335, "doppler_144_khz": -778},
+ {"time_sec": 346, "doppler_434_khz": -2471, "doppler_144_khz": -823},
+ {"time_sec": 347, "doppler_434_khz": -2599, "doppler_144_khz": -866},
+ {"time_sec": 348, "doppler_434_khz": -2851, "doppler_144_khz": -950},
+ {"time_sec": 349, "doppler_434_khz": -2975, "doppler_144_khz": -991},
+ {"time_sec": 350, "doppler_434_khz": -3098, "doppler_144_khz": -1032},
+ {"time_sec": 351, "doppler_434_khz": -3220, "doppler_144_khz": -1073},
+ {"time_sec": 352, "doppler_434_khz": -3458, "doppler_144_khz": -1152},
+ {"time_sec": 353, "doppler_434_khz": -3574, "doppler_144_khz": -1191},
+ {"time_sec": 354, "doppler_434_khz": -3693, "doppler_144_khz": -1230},
+ {"time_sec": 355, "doppler_434_khz": -3807, "doppler_144_khz": -1268},
+ {"time_sec": 356, "doppler_434_khz": -3921, "doppler_144_khz": -1306},
+ {"time_sec": 357, "doppler_434_khz": -4141, "doppler_144_khz": -1380},
+ {"time_sec": 358, "doppler_434_khz": -4249, "doppler_144_khz": -1416},
+ {"time_sec": 359, "doppler_434_khz": -4356, "doppler_144_khz": -1451},
+ {"time_sec": 360, "doppler_434_khz": -4460, "doppler_144_khz": -1486},
+ {"time_sec": 361, "doppler_434_khz": -4563, "doppler_144_khz": -1520},
+ {"time_sec": 362, "doppler_434_khz": -4763, "doppler_144_khz": -1587},
+ {"time_sec": 363, "doppler_434_khz": -4861, "doppler_144_khz": -1620},
+ {"time_sec": 364, "doppler_434_khz": -4956, "doppler_144_khz": -1651},
+ {"time_sec": 365, "doppler_434_khz": -5050, "doppler_144_khz": -1683},
+ {"time_sec": 366, "doppler_434_khz": -5142, "doppler_144_khz": -1713},
+ {"time_sec": 367, "doppler_434_khz": -5323, "doppler_144_khz": -1774},
+ {"time_sec": 368, "doppler_434_khz": -5410, "doppler_144_khz": -1803},
+ {"time_sec": 369, "doppler_434_khz": -5497, "doppler_144_khz": -1832},
+ {"time_sec": 370, "doppler_434_khz": -5582, "doppler_144_khz": -1860},
+ {"time_sec": 371, "doppler_434_khz": -5665, "doppler_144_khz": -1888},
+ {"time_sec": 372, "doppler_434_khz": -5825, "doppler_144_khz": -1941},
+ {"time_sec": 373, "doppler_434_khz": -5904, "doppler_144_khz": -1967},
+ {"time_sec": 374, "doppler_434_khz": -5981, "doppler_144_khz": -1993},
+ {"time_sec": 375, "doppler_434_khz": -6056, "doppler_144_khz": -2018},
+ {"time_sec": 376, "doppler_434_khz": -6203, "doppler_144_khz": -2067},
+ {"time_sec": 377, "doppler_434_khz": -6275, "doppler_144_khz": -2091},
+ {"time_sec": 378, "doppler_434_khz": -6344, "doppler_144_khz": -2114},
+ {"time_sec": 379, "doppler_434_khz": -6413, "doppler_144_khz": -2137},
+ {"time_sec": 380, "doppler_434_khz": -6479, "doppler_144_khz": -2159},
+ {"time_sec": 381, "doppler_434_khz": -6609, "doppler_144_khz": -2202},
+ {"time_sec": 382, "doppler_434_khz": -6676, "doppler_144_khz": -2225},
+ {"time_sec": 383, "doppler_434_khz": -6738, "doppler_144_khz": -2245},
+ {"time_sec": 384, "doppler_434_khz": -6798, "doppler_144_khz": -2265},
+ {"time_sec": 385, "doppler_434_khz": -6858, "doppler_144_khz": -2285},
+ {"time_sec": 386, "doppler_434_khz": -6974, "doppler_144_khz": -2324},
+ {"time_sec": 387, "doppler_434_khz": -7031, "doppler_144_khz": -2343},
+ {"time_sec": 388, "doppler_434_khz": -7086, "doppler_144_khz": -2361},
+ {"time_sec": 389, "doppler_434_khz": -7139, "doppler_144_khz": -2379},
+ {"time_sec": 390, "doppler_434_khz": -7191, "doppler_144_khz": -2396},
+ {"time_sec": 391, "doppler_434_khz": -7292, "doppler_144_khz": -2430},
+ {"time_sec": 392, "doppler_434_khz": -7342, "doppler_144_khz": -2447},
+ {"time_sec": 393, "doppler_434_khz": -7390, "doppler_144_khz": -2463},
+ {"time_sec": 394, "doppler_434_khz": -7437, "doppler_144_khz": -2478},
+ {"time_sec": 395, "doppler_434_khz": -7483, "doppler_144_khz": -2494},
+ {"time_sec": 396, "doppler_434_khz": -7573, "doppler_144_khz": -2524},
+ {"time_sec": 397, "doppler_434_khz": -7617, "doppler_144_khz": -2538},
+ {"time_sec": 398, "doppler_434_khz": -7659, "doppler_144_khz": -2552},
+ {"time_sec": 399, "doppler_434_khz": -7701, "doppler_144_khz": -2566},
+ {"time_sec": 400, "doppler_434_khz": -7742, "doppler_144_khz": -2580},
+ {"time_sec": 401, "doppler_434_khz": -7821, "doppler_144_khz": -2606},
+ {"time_sec": 402, "doppler_434_khz": -7860, "doppler_144_khz": -2619},
+ {"time_sec": 403, "doppler_434_khz": -7898, "doppler_144_khz": -2632},
+ {"time_sec": 404, "doppler_434_khz": -7935, "doppler_144_khz": -2644},
+ {"time_sec": 405, "doppler_434_khz": -7971, "doppler_144_khz": -2656},
+ {"time_sec": 406, "doppler_434_khz": -8041, "doppler_144_khz": -2680},
+ {"time_sec": 407, "doppler_434_khz": -8076, "doppler_144_khz": -2691},
+ {"time_sec": 408, "doppler_434_khz": -8109, "doppler_144_khz": -2702},
+ {"time_sec": 409, "doppler_434_khz": -8142, "doppler_144_khz": -2713},
+ {"time_sec": 410, "doppler_434_khz": -8205, "doppler_144_khz": -2734},
+ {"time_sec": 411, "doppler_434_khz": -8236, "doppler_144_khz": -2745},
+ {"time_sec": 412, "doppler_434_khz": -8266, "doppler_144_khz": -2755},
+ {"time_sec": 413, "doppler_434_khz": -8296, "doppler_144_khz": -2765},
+ {"time_sec": 414, "doppler_434_khz": -8325, "doppler_144_khz": -2774},
+ {"time_sec": 415, "doppler_434_khz": -8381, "doppler_144_khz": -2793},
+ {"time_sec": 416, "doppler_434_khz": -8408, "doppler_144_khz": -2802},
+ {"time_sec": 417, "doppler_434_khz": -8435, "doppler_144_khz": -2811},
+ {"time_sec": 418, "doppler_434_khz": -8462, "doppler_144_khz": -2820},
+ {"time_sec": 419, "doppler_434_khz": -8487, "doppler_144_khz": -2828},
+ {"time_sec": 420, "doppler_434_khz": -8539, "doppler_144_khz": -2846},
+ {"time_sec": 421, "doppler_434_khz": -8563, "doppler_144_khz": -2854},
+ {"time_sec": 422, "doppler_434_khz": -8587, "doppler_144_khz": -2862},
+ {"time_sec": 423, "doppler_434_khz": -8610, "doppler_144_khz": -2869},
+ {"time_sec": 424, "doppler_434_khz": -8633, "doppler_144_khz": -2877},
+ {"time_sec": 425, "doppler_434_khz": -8678, "doppler_144_khz": -2892},
+ {"time_sec": 426, "doppler_434_khz": -8700, "doppler_144_khz": -2899},
+ {"time_sec": 427, "doppler_434_khz": -8721, "doppler_144_khz": -2906},
+ {"time_sec": 428, "doppler_434_khz": -8742, "doppler_144_khz": -2913},
+ {"time_sec": 429, "doppler_434_khz": -8762, "doppler_144_khz": -2920},
+ {"time_sec": 430, "doppler_434_khz": -8802, "doppler_144_khz": -2933},
+ {"time_sec": 431, "doppler_434_khz": -8822, "doppler_144_khz": -2940},
+ {"time_sec": 432, "doppler_434_khz": -8841, "doppler_144_khz": -2946},
+ {"time_sec": 433, "doppler_434_khz": -8860, "doppler_144_khz": -2953},
+ {"time_sec": 434, "doppler_434_khz": -8878, "doppler_144_khz": -2959},
+ {"time_sec": 435, "doppler_434_khz": -8915, "doppler_144_khz": -2971},
+ {"time_sec": 436, "doppler_434_khz": -8932, "doppler_144_khz": -2977},
+ {"time_sec": 437, "doppler_434_khz": -8949, "doppler_144_khz": -2982},
+ {"time_sec": 438, "doppler_434_khz": -8966, "doppler_144_khz": -2988},
+ {"time_sec": 439, "doppler_434_khz": -8982, "doppler_144_khz": -2993},
+ {"time_sec": 440, "doppler_434_khz": -9015, "doppler_144_khz": -3004},
+ {"time_sec": 441, "doppler_434_khz": -9030, "doppler_144_khz": -3009},
+ {"time_sec": 442, "doppler_434_khz": -9045, "doppler_144_khz": -3014},
+ {"time_sec": 443, "doppler_434_khz": -9061, "doppler_144_khz": -3020},
+ {"time_sec": 444, "doppler_434_khz": -9075, "doppler_144_khz": -3024},
+ {"time_sec": 445, "doppler_434_khz": -9104, "doppler_144_khz": -3034},
+ {"time_sec": 446, "doppler_434_khz": -9118, "doppler_144_khz": -3039},
+ {"time_sec": 447, "doppler_434_khz": -9132, "doppler_144_khz": -3043},
+ {"time_sec": 448, "doppler_434_khz": -9146, "doppler_144_khz": -3048},
+ {"time_sec": 449, "doppler_434_khz": -9172, "doppler_144_khz": -3057},
+ {"time_sec": 450, "doppler_434_khz": -9185, "doppler_144_khz": -3061},
+ {"time_sec": 451, "doppler_434_khz": -9197, "doppler_144_khz": -3065},
+ {"time_sec": 452, "doppler_434_khz": -9210, "doppler_144_khz": -3069},
+ {"time_sec": 453, "doppler_434_khz": -9222, "doppler_144_khz": -3073},
+ {"time_sec": 454, "doppler_434_khz": -9246, "doppler_144_khz": -3081},
+ {"time_sec": 455, "doppler_434_khz": -9258, "doppler_144_khz": -3085},
+ {"time_sec": 456, "doppler_434_khz": -9270, "doppler_144_khz": -3089},
+ {"time_sec": 457, "doppler_434_khz": -9281, "doppler_144_khz": -3093},
+ {"time_sec": 458, "doppler_434_khz": -9292, "doppler_144_khz": -3097},
+ {"time_sec": 459, "doppler_434_khz": -9313, "doppler_144_khz": -3104},
+ {"time_sec": 460, "doppler_434_khz": -9324, "doppler_144_khz": -3107},
+ {"time_sec": 461, "doppler_434_khz": -9334, "doppler_144_khz": -3111},
+ {"time_sec": 462, "doppler_434_khz": -9344, "doppler_144_khz": -3114},
+ {"time_sec": 463, "doppler_434_khz": -9354, "doppler_144_khz": -3117},
+ {"time_sec": 464, "doppler_434_khz": -9374, "doppler_144_khz": -3124},
+ {"time_sec": 465, "doppler_434_khz": -9383, "doppler_144_khz": -3127},
+ {"time_sec": 466, "doppler_434_khz": -9393, "doppler_144_khz": -3130},
+ {"time_sec": 467, "doppler_434_khz": -9402, "doppler_144_khz": -3133},
+ {"time_sec": 468, "doppler_434_khz": -9411, "doppler_144_khz": -3136},
+ {"time_sec": 469, "doppler_434_khz": -9429, "doppler_144_khz": -3142},
+ {"time_sec": 470, "doppler_434_khz": -9438, "doppler_144_khz": -3145},
+ {"time_sec": 471, "doppler_434_khz": -9446, "doppler_144_khz": -3148},
+ {"time_sec": 472, "doppler_434_khz": -9454, "doppler_144_khz": -3151},
+ {"time_sec": 473, "doppler_434_khz": -9470, "doppler_144_khz": -3156},
+ {"time_sec": 474, "doppler_434_khz": -9478, "doppler_144_khz": -3159},
+ {"time_sec": 475, "doppler_434_khz": -9486, "doppler_144_khz": -3161},
+ {"time_sec": 476, "doppler_434_khz": -9494, "doppler_144_khz": -3164},
+ {"time_sec": 477, "doppler_434_khz": -9501, "doppler_144_khz": -3166},
+ {"time_sec": 478, "doppler_434_khz": -9516, "doppler_144_khz": -3171},
+ {"time_sec": 479, "doppler_434_khz": -9523, "doppler_144_khz": -3174},
+ {"time_sec": 480, "doppler_434_khz": -9530, "doppler_144_khz": -3176},
+ {"time_sec": 481, "doppler_434_khz": -9537, "doppler_144_khz": -3178},
+ {"time_sec": 482, "doppler_434_khz": -9551, "doppler_144_khz": -3183},
+ {"time_sec": 483, "doppler_434_khz": -9557, "doppler_144_khz": -3185},
+ {"time_sec": 484, "doppler_434_khz": -9564, "doppler_144_khz": -3187},
+ {"time_sec": 485, "doppler_434_khz": -9570, "doppler_144_khz": -3189},
+ {"time_sec": 486, "doppler_434_khz": -9583, "doppler_144_khz": -3194},
+ {"time_sec": 487, "doppler_434_khz": -9589, "doppler_144_khz": -3196},
+ {"time_sec": 488, "doppler_434_khz": -9595, "doppler_144_khz": -3198},
+ {"time_sec": 489, "doppler_434_khz": -9601, "doppler_144_khz": -3200},
+ {"time_sec": 490, "doppler_434_khz": -9607, "doppler_144_khz": -3202},
+ {"time_sec": 491, "doppler_434_khz": -9619, "doppler_144_khz": -3206},
+ {"time_sec": 492, "doppler_434_khz": -9625, "doppler_144_khz": -3208},
+ {"time_sec": 493, "doppler_434_khz": -9630, "doppler_144_khz": -3209},
+ {"time_sec": 494, "doppler_434_khz": -9636, "doppler_144_khz": -3211},
+ {"time_sec": 495, "doppler_434_khz": -9642, "doppler_144_khz": -3213},
+ {"time_sec": 496, "doppler_434_khz": -9652, "doppler_144_khz": -3217},
+ {"time_sec": 497, "doppler_434_khz": -9658, "doppler_144_khz": -3219},
+ {"time_sec": 498, "doppler_434_khz": -9663, "doppler_144_khz": -3220},
+ {"time_sec": 499, "doppler_434_khz": -9668, "doppler_144_khz": -3222},
+ {"time_sec": 500, "doppler_434_khz": -9678, "doppler_144_khz": -3225},
+ {"time_sec": 501, "doppler_434_khz": -9683, "doppler_144_khz": -3227},
+ {"time_sec": 502, "doppler_434_khz": -9687, "doppler_144_khz": -3228},
+ {"time_sec": 503, "doppler_434_khz": -9692, "doppler_144_khz": -3230},
+ {"time_sec": 504, "doppler_434_khz": -9697, "doppler_144_khz": -3232},
+ {"time_sec": 505, "doppler_434_khz": -9706, "doppler_144_khz": -3235},
+ {"time_sec": 506, "doppler_434_khz": -9710, "doppler_144_khz": -3236},
+ {"time_sec": 507, "doppler_434_khz": -9715, "doppler_144_khz": -3238},
+ {"time_sec": 508, "doppler_434_khz": -9719, "doppler_144_khz": -3239},
+ {"time_sec": 509, "doppler_434_khz": -9727, "doppler_144_khz": -3242},
+ {"time_sec": 510, "doppler_434_khz": -9732, "doppler_144_khz": -3243},
+ {"time_sec": 511, "doppler_434_khz": -9736, "doppler_144_khz": -3245},
+ {"time_sec": 512, "doppler_434_khz": -9740, "doppler_144_khz": -3246},
+ {"time_sec": 513, "doppler_434_khz": -9747, "doppler_144_khz": -3248},
+ {"time_sec": 514, "doppler_434_khz": -9751, "doppler_144_khz": -3250},
+ {"time_sec": 515, "doppler_434_khz": -9755, "doppler_144_khz": -3251},
+ {"time_sec": 516, "doppler_434_khz": -9759, "doppler_144_khz": -3252},
+ {"time_sec": 517, "doppler_434_khz": -9763, "doppler_144_khz": -3254},
+ {"time_sec": 518, "doppler_434_khz": -9770, "doppler_144_khz": -3256},
+ {"time_sec": 519, "doppler_434_khz": -9773, "doppler_144_khz": -3257},
+ {"time_sec": 520, "doppler_434_khz": -9777, "doppler_144_khz": -3258},
+ {"time_sec": 521, "doppler_434_khz": -9780, "doppler_144_khz": -3259},
+ {"time_sec": 522, "doppler_434_khz": -9787, "doppler_144_khz": -3262},
+ {"time_sec": 523, "doppler_434_khz": -9791, "doppler_144_khz": -3263},
+ {"time_sec": 524, "doppler_434_khz": -9794, "doppler_144_khz": -3264},
+ {"time_sec": 525, "doppler_434_khz": -9797, "doppler_144_khz": -3265},
+ {"time_sec": 526, "doppler_434_khz": -9800, "doppler_144_khz": -3266},
+ {"time_sec": 527, "doppler_434_khz": -9807, "doppler_144_khz": -3268},
+ {"time_sec": 528, "doppler_434_khz": -9810, "doppler_144_khz": -3269},
+ {"time_sec": 529, "doppler_434_khz": -9813, "doppler_144_khz": -3270},
+ {"time_sec": 530, "doppler_434_khz": -9816, "doppler_144_khz": -3271},
+ {"time_sec": 531, "doppler_434_khz": -9822, "doppler_144_khz": -3273},
+ {"time_sec": 532, "doppler_434_khz": -9825, "doppler_144_khz": -3274},
+ {"time_sec": 533, "doppler_434_khz": -9827, "doppler_144_khz": -3275},
+ {"time_sec": 534, "doppler_434_khz": -9830, "doppler_144_khz": -3276},
+ {"time_sec": 535, "doppler_434_khz": -9833, "doppler_144_khz": -3277},
+ {"time_sec": 536, "doppler_434_khz": -9838, "doppler_144_khz": -3279},
+ {"time_sec": 537, "doppler_434_khz": -9841, "doppler_144_khz": -3280},
+ {"time_sec": 538, "doppler_434_khz": -9843, "doppler_144_khz": -3280},
+ {"time_sec": 539, "doppler_434_khz": -9846, "doppler_144_khz": -3281},
+ {"time_sec": 540, "doppler_434_khz": -9851, "doppler_144_khz": -3283},
+ {"time_sec": 541, "doppler_434_khz": -9853, "doppler_144_khz": -3284},
+ {"time_sec": 542, "doppler_434_khz": -9856, "doppler_144_khz": -3285},
+ {"time_sec": 543, "doppler_434_khz": -9858, "doppler_144_khz": -3285},
+ {"time_sec": 544, "doppler_434_khz": -9861, "doppler_144_khz": -3286},
+ {"time_sec": 545, "doppler_434_khz": -9865, "doppler_144_khz": -3288},
+ {"time_sec": 546, "doppler_434_khz": -9867, "doppler_144_khz": -3288},
+ {"time_sec": 547, "doppler_434_khz": -9870, "doppler_144_khz": -3289},
+ {"time_sec": 548, "doppler_434_khz": -9872, "doppler_144_khz": -3290},
+ {"time_sec": 549, "doppler_434_khz": -9876, "doppler_144_khz": -3291},
+ {"time_sec": 550, "doppler_434_khz": -9878, "doppler_144_khz": -3292},
+ {"time_sec": 551, "doppler_434_khz": -9880, "doppler_144_khz": -3293},
+ {"time_sec": 552, "doppler_434_khz": -9882, "doppler_144_khz": -3293},
+ {"time_sec": 553, "doppler_434_khz": -9886, "doppler_144_khz": -3295},
+ {"time_sec": 554, "doppler_434_khz": -9888, "doppler_144_khz": -3295},
+ {"time_sec": 555, "doppler_434_khz": -9890, "doppler_144_khz": -3296},
+ {"time_sec": 556, "doppler_434_khz": -9892, "doppler_144_khz": -3297},
+ {"time_sec": 557, "doppler_434_khz": -9894, "doppler_144_khz": -3297},
+ {"time_sec": 558, "doppler_434_khz": -9898, "doppler_144_khz": -3299},
+ {"time_sec": 559, "doppler_434_khz": -9899, "doppler_144_khz": -3299},
+ {"time_sec": 560, "doppler_434_khz": -9901, "doppler_144_khz": -3300},
+ {"time_sec": 561, "doppler_434_khz": -9903, "doppler_144_khz": -3300},
+ {"time_sec": 562, "doppler_434_khz": -9906, "doppler_144_khz": -3301},
+ {"time_sec": 563, "doppler_434_khz": -9908, "doppler_144_khz": -3302},
+ {"time_sec": 564, "doppler_434_khz": -9910, "doppler_144_khz": -3303},
+ {"time_sec": 565, "doppler_434_khz": -9911, "doppler_144_khz": -3303},
+ {"time_sec": 566, "doppler_434_khz": -9913, "doppler_144_khz": -3304},
+ {"time_sec": 567, "doppler_434_khz": -9916, "doppler_144_khz": -3305},
+ {"time_sec": 568, "doppler_434_khz": -9918, "doppler_144_khz": -3305},
+ {"time_sec": 569, "doppler_434_khz": -9919, "doppler_144_khz": -3306},
+ {"time_sec": 570, "doppler_434_khz": -9921, "doppler_144_khz": -3306},
+ {"time_sec": 571, "doppler_434_khz": -9923, "doppler_144_khz": -3307},
+ {"time_sec": 572, "doppler_434_khz": -9925, "doppler_144_khz": -3308},
+ {"time_sec": 573, "doppler_434_khz": -9926, "doppler_144_khz": -3308},
+ {"time_sec": 574, "doppler_434_khz": -9928, "doppler_144_khz": -3309},
+ {"time_sec": 575, "doppler_434_khz": -9930, "doppler_144_khz": -3309},
+ {"time_sec": 576, "doppler_434_khz": -9932, "doppler_144_khz": -3310},
+ {"time_sec": 577, "doppler_434_khz": -9933, "doppler_144_khz": -3310},
+ {"time_sec": 578, "doppler_434_khz": -9934, "doppler_144_khz": -3311},
+ {"time_sec": 579, "doppler_434_khz": -9936, "doppler_144_khz": -3311},
+ {"time_sec": 580, "doppler_434_khz": -9938, "doppler_144_khz": -3312},
+ {"time_sec": 581, "doppler_434_khz": -9939, "doppler_144_khz": -3312},
+ {"time_sec": 582, "doppler_434_khz": -9940, "doppler_144_khz": -3313},
+ {"time_sec": 583, "doppler_434_khz": -9942, "doppler_144_khz": -3313},
+ {"time_sec": 584, "doppler_434_khz": -9944, "doppler_144_khz": -3314},
+ {"time_sec": 585, "doppler_434_khz": -9945, "doppler_144_khz": -3314},
+ {"time_sec": 586, "doppler_434_khz": -9946, "doppler_144_khz": -3315},
+ {"time_sec": 587, "doppler_434_khz": -9947, "doppler_144_khz": -3315},
+ {"time_sec": 588, "doppler_434_khz": -9949, "doppler_144_khz": -3316},
+ {"time_sec": 589, "doppler_434_khz": -9950, "doppler_144_khz": -3316},
+ {"time_sec": 590, "doppler_434_khz": -9951, "doppler_144_khz": -3316},
+ {"time_sec": 591, "doppler_434_khz": -9952, "doppler_144_khz": -3317},
+ {"time_sec": 592, "doppler_434_khz": -9953, "doppler_144_khz": -3317},
+ {"time_sec": 593, "doppler_434_khz": -9955, "doppler_144_khz": -3318},
+ {"time_sec": 594, "doppler_434_khz": -9956, "doppler_144_khz": -3318},
+ {"time_sec": 595, "doppler_434_khz": -9957, "doppler_144_khz": -3318},
+ {"time_sec": 596, "doppler_434_khz": -9958, "doppler_144_khz": -3319},
+ {"time_sec": 597, "doppler_434_khz": -9960, "doppler_144_khz": -3319},
+ {"time_sec": 598, "doppler_434_khz": -9961, "doppler_144_khz": -3320},
+ {"time_sec": 599, "doppler_434_khz": -9961, "doppler_144_khz": -3320},
+ {"time_sec": 600, "doppler_434_khz": -9962, "doppler_144_khz": -3320},
+ {"time_sec": 601, "doppler_434_khz": -9963, "doppler_144_khz": -3320},
+ {"time_sec": 602, "doppler_434_khz": -9965, "doppler_144_khz": -3321},
+ {"time_sec": 603, "doppler_434_khz": -9965, "doppler_144_khz": -3321},
+ {"time_sec": 604, "doppler_434_khz": -9966, "doppler_144_khz": -3321},
+ {"time_sec": 605, "doppler_434_khz": -9967, "doppler_144_khz": -3322},
+ {"time_sec": 606, "doppler_434_khz": -9968, "doppler_144_khz": -3322},
+ {"time_sec": 607, "doppler_434_khz": -9969, "doppler_144_khz": -3322},
+ {"time_sec": 608, "doppler_434_khz": -9970, "doppler_144_khz": -3323},
+ {"time_sec": 609, "doppler_434_khz": -9970, "doppler_144_khz": -3323},
+ {"time_sec": 610, "doppler_434_khz": -9972, "doppler_144_khz": -3323},
+ {"time_sec": 611, "doppler_434_khz": -9972, "doppler_144_khz": -3323},
+ {"time_sec": 612, "doppler_434_khz": -9973, "doppler_144_khz": -3324},
+ {"time_sec": 613, "doppler_434_khz": -9974, "doppler_144_khz": -3324},
+ {"time_sec": 614, "doppler_434_khz": -9974, "doppler_144_khz": -3324},
+ {"time_sec": 615, "doppler_434_khz": -9975, "doppler_144_khz": -3324},
+ {"time_sec": 616, "doppler_434_khz": -9976, "doppler_144_khz": -3325},
+ {"time_sec": 617, "doppler_434_khz": -9976, "doppler_144_khz": -3325},
+ {"time_sec": 618, "doppler_434_khz": -9977, "doppler_144_khz": -3325},
+ {"time_sec": 619, "doppler_434_khz": -9978, "doppler_144_khz": -3325},
+ {"time_sec": 620, "doppler_434_khz": -9978, "doppler_144_khz": -3325},
+ {"time_sec": 621, "doppler_434_khz": -9979, "doppler_144_khz": -3326},
+ {"time_sec": 622, "doppler_434_khz": -9979, "doppler_144_khz": -3326},
+ {"time_sec": 623, "doppler_434_khz": -9980, "doppler_144_khz": -3326},
+ {"time_sec": 624, "doppler_434_khz": -9981, "doppler_144_khz": -3326},
+ {"time_sec": 625, "doppler_434_khz": -9981, "doppler_144_khz": -3326},
+ {"time_sec": 626, "doppler_434_khz": -9982, "doppler_144_khz": -3327},
+ {"time_sec": 627, "doppler_434_khz": -9982, "doppler_144_khz": -3327},
+ {"time_sec": 628, "doppler_434_khz": -9983, "doppler_144_khz": -3327},
+ {"time_sec": 629, "doppler_434_khz": -9983, "doppler_144_khz": -3327},
+ {"time_sec": 630, "doppler_434_khz": -9984, "doppler_144_khz": -3327},
+ {"time_sec": 631, "doppler_434_khz": -9984, "doppler_144_khz": -3327},
+ {"time_sec": 632, "doppler_434_khz": -9985, "doppler_144_khz": -3328},
+ {"time_sec": 633, "doppler_434_khz": -9985, "doppler_144_khz": -3328},
+ {"time_sec": 634, "doppler_434_khz": -9985, "doppler_144_khz": -3328},
+ {"time_sec": 635, "doppler_434_khz": -9986, "doppler_144_khz": -3328},
+ {"time_sec": 636, "doppler_434_khz": -9986, "doppler_144_khz": -3328},
+ {"time_sec": 637, "doppler_434_khz": -9986, "doppler_144_khz": -3328},
+ {"time_sec": 638, "doppler_434_khz": -9987, "doppler_144_khz": -3328},
+ {"time_sec": 639, "doppler_434_khz": -9987, "doppler_144_khz": -3328},
+ {"time_sec": 640, "doppler_434_khz": -9987, "doppler_144_khz": -3328},
+ {"time_sec": 641, "doppler_434_khz": -9988, "doppler_144_khz": -3329},
+ {"time_sec": 642, "doppler_434_khz": -9988, "doppler_144_khz": -3329},
+ {"time_sec": 643, "doppler_434_khz": -9988, "doppler_144_khz": -3329},
+ {"time_sec": 644, "doppler_434_khz": -9988, "doppler_144_khz": -3329},
+ {"time_sec": 645, "doppler_434_khz": -9988, "doppler_144_khz": -3329},
+ {"time_sec": 646, "doppler_434_khz": -9989, "doppler_144_khz": -3329},
+ {"time_sec": 647, "doppler_434_khz": -9989, "doppler_144_khz": -3329},
+ {"time_sec": 648, "doppler_434_khz": -9989, "doppler_144_khz": -3329},
+ {"time_sec": 649, "doppler_434_khz": -9989, "doppler_144_khz": -3329},
+ {"time_sec": 650, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 651, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 652, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 653, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 654, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 655, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 656, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 657, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 658, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 659, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 660, "doppler_434_khz": -9990, "doppler_144_khz": -3329},
+ {"time_sec": 661, "doppler_434_khz": -9990, "doppler_144_khz": -3329}
+ ]
+}
+
+print("CubeSatSim v2.2 frequency.py starting...")
+try:
+ tx_value = '0'
+ rx_value = '0'
+ sq = '0'
+ tx = '434.9000'
+ rx = '435.0000'
+ txr = '144.9000'
+ sim_mode = False
+ sim_config = False
+ doppler_mode = "off"
+ debug_mode = True
+
+ 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)
+
+ try:
+ file = open("/home/pi/CubeSatSim/sim.cfg")
+ config = file.readline().split()
+ if len(config) > 6:
+ txf = float(config[6])
+ tx = "{:.4f}".format(txf)
+######
+ if (mode == 'e'):
+ txrf = (txf - 290.0) # - 0.1 # Cross Band Repeater mode transmit frequency in 2m band
+ txr = "{:.4f}".format(txrf)
+ print("Transmit frequency: ",txr)
+ else:
+ print("Transmit frequency: ",tx)
+######
+ print("Transmit frequency: ",tx)
+ if len(config) > 7:
+ rxf = float(config[7])
+ rx = "{:.4f}".format(rxf)
+ print(rx)
+ 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)
+ if len(config) > 13:
+ if config[13] == 'sim':
+ doppler_mode = 'sim'
+ print("Simulated Doppler frequency shift is enabled.")
+ elif config[13] == 'rig':
+ doppler_mode = 'rig'
+ print("rigctl Doppler frequency shift is enabled.")
+ else:
+ doppler_mode = 'off'
+ print("Doppler frequency shift is disabled.")
+ else:
+ doppler_mode = 'off'
+ print("Doppler frequency shift is disabled.")
+ print(config)
+ print
+# print(callsign)
+ print(sq)
+# if sq == '8':
+# print("squelch set to 8, no command input!")
+# no_command = True
+# else:
+ no_command = False
+ print(no_command)
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ if (debug_mode == 1):
+ print("Can't read sim.cfg file")
+ file.close()
+
+except Exception as e:
+ print(f"An error occurred: {e}")
+
+if (doppler_mode == 'off'):
+ tx_freq_hz = txf * 1e6
+ rx_freq_hz = rxf * 1e6
+# check_frequency()
+ print("writing sim.cfg frequency to freq.txt")
+ with open("/home/pi/CubeSatSim/freq.txt", "w") as file:
+ file.write(f"{tx_freq_hz:.0f} {rx_freq_hz:.0f}")
+ while True:
+ sleep(1)
+
+if (doppler_mode == 'sim'):
+ print("Sim mode")
+#####
+ if (mode == 'e'):
+ tx_doppler_start_hz = txrf * 1e6
+ else:
+ tx_doppler_start_hz = txf * 1e6
+#####
+# tx_doppler_start_hz = txf * 1e6
+ tx_doppler_shift_hz = 0
+ print(f"Tx center frequency: {tx_doppler_start_hz}")
+ rx_doppler_start_hz = rxf * 1e6
+ rx_doppler_shift_hz = 0
+ print(f"Rx center frequency: {rx_doppler_start_hz}")
+
+ TARGET_PASS = 88 # Maximum elevation profile
+ doppler_table = iss_doppler_passes[TARGET_PASS]
+ print(f"Pass Max Elevation: {TARGET_PASS}°")
+
+ start_time = time.perf_counter()
+ current_index = 0;
+ while True:
+ relative_time = (time.perf_counter() - start_time)
+# index = int(relative_time/10) % 37
+ index = int(relative_time)
+ if (index > current_index):
+ current_index = index
+ index = index % 661
+ print(f"relative time: {relative_time:.1f} seconds after start is AOS index: {index}")
+ table_row = doppler_table[index]
+ rx_doppler_shift_hz = table_row["doppler_434_khz"] # * 1000
+ if (mode == 'e'):
+ tx_doppler_shift_hz = table_row["doppler_144_khz"] # * 1000
+ else:
+ tx_doppler_shift_hz = rx_doppler_shift_hz
+ tx_doppler_freq_hz = tx_doppler_start_hz + tx_doppler_shift_hz
+ rx_doppler_freq_hz = rx_doppler_start_hz + rx_doppler_shift_hz
+ check_frequency()
+ print(f"Tx Doppler shift: {tx_doppler_freq_hz:.0f}")
+ print(f"Rx Doppler shift: {rx_doppler_freq_hz:.0f}")
+
+ with open("/home/pi/CubeSatSim/freq.txt", "w") as file:
+ file.write(f"{tx_doppler_freq_hz:.0f} {rx_doppler_freq_hz:.0f}")
+ sleep(1)
+
+if (doppler_mode == 'rig'):
+ print("rig mode")
+ while True:
+
+ system("sudo killall -9 ft857d &>/dev/null")
+ system("sudo killall -9 socat &>/dev/null")
+ system("sudo killall -9 rigctld &>/dev/null")
+
+ print("Starting virtual serial ports /tmp/vttyA and /tmp/vttyB")
+
+ system("socat -d -d PTY,raw,echo=0,link=/tmp/vttyA PTY,raw,echo=0,link=/tmp/vttyB &")
+
+ sleep(1.0)
+
+ print("Starting CubeSatSim FT857 emulation")
+ system("/home/pi/FT857d/examples/FT857d/ft857d &")
+
+ sleep(1.0)
+
+ print("Starting rigctl emulating FT857 rig using virtual serial port /tmp/vttyB")
+ system("rigctld -m 1022 -r /tmp/vttyB -t 4532 -vvv")
+
+ print("rigctld ended")
+
diff --git a/frequency.sh b/frequency.sh
new file mode 100755
index 00000000..7a81fd07
--- /dev/null
+++ b/frequency.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo "Starting frequency control"
+
+python3 /home/pi/CubeSatSim/frequency.py
diff --git a/groundstation/SDRpp.desktop b/groundstation/SDRpp.desktop
new file mode 100644
index 00000000..f4f4ba38
--- /dev/null
+++ b/groundstation/SDRpp.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Exec=/home/pi/CubeSatSim/groundstation/sdrpp.sh
+Name=SDRpp
+Comment=SDRpp
+Icon=/home/pi/Icons/sdrpp.png
+Path=/home/pi
+Terminal=true
+Categories=HamRadio
+Keywords=Ham Radio;SDR
diff --git a/groundstation/aprs-cubesatsim.sh b/groundstation/aprs-cubesatsim.sh
index f71a70e3..dfc30e03 100755
--- a/groundstation/aprs-cubesatsim.sh
+++ b/groundstation/aprs-cubesatsim.sh
@@ -9,6 +9,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
diff --git a/groundstation/aprs.desktop b/groundstation/aprs.desktop
index b9ee2512..a7d0062a 100644
--- a/groundstation/aprs.desktop
+++ b/groundstation/aprs.desktop
@@ -2,7 +2,7 @@
Name=APRS Decode using Direwolf
GenericName=Decodes APRS using rtl_fm and Direwolf
Comment=APRS signals
-Exec=/home/pi/CubeSatSim/groundstation/aprs.sh
+Exec=/usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/groundstation/packet.sh"
Icon=/home/pi/Icons/aprs.png
Terminal=true
Type=Application
diff --git a/groundstation/aprs.sh b/groundstation/aprs.sh
index 2e1c6873..358d8bf6 100755
--- a/groundstation/aprs.sh
+++ b/groundstation/aprs.sh
@@ -3,12 +3,16 @@
sudo modprobe snd-aloop
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
@@ -78,7 +82,7 @@ echo -e "Auto decoding APRS packets on $frequency Hz"
#sudo rtl_fm -f 144.39M -s 22050 -g 48 - | multimon-ng -a AFSK1200 -A -t raw -
-direwolf -r 48000 -t 0 &
+direwolf -c /home/pi/CubeSatSim/groundstation/direwolf.conf -r 48000 -t 0 &
sleep 5
@@ -87,6 +91,7 @@ echo "$value" > /dev/null
set -- $value
#rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
-rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1
+#rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1
+rtl_fm -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
sleep 5
diff --git a/groundstation/auto-tune.py b/groundstation/auto-tune.py
new file mode 100644
index 00000000..b7808902
--- /dev/null
+++ b/groundstation/auto-tune.py
@@ -0,0 +1,93 @@
+from rtlsdr import RtlSdr
+import numpy as np
+import matplotlib.pyplot as plt
+import sys
+
+if __name__ == "__main__":
+ graph = 'n'
+ center_frequency = 434.7e6
+ if (len(sys.argv)) > 0:
+# print("There are arguments!")
+ center_frequency = float(sys.argv[1]) - 200e3
+ if (center_frequency == 0):
+ center_frequency = 434.7e6
+ if (len(sys.argv)) > 1:
+# print("There are more arguments")
+ if (sys.argv[2] == 'g') or (sys.argv[2] == '-g'):
+ graph = 'y'
+
+ sampling_rate = 1024e3 # 250e3 # Hz
+ duration = 65536/sampling_rate # 1 # seconds
+
+ try:
+ sdr = RtlSdr()
+
+ # configure device
+ sdr.sample_rate = sampling_rate # 250e3 # 2.4e6
+ #center_frequency = 434.8e6
+ sdr.center_freq = center_frequency
+ sdr.gain = 47
+ sdr.direct_sampling = False
+
+ # signal = sdr.read_samples(64*1024) #256
+ signal = sdr.read_samples(duration*sampling_rate).real #256
+
+ # print(f"Center frequency is {center_frequency}")
+
+ sdr.close()
+
+ # Compute the FFT
+ fft_result = np.fft.fft(signal)
+
+ # Calculate the frequencies corresponding to the FFT output
+ n = len(signal)
+ frequencies = np.fft.fftfreq(n, d=1/sampling_rate)
+
+ # Take the absolute value for amplitude spectrum and consider only the positive frequencies
+ positive_frequencies_indices = np.where(frequencies >= 0)
+ positive_frequencies = frequencies[positive_frequencies_indices]
+ amplitude_spectrum = 2/n * np.abs(fft_result[positive_frequencies_indices]) # Normalize for amplitude
+
+ if (graph == 'y'):
+ # Plotting the results
+ t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
+
+ plt.figure(figsize=(12, 6))
+
+ plt.subplot(1, 2, 1)
+ plt.plot(t, signal)
+ plt.title('Time Domain Signal')
+ plt.xlabel('Time (s)')
+ plt.ylabel('Amplitude')
+
+ plt.subplot(1, 2, 2)
+ plt.stem(positive_frequencies, amplitude_spectrum, markerfmt=" ", basefmt="-b")
+ plt.title('Frequency Domain (FFT)')
+ plt.xlabel('Frequency (Hz)')
+ plt.ylabel('Amplitude')
+ plt.grid(True)
+
+ plt.tight_layout()
+ plt.show()
+
+ # print(amplitude_spectrum)
+ x = amplitude_spectrum
+ # print(x)
+ min_value = min(x)
+ max_value = max(x) * 100
+
+ #freq_min = np.argmax(min_value)
+ # print(np.argmax(x))
+ # print(np.argmax(x)*(150e3 - 10e3)/(9770 - 709))
+ # print(sampling_rate)
+ # print(center_frequency)
+
+ offset = (np.argmax(x)*(150e3 - 10e3)/(9770 - 709))
+ freq_max = center_frequency + offset + 2000
+ except: # if no RTL-SDR or in use, stop scanning with high max value and center frequency
+ max_value = 100
+ freq_max = center_frequency + 200e3 # should be 434900000
+
+ print(f" {freq_max:.0f} {max_value:.0f}")
+
+
diff --git a/groundstation/autostart/chromium.desktop b/groundstation/autostart/chromium.desktop
index fc57834e..f6e74ffd 100644
--- a/groundstation/autostart/chromium.desktop
+++ b/groundstation/autostart/chromium.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
Type=Application
-Name=Chromium with WebSDR
-Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073
+Name=Browser with WebSDR
+Exec=x-www-browser http://localhost:8073/
diff --git a/groundstation/bookmarks.json b/groundstation/bookmarks.json
index f8bae496..d780af28 100644
--- a/groundstation/bookmarks.json
+++ b/groundstation/bookmarks.json
@@ -1,137 +1,87 @@
[
- {
- "name": "ISS APRS",
- "frequency": 145825000,
- "modulation": "nfm"
- },
- {
- "name": "ISS SSTV/Voice",
- "frequency": 145800000,
- "modulation": "nfm"
- },
- {
- "name": "ARISS Repeater Downlink",
- "frequency": 437800000,
- "modulation": "nfm"
- },
- {
- "name": "AO-27",
- "frequency": 436795000,
- "modulation": "nfm"
- },
- {
- "name": "AO-73",
- "frequency": 145815000,
- "modulation": "usb"
- },
- {
- "name": "Fox-1B AO-91",
- "frequency": 145960000,
- "modulation": "nfm"
- },
- {
- "name": "Fox-1D AO-92",
- "frequency": 145880000,
- "modulation": "nfm"
- },
- {
- "name": "HuskySat-1 HO-107",
- "frequency": 435800000,
- "modulation": "usb"
- },
- {
- "name": "Fox-1E",
- "frequency": 435750000,
- "modulation": "usb"
- },
- {
- "name": "MAX VALIER",
- "frequency": 145860000,
- "modulation": "usb"
- },
- {
- "name": "NOAA WX Radio 1",
- "frequency": 162400000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 2",
- "frequency": 162425000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 3",
- "frequency": 162450000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 4",
- "frequency": 162475000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 5",
- "frequency": 162500000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 6",
- "frequency": 162525000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA WX Radio 7",
- "frequency": 162550000,
- "modulation": "nfm"
- },
- {
- "name": "CAS-4A",
- "frequency": 145855000,
- "modulation": "usb"
- },
- {
- "name": "CAS-4B",
- "frequency": 145910000,
- "modulation": "usb"
- },
- {
- "name": "XW-2A",
- "frequency": 145660000,
- "modulation": "usb"
- },
- {
- "name": "XW-2B",
- "frequency": 145725000,
- "modulation": "usb"
- },
- {
- "name": "XW-2C",
- "frequency": 145790000,
- "modulation": "usb"
- },
- {
- "name": "XW-2F",
- "frequency": 145975000,
- "modulation": "usb"
- },
- {
- "name": "NOAA-19",
- "frequency": 137100000,
- "modulation": "nfm"
- },
- {
- "name": "NOAA-18",
- "frequency": 137912500,
- "modulation": "nfm"
- },
- {
- "name": "NOAA-15",
- "frequency": 137620000,
- "modulation": "nfm"
- },
- {
- "name": "CubeSatSim",
- "frequency": 434900000,
- "modulation": "packet"
- }
+ {
+ "name": "NOAA WX Radio 1",
+ "frequency": 162400000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 2",
+ "frequency": 162425000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 3",
+ "frequency": 162450000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 4",
+ "frequency": 162475000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 5",
+ "frequency": 162500000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 6",
+ "frequency": 162525000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "NOAA WX Radio 7",
+ "frequency": 162550000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "CubeSatSim Cross Band Repeater",
+ "frequency": 144900000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "CubeSatSim",
+ "frequency": 434900000,
+ "modulation": "sstv"
+ },
+ {
+ "name": "CubeSatSim RX",
+ "frequency": 435000000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "ISS SSTV/Voice",
+ "frequency": 145800000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "ISS APRS",
+ "frequency": 145825000,
+ "modulation": "packet"
+ },
+ {
+ "name": "ISS Voice Repeater",
+ "frequency": 437800000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "AO-91",
+ "frequency": 145960000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "AO-73",
+ "frequency": 145970000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "ISS U/V",
+ "frequency": 145800000,
+ "modulation": "nfm"
+ },
+ {
+ "name": "AO-7 Mode B",
+ "frequency": 145950000,
+ "modulation": "nfm"
+ }
]
diff --git a/groundstation/chromium.desktop.autostart b/groundstation/chromium.desktop.autostart
index da2a350e..76d785f9 100644
--- a/groundstation/chromium.desktop.autostart
+++ b/groundstation/chromium.desktop.autostart
@@ -1,4 +1,4 @@
[Desktop Entry]
Type=Application
Name=Chromium with WebSDR
-Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073
+Exec=x-www-browser http://127.0.0.1:8073
diff --git a/groundstation/command.sh b/groundstation/command.sh
new file mode 100755
index 00000000..6069f9b2
--- /dev/null
+++ b/groundstation/command.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# script to send APRS or DTMR commands to a CubeSatSim
+
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+
+if [ "$1" != "n" ]; then
+
+ echo "You are not in Transmit Commands mode"
+ sleep 10
+ exit
+
+fi
+
+sudo killall -9 zenity &>/dev/null
+
+echo
+
+autotune=0
+
+mode=$(zenity --timeout=20 --list 2>/dev/null --width=300 --height=380 --title="Transmit Command" --text="Choose the command to transmit" --column="Mode" --column="Result" a "APRS Mode" f "FSK Mode" b "BPSK Mode" s "SSTV Mode" m "CM Mode" e "Repeater Mode" j "FUNcube Mode" G "PacSatSim Mode" o "Beacon On/Off")
+
+# echo $mode
+
+if [ -z "$mode" ]; then
+
+ echo "No choice made."
+ sleep 10
+
+ exit
+
+fi
+
+/home/pi/CubeSatSim/config -$mode
+sleep 10
+
+
+
+
diff --git a/groundstation/cubicsdr-packet.sh b/groundstation/cubicsdr-packet.sh
index c5f0a1e8..a14fa706 100755
--- a/groundstation/cubicsdr-packet.sh
+++ b/groundstation/cubicsdr-packet.sh
@@ -8,6 +8,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
diff --git a/groundstation/cubicsdr.desktop b/groundstation/cubicsdr.desktop
index 1599f5df..2cf19759 100644
--- a/groundstation/cubicsdr.desktop
+++ b/groundstation/cubicsdr.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/cubicsdr.sh
Name=SDR FM Broadcast
Comment=CubicSDR FM Broadcast
-Icon=/home/pi/Downloads/cubicsdr.png
+Icon=/home/pi/Icons/cubicsdr.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/cubicsdr.sh b/groundstation/cubicsdr.sh
index 5d66f4c3..0db3a88e 100755
--- a/groundstation/cubicsdr.sh
+++ b/groundstation/cubicsdr.sh
@@ -9,19 +9,23 @@ echo "Note: Select Generic RTL2832 device then click Start to begin"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sudo killall -9 java &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 qsstv &>/dev/null
@@ -39,11 +43,28 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
zenity --info --width=650 --height=140 --title="Instructions" --text="When CubicSDR opens, select Generic RTL2832U device then click Start to begin.\n\nThen click on a signal in the watefall to listen." &
+sleep 5
+
+setsid CubicSDR
+
+sleep 10
+
+#$SHELL
+#sudo kill `ps -aux | grep sstv_decode_prompt| grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+sudo killall -9 zenity &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+zenity --info --width=650 --height=140 --title="Instructions" --text="When CubicSDR opens, select Generic RTL2832U device then click Start to begin.\n\nThen click on a signal in the watefall to listen." &
sleep 5
diff --git a/groundstation/direwolf.conf b/groundstation/direwolf.conf
index ce8b6823..d70427b9 100644
--- a/groundstation/direwolf.conf
+++ b/groundstation/direwolf.conf
@@ -1 +1 @@
-ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=b1,DEV=0
+ADEVICE plughw:CARD=Loopback,DEV=1 default
diff --git a/groundstation/direwolf/direwolf-pacsat.conf b/groundstation/direwolf/direwolf-pacsat.conf
new file mode 100644
index 00000000..0d4ba0e1
--- /dev/null
+++ b/groundstation/direwolf/direwolf-pacsat.conf
@@ -0,0 +1,9 @@
+CHANNEL 0
+MODEM 1200
+KISSPORT 8100
+AGWPORT 8002
+DWAIT 20
+SLOTTIME 10
+PERSIST 63
+TXDELAY 30
+FULLDUP OFF
diff --git a/groundstation/fctelem.sh b/groundstation/fctelem.sh
index 4beb88a3..eee1ee09 100755
--- a/groundstation/fctelem.sh
+++ b/groundstation/fctelem.sh
@@ -5,7 +5,7 @@ echo "Script to run FUNcube CubeSatSim Telemetry"
echo
-echo "The Chromium browser will load in a few seconds with fctelem."
+echo "The browser will load in a few seconds with fctelem."
echo "You can also use another web browser if you are on the same network as your Pi."
@@ -24,6 +24,16 @@ echo "Note: you need to be on the Wifi network: $ssid"
echo
+if [[ $(gpio -v | grep "Pi 4") ]] && [[ ! $(sudo raspi-config nonint get_browser | grep "chromium") ]] ; then
+ echo "Since Pi 4, changing default browser to Chromium"
+ sudo raspi-config nonint do_browser chromium
+fi
+
+if [[ $(gpio -v | grep "Pi 5") ]] && [[ ! $(sudo raspi-config nonint get_browser | grep "firefox") ]] ; then
+ echo "Since Pi 5, changing default browser to Firefox"
+ sudo raspi-config nonint do_browser firefox
+fi
+
sudo killall -9 fctelem &>/dev/null
sudo killall -9 python3 &>/dev/null
@@ -34,6 +44,8 @@ sudo killall -9 python3 &>/dev/null
#pkill -o chromium &>/dev/null
+#pkill -o firefox &>/dev/null
+
#sudo killall -9 rtl_tcp &>/dev/null
#sudo killall -9 CubicSDR &>/dev/null
@@ -80,8 +92,9 @@ else
echo
fi
+autotune=0
-frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=180 --title="FUNcube Telem Decoding" --text="Choose the frequency for FUNcube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency")
+frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=220 --title="FUNcube Telem Decoding" --text="Choose the frequency for FUNcube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" Other "Choose another frequency")
echo $frequency
@@ -96,6 +109,11 @@ if [ "$frequency" = "434900" ]; then
frequency=434900000
+elif [ "$frequency" = "Auto-tune" ]; then
+
+ frequency=434900000
+ autotune=1
+
elif [ "$frequency" = "Other" ]; then
echo
@@ -110,6 +128,39 @@ elif [ "$frequency" = "Other" ]; then
fi
+if [ "$autotune" = "1" ]; then
+ threshold=1
+ delay=5
+ retries=5
+
+ echo "Starting Auto-tune scanning"
+ echo "Scan will stop when confidence exceeds threshold value of" $threshold "or after" $retries "retries"
+ tries=0
+ confidence=0
+ delay=$((delay-2)) # subtract 2 second built in delay
+ while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
+
+ sleep $delay
+ source /home/pi/venv/bin/activate
+ python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ # echo "auto-tune.txt"
+ # cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune confidence:" $confidence
+ tries=$((tries+1))
+
+ done
+
+ if [ "$confidence" -gt "$threshold" ]; then
+ frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune frequency:" $frequency
+ else
+ echo "Auto tune failed, frequency unchanged"
+ fi
+
+sleep 5
+fi
+
echo "Frequency is" $frequency
echo
echo "If your CubeSatSim is transmitting in FUNcube mode (mode 7) you should get some frames after 30 seconds"
@@ -135,7 +186,8 @@ cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg
python3 -m http.server 8002 &
-setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8002 &>/dev/null &
+#setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8002 &>/dev/null &
+setsid x-www-browser http://127.0.0.1:8002/
cd /home/pi/fctelem
diff --git a/groundstation/fox-download.desktop b/groundstation/fox-download.desktop
index d58827d0..4e4bcf40 100644
--- a/groundstation/fox-download.desktop
+++ b/groundstation/fox-download.desktop
@@ -2,7 +2,7 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-download.sh
Name=FoxTelem Download
-Comment=FIAB-v3
+Comment=FIAB-v4
Icon=/home/pi/Icons/FoxTelemDownload.png
Path=/home/pi
Terminal=true
diff --git a/groundstation/fox-profile.desktop b/groundstation/fox-profile.desktop
index c03f40d4..8b7aaabe 100644
--- a/groundstation/fox-profile.desktop
+++ b/groundstation/fox-profile.desktop
@@ -2,8 +2,8 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-profile.sh
Name=Change FoxTelem Profile
-Comment=FIAB-v3
-Icon=/home/pi/Downloads/foxtelem.png
+Comment=FIAB-v4
+Icon=/home/pi/Icons/foxtelem.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/fox-run.sh b/groundstation/fox-run.sh
index fa456cd1..d321719d 100755
--- a/groundstation/fox-run.sh
+++ b/groundstation/fox-run.sh
@@ -5,6 +5,8 @@ echo "Startup script to run FoxTelem for FIAB v4"
echo
+source /home/pi/venv/bin/activate
+
sudo killall -9 FoxTelem &>/dev/null
sudo killall -9 zenity &>/dev/null
@@ -12,7 +14,7 @@ sudo killall -9 zenity &>/dev/null
FILE=/home/pi/FoxTelemetryData/.foxprofile
if [ ! -f "$FILE" ]; then
- profile=$(zenity --text="Choose your default FoxTelem profile:" --list 2>/dev/null --width=410 --height=120 --title="Set FoxTelem Profile" --column="Profile" --column="Receive and decode telemetry from" Fox-in-a-Box "AMSAT Fox satellites" "CubeSatSim" "AMSAT CubeSat Simulator")
+ profile=$(zenity --text="Choose your default FoxTelem profile:" --list 2>/dev/null --width=410 --height=120 --title="Set FoxTelem Profile" --column="Profile" --column="Receive and decode telemetry from" Fox-in-a-Box "AMSAT Satellites" "CubeSatSim" "AMSAT CubeSat Simulator")
echo $profile
diff --git a/groundstation/fox-startup.sh b/groundstation/fox-startup.sh
index cf6a6282..5fc934e5 100755
--- a/groundstation/fox-startup.sh
+++ b/groundstation/fox-startup.sh
@@ -5,6 +5,12 @@ echo "Startup script to run FoxTelem for FIAB v4"
echo
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+echo $1
+if [ "$1" != "P" ] ; then
+
sudo killall -9 FoxTelem &>/dev/null
FILE=/home/pi/FoxTelemetryData/.foxprofile
@@ -36,4 +42,10 @@ sleep 10
fi
+else
+ echo "Don't run FoxTelem since PacSat Ground Station mode is set"
+# /home/pi/CubeSatSim/groundstation/pacsat-run.sh
+
+fi
+
#$SHELL
diff --git a/groundstation/fox.sh b/groundstation/fox.sh
index 9e1f4130..0065548e 100755
--- a/groundstation/fox.sh
+++ b/groundstation/fox.sh
@@ -5,12 +5,16 @@ echo "Script to run FoxTelem for ARISS Radio Pi"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -23,12 +27,15 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 qsstv &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
sleep 5
diff --git a/groundstation/foxtelem.desktop b/groundstation/foxtelem.desktop
index 9dc42ab9..c01913be 100644
--- a/groundstation/foxtelem.desktop
+++ b/groundstation/foxtelem.desktop
@@ -2,8 +2,8 @@
Type=Application
Exec=/home/pi/CubeSatSim/groundstation/fox-run.sh
Name=FoxTelem
-Comment=FIAB-v3
-Icon=/home/pi/Downloads/foxtelem.png
+Comment=FIAB-v4
+Icon=/home/pi/Icons/foxtelem.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/gpredict.desktop b/groundstation/gpredict.desktop
index 20a6ab49..c3e0a72b 100644
--- a/groundstation/gpredict.desktop
+++ b/groundstation/gpredict.desktop
@@ -1,9 +1,9 @@
[Desktop Entry]
Type=Application
-Exec=/usr/bin/gpredict
+Exec=/home/pi/CubeSatSim/groundstation/gpredict.sh
Name=Gpredict
Comment=ISS and Satellite Tracking for ARISS Radio Pi
-Icon=/home/pi/Downloads/gpredict.png
+Icon=/home/pi/Icons/gpredict.png
Path=/home/pi
Terminal=false
Categories=HamRadio
diff --git a/groundstation/gpredict.sh b/groundstation/gpredict.sh
new file mode 100755
index 00000000..6f926dc8
--- /dev/null
+++ b/groundstation/gpredict.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+
+if [ ! $(systemctl get-default | grep graphical) ]; then
+
+ echo "Graphical User Interface not running!"
+ echo
+ echo "Do you want to reboot and switch to GUI so you can run Gpredict?"
+ read answer
+
+ if [ "$answer" = "y" ] || [ "$answer" = "yes" ]; then
+ echo "Rebooting!"
+ sudo raspi-config nonint do_boot_behaviour B4
+ sudo reboot now
+ else
+ echo "You can run Gpredict next time you run the GUI."
+ exit
+ fi
+fi
+
+nohup /usr/bin/gpredict /dev/null 2>&1 &
diff --git a/groundstation/loc-add-foxtelem.py b/groundstation/loc-add-foxtelem.py
index 64c47bbd..1f4279cc 100644
--- a/groundstation/loc-add-foxtelem.py
+++ b/groundstation/loc-add-foxtelem.py
@@ -118,6 +118,16 @@ if (latitude != 0) and (longitude != 0):
system(longSedStr)
print("\nKLAtracker configuration updated with your latitude and longitude")
+
+ latSedStr = 'sed -i "s/latitude=.*/latitude=' + str(latitude) + '/g" /home/pi/PacSatGround/PacSatGround.properties'
+ #print (latSedStr)
+ system(latSedStr)
+
+ longSedStr = 'sed -i "s/longitude=.*/longitude=' + str(longitude) + '/g" /home/pi/PacSatGround/PacSatGround.properties'
+ #print (longSedStr)
+ system(longSedStr)
+
+ print("\nPacsat configuration updated with your latitude and longitude")
receiver_gpsSedStr = 'sudo sed -i "s/ ' + dquote + 'lat' + dquote + ': .*/ ' + dquote + 'lat' + dquote + ': ' + str(latitude) + ',/g" /var/lib/openwebrx/settings.json'
#print (receiver_gpsSedStr)
diff --git a/groundstation/loc.sh b/groundstation/loc.sh
index bdbedc77..94558962 100755
--- a/groundstation/loc.sh
+++ b/groundstation/loc.sh
@@ -12,4 +12,3 @@ python3 /home/pi/CubeSatSim/groundstation/loc-foxtelem.py
#/usr/bin/gpredict
nohup /usr/bin/gpredict /dev/null 2>&1 &
-
diff --git a/groundstation/packet.sh b/groundstation/packet.sh
index 803e988a..627d04da 100755
--- a/groundstation/packet.sh
+++ b/groundstation/packet.sh
@@ -12,8 +12,12 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_fm &>/dev/null
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 direwolf &>/dev/null
sudo killall -9 aplay &>/dev/null
@@ -37,7 +41,9 @@ sudo /etc/init.d/alsa-utils start
echo
-frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=360 --title="Packet Decoding with Direwolf" --text="Choose the frequency for packet decoding" --column="kHz" --column="Application" 144390 "APRS US 2m" 434900 "CubeSatSim" 144800 "APRS European 2m" 145175 "APRS Australian 2m" Other "Choose another frequency" 145825 "APRS on ISS" APRS "Test APRS decoding with CubeSatSim WAV file")
+autotune=0
+
+frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=400 --title="Packet Decoding with Direwolf" --text="Choose the frequency for packet decoding" --column="kHz" --column="Application" 144390 "APRS US 2m" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" 144800 "APRS European 2m" 145175 "APRS Australian 2m" Other "Choose another frequency" 145825 "APRS on ISS" APRS "Test APRS decoding with CubeSatSim WAV file")
#echo $frequency
@@ -75,6 +81,11 @@ elif [ "$choice" = "2" ] || [ "$frequency" = "434900" ] ; then
echo "If your CubeSatSim is transmitting in APRS mode (mode 1) then you should see packets."
echo
+elif [ "$frequency" = "Auto-tune" ] ; then
+
+ frequency=434900000
+ autotune=1
+
elif [ "$choice" = "3" ] || [ "$frequency" = "144800" ]; then
frequency=144800000
@@ -155,7 +166,41 @@ echo
#fi
-sleep 5
+#sleep 5
+
+if [ "$autotune" = "1" ]; then
+ threshold=1
+ delay=1
+ retries=30
+
+ echo "Starting Auto-tune scanning"
+ echo "Scan will stop when confidence exceeds threshold value of " $threshold " or after " $retries " retries"
+ tries=0
+ confidence=0
+ while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
+
+# sleep $delay
+ source /home/pi/venv/bin/activate
+ python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ # echo "auto-tune.txt"
+ # cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune confidence: " $confidence
+ tries=$((tries+1))
+
+ done
+
+ if [ "$confidence" -gt "$threshold" ]; then
+ frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune frequency: " $frequency
+ else
+ echo "Auto tune failed, frequency unchanged"
+ fi
+ echo
+ echo "If your CubeSatSim is transmitting in APRS mode (mode 1) then you should see packets."
+ echo
+
+fi
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
@@ -166,5 +211,4 @@ rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t r
rtl_fm -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
-
sleep 5
diff --git a/groundstation/pacsat-config.sh b/groundstation/pacsat-config.sh
new file mode 100755
index 00000000..a7d02549
--- /dev/null
+++ b/groundstation/pacsat-config.sh
@@ -0,0 +1,208 @@
+#!/bin/bash
+# script to run FoxTelem
+
+echo "Script to configure the Pacsat Ground Station for FIAB v4"
+
+echo
+
+#source /home/pi/venv/bin/activate
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+#FILE=/home/pi/.pacsatprofile
+#if [ ! -f "$FILE" ]; then
+
+# profile=$(zenity --text="Choice:" --list 2>/dev/null --width=410 --height=120 --title=" Ground Station Choice" --column="Choice" --column="Result" "" "Receive from CubeSatSim PacSatSim" "Configure" "Configure PacSat Ground Station" "Loopback" "Run a Locally Simulated PacSat")
+# echo $profile
+
+ echo "Here are the configuration choices:"
+ echo
+ echo " 1. Pacsat Ground Station Configuration"
+ echo
+ echo " 2. Pacsat Ground Station Simulation Configuration"
+ echo
+ echo " 3. Set Frequencies"
+ echo
+ echo " 4. Reset Pacsat Satellite"
+ echo
+ echo "Which do you choose? Enter 1 - 4"
+ echo
+
+ read -r ANS
+
+ if [ -z "$ANS" ]; then
+
+ echo "No choice made. Exiting."
+
+ sleep 3
+
+ exit
+
+ fi
+
+ if [ "$ANS" = "1" ] || [ "$ANS" = "2" ] ; then
+
+ if [ "$ANS" = "1" ] ; then
+ echo "Here are your Pacsat Ground Station Configuration choices:"
+ else
+ echo "Here are your Pacsat Ground Station Simulation Configuration choices:"
+ fi
+ echo
+ echo " 1. Pacsat Ground Station Callsign"
+ echo
+ echo " 2. Set Remote Pacsat Satellite Callsign in Ground Station configuration"
+ echo
+ echo " 3. Reset Pacsat Ground Station Configuration"
+ echo
+
+ read -r CH
+
+
+ if [ -z "$CH" ]; then
+
+ echo "No choice made. Exiting."
+
+ sleep 3
+
+ exit
+
+ fi
+
+ if [ "$CH" = "1" ] ; then
+
+ echo
+ if [ "$ANS" = "1" ] ; then
+ oldcallsign=$(grep -oP '(?<=callsign=).*$' /home/pi/PacSatGround/PacSatGround.properties)
+ else
+ oldcallsign=$(grep -oP '(?<=callsign=).*$' /home/pi/PacSatGroundLoop/PacSatGround.properties)
+ fi
+ echo "Callsign in PacSatGround.properties is "
+ echo $oldcallsign
+
+ echo "Enter new callsign in all capitals: "
+ echo
+ read callsign
+
+ if [ -z $callsign ] ; then
+
+ callsign="$1"
+ echo "Keeping value of" $oldcallsign
+
+ else
+
+ echo "Configured callsign is "
+ echo $callsign
+
+ if [ ! "$callsign" = "$oldcallsign" ] ; then
+
+ if [ "$ANS" = "1" ] ; then
+ sudo sed -i "s/callsign=$oldcallsign/callsign=$callsign/g" /home/pi/PacSatGround/PacSatGround.properties
+ cat /home/pi/PacSatGround/PacSatGround.properties
+ else
+ sudo sed -i "s/callsign=$oldcallsign/callsign=$callsign/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
+ cat /home/pi/PacSatGroundLoop/PacSatGround.properties
+ fi
+
+ fi
+ fi
+
+ elif [ "$CH" = "2" ] ; then
+
+ echo "You have chosen to set the remote CubeSatSim Pacsat Satellite callsign in ground station configuration"
+ echo
+
+ PROPERTIES=/home/pi/PacSatGround/spacecraft/PacSatSim.properties
+ PROPERTIES_L=/home/pi/PacSatGroundLoop/spacecraft/PacSatSim.properties
+
+ if [ "$ANS" = "1" ] ; then
+ oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' $PROPERTIES )
+ else
+ oldcallsign=$(grep -oP '(?<=bbsCallsign=).*(?=-)' $PROPERTIES_L )
+ fi
+ echo "Current value of remote Pacsat callsign is"
+ echo $oldcallsign
+ echo
+
+ echo "Enter new callsign in all capitals: "
+ echo
+ read callsign
+
+ if [ -z $callsign ] ; then
+
+ callsign="$1"
+ echo "Keeping value of" $oldcallsign
+
+ else
+ if [ "$ANS" = "1" ] ; then
+ sudo sed -i "s/$oldcallsign/$callsign/g" $PROPERTIES
+ else
+ sudo sed -i "s/$oldcallsign/$callsign/g" $PROPERTIES_L
+ fi
+ echo
+ echo "Changing callsign to "
+ echo $callsign
+ echo
+ echo "You will see the change next time you run the Pacsat Ground Station"
+ echo "You can close this window"
+ fi
+
+ elif [ "$CH" = "3" ] ; then
+
+ echo "You have chosen to reset the Pacsat Ground Station Configuration"
+ echo
+# echo "Next time you run the Ground Station you will need to Add the PacSatSim spacecraft"
+# echo
+
+ if [ "$ANS" = "1" ] ; then
+ sudo rm -r /home/pi/PacSatGround
+ # cd
+ # sudo rm PacSatGround.zip
+ # wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p-s/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ # unzip PacSatGround.zip -d PacSatGround
+ # sudo rm PacSatGround.zip
+ else
+ sudo rm -r /home/pi/PacSatGroundLoop
+ # cd
+ # sudo rm PacSatGround.zip
+ # wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p-s/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ # unzip PacSatGround.zip -d PacSatGroundLoop
+ # sudo rm PacSatGround.zip
+ fi
+ echo "You can close this window now"
+ else
+
+ echo "Please choose an option 1-3"
+ echo
+
+ fi
+
+ elif [ "$ANS" = "3" ] ; then
+
+ echo "You have chosen to set the Frequency of the Pacsat Ground Station"
+ echo
+
+ /home/pi/CubeSatSim/config -F
+
+ echo "You can close this window now"
+
+ elif [ "$ANS" = "4" ] ; then
+
+ echo "You have chosen to reset the Pacsat Satellite"
+ echo
+
+ /home/pi/CubeSatSim/config -k
+
+ else
+
+ echo "Please enter only 1 to 4"
+
+ fi
+
+
+# sleep 10
+
+#$SHELL
diff --git a/groundstation/pacsat-run.sh b/groundstation/pacsat-run.sh
new file mode 100755
index 00000000..ca791022
--- /dev/null
+++ b/groundstation/pacsat-run.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+# script to run FoxTelem
+
+echo "Startup script to run the Pacsat Ground Station"
+
+echo
+
+# source /home/pi/venv/bin/activate
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+sudo killall -9 aplay &>/dev/null
+
+if [ ! $(systemctl get-default | grep graphical) ]; then
+
+ echo "Graphical User Interface not running!"
+ echo
+ echo "Do you want to reboot and switch to GUI so you can run the Pacsat Ground Station"
+ read answer
+
+ if [ "$answer" = "y" ] || [ "$answer" = "yes" ]; then
+ echo "Rebooting!"
+ sudo raspi-config nonint do_boot_behaviour B4
+ sudo reboot now
+ else
+ echo "You can run the Pacsat Ground Station next time you run the GUI."
+ exit
+ fi
+fi
+
+#FILE=/home/pi/.pacsatprofile
+#if [ ! -f "$FILE" ]; then
+
+ profile=$(zenity --timeout=10 --text="Choose what you want to do:" --list 2>/dev/null --width=410 --height=220 --title="Pacsat Ground Station" --column="Choice" --column="Result" "Pacsat" "Run Pacsat Ground Station" "Configure" "Configure the Pacsat Ground Station" "Simulate" "Run a Locally Simulated Pacsat")
+
+ echo $profile
+
+ if [ -z "$profile" ]; then
+
+ echo "No choice made. Default to Pacsat Ground Station."
+
+ profile="Pacsat"
+
+ fi
+
+ if [ "$ANS" = "1" ] || [ "$profile" = "Pacsat" ] ; then
+
+ echo "You have chosen to run the Pacsat Ground Station"
+ # echo "p" > /home/pi/.pacsatprofile
+ echo
+
+ /home/pi/CubeSatSim/groundstation/pacsat.sh
+
+
+ elif [ "$ANS" = "2" ] || [ "$profile" = "Configure" ] ; then
+
+ echo "You have chosen to configure the Pacsat Ground Station"
+ echo
+
+ /home/pi/CubeSatSim/groundstation/pacsat-config.sh
+
+ elif [ "$ANS" = "3" ] || [ "$profile" = "Simulate" ] ; then
+
+ sudo systemctl stop transmit
+
+ echo "You have chosen the Pacsat Ground Station with Local Simulated Satellite"
+
+ sleep 1
+
+ /usr/bin/x-terminal-emulator --geometry=120x40 -e "bash /home/pi/CubeSatSim/pacsatsim.sh l"
+
+ sleep 1
+
+ /home/pi/CubeSatSim/groundstation/pacsat.sh l
+
+ else
+
+ echo "Please enter only 1 or 2 or 3"
+
+ fi
+
+# sudo killall -9 direwolf &>/dev/null
+
+sleep 10
+
+#$SHELL
diff --git a/groundstation/pacsat.desktop b/groundstation/pacsat.desktop
new file mode 100644
index 00000000..04cea812
--- /dev/null
+++ b/groundstation/pacsat.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Pacsat Ground Station
+GenericName=Pacsat Ground Station
+Comment=Pacsat
+Exec=/usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/groundstation/pacsat-run.sh"
+Icon=/home/pi/Icons/pacsat.png
+Terminal=true
+Type=Application
+Categories=HamRadio;
+Keywords=APRS;
diff --git a/groundstation/pacsat.sh b/groundstation/pacsat.sh
new file mode 100755
index 00000000..0a1e64da
--- /dev/null
+++ b/groundstation/pacsat.sh
@@ -0,0 +1,371 @@
+#!/bin/bash
+
+function start-rtl {
+
+ value=`aplay -l | grep "Loopback"`
+ echo "$value" > /dev/null
+ set -- $value
+
+ #rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
+ #rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -r 48000 -t raw -f S16_LE -c 1
+
+# rtl_fm -g 12 -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 &
+ rtl_fm -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 &
+
+}
+
+# script to auto decode packets using Direwolf and FM TXC and run Pacsat Ground Station
+
+sudo pkill -f "/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
+
+loopback=0
+vox=0
+#rpitx=0
+#card=0
+#pwm=0
+
+if [ "$1" = "l" ] ; then
+ loopback=1
+elif [ "$1" = "v" ] ; then
+ vox=1
+#elif [ "$1" = "c" ] ; then
+# card=1
+#else
+# pwm=1
+fi
+
+if [[ $(lsusb | grep "RTL") ]] ; then
+ echo "RTL-SDR detected"
+ rtl=1
+else
+ echo "No RTL-SDR detected"
+ rtl=0
+# pwm=1
+fi
+
+if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+ /home/pi/CubeSatSim/config -L -1
+else
+ echo "No USB Sound Card detected"
+ soundcard=0
+fi
+
+gpio -g mode 12 up
+ if [[ $(gpio -g read 12 | grep 0) ]] ; then
+ echo "LPF is present"
+ lpf=1
+else
+ echo "LPF not present"
+ lpf=0
+fi
+
+gpio -g mode 7 up
+if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "TXC is present"
+ txc=1
+else
+ echo "TXC not present"
+ txc=0
+fi
+
+card="Headphones"
+if [[ $(gpio -v | grep "Pi 5") ]] ; then
+# echo "Since Pi 5, setting TXC to LPF setting and using USB headphones"
+# txc=$lpf
+ echo "Don't use TXC for Pi 5 for now"
+ txc=0
+ lpf=0
+ card="Device"
+fi
+
+FILE=/home/pi/CubeSatSim/battery_saver
+if [ -f "$FILE" ]; then
+ rpitx=1
+elif [ "$txc" = "0" ] && [ "$lpf" = "1" ]; then
+ rpitx=1
+else
+ rpitx=0
+fi
+
+
+if [ "$soundcard" = "0" ] && [ "$rtl" = "0" ]; then
+
+ echo "Won't work since can't receive with Sound Card or RTL-SDR"
+ sleep 10
+ exit
+
+fi
+
+value=`cat /home/pi/CubeSatSim/.mode`
+echo "$value" > /dev/null
+set -- $value
+
+MODE=$1
+
+if [ ! "$MODE" = "P" ] && [ ! "$loopback" = "1" ] ; then
+ echo
+ echo "Changing to Pacsat Ground Station Mode."
+ echo "You might reboot"
+ echo
+ sleep 5
+ /home/pi/CubeSatSim/config -I
+fi
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+txfrequency="$7e3"
+rxfrequency="$8e3"
+frequency="$8e6"
+
+echo -n "Callsign is "
+echo $callsign
+
+if [ "$loopback" = "1" ] ; then
+
+# if [ ! "$MODE" = "p" ] ; then
+ echo
+ echo "Switching to Pacsat mode for the Simulated Pacsat Satellite"
+ echo
+ /home/pi/CubeSatSim/config -G -n
+# fi
+
+ if [ ! -d "/home/pi/PacSatGroundLoop" ] ; then
+# if [ ! "$loopback" = "1" ] ; then # don't do this for now.
+
+ cd
+ sudo rm PacSatGroundLoop.zip &>/dev/null
+# wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/PacSatGround.zip .
+ unzip PacSatGround.zip -d PacSatGroundLoop
+ sudo rm PacSatGround.zip
+
+ mkdir PacSatGroundLoop/spacecraft
+ mv PacSatGroundLoop/PacSatGround/spacecraft/PacSatSim.properties PacSatGroundLoop/spacecraft/PacSatSim.properties
+ mv PacSatGroundLoop/PacSatGround/stp.dat PacSatGroundLoop/stp.dat
+ mv PacSatGroundLoop/PacSatGround/seq.dat PacSatGroundLoop/seq.dat
+ mv PacSatGroundLoop/PacSatGround/PacSatGround.properties PacSatGroundLoop/PacSatGround.properties
+
+ sudo sed -i 's/logfile_dir=\/home\/pi\/PacSatGround/logfile_dir=\/home\/pi\/PacSatGroundLoop/g' /home/pi/PacSatGroundLoop/PacSatGround.properties
+
+ FILE=/home/pi/Desktop/PacsatGround/spacecraft/PacSatSim.properties
+ if [ -f "$FILE" ]; then
+ FILE2=/home/pi/PacSatGroundLoop/spacecraft/PacSatSim.properties
+ sudo rm $FILE2
+ cp $FILE $FILE2
+ else
+ echo
+ echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
+ sleep 10
+ fi
+ fi
+ sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
+
+else
+
+ echo -n "Transmit Frequency is "
+ echo $txfrequency
+ echo -n "Receive Frequency is "
+ echo $rxfrequency
+ sleep 2
+
+ echo
+ echo "Mode is Pacsat Ground Station"
+ echo
+
+ if [ ! -d "/home/pi/PacSatGround" ] ; then
+
+ cd
+ sudo rm PacSatGround.zip &>/dev/null
+# wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
+ cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/PacSatGround.zip .
+ unzip PacSatGround.zip
+ sudo rm PacSatGround.zip
+
+ FILE=/home/pi/Desktop/PacsatGround/spacecraft/PacSatSim.properties
+ if [ -f "$FILE" ]; then
+ FILE2=/home/pi/PacSatGround/spacecraft/PacSatSim.properties
+ sudo rm $FILE2
+ cp $FILE $FILE2
+ else
+ echo
+ echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
+ sleep 10
+ fi
+
+ fi
+ sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGround/PacSatGround.properties
+fi
+
+sudo modprobe snd-aloop
+
+sudo systemctl stop command >/dev/null 2>&1
+
+sudo systemctl stop command >/dev/null 2>&1
+
+sudo systemctl stop openwebrx >/dev/null 2>&1
+
+sudo systemctl stop rtl_tcp >/dev/null 2>&1
+
+pkill -o chromium &>/dev/null
+
+pkill -o firefox &>/dev/null
+
+sudo killall -9 rtl_fm &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
+sudo killall -9 qsstv &>/dev/null
+
+sudo killall -9 rtl_tcp &>/dev/null
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 CubicSDR &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo usermod -a -G gpio pi
+
+
+if [ "$loopback" = "1" ] ; then
+
+ echo "1: Using Audio Loopback, No Transmit or Receive"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
+ PTT="PTT GPIOD gpiochip0 17"
+
+else
+
+ if [ "$lpf" = "1" ] ; then
+
+ if [ "$txc" = "1" ] && [ "$soundcard" = "1" ] ; then
+
+ if [ "$rpitx" = "1" ] ; then
+
+ echo "2: Using FM for Receive and rpitx for Transmit"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ else
+
+ echo "3: Using FM for Receive and Transmit"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=$card,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+
+ fi
+
+ elif [ "$txc" = "1" ] && [ "$soundcard" = "0" ] ; then
+
+ if [ "$rtl" = "1" ]; then
+
+ if [ "$rpitx" = "1" ]; then
+
+ echo "2b: Using RTL-SDR for Receive and rpitx for Transmit"
+ start-rtl
+ # ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ else
+
+ echo "3b: RTL-SDR for Receive Only"
+ start-rtl
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
+ PTT="#PTT GPIOD gpiochip0 17"
+
+ fi
+
+ else
+
+ echo "Won't work since can't receive with Sound Card or RTL-SDR"
+ sleep 10
+ exit
+
+ fi
+ else
+
+ if [ "$rtl" = "1" ]; then
+
+ echo "4: Using RTL-SDR for Receive and rpitx for Transmit"
+ start-rtl
+# ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ else
+
+ echo "5: Using Sound Card for Receive and rpitx for Transmit"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ fi
+ fi
+
+ else
+
+ if [ "$txc" = "1" ] ; then
+
+ echo "6: Using FM for Receive Only"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=$card,DEV=0"
+ PTT="#PTT GPIOD gpiochip0 -20"
+
+ else
+
+ if [ "$rtl" = "1" ] ; then
+
+ echo "7: Using RTL-SDR for Receive Only"
+ start-rtl
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
+ PTT="#PTT GPIOD gpiochip0 17"
+
+ else
+
+ echo "8: Using USB Sound Card for Receive and Transmit with RTS PTT"
+ ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
+ PTT="PTT /dev/ttyUSB0 RTS"
+
+ fi
+ fi
+ fi
+fi
+
+DIREWOLF_CONF="/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
+
+echo "$ADEVICE" > $DIREWOLF_CONF
+echo "MYCALL $callsign-1" >> $DIREWOLF_CONF
+echo "$PTT" >> $DIREWOLF_CONF
+cat /home/pi/CubeSatSim/groundstation/direwolf/direwolf-pacsat.conf >> $DIREWOLF_CONF
+
+echo
+echo "$DIREWOLF_CONF"
+echo
+cat $DIREWOLF_CONF
+echo
+
+# direwolf -P+ -D1 -qd -r 48000 -c $DIREWOLF_CONF &
+direwolf -D3 -qd -r 48000 -c $DIREWOLF_CONF &
+
+cd /home/pi/Desktop/PacsatGround/
+
+if [ "$loopback" = "1" ] ; then
+
+ setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGroundLoop" # removed &
+
+else
+
+ setsid java -Xmx512M -jar PacSatGround.jar "/home/pi/PacSatGround" # removed &
+
+fi
+
+sleep 10
+
+#echo "Stopping Pacsatsim"
+
+#$SHELL
+
+
+
diff --git a/groundstation/rtl-tcp-d.sh b/groundstation/rtl-tcp-d.sh
index b19539b7..2bda312a 100755
--- a/groundstation/rtl-tcp-d.sh
+++ b/groundstation/rtl-tcp-d.sh
@@ -23,6 +23,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 java &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
diff --git a/groundstation/rtl-tcp.desktop b/groundstation/rtl-tcp.desktop
index 117acb9c..7ae3c038 100644
--- a/groundstation/rtl-tcp.desktop
+++ b/groundstation/rtl-tcp.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/rtl-tcp.sh
Name=RTL-TCP
Comment=RTL-TCP for SDR#
-Icon=/home/pi/Downloads/SDRSharp.png
+Icon=/home/pi/Icons/SDRSharp.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/rtl-tcp.sh b/groundstation/rtl-tcp.sh
index dc10376c..3260b865 100755
--- a/groundstation/rtl-tcp.sh
+++ b/groundstation/rtl-tcp.sh
@@ -23,13 +23,17 @@ echo "Note: you need to be on the Wifi network: $ssid"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sleep 2
pkill -o chromium &>/dev/null
-sudo systemctl stop rtl_tcp
+pkill -o firefox &>/dev/null
+
+sudo systemctl stop rtl_tcp &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
sudo killall -9 java &>/dev/null
@@ -45,10 +49,13 @@ sudo killall -9 qsstv &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
sudo /bin/sh -c 'rtl_tcp -a $(hostname -I|cut -f1 -d " ")'
diff --git a/groundstation/rtl_tcp.service b/groundstation/rtl_tcp.service
index 403425a3..ff899e9b 100644
--- a/groundstation/rtl_tcp.service
+++ b/groundstation/rtl_tcp.service
@@ -3,7 +3,7 @@ Description=RTL-TCP
[Service]
TimeoutStopSec = 5
-ExecStart=/bin/sh -c '/usr/local/bin/rtl_tcp -a $(hostname -I)'
+ExecStart=/bin/sh -c 'rtl_tcp -a $(hostname -I|cut -f1 -d " ")'
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
diff --git a/groundstation/rtltcp.socket b/groundstation/rtltcp.socket
new file mode 100644
index 00000000..d8a67a14
--- /dev/null
+++ b/groundstation/rtltcp.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=RTL TCP Socket
+PartOf=rtltcp.service
+
+[Socket]
+ListenStream=[::]:1234
+
+[Install]
+WantedBy=sockets.target
diff --git a/groundstation/sdr.sh b/groundstation/sdr.sh
index 4603b153..5ef4de55 100755
--- a/groundstation/sdr.sh
+++ b/groundstation/sdr.sh
@@ -5,7 +5,7 @@ echo "Script to run Web SDR for ARISS Radio Pi"
echo
-echo "The Chromium browser will load in a few seconds with OpenWebRX."
+echo "The browser will load in a few seconds with OpenWebRX."
echo "You can also use another web browser if you are on the same network as your Pi."
@@ -24,12 +24,26 @@ echo "Note: you need to be on the Wifi network: $ssid"
echo
+if [[ $(gpio -v | grep "Pi 4") ]] && [[ ! $(sudo raspi-config nonint get_browser | grep "chromium") ]] ; then
+ echo "Since Pi 4, changing default browser to Chromium"
+ sudo raspi-config nonint do_browser chromium
+fi
+
+if [[ $(gpio -v | grep "Pi 5") ]]&& [[ ! $(sudo raspi-config nonint get_browser | grep "firefox") ]] ; then
+ echo "Since Pi 5, changing default browser to Firefox"
+ sudo raspi-config nonint do_browser firefox
+fi
+
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 java &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 CubicSDR &>/dev/null
@@ -38,13 +52,18 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 qsstv &>/dev/null
-sudo killall -9 aplay &>/dev/null
+#sudo killall -9 aplay &>/dev/null
sudo killall -9 direwolf &>/dev/null
sudo killall -9 zenity &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -52,7 +71,8 @@ sudo systemctl restart openwebrx
sleep 10
-setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073 &>/dev/null &
+#setsid chromium-browser --password-store=basic --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073 &>/dev/null &
+setsid x-www-browser http://localhost:8073/
sleep 10
diff --git a/groundstation/sdrpp.sh b/groundstation/sdrpp.sh
new file mode 100755
index 00000000..e8f83e3e
--- /dev/null
+++ b/groundstation/sdrpp.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# script to run sdrpp
+
+echo "Script to run SDRpp for ARISS Radio Pi"
+
+echo
+
+sudo systemctl stop openwebrx
+
+sudo killall -9 java &>/dev/null
+
+sudo killall -9 sdrpp &>/dev/null
+
+sudo systemctl stop rtl_tcp
+
+pkill -o chromium &>/dev/null
+
+pkill -o firefox &>/dev/null
+
+sudo killall -9 rtl_fm &>/dev/null
+
+sudo killall -9 direwolf &>/dev/null
+
+#sudo killall -9 aplay &>/dev/null
+
+sudo killall -9 qsstv &>/dev/null
+
+sudo killall -9 rtl_tcp &>/dev/null
+
+sudo killall -9 CubicSDR &>/dev/null
+
+#sudo kill `ps -aux | grep cubicsdr-packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+#sudo kill `ps -aux | grep packet | grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+#sudo kill `ps -aux | grep sstv_decode_prompt| grep -v grep | awk '{ print $2 }'` &>/dev/null && killall inotifywait &>/dev/null
+
+sudo killall -9 zenity &>/dev/null
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+sleep 5
+
+setsid sdrpp &
+
+sleep 10
+
+#$SHELL
diff --git a/groundstation/set location.desktop b/groundstation/set location.desktop
index e2b80016..9adc6f66 100644
--- a/groundstation/set location.desktop
+++ b/groundstation/set location.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/loc.sh
Name=Set My Location
Comment=Set Location for Gpredict
-Icon=/home/pi/Downloads/gpredict.png
+Icon=/home/pi/Icons/gpredict.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/groundstation/settings.json b/groundstation/settings.json
new file mode 100644
index 00000000..69033009
--- /dev/null
+++ b/groundstation/settings.json
@@ -0,0 +1,808 @@
+{
+ "version": 8,
+ "sdrs": {
+ "rtlsdr": {
+ "name": "RTL-SDR",
+ "type": "rtl_sdr",
+ "profiles": {
+ "70cm": {
+ "name": "70cm Ham Band 435 MHz (CubeSatSim)",
+ "center_freq": 435000000,
+ "rf_gain": 10.0,
+ "samp_rate": 2400000,
+ "start_freq": 434900000,
+ "start_mod": "nfm",
+ "tuning_step": 1000,
+ "direct_sampling": 0
+ },
+ "2m": {
+ "name": "WX Band 161 MHz",
+ "center_freq": 162400000,
+ "rf_gain": 29,
+ "samp_rate": 2048000,
+ "start_freq": 157000000,
+ "start_mod": "nfm"
+ },
+ "e59a4765-4139-4ab8-89c5-d8ac3343ba70": {
+ "name": "2m Ham Band 146 MHz (ISS)",
+ "center_freq": 145000000,
+ "samp_rate": 2400000,
+ "start_freq": 145000000,
+ "start_mod": "nfm",
+ "rf_gain": 42.0,
+ "direct_sampling": 0
+ },
+ "faf80b0b-1a96-4a9b-96fa-ce40b109c7e0": {
+ "name": "70cm Ham Band 438 MHz (ISS)",
+ "rf_gain": 29.0,
+ "center_freq": 438000000,
+ "samp_rate": 2400000,
+ "start_freq": 437800000,
+ "start_mod": "nfm"
+ },
+ "a4fd4a5d-d2d0-4949-87e2-bda83cd83a37": {
+ "name": "FM Band 95 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 95000000,
+ "samp_rate": 2400000,
+ "start_freq": 94000000,
+ "start_mod": "wfm"
+ },
+ "ce2bca29-78cb-45d8-ab46-8dea3135981c": {
+ "name": "10m Ham Band 28 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 28000000,
+ "samp_rate": 2400000,
+ "start_freq": 28000000,
+ "start_mod": "usb",
+ "direct_sampling": 0
+ },
+ "d6cdbf2d-74e4-4cac-aaa8-e793103a8e89": {
+ "name": "6m Ham Band 51 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 51000000,
+ "samp_rate": 2400000,
+ "start_freq": 51000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e2aba387-1d3b-4ca8-b280-e119282b8812": {
+ "name": "90 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 90000000,
+ "samp_rate": 2400000,
+ "start_freq": 90000000,
+ "start_mod": "wfm"
+ },
+ "f700b99d-3c51-4524-b151-a0809b868ecc": {
+ "name": "92 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 92000000,
+ "samp_rate": 2400000,
+ "start_freq": 92000000,
+ "start_mod": "wfm"
+ },
+ "dc6af94f-d607-4fee-a522-7f375f66a62c": {
+ "name": "94 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 94000000,
+ "samp_rate": 2400000,
+ "start_freq": 94000000,
+ "start_mod": "wfm"
+ },
+ "6887e85a-a4dc-4245-810f-99801fc5e824": {
+ "name": "96 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 96000000,
+ "samp_rate": 2400000,
+ "start_freq": 96000000,
+ "start_mod": "wfm"
+ },
+ "a2182ed6-70a8-4377-b233-ac6f8ccc91d7": {
+ "name": "98 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 96000000,
+ "samp_rate": 2400000,
+ "start_freq": 96000000,
+ "start_mod": "wfm"
+ },
+ "57e38353-fb86-4935-899b-e365228b8ae5": {
+ "name": "100 MHz FM Band",
+ "center_freq": 100000000,
+ "samp_rate": 2400000,
+ "start_freq": 100000000,
+ "start_mod": "wfm"
+ },
+ "5e9ec6dd-905d-4781-bd13-9cb702f58e84": {
+ "name": "102 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 102000000,
+ "samp_rate": 2400000,
+ "start_freq": 102000000,
+ "start_mod": "wfm"
+ },
+ "ef2c703c-2e22-4e87-82b5-581420d704bd": {
+ "name": "104 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 104000000,
+ "samp_rate": 2400000,
+ "start_freq": 104000000,
+ "start_mod": "wfm"
+ },
+ "34cc3ddf-8018-4288-acb9-29e6940bc37e": {
+ "name": "106 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 106000000,
+ "samp_rate": 2400000,
+ "start_freq": 106000000,
+ "start_mod": "wfm"
+ },
+ "b4693683-ccf5-474d-a2d9-9a47b0a18ee2": {
+ "name": "108 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 108000000,
+ "samp_rate": 2400000,
+ "start_freq": 108000000,
+ "start_mod": "wfm"
+ },
+ "34224d77-7b61-467c-b78f-18c7f3af1a0c": {
+ "name": "110 MHz FM Band",
+ "rf_gain": 29.0,
+ "center_freq": 110000000,
+ "samp_rate": 2400000,
+ "start_freq": 110000000,
+ "start_mod": "wfm"
+ },
+ "8dd82d97-73db-4fa7-ac41-263c3026ea1d": {
+ "name": "112 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 112000000,
+ "samp_rate": 2400000,
+ "start_freq": 112000000,
+ "start_mod": "nfm"
+ },
+ "79304b30-f10d-469e-9617-50a19bfdb435": {
+ "name": "114 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 114000000,
+ "samp_rate": 2400000,
+ "start_freq": 114000000,
+ "start_mod": "nfm"
+ },
+ "c00bf096-27b8-4262-832c-df1a308d7eb9": {
+ "name": "116 MHz",
+ "rf_gain": 29.0,
+ "center_freq": 116000000,
+ "samp_rate": 2400000,
+ "start_freq": 116000000,
+ "start_mod": "nfm"
+ },
+ "669d25a6-6c15-4131-a330-3c33dd2147f0": {
+ "name": "118 Mhz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 118000000,
+ "samp_rate": 2400000,
+ "start_freq": 118000000,
+ "start_mod": "am"
+ },
+ "948248fa-43d9-4e7d-bf86-afaadd391779": {
+ "name": "120 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 120000000,
+ "samp_rate": 2400000,
+ "start_freq": 120000000,
+ "start_mod": "am"
+ },
+ "b634273b-8fc8-4e87-b5c4-e6226d4be0ac": {
+ "name": "122 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 122000000,
+ "samp_rate": 2400000,
+ "start_freq": 121000000,
+ "start_mod": "nfm"
+ },
+ "c55289a2-8286-4a3d-a505-37ba2867571a": {
+ "name": "124 Mhz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 124000000,
+ "samp_rate": 2400000,
+ "start_freq": 124000000,
+ "start_mod": "am"
+ },
+ "4fe488b7-f369-43ba-bb49-91e1a185be7a": {
+ "name": "126 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 126000000,
+ "samp_rate": 2400000,
+ "start_freq": 126000000,
+ "start_mod": "am"
+ },
+ "e79639a2-1384-4e92-8e46-f6e5670ec9fd": {
+ "name": "128 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 128000000,
+ "samp_rate": 2400000,
+ "start_freq": 128000000,
+ "start_mod": "am"
+ },
+ "319f3fb2-b98a-4620-85a7-a99d5a722bd5": {
+ "name": "130 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 130000000,
+ "samp_rate": 2400000,
+ "start_freq": 130000000,
+ "start_mod": "am"
+ },
+ "63c5c2ce-07de-496c-81f6-b188a7adbf39": {
+ "name": "132 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 132000000,
+ "samp_rate": 2400000,
+ "start_freq": 132000000,
+ "start_mod": "am"
+ },
+ "386bdc7b-eb10-4e05-972a-69d730a23cd8": {
+ "name": "134 MHz Air Band",
+ "rf_gain": 29.0,
+ "center_freq": 134000000,
+ "samp_rate": 2400000,
+ "start_freq": 134000000,
+ "start_mod": "am"
+ },
+ "ae8ea8b1-23de-45ef-b8c4-3b83a188e65d": {
+ "name": "136 MHz Air Band",
+ "rf_gain": 42.0,
+ "center_freq": 136000000,
+ "samp_rate": 2400000,
+ "start_freq": 136000000,
+ "start_mod": "am"
+ },
+ "c0b1a28c-5e07-400a-a5f3-07c62db27587": {
+ "name": "138 MHz NOAA Weather Satellite Band",
+ "rf_gain": 42.0,
+ "center_freq": 138000000,
+ "samp_rate": 2400000,
+ "start_freq": 138000000,
+ "start_mod": "nfm"
+ },
+ "20f7ce56-fd85-4b3e-8fac-94cbe9ba0e1d": {
+ "name": "140 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 140000000,
+ "samp_rate": 2400000,
+ "start_freq": 140000000,
+ "start_mod": "nfm"
+ },
+ "882079f8-5697-428a-ae9d-bcc091269c7f": {
+ "name": "142 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 142000000,
+ "samp_rate": 2400000,
+ "start_freq": 142000000,
+ "start_mod": "nfm"
+ },
+ "da1b3f12-2eba-40e9-8c62-33493adf74b3": {
+ "name": "144 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 144000000,
+ "samp_rate": 2400000,
+ "start_freq": 144000000,
+ "start_mod": "nfm"
+ },
+ "8d9cf1e1-44c5-41c4-bcea-7b1c69446e62": {
+ "name": "146 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 146000000,
+ "samp_rate": 2400000,
+ "start_freq": 146000000,
+ "start_mod": "nfm"
+ },
+ "eec8aa0d-3485-43d2-baa4-82f7d9e14df6": {
+ "name": "148 MHz 2m Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 148000000,
+ "samp_rate": 2400000,
+ "start_freq": 148000000,
+ "start_mod": "nfm"
+ },
+ "bf66a908-1988-4aec-b998-06e2bc7d0a84": {
+ "name": "150 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 150000000,
+ "samp_rate": 2400000,
+ "start_freq": 150000000,
+ "start_mod": "nfm"
+ },
+ "0389f270-b919-4aae-a313-f73697059f70": {
+ "name": "152 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 152000000,
+ "samp_rate": 2400000,
+ "start_freq": 152000000,
+ "start_mod": "nfm"
+ },
+ "6ef9d955-76aa-46c0-8463-2c23def5e37b": {
+ "name": "154 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 154000000,
+ "samp_rate": 2400000,
+ "start_freq": 154000000,
+ "start_mod": "nfm"
+ },
+ "5d0a64c7-3bce-408e-94d9-c8315bef7540": {
+ "name": "156 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 156000000,
+ "samp_rate": 2400000,
+ "start_freq": 156000000,
+ "start_mod": "nfm"
+ },
+ "5b869cae-ffa7-4554-96af-7acd497bbaf3": {
+ "name": "158 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 158000000,
+ "samp_rate": 2400000,
+ "start_freq": 158000000,
+ "start_mod": "nfm"
+ },
+ "0de7c5d4-14fc-4655-9a81-2bcebb2f4147": {
+ "name": "160 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 160000000,
+ "samp_rate": 2400000,
+ "start_freq": 160000000,
+ "start_mod": "nfm"
+ },
+ "8ca54821-8b80-4938-a35c-9fe25e2320d1": {
+ "name": "162 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 162000000,
+ "samp_rate": 2400000,
+ "start_freq": 162000000,
+ "start_mod": "nfm"
+ },
+ "f74d262d-9e98-4030-86b2-45676121ff1e": {
+ "name": "164 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 164000000,
+ "samp_rate": 2400000,
+ "start_freq": 164000000,
+ "start_mod": "nfm"
+ },
+ "bfc9c686-6c06-4de2-b1d5-c8f012131042": {
+ "name": "168 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 168000000,
+ "samp_rate": 2400000,
+ "start_freq": 167000000,
+ "start_mod": "nfm"
+ },
+ "5468e597-d529-42fe-9fcf-0ff4fa9e2d06": {
+ "name": "170 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 170000000,
+ "samp_rate": 2400000,
+ "start_freq": 170000000,
+ "start_mod": "nfm"
+ },
+ "e124cc6e-7177-4d5f-ae5b-2ec6a6fa2956": {
+ "name": "172 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 172000000,
+ "samp_rate": 2400000,
+ "start_freq": 172000000,
+ "start_mod": "nfm"
+ },
+ "1ce0f3ed-4763-4f00-916a-4f72d29ba410": {
+ "name": "174 MHz ",
+ "rf_gain": 42.0,
+ "center_freq": 174000000,
+ "samp_rate": 2400000,
+ "start_freq": 174000000,
+ "start_mod": "nfm"
+ },
+ "639b1496-a2b9-4a42-ad28-3cda89fbe2fb": {
+ "name": "420 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 420000000,
+ "samp_rate": 2400000,
+ "start_freq": 420000000,
+ "start_mod": "nfm"
+ },
+ "bbc9b57e-ea86-43ef-be65-cb2337615ae5": {
+ "name": "422 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 422000000,
+ "samp_rate": 2400000,
+ "start_freq": 422000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "3aed286d-7d13-4338-8621-d1c0dfdf3ac6": {
+ "name": "424 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 424000000,
+ "samp_rate": 2400000,
+ "start_freq": 424000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "9ae664b4-48f3-410a-8995-edc60127d746": {
+ "name": "426 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 426000000,
+ "samp_rate": 2400000,
+ "start_freq": 426000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "24d2467b-6740-42b5-8d3f-8f389fc0860b": {
+ "name": "428 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 428000000,
+ "samp_rate": 2400000,
+ "start_freq": 428000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "debbc3ab-081d-41e7-80fe-7d564838154e": {
+ "name": "430 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 430000000,
+ "samp_rate": 2400000,
+ "start_freq": 430000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "649233e0-fc85-415d-b88e-94750f49ca4b": {
+ "name": "432 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 432000000,
+ "samp_rate": 2400000,
+ "start_freq": 432000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "bed3b482-fd3b-45ee-b924-200aa4223ace": {
+ "name": "434 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 434000000,
+ "samp_rate": 2400000,
+ "start_freq": 434000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "58dfac9e-6030-4bb3-ba28-465285baa25e": {
+ "name": "436 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 436000000,
+ "samp_rate": 2400000,
+ "start_freq": 436000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "4c293b84-cd43-495f-95a5-1fcabfe4e4c7": {
+ "name": "438 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 438000000,
+ "samp_rate": 2400000,
+ "start_freq": 438000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "0e763161-a0e8-411a-abe6-c1af13045f27": {
+ "name": "440 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 440000000,
+ "samp_rate": 2400000,
+ "start_freq": 440000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "6dda77d3-e859-41b7-9b0b-22c2dee47472": {
+ "name": "442 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 442000000,
+ "samp_rate": 2400000,
+ "start_freq": 442000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "285813ef-aa6d-433f-a316-074f47e02073": {
+ "name": "444 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 444000000,
+ "samp_rate": 2400000,
+ "start_freq": 444000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e0842b63-6857-4554-874b-fad99e4db03a": {
+ "name": "446 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 446000000,
+ "samp_rate": 2400000,
+ "start_freq": 446000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "c7b21c80-cfef-42e8-a6fe-c5eea4556c7e": {
+ "name": "448 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 448000000,
+ "samp_rate": 2400000,
+ "start_freq": 448000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "d98b4d4a-8247-4a99-9fc7-89780e5e1fef": {
+ "name": "450 MHz 70cm Ham Band",
+ "rf_gain": 42.0,
+ "center_freq": 450000000,
+ "samp_rate": 2400000,
+ "start_freq": 450000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "a09a546f-c56f-41b5-ae34-c5511afbcef5": {
+ "name": "460 MHz",
+ "rf_gain": 42.0,
+ "center_freq": 460000000,
+ "samp_rate": 2400000,
+ "start_freq": 460000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "232b2ae6-88dd-4e58-b489-37f310e5e204": {
+ "name": "462 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 462000000,
+ "samp_rate": 2400000,
+ "start_freq": 462000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "41db9b38-87d7-40a0-9f90-1f0c77c054d9": {
+ "name": "464 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 464000000,
+ "samp_rate": 2400000,
+ "start_freq": 464000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "e9bb7781-eb9b-4314-b399-2d96c52716f0": {
+ "name": "466 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 466000000,
+ "samp_rate": 2400000,
+ "start_freq": 466000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "5d9e07e8-eb42-4832-82c9-016f05d89027": {
+ "name": "468 MHz FRS/GMRS",
+ "rf_gain": 42.0,
+ "center_freq": 468000000,
+ "samp_rate": 2400000,
+ "start_freq": 468000000,
+ "start_mod": "nfm",
+ "direct_sampling": 0
+ },
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 384000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 192000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 256000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 384000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6050000,
+ "samp_rate": 384000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000",
+ "rf_gain": 42.0,
+ "direct_sampling": 1
+ },
+ "c1982ce1-7504-455e-908c-dc097fa031a8": {
+ "name": "1090 MHz ADS-B Band",
+ "rf_gain": 42.0,
+ "center_freq": 1090000000,
+ "samp_rate": 2400000,
+ "start_freq": 1090000000,
+ "start_mod": "adsb",
+ "tuning_step": 1,
+ "direct_sampling": 0
+ },
+ "cb7f2f8e-e317-4a5e-9504-826dd3781791": {
+ "name": "978 MHz ADS-B Band",
+ "rf_gain": 42.0,
+ "center_freq": 978000000,
+ "samp_rate": 2400000,
+ "start_freq": 978000000,
+ "start_mod": "adsb",
+ "tuning_step": 1
+ }
+ }
+ },
+ "airspy": {
+ "name": "Airspy HF+",
+ "type": "airspyhf",
+ "rf_gain": "auto",
+ "profiles": {
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 384000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 192000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 256000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 384000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6050000,
+ "samp_rate": 384000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000"
+ }
+ }
+ },
+ "sdrplay": {
+ "name": "SDRPlay device",
+ "type": "sdrplay",
+ "antenna": "Antenna A",
+ "rf_gain": "auto",
+ "profiles": {
+ "20m": {
+ "name": "20m",
+ "center_freq": 14150000,
+ "samp_rate": 500000,
+ "start_freq": 14070000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "30m": {
+ "name": "30m",
+ "center_freq": 10125000,
+ "samp_rate": 250000,
+ "start_freq": 10142000,
+ "start_mod": "usb",
+ "tuning_step": "500"
+ },
+ "40m": {
+ "name": "40m",
+ "center_freq": 7100000,
+ "samp_rate": 500000,
+ "start_freq": 7070000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "80m": {
+ "name": "80m",
+ "center_freq": 3650000,
+ "samp_rate": 500000,
+ "start_freq": 3570000,
+ "start_mod": "lsb",
+ "tuning_step": "500"
+ },
+ "49m": {
+ "name": "49m Broadcast",
+ "center_freq": 6000000,
+ "samp_rate": 500000,
+ "start_freq": 6070000,
+ "start_mod": "am",
+ "tuning_step": "1000"
+ }
+ }
+ }
+ },
+ "receiver_name": "ARISS Radio Pi",
+ "receiver_location": "Budapest, Hungary",
+ "receiver_asl": 200,
+ "receiver_admin": "example@example.com",
+ "receiver_gps": {
+ "lat": 39.95233,
+ "lon": -75.16379
+ },
+ "photo_title": "Panorama of Budapest from Sch\u00f6nherz Zolt\u00e1n Dormitory",
+ "photo_desc": "",
+ "max_clients": 20,
+ "keep_files": 20,
+ "session_timeout": 0,
+ "usage_policy_url": "policy",
+ "allow_chat": true,
+ "allow_audio_recording": true,
+ "allow_center_freq_changes": false,
+ "magic_key": "memagic",
+ "receiver_keys": [],
+ "waterfall_scheme": "GoogleTurboWaterfall",
+ "fft_fps": 9,
+ "fft_size": 4096,
+ "fft_voverlap_factor": 0.3,
+ "waterfall_levels": {
+ "min": -88.0,
+ "max": -20.0
+ },
+ "waterfall_auto_levels": {
+ "min": 3.0,
+ "max": 10.0
+ },
+ "waterfall_auto_level_default_mode": false,
+ "waterfall_auto_min_range": 50,
+ "audio_compression": "adpcm",
+ "fft_compression": "adpcm",
+ "tuning_precision": 2,
+ "eibi_bookmarks_range": 0,
+ "repeater_range": 0,
+ "map_type": "google",
+ "google_maps_api_key": "",
+ "openweathermap_api_key": "",
+ "map_position_retention_time": 7200,
+ "map_ignore_indirect_reports": false,
+ "map_prefer_recent_reports": true,
+ "callsign_url": "https://www.qrzcq.com/call/{}",
+ "vessel_url": "https://www.vesselfinder.com/vessels/details/{}",
+ "flight_url": "https://flightaware.com/live/flight/{}",
+ "modes_url": "https://flightaware.com/live/modes/{}/redirect"
+}
+
diff --git a/groundstation/sstv_decode.sh b/groundstation/sstv_decode.sh
index b539d2b0..7c3f64aa 100755
--- a/groundstation/sstv_decode.sh
+++ b/groundstation/sstv_decode.sh
@@ -15,6 +15,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 java &>/dev/null
diff --git a/groundstation/sstv_decode_iss.sh b/groundstation/sstv_decode_iss.sh
index c72ee286..46e64498 100755
--- a/groundstation/sstv_decode_iss.sh
+++ b/groundstation/sstv_decode_iss.sh
@@ -21,6 +21,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
diff --git a/groundstation/sstv_decode_prompt.sh b/groundstation/sstv_decode_prompt.sh
index dab0f18a..79c794c2 100755
--- a/groundstation/sstv_decode_prompt.sh
+++ b/groundstation/sstv_decode_prompt.sh
@@ -4,10 +4,12 @@ echo "Script to decode SSTV using QSSTV with rtl_fm"
echo
-sudo systemctl stop openwebrx
+sudo systemctl stop openwebrx &>/dev/null
sudo modprobe snd-aloop
+sudo killall -9 sdrpp &>/dev/null
+
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
@@ -16,10 +18,12 @@ sudo killall -9 aplay &>/dev/null
sudo killall -9 direwolf &>/dev/null
-sudo systemctl stop rtl_tcp
+sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 java &>/dev/null
@@ -30,11 +34,16 @@ sudo killall -9 sdrpp &>/dev/null
sudo killall -9 zenity &>/dev/null
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
sudo killall -9 rtl_fm &>/dev/null
#echo "s" >> .mode
-frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=220 --title="SSTV Decoding using QSSTV" --text="Choose the frequency for SSTV decoding:" --column="kHz" --column="Use" 145800 "ISS" 434900 "CubeSatSim" Other "Choose another frequency" SSTV "Test SSTV decoding with WAV file")
+autotune=0
+
+frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=270 --title="SSTV Decoding using QSSTV" --text="Choose the frequency for SSTV decoding:" --column="kHz" --column="Use" 145800 "ISS" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" Other "Choose another frequency" SSTV "Test SSTV decoding with WAV file")
echo $frequency
@@ -70,6 +79,11 @@ echo
echo "If your CubeSatSim is transmitting in SSTV mode (mode 4) you should get images."
echo "Note: if you see and hear an SSTV signal but don't get any images, the CubeSatSim signal might have a frequency offset. Try rebooting the CubeSatSim to fix."
+elif [ "$frequency" = "Auto-tune" ]; then
+
+frequency=434900000
+autotune=1
+
elif [ "$choice" = "3" ] || [ "$frequency" = "Other" ]; then
echo
@@ -115,14 +129,48 @@ echo
echo -e "Auto decoding SSTV on $frequency Hz"
-sleep 2
+#sleep 2
setsid qsstv &
-sleep 5
+#sleep 5
+
+if [ "$autotune" = "1" ]; then
+ threshold=1
+ delay=5
+ retries=5
+
+ echo "Starting Auto-tune scanning"
+ echo "Scan will stop when confidence exceeds threshold value of" $threshold "or after" $retries "retries"
+ tries=0
+ confidence=0
+ delay=$((delay-2)) # subtract 2 second built in delay
+ while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
+
+ sleep $delay
+ source /home/pi/venv/bin/activate
+ python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ # echo "auto-tune.txt"
+ # cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
+ confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune confidence:" $confidence
+ tries=$((tries+1))
+
+ done
+
+ if [ "$confidence" -gt "$threshold" ]; then
+ frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
+ echo "Auto tune frequency:" $frequency
+ else
+ echo "Auto tune failed, frequency unchanged"
+ fi
+ echo
+ echo "If your CubeSatSim is transmitting in SSTV mode (mode 4) you should get images."
+ echo
-#sudo systemctl restart cubesatsim
+fi
+#sudo systemctl restart cubesatsim
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
diff --git a/groundstation/sstv_decode_sim.sh b/groundstation/sstv_decode_sim.sh
index 3b72c7a4..f4451d30 100755
--- a/groundstation/sstv_decode_sim.sh
+++ b/groundstation/sstv_decode_sim.sh
@@ -21,6 +21,8 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
+pkill -o firefox &>/dev/null
+
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
diff --git a/groundstation/webSDR.desktop b/groundstation/webSDR.desktop
index 277bbae2..387dfd95 100644
--- a/groundstation/webSDR.desktop
+++ b/groundstation/webSDR.desktop
@@ -3,7 +3,7 @@ Type=Application
Exec=/home/pi/CubeSatSim/groundstation/sdr.sh
Name=Web SDR
Comment=openwebrx for Web SDR
-Icon=/home/pi/Downloads/openwebrx.png
+Icon=/home/pi/Icons/openwebrx.png
Path=/home/pi
Terminal=true
Categories=HamRadio
diff --git a/hotspot_ini b/hotspot_ini
new file mode 100644
index 00000000..926de3ea
--- /dev/null
+++ b/hotspot_ini
@@ -0,0 +1,13 @@
+[Hotspot]
+# WiFi hotspot name
+hotspot_ssid=CubeSat
+# WiFi hotspot password - note: this password is stored in the clear!
+hotspot_password=amsatcubesat
+# WiFi hotspot always on regardless of pushbutton
+hotspot_default=no
+# Web Dashboard port number. If 80, no port needs to be entered in browser
+# dashboard_port=80
+# Web terminal setting during hotspot - note, there is no authentication for this!
+web_term_hotspot=yes
+# Web terminal setting during WiFi - note: there is no authentication for this!
+web_term_wifi=no
diff --git a/install b/install
index b71cde89..4389c707 100755
--- a/install
+++ b/install
@@ -1,24 +1,346 @@
#!/bin/bash
-echo -e "\ninstallation script for CubeSatSim v2.2\n"
+FLAG=0
+checkout=0
+BULLSEYE=0
+UPDATE=0
+NETWORK=1
- if [[ $(grep '11.' /etc/debian_version) ]]; then
- echo "Installing on Debian 11 (Bullseye)"
- else
- echo "The OS is not Debian 11 (Bullseye)!"
- echo "Installation is not likely to work."
- echo "It is recommended you start with"
- echo "Bullseye as your OS."
+FILE=/home/pi/CubeSatSim/cubesatsim # code has already been compiled
+if [ -f "$FILE" ]; then
+
+ UPDATE=1
+
+ echo -e "\nUpdate script for CubeSatSim v2.3\n"
+
+ echo "You should restart when this update completes with command:"
+ echo "sudo reboot now"
echo
- sleep 10
- fi
-if [[ $(grep 'bullseye' /etc/os-release) ]]; then
- echo "Bullseye detected, installation continuing."
+ sudo rm /home/pi/CubeSatSim/telem.wav &>/dev/null
+ sudo rm /home/pi/CubeSatSim/t.txt &>/dev/null
+ sudo rm /home/pi/CubeSatSim/uptime &>/dev/null
+
+ if [ -z "$1" ] ; then
+ checkout=0
+ else
+ checkout=1
+ branch="$1"
+ echo -n "changing to branch "
+ echo $branch
+ FLAG=1
+ fi
+
+ if [ "$2" = "n" ] ; then
+ noreboot=1
+ else
+ noreboot=0
+ fi
+
else
- echo "Your Pi OS version is not Bullseye."
+
+ echo -e "\nInstallation script for CubeSatSim v2.3\n"
+
+ echo "You should restart when this install completes with command:"
+ echo "sudo reboot now"
+ echo
+
+ touch /home/pi/CubeSatSim/command_control_direwolf
+
+ echo "creating $FILE"
+ echo "AMSAT 0 0 0 no 3 434.9 435 no 0 0 no 60 no" > /home/pi/CubeSatSim/sim.cfg
+
+ echo "434900000 435000000" > frequency.txt
+
+ cp /home/pi/CubeSatSim/hotspot_ini /home/pi/CubeSatSim/hotspot.ini
+
+ /home/pi/CubeSatSim/config -c -n
+
+ /home/pi/CubeSatSim/config -l -n
+
+fi
+
+FILE=/home/pi/CubeSatSim/hotspot.ini
+if [ ! -f "$FILE" ]; then
+ echo "Creating hotspot.ini configuration file. You can edit it to change Wi-Fi hotspot options"
+ cp /home/pi/CubeSatSim/hotspot_ini /home/pi/CubeSatSim/hotspot.ini
+fi
+
+if [[ $(grep 'bullseye' /etc/os-release) ]]; then
+
+ BULLSEYE=1
+
+ echo "Debian 11 (Bullseye) detected"
+
+ sudo cp /boot/config.txt /boot/config.txt.0
+
+ sudo cp /boot/cmdline.txt /boot/cmdline.txt.0
+
+ sudo raspi-config nonint do_i2c 0
+
+ sudo raspi-config nonint do_camera 0
+
+ sudo raspi-config nonint do_legacy 0
+
+ sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
+
+# sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=2 r/g' /boot/cmdline.txt # single core if Pi Zero 2
+## sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/cmdline.txt
+
+# sudo sed -i 's/maxcpus=1/maxcpus=2/g' /boot/cmdline.txt # single core if Pi Zero 2
+
+ sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
+
+ if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then
+ echo "dtoverlay=i2c-gpio already in /boot/config.txt"
+ else
+ echo "adding dtoverlay=i2c-gpio to /boot/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then
+ echo "enable_uart=1 already in /boot/config.txt"
+ else
+ echo "adding enable_uart=1 to /boot/config.txt"
+ sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then
+ echo "dtoverlay=disable-bt already in /boot/config.txt"
+ else
+ echo "adding dtoverlay=disable-bt to /boot/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then
+ echo "dtoverlay=dwc2 aalready in /boot/config.txt"
+ else
+ echo "adding dtoverlay=dwc2 to /boot/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then
+ echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt"
+ else
+ echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt"
+ sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt
+ fi
+
+ if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then
+ echo "dtparam=audio=on already in /boot/config.txt"
+ else
+ echo "adding dtparam=audio=on to /boot/config.txt"
+ sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then
+ echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt"
+ else
+ echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then
+ echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt"
+ else
+ echo "adding overlay=pwm,pin=18,func=2 to /boot/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then
+ echo "disable_splash=1 already in /boot/config.txt"
+ else
+ echo "adding disable_splash=1 to /boot/config.txt"
+ sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt'
+ fi
+
+ if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then
+ echo "boot_delay=0 already in /boot/config.txt"
+ else
+ echo "adding boot_delay=0 to /boot/config.txt"
+ sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt'
+ fi
+
+ if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
+
+ sudo sh -c 'echo "\n" >> /boot/config.txt'
+
+ if [[ $(sudo systemctl is-active NetworkManager | grep inactive) ]]; then
+ echo
+ echo "NetworkManager is inactive"
+ echo
+ echo "In order to use the Wi-Fi Hotspot, NetworkManager needs to be enabled and configured."
+ echo
+ echo "Do you want to enable NetworkManager and re-configure your Wi-Fi (y/n) "
+ read choice
+ echo
+ if [ "$choice" = "y" ] || [ "$choice" = "yes" ] ; then
+ NETWORK=0
+
+# sudo sed -i 's/managed=false/managed=true/g' /etc/NetworkManager/NetworkManager.conf # allow nmcli to manage WiFi
+# sudo systemctl disable dhcpcd
+# sudo systemctl enable NetworkManager
+# sudo systemctl start NetworkManager
+# sudo nmcli dev wifi connect "$ssid" password "$password"
+
+ echo "Enter your Wi-Fi SSID"
+ read ssid
+ echo "Enter your Wi-Fi password"
+ read password
+
+ echo
+ echo "Wi-Fi will be updated at the end of this install/update. You will need to log back in."
+ echo
+ sleep 5
+ else
+ echo "Not enabling NetworkManager. Wi-Fi Hotspot feature will not be available."
+ fi
+ fi
+
+ FILE=/usr/bin/ttyd
+ if [ -f "$FILE" ]; then
+ echo "$FILE exists."
+ else
+ cd /tmp
+ wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.armhf
+ chmod +x ttyd.armhf
+ sudo cp ttyd.armhf $FILE
+ fi
+
+ fi
+
+if [[ $(grep 'bookworm' /etc/os-release) ]]; then
+
+ echo "Debian 12 (Bookworm) detected"
+
+ sudo cp /boot/firmware/config.txt /boot/firmware/config.txt.0
+
+ sudo cp /boot/firmware/cmdline.txt /boot/firmware/cmdline.txt.0
+
+ sudo raspi-config nonint do_i2c 0
+
+ sudo raspi-config nonint do_camera 0
+
+ sudo raspi-config nonint do_legacy 0
+
+ sudo sed -i 's/console=serial0,115200 //g' /boot/firmware/cmdline.txt
+
+# sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=2 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
+## sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/firmware/cmdline.txt
+
+# sudo sed -i 's/maxcpus=1/maxcpus=2/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
+
+ sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/firmware/config.txt
+
+ sudo sed -i 's/#dtoverlay=vc4-fkms-v3d/dtoverlay=vc4-fkms-v3d/g' /boot/firmware/config.txt
+ sudo sed -i 's/#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/g' /boot/firmware/config.txt
+
+
+ if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/firmware/config.txt) ]]; then
+ echo "dtoverlay=i2c-gpio already in /boot/firmware/config.txt"
+ else
+ echo "adding dtoverlay=i2c-gpio to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'enable_uart=1' /boot/firmware/config.txt) ]]; then
+ echo "enable_uart=1 already in /boot/firmware/config.txt"
+ else
+ echo "adding enable_uart=1 to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\nenable_uart=1" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=disable-bt' /boot/firmware/config.txt) ]]; then
+ echo "dtoverlay=disable-bt already in /boot/firmware/config.txt"
+ else
+ echo "adding dtoverlay=disable-bt to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=dwc2' /boot/firmware/config.txt) ]]; then
+ echo "dtoverlay=dwc2 aalready in /boot/firmware/config.txt"
+ else
+ echo "adding dtoverlay=dwc2 to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'modules-load=dwc2,g_ether' /boot/firmware/cmdline.txt) ]]; then
+ echo "modules-load=dwc2,g_ether already in /boot/firmware/cmdline.txt"
+ else
+ echo "adding modules-load=dwc2,g_ether to /boot/firmware/cmdline.txt"
+ sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/firmware/cmdline.txt
+ fi
+
+ if [[ $(grep 'dtparam=audio=on' /boot/firmware/config.txt) ]]; then
+ echo "dtparam=audio=on already in /boot/firmware/config.txt"
+ else
+ echo "adding dtparam=audio=on to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/firmware/config.txt) ]]; then
+ echo "dtoverlay=audremap,enable_jack=on already in /boot/firmware/config.txt"
+ else
+ echo "adding dtoverlay=audremap,enable_jack=on to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/firmware/config.txt) ]]; then
+ echo "dtoverlay=pwm,pin=18,func=2 already in /boot/firmware/config.txt"
+ else
+ echo "adding to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'disable_splash=1' /boot/firmware/config.txt) ]]; then
+ echo "disable_splash=1 already in /boot/firmware/config.txt"
+ else
+ echo "adding disable_splash=1 to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ndisable_splash=1" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'boot_delay=0' /boot/firmware/config.txt) ]]; then
+ echo "boot_delay=0 already in /boot/firmware/config.txt"
+ else
+ echo "adding boot_delay=0 to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\nboot_delay=0" >> /boot/firmware/config.txt'
+ fi
+
+ if [[ $(grep 'camera_auto_detect=1' /boot/firmware/config.txt) ]]; then
+ echo "camera_auto_detect=1 already in /boot/firmware/config.txt"
+ else
+ echo "adding camera_auto_detect=1 to /boot/firmware/config.txt"
+ sudo sh -c 'echo "\ncamera_auto_detect=1" >> /boot/firmware/config.txt'
+ fi
+
+ if ! grep -q force_turbo=1 /boot/firmware/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/firmware/config.txt'; fi
+
+ sudo sh -c 'echo "\n" >> /boot/firmware/config.txt'
+
+ sudo sed -i 's/managed=false/managed=true/g' /etc/NetworkManager/NetworkManager.conf # allow nmcli to manage WiFi
+
+ FILE=/boot/firmware/cmdline.txt
+ if [[ $(grep "vc4.force_hotplug=1" $FILE) ]]; then
+ echo "vc4.force_hotplug=1 already in $FILE";
+ else
+ echo "adding vc4.force_hotplug=1 to $FILE";
+ sudo sed -i '1s/^/vc4.force_hotplug=1 /' $FILE
+ fi
+
+# if [ ! -d "/var/log/journal" ]; then # persistant journal logs across boots
+ echo "Setting up journal logs across boots"
+ sudo mkdir -p /var/log/journal &>/dev/null
+ sudo systemd-tmpfiles --create --prefix /var/log/journal
+ sudo systemctl restart systemd-journal-flush.service
+ sudo sed -i 's/Storage=volatile/Storage=persistent/g' /etc/systemd/journald.conf
+# fi
+
+elif [[ $(grep 'trixie' /etc/os-release) ]]; then
+
+ echo "Trixie detected, installation continuing."
+ echo "Your Pi OS version is not Bookworm or Bullseye."
echo "The software installation will likely not work."
- echo "See the README.md for how to install using Bullseye."
+ echo "See the README.md for how to install using Bookworm."
echo
echo "Are you sure you want to continue the installation (y/n)?"
@@ -30,12 +352,62 @@ else
fi
fi
+/home/pi/CubeSatSim/config -V 2 # set maxcpus to 2
+
+# FILE=/etc/modprobe.d/alsa-base.conf
+# if [ -f "$FILE" ]; then
+# echo "$FILE exists."
+# if [[ $(grep "options snd-usb-audio index=2" $FILE) ]]; then
+# echo "options snd-usb-audio index=2 already in $FILE";
+# else
+# echo "adding options snd-usb-audio index=2 to $FILE";
+# sudo sed -i '$a options snd-usb-audio index=2' $FILE
+# echo "options snd-usb-audio index=2" | sudo tee -a $FILE # > /dev/null
+# fi
+# else
+# echo "creating $FILE"
+# echo "options snd-usb-audio index=2" | sudo tee $FILE # > /dev/null
+# fi
+
FILE=/home/pi/CubeSatSim/sim.cfg
if [ -f "$FILE" ]; then
echo "$FILE exists."
+
+ changed=0
+ value=`cat /home/pi/CubeSatSim/sim.cfg`
+ # echo "$value"
+ echo "$value" > /dev/null
+ set -- $value
+
+ if [ -z "$1" ] ; then n1="AMSAT" ; changed=1 ; else n1=$1 ; fi # callsign
+ if [ -z "$2" ] ; then n2="0" ; changed=1 ; else n2=$2 ; fi # reset count
+ if [ -z "$3" ] ; then n3="0" ; changed=1 ; else n3=$3 ; fi # lat
+ if [ -z "$4" ] ; then n4="0" ; changed=1 ; else n4=$4 ; fi # lon
+ if [ -z "$5" ] ; then n5="no" ; changed=1 ; else n5=$5 ; fi # sim mode
+ 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 [ -z "${12}" ] ; then m3="no" ; changed=1 ; else m3=${12} ; fi # random fail
+ if [ -z "${13}" ] ; then m4="60" ; changed=1 ; else m4=${13} ; fi # random fail period
+ if [ -z "${14}" ] ; then m5="no" ; changed=1 ; else m5=${14} ; fi # doppler mode
+
+ if [ $changed -eq 1 ]; then
+ echo -e "Current sim.cfg configuration file:"
+ echo
+ echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}
+ echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
+ echo
+ echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 $m3 $m4 $m5
+ echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $m1 $m2 $m3 $m4 $m5 > /home/pi/CubeSatSim/sim.cfg
+ echo
+ fi
+
else
echo "creating $FILE"
- echo "AMSAT 1 0.0 0.0" > /home/pi/CubeSatSim/sim.cfg
+ echo "AMSAT 0 0 0 no 3 434.9 435 no 0 0 no 60 no" > /home/pi/CubeSatSim/sim.cfg
fi
if [[ $(grep 'cubesatsim' /etc/motd) ]]; then
@@ -58,65 +430,131 @@ if [ -f "$FILE" ]; then
echo "$FILE exists."
else
echo "creating $FILE"
- echo "0\n" > /home/pi/CubeSatSim/command_count.txt
+ echo -n "0" > /home/pi/CubeSatSim/command_count.txt
fi
+
+sudo apt-get update && sudo apt-get dist-upgrade -y
-touch /home/pi/CubeSatSim/command_control_direwolf
+# if [ $BULLSEYE -eq 1 ]; then
+# sudo apt-get purge -y python3-pip
+# sudo apt-get install -y python3-pip
+# fi
-CubeSatSim/config -c -n
+cp /home/pi/CubeSatSim/groundstation/pacsat.desktop /home/pi/Desktop/pacsat.desktop
+cp /home/pi/CubeSatSim/groundstation/gpredict.desktop /home/pi/Desktop/gpredict.desktop
-CubeSatSim/config -l -n
-
-sudo apt-get update && sudo apt-get dist-upgrade -y
+if [ ! -d "/home/pi/venv" ]; then
-sudo apt-get remove pulseaudio -y
+ cd
+ sudo apt-get install -y python3-venv
+ sudo python3 -m venv venv
+ source /home/pi/venv/bin/activate
+
+ curl https://bootstrap.pypa.io/get-pip.py | sudo /home/pi/venv/bin/python3
+
+ sudo /home/pi/venv/bin/pip3 install adafruit_extended_bus
+ sudo /home/pi/venv/bin/pip3 install adafruit-circuitpython-ina219
-sudo apt-get install -y gcc g++ make cmake libasound2-dev libudev-dev libavahi-client-dev libgpiod-dev
+fi
-cd
+sudo apt-get remove pulseaudio -y
-git clone https://github.com/alanbjohnston/direwolf.git
+sudo apt-get install -y gcc g++ make cmake libasound2-dev libudev-dev libavahi-client-dev libgpiod-dev raspi-config
-cd direwolf
+# removed wiringpi and python-picamera python3-picamera
+sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom
-make -j
+if [ -d "/home/pi/direwolf" ]; then
-sudo make install
+ cd
+ cd direwolf
+ # Get the URL of the 'origin' remote
+ REPO_URL=$(git config --get remote.origin.url)
+
+ # Check if the command was successful and a URL was retrieved
+ if [ $? -eq 0 ] && [ -n "$REPO_URL" ]; then
+
+ if [ ! "$REPO_URL" = "https://github.com/wb2osz/direwolf.git" ]; then
+
+ echo "Current Direwolf git repository URL is $REPO_URL"
+ sudo rm -r /home/pi/direwolf
+ fi
+ else
+ echo "Could not find the URL for the 'origin' remote for Direwolf"
+ fi
+fi
-make install-rpi
+if [ ! -d "/home/pi/direwolf" ]; then
-# removed wiringpi and python-picamera python3-picamera
-sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom gpsd gpsd-clients libgps-dev python3-gps
+ echo "Installing Direwolf from https://github.com/wb2osz/direwolf.git"
+ cd
+ git clone https://github.com/wb2osz/direwolf.git
+ cd direwolf
+ mkdir build
+ cd build
+ cmake ..
+ make -j4
+ sudo make install
+ make install-conf
-sudo systemctl disable gpsd
-sudo systemctl disable gpsd.socket
+fi
-cd /tmp
+ sudo apt-get install -y gpsd gpsd-clients libgps-dev python3-gps
+ sudo systemctl disable gpsd
+ sudo systemctl disable gpsd.socket
-# wget https://project-downloads.drogon.net/wiringpi-latest.deb
+#if [ ! -d "/home/pi/WiringPi" ]; then
+# cd
+# git clone https://github.com/alanbjohnston/WiringPi
+# cd WiringPi
+# ./build debian
+# sudo dpkg -i debian-template/wiringpi-2.61-1.deb
+#fi
-# sudo dpkg -i wiringpi-latest.deb
+if [ ! -d "/home/pi/WiringPi3" ]; then
+ cd
+ git clone https://github.com/WiringPi/WiringPi.git WiringPi3
+ cd WiringPi3
+ ./build debian
+ mv debian-template/wiringpi*.deb .
+ sudo apt-get install ./wiringpi*.deb
+fi
cd
-git clone https://github.com/alanbjohnston/WiringPi
-cd WiringPi
-./build debian
+if [ ! $BULLSEYE -eq 1 ]; then
+ sudo apt-get install -y libtiff6
+fi
-sudo dpkg -i debian-template/wiringpi-2.61-1.deb
+sudo apt-get install -y python3-pip python3-smbus libjpeg-dev zlib1g-dev libfreetype6-dev libopenjp2-7 python3-pil python3-serial libusb-1.0-0 libusb-1.0-0-dev
-cd
+if [ $BULLSEYE -eq 1 ] || [ $UPDATE -eq 0 ] ; then
-#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 libusb-1.0-0 libusb-1.0-0-dev
+ sudo pip3 install --upgrade setuptools
+
+ sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
-sudo pip3 install --upgrade setuptools
+fi
-sudo pip3 install adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219
+cd /home/pi/CubeSatSim
-cd ~/CubeSatSim
+git pull --no-rebase > .updated
-git pull --no-rebase
+if [ $checkout -eq 1 ]; then
+ git checkout $branch
+ git pull --no-rebase > .updated
+ FLAG=1
+ echo "Running update again"
+ /home/pi/CubeSatSim/install
+ exit
+fi
+
+grep 'install' /home/pi/CubeSatSim/.updated
+if [[ $(grep 'install' /home/pi/CubeSatSim/.updated) ]]; then
+ echo "install script updated, running again"
+ /home/pi/CubeSatSim/install
+ exit
+fi
make debug
@@ -128,236 +566,518 @@ else
echo "b" > .mode
fi
-cd
-
-git clone https://github.com/alanbjohnston/pi-power-button.git
-
-cd pi-power-button
+if [ ! -d "/home/pi/g0kla_common" ]; then
+ cd
+ git clone https://github.com/alanbjohnston/g0kla_common.git
+ cd g0kla_common/Debug/
+ make clean
+ make all
+ sudo ./install.sh
-git checkout master
-
-./script/install
+else
+ cd /home/pi/g0kla_common/Debug/
+
+ git pull --no-rebase > .updated
+ grep 'changed' /home/pi/g0kla_common/Debug/.updated
+ if [[ $(grep 'changed' /home/pi/g0kla_common/Debug/.updated) ]]; then
+
+ echo "updating g0kla_common"
+ make clean
+ make all
+ FLAG=1
+ fi
+fi
-cd
+FILE=/home/pi/pi_pacsat/Debug/pi_pacsat # code has already been compiled
+if [ ! -f "$FILE" ]; then
+
+ cd
+ git clone https://github.com/alanbjohnston/pi_pacsat.git
+ #git clone https://github.com/ac2cz/pi_pacsat.git
+ cd pi_pacsat
+ #git checkout master-debug
+ cd Debug
+ make clean
+ make all
+ /home/pi/CubeSatSim/config -k -n
+
+else
+ cd /home/pi/pi_pacsat/Debug/
+
+ git pull --no-rebase > .updated
+ grep 'changed' /home/pi/pi_pacsat/Debug/.updated
+ if [[ $(grep 'changed' /home/pi/pi_pacsat/Debug/.updated) ]]; then
+
+ echo "updating pi_pacsat"
+ make clean
+ make all
+ /home/pi/CubeSatSim/config -k -n
+ FLAG=1
+ fi
+fi
-echo "Installing SSDV for FUNcube mode"
-git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FUNcube images
-cd ssdv
-make
-cd
+FILE=/home/pi/pacsat_telem/Debug/pacsat_telem # code has already been compiled
+if [ ! -f "$FILE" ]; then
+ cd
+ sudo apt-get install -y libbsd-dev
+ git clone https://github.com/alanbjohnston/pacsat_telem.git
+ cd pacsat_telem
+ git checkout master-fox
+ cd Debug
+ make clean
+ make all
+fi
-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 -u fctelem.zip
+cd /home/pi/pacsat_telem/Debug/
-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 pull --no-rebase > .updated
+# git checkout master-fox
+grep 'changed' /home/pi/pacsat_telem/Debug/.updated
+if [[ $(grep 'changed' /home/pi/pacsat_telem/Debug/.updated) ]]; then
-cd
+ echo "updating pacsat_telem"
+ make clean
+ make all
+ FLAG=1
+fi
-git clone https://github.com/alanbjohnston/PiSSTVpp.git
+sudo sed -i 's/#hdmi_group=1/hdmi_group=2/g' /boot/config.txt
+sudo sed -i 's/#hdmi_mode=1/hdmi_mode=16/g' /boot/config.txt
+sudo sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/g' /boot/config.txt
-cd PiSSTVpp
+sudo raspi-config nonint do_vnc 0
-make pisstvpp
-echo "Copying SSTV image 1"
-cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
-echo "Copying SSTV image 2"
-cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
+if [ ! -d "/home/pi/Desktop/PacsatGround" ]; then
-cd
+ URL="https://www.g0kla.com/pacsat/downloads/test/"
+ FILENAME=$(wget -q -O - $URL | grep -E -o -m 1 'PacsatGround_unix...........gz' | head -n 1)
+ echo "Downloading latest PacsatGround Station version" $FILENAME
+ wget $URL/$FILENAME -O PacsatGround_unix.tar.gz
+ tar -xzf PacsatGround_unix.tar.gz -C /home/pi/Desktop
-git clone https://github.com/alanbjohnston/rpitx.git
+fi
-cd rpitx
+sudo usermod -a -G gpio pi
+sudo apt-get install default-jdk -y
-./install.sh
+FILE=/home/pi/Desktop/PacsatGround/spacecraft/PacSatSim.commands
+if [ ! -f "$FILE" ]; then
+ echo "copying missing commands file"
+ cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/PacSatSim.commands $FILE
+fi
cd
-sudo cp ~/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
-
-sudo systemctl enable cubesatsim
-
-sudo cp ~/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service
+if [ ! -d "/home/pi/PiSSTVpp" ]; then
-# sudo systemctl enable transmit
+ sudo apt-get update -y
+ sudo apt-get install -y python-picamera python3-picamera build-essential libgd-dev libmagic-dev
+ cd
+ git clone https://github.com/alanbjohnston/PiSSTVpp.git
+ cd PiSSTVpp
+ make pisstvpp
-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
-
-
-sudo raspi-config nonint do_i2c 0
+fi
-sudo raspi-config nonint do_camera 0
+if [ ! -d "/home/pi/rpitx" ]; then
-sudo raspi-config nonint do_legacy 0
+ sudo apt-get install -y libraspberrypi-dev
+ cd
+ git clone https://github.com/alanbjohnston/rpitx.git
+ cd rpitx
+ ./install.sh
+ cd
+else
-#if [ "$1" = "u" ]; then
-#fi
+ if [[ $(grep 'SYNCWITHPWM' /home/pi/rpitx/src/librpitx/src/fskburst.h) ]]; then
+ echo "rpitx library already updated"
+ else
+ echo "updating rpitx"
+ cd /home/pi/rpitx
+ git pull
+ ./update.sh
+ cd
+ fi
+fi
-## sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
-
+FILE=/etc/systemd/system/cubesatsim.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service) ]]; then
+ echo "changed cubesatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
+ FLAG=1
+ else
+ echo "no changes to cubesatsim.service."
+ fi
+else
+ echo "creating cubesatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
+ sudo systemctl enable cubesatsim
- sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
+ FLAG=1
+fi
- sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2
+FILE=/etc/systemd/system/rpitx.service
+if [ -f "$FILE" ]; then
+ sudo systemctl disable rpitx
+ sudo rm /etc/systemd/system/rpitx.service
+fi
- sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/cmdline.txt # single core if Pi Zero 2
+if [[ -z $(sudo systemctl is-active packagekit | grep inactive) ]]; then
+ echo "Removing packagekit so won't auto check for updates on boot"
+ sudo systemctl stop packagekit
+ sudo systemctl disable packagekit
+ sudo apt-get remove -y packagekit
+fi
- sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
-
- if [[ $(grep 'dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24' /boot/config.txt) ]]; then
- echo "dtoverlay=i2c-gpio already in /boot/config.txt"
+FILE=/etc/systemd/system/transmit.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service) ]]; then
+ echo "changed transmit.service."
+ sudo cp /home/pi/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service
+ FLAG=1
else
- echo "adding dtoverlay=i2c-gpio to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24" >> /boot/config.txt'
+ echo "no change to transmit.service."
fi
+else
+ echo "creating transmit.service."
+ sudo cp /home/pi/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service
+ FLAG=1
+fi
- if [[ $(grep 'enable_uart=1' /boot/config.txt) ]]; then
- echo "enable_uart=1 already in /boot/config.txt"
- else
- echo "adding enable_uart=1 to /boot/config.txt"
- sudo sh -c 'echo "\nenable_uart=1" >> /boot/config.txt'
- fi
-
- if [[ $(grep 'dtoverlay=disable-bt' /boot/config.txt) ]]; then
- echo "dtoverlay=disable-bt already in /boot/config.txt"
- else
- echo "adding dtoverlay=disable-bt to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=disable-bt" >> /boot/config.txt'
- fi
-
- if [[ $(grep 'dtoverlay=dwc2' /boot/config.txt) ]]; then
- echo "dtoverlay=dwc2 aalready in /boot/config.txt"
+FILE=/etc/systemd/system/command.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/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 "adding dtoverlay=dwc2 to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=dwc2" >> /boot/config.txt'
+ 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
- if [[ $(grep 'modules-load=dwc2,g_ether' /boot/cmdline.txt) ]]; then
- echo "modules-load=dwc2,g_ether already in /boot/cmdline.txt"
+FILE=/etc/systemd/system/pacsatsim.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service) ]]; then
+ echo "changed pacsatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service
+ FLAG=1
else
- echo "adding modules-load=dwc2,g_ether to /boot/cmdline.txt"
- sudo sed -i 's/ rootwait/ rootwait modules-load=dwc2,g_ether/g' /boot/cmdline.txt
+ echo "no change to pacsatsim.service."
fi
-
- if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then
- echo "dtparam=audio=on already in /boot/config.txt"
+else
+ echo "creating pacsatsim.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pacsatsim.service /etc/systemd/system/pacsatsim.service
+ FLAG=1
+fi
+
+FILE=/etc/systemd/system/frequency.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/frequency.service /etc/systemd/system/frequency.service) ]]; then
+ echo "changed frequency.service."
+ sudo cp /home/pi/CubeSatSim/systemd/frequency.service /etc/systemd/system/frequency.service
+ FLAG=1
else
- echo "adding dtparam=audio=on to /boot/config.txt"
- sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt'
+ echo "no change to frequency.service."
fi
+else
+ echo "creating frequency.service."
+ sudo cp /home/pi/CubeSatSim/systemd/frequency.service /etc/systemd/system/frequency.service
+ FLAG=1
+fi
- if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then
- echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt"
+FILE=/etc/init.d/listen-for-shutdown.sh
+if [ -f $FILE ]; then
+ echo "Uninstalling pi-power-button"
+ sudo rm $FILE
+fi
+
+FILE=/etc/systemd/system/pushbutton.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/pushbutton.service /etc/systemd/system/pushbutton.service) ]]; then
+ echo "changed pushbutton.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pushbutton.service /etc/systemd/system/pushbutton.service
+ sudo systemctl enable pushbutton
+ FLAG=1
else
- echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt'
+ echo "no change to pushbutton.service."
fi
+else
+ echo "creating pushbutton.service."
+ sudo cp /home/pi/CubeSatSim/systemd/pushbutton.service /etc/systemd/system/pushbutton.service
+ sudo systemctl enable pushbutton
+ FLAG=1
+fi
- if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then
- echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt"
+FILE=/etc/OliveTin/config.yaml
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/OliveTin/config.yaml /etc/OliveTin/config.yaml) ]]; then
+ echo "changed config.yaml"
+ sudo cp /home/pi/CubeSatSim/OliveTin/config.yaml /etc/OliveTin/config.yaml
+ sudo systemctl daemon-reload
+ sudo systemctl restart OliveTin
else
- echo "adding to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt'
+ echo "no change to config.yaml"
fi
+else
+ echo "creating config.yaml"
+ cd /tmp
+ wget https://github.com/OliveTin/OliveTin/releases/download/3000.18.1/OliveTin_linux_armv7.deb
+ sudo dpkg -i OliveTin_linux_armv7.deb
+ sudo cp /home/pi/CubeSatSim/OliveTin/config.yaml /etc/OliveTin/config.yaml
+ sudo systemctl enable --now OliveTin
+fi
- if [[ $(grep 'disable_splash=1 ' /boot/config.txt) ]]; then
- echo "disable_splash=1 already in /boot/config.txt"
+FILE=/etc/systemd/system/OliveTin.service
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/systemd/OliveTin.service /etc/systemd/system/OliveTin.service) ]]; then
+ echo "changed OliveTin.service."
+ sudo cp /home/pi/CubeSatSim/systemd/OliveTin.service /etc/systemd/system/OliveTin.service
+ sudo systemctl daemon-reload
+ sudo systemctl restart OliveTin
+ FLAG=1
else
- echo "adding to /boot/config.txt"
- sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt'
+ echo "no change to OliveTin.service."
fi
+else
+ echo "creating OliveTin.service."
+ sudo cp /home/pi/CubeSatSim/systemd/OliveTin.service /etc/systemd/system/OliveTin.service
+ sudo systemctl daemon-reload
+ sudo systemctl enable OliveTin
+ FLAG=1
+fi
- if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then
- echo "boot_delay=0 already in /boot/config.txt"
+FILE=/etc/asound.conf
+if [ -f "$FILE" ]; then
+ if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then
+ echo "changed /etc/asound.conf."
+ sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf
+ FLAG=1
else
- echo "adding to /boot/config.txt"
- sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt'
+ echo "no change to /etc/asound.conf."
fi
+else
+ echo "creating /etc/asound.conf."
+ sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf
+ FLAG=1
+fi
- if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi
-
-sudo sh -c 'echo "\n" >> /boot/config.txt'
+sudo alsactl init
+sleep 5
+echo "Turn Command and Control on and off to activate MicVolume"
+touch /home/pi/CubeSatSim/command_control
+sudo systemctl start command
+sleep 10
+sudo rm /home/pi/CubeSatSim/command_control
+sudo systemctl restart command
+sudo alsactl init
+sleep 5
+/home/pi/CubeSatSim/config -L 75
+
+FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
+if [ ! -f "$FILE" ]; then
+ echo "Copying SSTV image 1."
+ cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
+fi
+
+FILE=/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
+if [ ! -f "$FILE" ]; then
+ echo "Copying SSTV image 2."
+ cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
+fi
sudo sed -i 's/DEVICES=""/DEVICES="\/dev\/serial0"/g' /etc/default/gpsd
sudo sed -i 's/GPSD_OPTIONS=""/GPSD_OPTIONS="-s 9600"/g' /etc/default/gpsd
-changed=0
-value=`cat /home/pi/CubeSatSim/sim.cfg`
-echo "$value" > /dev/null
-set -- $value
-
-if [ -z "$1" ] ; then n1="AMSAT" ; changed=1 ; else n1=$1 ; fi # callsign
-if [ -z "$2" ] ; then n2="0" ; changed=1 ; else n2=$2 ; fi # reset count
-if [ -z "$3" ] ; then n3="0" ; changed=1 ; else n3=$3 ; fi # lat
-if [ -z "$4" ] ; then n4="0" ; changed=1 ; else n4=$4 ; fi # lon
-if [ -z "$5" ] ; then n5="no" ; changed=1 ; else n5=$5 ; fi # sim mode
-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 ${10} ${11}
- echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo
- echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11
- echo $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10 $n11 > /home/pi/CubeSatSim/sim.cfg
- echo
+if [ ! -d "/home/pi/fctelem" ]; then
+ echo "Installing fctelem binary v0.2 for FUNcube mode"
+ cd
+ 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 -u fctelem.zip
+ FLAG=1
+elif [ ! -f "/home/pi/fctelem/v0.2" ]; then
+ echo "Updating fctelem binary to version v0.2 for FUNcube mode"
+ cd
+ cd /home/pi/fctelem
+ sudo mv fctelem fctelem.bk
+ sudo mv fcdecode.conf fcdecode.conf.bk
+ sudo mv fctelem.zip fctelem.zip.1
+ wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip
+ unzip -u fctelem.zip
+ FLAG=1
fi
-echo "Installing MPU6050-C-CPP-Library-for-Raspberry-Pi"
-sudo apt-get install -y libi2c-dev
-cd
-git clone https://github.com/alanbjohnston/MPU6050-C-CPP-Library-for-Raspberry-Pi.git
-cd MPU6050-C-CPP-Library-for-Raspberry-Pi
-sudo make install
-make payload
+if [ ! -f "/home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi/mpu6050" ]; then
+ echo "Installing MPU6050-C-CPP-Library-for-Raspberry-Pi"
+ sudo apt-get install -y libi2c-dev
+ cd
+ git clone https://github.com/alanbjohnston/MPU6050-C-CPP-Library-for-Raspberry-Pi.git
+ cd MPU6050-C-CPP-Library-for-Raspberry-Pi
+ sudo make install
+ make payload
+fi
-echo "Installing raspberry-pi-bme280"
-sudo apt-get install -y libi2c-dev
-cd
-git clone https://github.com/alanbjohnston/raspberry-pi-bme280.git
-cd raspberry-pi-bme280
+cd /home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi
+git checkout master
+git pull --no-rebase > .updated_p
+
+if [[ $(grep 'changed' /home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi/.updated_p) ]]; then
+ echo "updating MPU6050-C-CPP-Library-for-Raspberry-Pi"
+ sudo make install
+ make payload
+else
+ echo "nothing to do for MPU6050-C-CPP-Library-for-Raspberry-Pi."
+fi
+
+if [ ! -f "/home/pi/raspberry-pi-bme280/bme280" ]; then
+ echo "Installing raspberry-pi-bme280"
+ sudo apt-get install -y libi2c-dev
+ cd
+ git clone https://github.com/alanbjohnston/raspberry-pi-bme280.git
+ cd raspberry-pi-bme280
+ git checkout payload
+ make
+fi
+
+cd /home/pi/raspberry-pi-bme280
git checkout payload
-make
+git pull --no-rebase > .updated_p
+
+if [[ $(grep 'changed' /home/pi/raspberry-pi-bme280/.updated_p) ]]; then
+
+ echo "updating raspberry-pi-bme280"
+ make
+
+else
+ echo "nothing to do for raspberry-pi-bme280."
+fi
+
+if [ ! -f "/home/pi/fcdctl/fcdctl" ]; then
+ echo "Installing fcdctl to set FUNcubeDongle Pro gain"
+ sudo rm /var/lib/dpkg/info/python3-pip.list
+ sudo apt-get 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
+fi
-echo "Would you like to reboot to complete the installation (y/n)?"
+if [ ! -f "/home/pi/ssdv/ssdv" ]; then
+ cd
+ echo "Installing SSDV for FUNcube mode"
+ git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FUNcube images
+ cd ssdv
+ make
+fi
-read -r ANS
+if [ ! -f "/home/pi/FT857d/examples/FT857d/ft857d" ]; then
+ cd
+ echo "Installing FT857d for Doppler rigctld control mode"
+ git clone https://github.com/alanbjohnston/FT857d.git
+ cd FT857d
+ git checkout pi
+ cd examples/FT857d
+ g++ main.c ../../src/ft857d.cpp -lwiringPi -o ft857d
-if [ "$ANS" = "y" ]; then
+ sudo apt-get install -y libhamlib-utils socat gpredict
+fi
- sudo reboot now
+cd /home/pi/FT857d
+git checkout pi
+git pull --no-rebase > .updated_p
+if [[ $(grep 'changed' //home/pi/FT857d/.updated_p) ]]; then
+ echo "updating FT857d"
+ cd examples/FT857d
+ g++ main.c ../../src/ft857d.cpp -lwiringPi -o ft857d
else
+ echo "nothing to do for FT857d."
+fi
+
+cd
+
+#echo "Would you like to reboot to complete the installation (y/n)?"
+
+#read -r ANS
- echo "The CubeSatSim software will start next time you reboot"
+#if [ "$ANS" = "y" ]; then
+
+# sudo reboot now
+
+#else
+
+ # echo "The CubeSatSim software will start next time you reboot"
+#fi
+
+sed -i 's/quick_exec=0/quick_exec=1/' ~/.config/libfm/libfm.conf
+
+if [ ! -d "/home/pi/Icons" ]; then
+ cd
+ mkdir Icons
+ cd Icons
+ #wget http://cubesatsim.org/icons/*
+ #wget -r -nd --no-parent -A 'bar.*.tar.gz' http://url/dir/
+ wget -r -nd --no-parent -A '*' https://cubesatsim.org/icons/
fi
+
+sudo apt-get install -y raspberrypi-ui-mods rpi-connect ttyd
+
+sudo apt-get autoremove -y
+
+if [[ $(gpio -v | grep "Pi 4") ]] && [[ ! $(sudo raspi-config nonint get_browser | grep "chromium") ]] ; then
+ echo "Since Pi 4, changing default browser to Chromium"
+ sudo raspi-config nonint do_browser chromium
+fi
+
+if [[ $(gpio -v | grep "Pi 5") ]] && [[ ! $(sudo raspi-config nonint get_browser | grep "firefox") ]] ; then
+ echo "Since Pi 5, changing default browser to Firefox"
+ sudo raspi-config nonint do_browser firefox
+fi
+
+
+if [ "$NETWORK" = "0" ] ; then
+ echo "Enabling NetworkManager. You will need to login again and restart to complete the install/update."
+ sudo sed -i 's/managed=false/managed=true/g' /etc/NetworkManager/NetworkManager.conf # allow nmcli to manage WiFi
+ sudo systemctl enable --now NetworkManager && sudo nmcli networking on && sleep 5 && sudo nmcli dev wifi connect "$ssid" password "$password"
+fi
+
+if [ "$noreboot" = "0" ] ; then
+
+ if [ $FLAG -eq 1 ]; then # Not sure if this is needed
+ 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
+ if [ $FLAG -eq 1 ]; then
+ echo "reboot needed for changes to take effect" | wall
+ fi
+fi
+
+echo
+echo "You should restart to complete this operation with command:"
+echo "sudo reboot now"
+echo
diff --git a/log b/log
index 2a3ce9d7..8e1035ee 100755
--- a/log
+++ b/log
@@ -2,16 +2,105 @@
echo -e "\nLog file script for CubeSatSim\n"
-if [ "$1" = "-r" ] || [ "$1" = "-t" ] ; then
- sudo journalctl -a -u transmit > /home/pi/CubeSatSim/logt.txt
- cat /home/pi/CubeSatSim/logt.txt
- echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.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"
+if [ "$1" = "-h" ] ; then
+ echo "Displays systemd logs for the chose process. The choices are:"
+ echo " -d cubesatsim (also no choice gives you this)"
+ echo " -t transmit"
+ echo " -c command and control"
+ echo " -p pacsat"
+ echo " -r frequency control"
+ echo " -f frequency display"
+ echo " -b pushbutton"
+ echo " -o OliveTin"
+ echo "Default is the log is dumpted to the screen and written to a file."
+ echo "If an additional r is included, the log is realtime, and exits with a Control-C"
+ echo
+ exit
+fi
+
+REALTIME=0
+if [ "$2" = "r" ] ; then
+ REALTIME=1
+fi
+
+if [ "$REALTIME" = "1" ] ; then
+
+ echo "To exit, type Control-C"
+ echo
+ sleep 2
+
+ if [ "$1" = "-t" ] ; then
+ sudo journalctl -b all -af -u transmit # > /home/pi/CubeSatSim/logt.txt
+ # cat /home/pi/CubeSatSim/logt.txt
+ # echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
+ elif [ "$1" = "-c" ]; then
+ sudo journalctl -b all -af -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"
+ elif [ "$1" = "-p" ]; then
+ sudo journalctl -b all -af -u pacsatsim # > /home/pi/CubeSatSim/logp.txt
+ # cat /home/pi/CubeSatSim/logp.txt
+ # echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logp.txt"
+ elif [ "$1" = "-r" ]; then
+ sudo journalctl -b all -af -u frequency # > /home/pi/CubeSatSim/logr.txt
+ elif [ "$1" = "-f" ] ; then
+ echo "Transmit Receive"
+ while true; do
+ cat /home/pi/CubeSatSim/frequency.txt | tr -d '\n'
+# echo
+ sleep 1
+ printf "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
+ done
+ elif [ "$1" = "-b" ]; then
+ sudo journalctl -b all -af -u pushbutton # > /home/pi/CubeSatSim/logb.txt
+ elif [ "$1" = "-o" ]; then
+ sudo journalctl -b all -af -u OliveTin # > /home/pi/CubeSatSim/logb.txt
+ else
+ sudo journalctl -b all -af -u cubesatsim # > /home/pi/CubeSatSim/log.txt
+ # cat /home/pi/CubeSatSim/log.txt
+ # echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+ fi
+
else
- sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
- cat /home/pi/CubeSatSim/log.txt
- echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+
+ if [ "$1" = "-t" ] ; then
+ sudo rm /home/pi/CubeSatSim/logt.txt
+ sudo journalctl -b all -a -u transmit > /home/pi/CubeSatSim/logt.txt
+ cat /home/pi/CubeSatSim/logt.txt
+ echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
+ elif [ "$1" = "-c" ]; then
+ sudo rm /home/pi/CubeSatSim/logc.txt
+ sudo journalctl -b all -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"
+ elif [ "$1" = "-p" ]; then
+ sudo rm /home/pi/CubeSatSim/logp.txt
+ sudo journalctl -b all -a -u pacsatsim > /home/pi/CubeSatSim/logp.txt
+ cat /home/pi/CubeSatSim/logp.txt
+ echo -e "\nPacSat Log file also saved as /home/pi/CubeSatSim/logp.txt"
+ elif [ "$1" = "-r" ]; then
+ sudo rm /home/pi/CubeSatSim/logr.txt
+ sudo journalctl -b all -a -u frequency > /home/pi/CubeSatSim/logr.txt
+ cat /home/pi/CubeSatSim/logr.txt
+ echo -e "\nFrequency Log file also saved as /home/pi/CubeSatSim/logr.txt"
+ elif [ "$1" = "-f" ] ; then
+ cat /home/pi/CubeSatSim/frequency.txt
+ echo
+ elif [ "$1" = "-b" ]; then
+ sudo rm /home/pi/CubeSatSim/logb.txt
+ sudo journalctl -b all -a -u pushbutton > /home/pi/CubeSatSim/logb.txt
+ cat /home/pi/CubeSatSim/logb.txt
+ echo -e "\nPushbutton Log file also saved as /home/pi/CubeSatSim/logb.txt"
+ elif [ "$1" = "-o" ]; then
+ sudo rm /home/pi/CubeSatSim/logo.txt
+ sudo journalctl -b all -a -u OliveTin > /home/pi/CubeSatSim/logo.txt
+ cat /home/pi/CubeSatSim/logo.txt
+ echo -e "\nOliveTin Log file also saved as /home/pi/CubeSatSim/logo.txt"
+ else
+ sudo rm /home/pi/CubeSatSim/log.txt
+ sudo journalctl -b all -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
+ cat /home/pi/CubeSatSim/log.txt
+ echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
+ fi
+
fi
diff --git a/main.c b/main.c
index 42aaa7e8..b0444ef8 100644
--- a/main.c
+++ b/main.c
@@ -20,12 +20,13 @@
*/
#include "main.h"
+#include
//#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry
int main(int argc, char * argv[]) {
- printf("\n\nCubeSatSim v2.2 starting...\n\n");
+ printf("\n\nCubeSatSim v2.3 starting...\n\n");
wiringPiSetup();
@@ -42,11 +43,11 @@ int main(int argc, char * argv[]) {
// char * cfg_buf[100];
- fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d %s %d",
- call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, fail_yes, &fail_time);
+ fscanf(config_file, "%s %d %f %f %s %d %s %s %s %d %d %s %d %s",
+ call, &reset_count, &lat_file, &long_file, sim_yes, &squelch, tx, rx, hab_yes, &rx_pl, &tx_pl, fail_yes, &fail_time, doppler_mode);
fclose(config_file);
- fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %d\n",
- call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time);
+ fprintf(stderr,"Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s %s %d %d %s %d %s\n",
+ call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time, doppler_mode);
fprintf(stderr, "Transmit on %s MHz Receive on %s MHz\n", tx, rx);
@@ -125,7 +126,7 @@ int main(int argc, char * argv[]) {
FILE * sim_mode_auto = popen("touch /home/pi/CubeSatSim/sim_mode_auto", "r"); // store sim_mode_auto flag
pclose(sim_mode_auto);
} else {
- FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag
+ FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto > /dev/null 2>&1", "r"); // remove sim_mode_auto flag
pclose(sim_mode_auto);
}
@@ -261,13 +262,28 @@ int main(int argc, char * argv[]) {
printf("Mode is Repeater\n");
} else if ( mode_string == 'n') {
mode = TXCOMMAND;
- printf("Mode is Transmit Command\n");
- } else {
+ printf("Mode is Transmit Command\n");
+ } else if ( mode_string == 'p') {
+ mode = PACSAT;
+ printf("Mode is Pacsat\n");
+ } else if ( mode_string == 'P') {
+ mode = PACSATGND;
+ printf("Mode is Pacsat Ground Station\n");
+ } else {
printf("Mode is BPSK\n");
}
}
}
-
+/*
+ if ( mode == PACSAT) {
+ FILE * pacsat_file = popen("sudo systemctl restart pacsatsim", "r");
+ pclose(pacsat_file);
+ }
+ else {
+ FILE * pacsat_file = popen("sudo systemctl stop pacsatsim", "r");
+ pclose(pacsat_file);
+ }
+*/
// Open telemetry file with STEM Payload Data
telem_file = fopen("/home/pi/CubeSatSim/telem.txt", "a");
if (telem_file == NULL)
@@ -306,8 +322,8 @@ 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 %d %d %s %d",
- call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time);
+ fprintf(config_file, "%s %d %8.4f %8.4f %s %d %s %s %s %d %d %s %d %s",
+ call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx, hab_yes, rx_pl, tx_pl, fail_yes, fail_time, doppler_mode);
// fprintf(config_file, "%s %d", call, reset_count);
fclose(config_file);
config_file = fopen("sim.cfg", "r");
@@ -315,24 +331,45 @@ int main(int argc, char * argv[]) {
map[MINUS_X] = MINUS_Y;
map[PLUS_Z] = MINUS_X;
map[MINUS_Y] = PLUS_Z;
-
+/*
if (access("/dev/i2c-11", W_OK | R_OK) >= 0) { // Test if I2C Bus 11 is present
printf("/dev/i2c-11 is present\n\n");
snprintf(busStr, 10, "%d %d", test_i2c_bus(1), test_i2c_bus(11));
} else {
snprintf(busStr, 10, "%d %d", i2c_bus1, i2c_bus3);
}
-
-
- // check for camera
-// char cmdbuffer1[1000];
- FILE * file4 = popen("vcgencmd get_camera", "r");
- fgets(cmdbuffer, 1000, file4);
- char camera_present[] = "supported=1 detected=1";
+*/
+ snprintf(busStr, 10, "%d %d", i2c_bus1, i2c_bus3);
+
+ FILE * os_test = popen("cat /etc/os-release", "r");
+ fgets(cmdbuffer, 1000, os_test);
+ printf("os-release: %s\n", cmdbuffer);
+ char os_present[] = "bookworm";
// 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", & cmdbuffer, camera);
- pclose(file4);
+ int os_status = (strstr( (const char *)& cmdbuffer, os_present) != NULL) ? ON : OFF;
+ printf("os_status: %d\n", os_status);
+ pclose(os_test);
+
+ // check for camera
+ FILE *cam_test;
+ if (os_status == ON) { // bookworm
+ cam_test = popen("sudo rpicam-hello --list-cameras | grep 'No cameras available!'", "r");
+ fgets(cmdbuffer, 1000, cam_test);
+ char no_camera_present[] = "No cameras available!";
+ // printf("strstr: %s \n", strstr( & cmdbuffer1, camera_present));
+ camera = (strstr( (const char *)& cmdbuffer, no_camera_present) != NULL) ? OFF : ON;
+ }
+ else // bullseye
+ {
+ cam_test = popen("vcgencmd get_camera", "r");
+ fgets(cmdbuffer, 1000, cam_test);
+ 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", & cmdbuffer, camera);
+ pclose(cam_test);
#ifdef DEBUG_LOGGING
printf("INFO: I2C bus status 0: %d 1: %d 3: %d camera: %d\n", i2c_bus0, i2c_bus1, i2c_bus3, camera);
@@ -379,7 +416,7 @@ int main(int argc, char * argv[]) {
if (sim_mode && payload && !sim_config) {
sim_mode = FALSE;
printf("Turning off Sim Mode since payload is present and Sim Mode not manually configured.\n");
- FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag
+ FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto > /dev/null 2>&1", "r"); // remove sim_mode_auto flag
pclose(sim_mode_auto);
}
} else {
@@ -484,8 +521,9 @@ int main(int argc, char * argv[]) {
printf("\n FSK Mode, %d bits per frame, %d bits per second, %d ms per frame, %d ms sample period\n",
bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
-
- } else if (mode == BPSK) {
+ } else if ((mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {
+//// } else {
+
bitRate = 1200;
rsFrames = 3;
payloads = 6;
@@ -507,8 +545,11 @@ int main(int argc, char * argv[]) {
frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms
- printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n",
- bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
+ if (mode == BPSK)
+ printf("\n BPSK Mode, bufLen: %d, %d bits per frame, %d bits per second, %d ms per frame %d ms sample period\n",
+ bufLen, bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod);
+ else
+ printf("\n dataLen: %d \n", dataLen);
sin_samples = S_RATE/freq_Hz;
// printf("Sin map: ");
@@ -561,15 +602,8 @@ int main(int argc, char * argv[]) {
memset(sensor, 0, sizeof(sensor));
memset(other, 0, sizeof(other));
-// if (((mode == FSK) || (mode == BPSK))) // && !sim_mode)
- if (mode == FSK) { // && !sim_mode)
- get_tlm_fox();
-// get_tlm_fox();
- }
- if (mode == BPSK) { // && !sim_mode)
+ if ((mode == FSK) || (mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) // && !sim_mode)
get_tlm_fox(); // fill transmit buffer with reset count 0 packets that will be ignored
-// get_tlm_fox();
- }
else if (mode == FC) // && !sim_mode)
get_tlm_fc(); // fill transmit buffer with reset count 0 packets that will be ignored
else if (mode == CW)
@@ -586,11 +620,13 @@ int main(int argc, char * argv[]) {
strcat(pythonConfigStr, " c");
fprintf(stderr, "pythonConfigStr: %s\n", pythonConfigStr);
+
+ FILE *file2 = sopen(pythonVenv); // activate venv
file1 = sopen(pythonConfigStr); // python sensor polling function
fgets(cmdbuffer, 1000, file1);
- fprintf(stderr, "pythonStr result: %s\n", cmdbuffer);
+ fprintf(stderr, "pythonStr INA219 read result: %s\n", cmdbuffer);
}
for (int i = 0; i < 9; i++) {
@@ -667,7 +703,7 @@ int main(int argc, char * argv[]) {
char * token;
fputc('\n', file1);
fgets(cmdbuffer, 1000, file1);
-// fprintf(stderr, "Python read Result: %s\n", cmdbuffer);
+ fprintf(stderr, "Python INA219 read Result: %s\n", cmdbuffer);
// serialPuts(uart_fd, cmdbuffer); // write INA data to Pico over serial
@@ -699,7 +735,7 @@ int main(int argc, char * argv[]) {
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");
- FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag
+ FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto > /dev/null 2>&1", "r"); // remove sim_mode_auto flag
pclose(sim_mode_auto);
}
}
@@ -708,7 +744,7 @@ int main(int argc, char * argv[]) {
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");
- FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag
+ FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto > /dev/null 2>&1", "r"); // remove sim_mode_auto flag
pclose(sim_mode_auto);
}
}
@@ -734,7 +770,7 @@ int main(int argc, char * argv[]) {
if (sim_mode && payload && !sim_config) {
sim_mode = FALSE;
printf("Turning off Sim Mode since payload is present and Sim Mode not manually configured.\n");
- FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto", "r"); // remove sim_mode_auto flag
+ FILE * sim_mode_auto = popen("sudo rm /home/pi/CubeSatSim/sim_mode_auto > /dev/null 2>&1", "r"); // remove sim_mode_auto flag
pclose(sim_mode_auto);
}
@@ -1009,6 +1045,7 @@ int main(int argc, char * argv[]) {
}
if (sim_mode) { // simulated telemetry
+ printf("Simulated telemetry mode\n");
double time = ((long int)millis() - time_start) / 1000.0;
@@ -1047,9 +1084,9 @@ int main(int argc, char * argv[]) {
// float charging = eclipse * (fabs(amps_max[0] * 0.707) + fabs(amps_max[1] * 0.707) + rnd_float(-4.0, 4.0));
// current[map[BAT]] = ((current[map[BAT2]] * voltage[map[BAT2]]) / batt) - charging;
- current[map[BAT]] = rnd_float(320, 510) - charging;
+ current[map[BAT]] = rnd_float(320, 510) - charging;
- printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]);
+ printf("charging: %f bat curr: %f bus curr: %f bat volt: %f bus volt: %f \n",charging, current[map[BAT]], current[map[BAT2]], batt, voltage[map[BAT2]]);
batt -= (batt > 3.5) ? current[map[BAT]] / 300000 : current[map[BAT]] / 30000;
if (batt < 3.6) {
@@ -1256,11 +1293,11 @@ int main(int argc, char * argv[]) {
sleep(rand_sleep);
// fprintf(stderr, "INFO: Sleeping for extra %d sec\n", rand_sleep);
- } else if ((mode == FSK) || (mode == BPSK)) {// FSK or BPSK
+ } else if ((mode == FSK) || (mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {// FSK or BPSK
get_tlm_fox();
} else if ((mode == FC)) {
get_tlm_fc();
- } else { // SSTV
+ } else { // SSTV or PACSATGND
// fprintf(stderr, "Sleeping\n");
sleep(30);
}
@@ -1511,11 +1548,15 @@ void get_tlm(void) {
printf("\n\nTelemetry string is %s \n\n", str);
if (transmit) {
+// if (is_safe_input(str))
+// fprintf(stderr, "String is safe");
+// else
+// fprintf(stderr, "String is not safe");
FILE * file2 = popen(str, "r");
pclose(file2);
- sleep(2);
- digitalWrite(txLed, txLedOff);
+ sleep(2);
+ digitalWrite(txLed, txLedOff);
} else {
fprintf(stderr, "\nNo CubeSatSim Band Pass Filter detected. No transmissions after the CW ID.\n");
@@ -1530,6 +1571,19 @@ void get_tlm(void) {
return;
}
+/*
+int is_safe_input(const char *s) {
+ for (; *s; s++) {
+ if (!isdigit((unsigned char)*s)
+ && !isupper((unsigned char)*s)
+ && *s != '.' && *s != '-' && *s != '+'
+ && *s != ' ' && *s != '\n' && *s != '_')
+ return 0;
+ }
+ return 1;
+}
+*/
+
// generates telemetry which is decoded by AMSAT's FoxTelem: https://www.amsat.org/foxtelem-software-for-windows-mac-linux/
// for more info about how we use FoxTelem see https://www.g0kla.com/foxtelem/amsat_telemetry_designers_handbook.pdf
@@ -1541,6 +1595,8 @@ void get_tlm_fox() {
smaller = (int)(S_RATE / (2 * freq_Hz));
+// if (mode == PACSAT)
+// dataLen = 78;
short int b[dataLen];
short int b_max[dataLen];
short int b_min[dataLen];
@@ -1610,7 +1666,10 @@ void get_tlm_fox() {
sampleTime = (unsigned int)millis();
} else
- printf("first or second time - no sleep\n");
+ {
+ printf("first time - no sleep\n");
+ firstTime = OFF;
+ }
printf("++++ Loop time: %5.3f sec +++++\n", (millis() - loopTime) / 1000.0);
fflush(stdout);
@@ -1621,7 +1680,6 @@ void get_tlm_fox() {
for (int count1 = 0; count1 < 8; count1++) {
if (voltage[count1] < voltage_min[count1]) voltage_min[count1] = voltage[count1];
if (current[count1] < current_min[count1]) current_min[count1] = current[count1];
-
if (voltage[count1] > voltage_max[count1]) voltage_max[count1] = voltage[count1];
if (current[count1] > current_max[count1]) current_max[count1] = current[count1];
@@ -1720,8 +1778,11 @@ void get_tlm_fox() {
encodeA(b, 9 + head_offset, battCurr);
- encodeB(b, 10 + head_offset, (int)(sensor[TEMP] * 10 + 0.5)); // Temp
-
+ if (sensor[TEMP] > 0 )
+ encodeB(b, 10 + head_offset, (int)(sensor[TEMP] * 10 + 0.5)); // Temp
+ else
+ encodeB(b, 10 + head_offset, 0);
+
if (mode == FSK) {
encodeA(b, 12 + head_offset, posXv);
encodeB(b, 13 + head_offset, negXv);
@@ -1789,7 +1850,11 @@ void get_tlm_fox() {
encodeB(b_max, 43 + head_offset, (int)(sensor_max[GYRO_Z] + 0.5) + 2048);
// encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5) + 2048);
- encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5));
+ if (sensor_max[TEMP] > 0)
+ encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5));
+ else
+ encodeB(b_max, 10 + head_offset, 0);
+
encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5));
if (failureMode != FAIL_PAYLOAD) {
encodeA(b_max, 48 + head_offset, (int)(sensor_max[DTEMP] * 10 + 0.5) + 2048);
@@ -1852,8 +1917,12 @@ void get_tlm_fox() {
encodeB(b_min, 43 + head_offset, (int)(sensor_min[GYRO_Z] + 0.5) + 2048);
// encodeB(b_min, 49 + head_offset, (int)(sensor_min[XS1] * 10 + 0.5) + 2048);
- encodeB(b_min, 10 + head_offset, (int)(sensor_min[TEMP] * 10 + 0.5));
- encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5));
+ if (sensor_min[TEMP] > 0)
+ encodeB(b_min, 10 + head_offset, (int)(sensor_min[TEMP] * 10 + 0.5));
+ else
+ encodeB(b_min, 10 + head_offset, 0);
+
+ encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5));
if (failureMode != FAIL_PAYLOAD) {
encodeA(b_min, 48 + head_offset, (int)(sensor_min[DTEMP] * 10 + 0.5) + 2048);
@@ -1914,7 +1983,10 @@ void get_tlm_fox() {
if (sensor[ALT] < 0) sensor[ALT] = 0.0;
encodeB(b, 34 + head_offset, (int)(sensor[ALT] / 10.0 + 0.5)); // Altitude
encodeA(b, 45 + head_offset, (int)(sensor[HUMI] * 10 + 0.5)); // in place of sensor1
- encodeA(b, 39 + head_offset, (int)(other[TEMP] * 10 + 0.5));
+ if (other[TEMP] > 0)
+ encodeA(b, 39 + head_offset, (int)(other[TEMP] * 10 + 0.5));
+ else
+ encodeA(b, 39 + head_offset, 0);
encodeA(b, 36 + head_offset, Resets);
encodeB(b, 37 + head_offset, (int)(other[RSSI] + 0.5) + 2048);
@@ -1979,20 +2051,23 @@ void get_tlm_fox() {
encodeB(b, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
encodeA(b, 53 + head_offset, groundCommandCount);
- if (mode == BPSK) {
- encodeA(b_max, 51 + head_offset, status);
+ if ((mode == BPSK) || (mode == PACSAT) || (mode == PACSATGND)) {
+ encodeA(b_max, 51 + head_offset, status);
encodeA(b_min, 51 + head_offset, status);
encodeB(b_max, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
encodeB(b_min, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
}
+ int tlm_skip = FALSE;
if (txAntennaDeployed == 0) {
txAntennaDeployed = 1;
printf("TX Antenna Deployed!\n");
+ tlm_skip = TRUE;
}
if (rxAntennaDeployed == 0) {
rxAntennaDeployed = 1;
printf("RX Antenna Deployed!\n");
+ tlm_skip = TRUE;
}
if (mode == BPSK) { // wod field experiments
@@ -2001,8 +2076,38 @@ void get_tlm_fox() {
encodeA(b, 65 + head_offset, val >> 8);
encodeA(b, 63 + head_offset, 0x00);
encodeA(b, 62 + head_offset, 0x01);
- encodeB(b, 74 + head_offset, 0xfff);
+ encodeB(b, 74 + head_offset, 0xfff);
}
+
+ if (((mode == PACSAT) || (mode == PACSATGND)) && (tlm_skip == FALSE))
+ {
+ FILE *telem_binary = fopen("/home/pi/CubeSatSim/tlm.bin", "wb");
+ if (telem_binary != NULL) {
+
+ int bytes_written = 4;
+ unsigned int now = (unsigned int)time(0);
+ fwrite(&now, sizeof(now), 1, telem_binary);
+
+ int count;
+ char byte;
+ printf("b is: \n");
+ for (count = 0; count < dataLen; count++) {
+ byte = b[count];
+ fwrite(&byte, 1, 1, telem_binary);
+ printf("%02X ", byte);
+ bytes_written++;
+ }
+ printf("\n");
+ printf("Writing %d bytes to tlm.bin\n", bytes_written + 4);
+ fclose(telem_binary);
+ }
+ else
+ printf("Error opening tlm.bin\n");
+ }
+ else
+ { // extra bracket for some reason?
+ {
+
short int data10[headerLen + rsFrames * (rsFrameLen + parityLen)];
short int data8[headerLen + rsFrames * (rsFrameLen + parityLen)];
@@ -2291,22 +2396,25 @@ void get_tlm_fox() {
// max -= 1;
}
- /// if (sock_ret == -1) {
- /// printf("Error: %s \n", strerror(errno));
- /// socket_open = 0;
- // transmitStatus = -1;
- /// }
- /// }
+ if (socket_open == 1)
+ firstTime = 0;
+// else if (frames_sent > 0) //5)
+// firstTime = 0;
+
+ }
+ } // extra bracket for some reason?
+
if (!transmit) {
fprintf(stderr, "\nNo CubeSatSim Band 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");
}
- /// if (socket_open == 1)
- /// firstTime = 0;
- // else if (frames_sent > 0) //5)
- // firstTime = 0;
-
+// if (firstTime && (mode == PACSAT))
+// {
+// firstTime = OFF;
+// fprintf(stderr, "No longer first time\n");
+// fflush(stdout);
+// }
return;
}
@@ -2334,6 +2442,7 @@ FILE *sopen(const char *program)
_exit(127);
}
/* parent */
+ signal(SIGCHLD, SIG_IGN);
close(fds[1]);
return fdopen(fds[0], "r+");
}
@@ -2645,9 +2754,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");
- battery_saver_mode = ON;
- if ((mode == AFSK) || (mode == SSTV) || (mode == CW)) {
+ fprintf(stderr,"Turning Battery saver mode ON\n");
+ if ((mode == AFSK) || (mode == SSTV) || (mode == CW) || (mode == PACSAT) || (mode == PACSATGND)) {
command = popen("echo 'reboot due to turning ON Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
@@ -2664,7 +2772,7 @@ if (setting == ON) {
pclose(command);
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) || (mode == PACSAT) || (mode == PACSATGND)) {
command = popen("echo 'reboot due to turning OFF Safe Mode!' | wall", "r");
pclose(command);
command = popen("sudo reboot now", "r");
diff --git a/main.h b/main.h
index 7c8f2386..bbc66639 100644
--- a/main.h
+++ b/main.h
@@ -98,6 +98,7 @@ extern const unsigned char ALPHA_TO[];
// const unsigned char *CCodecAO40::encode(unsigned char *source_bytes, int byte_count);
void program_radio();
void socket_send(int length);
+int is_safe_input(const char *s);
int socket_open = 0;
int sock = 0;
@@ -125,7 +126,9 @@ FILE *image_file;
#define CW 5
#define FC 6
#define REPEATER 7
+#define PACSAT 8
#define TXCOMMAND 12
+#define PACSATGND 13
#define FAIL_COUNT 11
#define FAIL_NONE -1
@@ -168,6 +171,7 @@ char sim_yes[10];
char hab_yes[10];
char fail_yes[10];
int fail_time = 60;
+char doppler_mode[10];
int squelch = 3; // default squelch
char rx[12], tx[12];
int tx_pl = 0;
@@ -200,7 +204,8 @@ char sensor_string[SENSOR_FIELDS][32];
int test_i2c_bus(int bus);
//const char pythonCmd[] = "python3 -u /home/pi/CubeSatSim/python/voltcurrent.py ";
-const char pythonCmd[] = "python3 -u /home/pi/CubeSatSim/ina219.py ";
+const char pythonVenv[] = "/home/pi/CubeSatSim/venv.sh";
+const char pythonCmd[] = "/home/pi/venv/bin/python3 -u /home/pi/CubeSatSim/ina219.py ";
char pythonStr[100], pythonConfigStr[100], busStr[10];
int map[8] = {0, 1, 2, 3, 4, 5, 6, 7};
char src_addr[5] = "";
diff --git a/pacsatsim.sh b/pacsatsim.sh
new file mode 100755
index 00000000..e690a948
--- /dev/null
+++ b/pacsatsim.sh
@@ -0,0 +1,361 @@
+#!/bin/bash
+
+# script to run PacsatSim
+
+loopback=0
+vox=0
+safe=0
+card=0
+pwm=0
+reset=0
+
+if [ "$1" = "l" ] ; then
+
+ loopback=1
+
+elif [ "$1" = "v" ] ; then
+
+ vox=1
+
+elif [ "$1" = "c" ] ; then
+
+ card=1
+
+elif [ "$1" = "r" ] ; then
+
+ reset=1
+
+else
+
+ pwm=1
+
+fi
+
+FILE=/home/pi/CubeSatSim/battery_saver
+if [ -f "$FILE" ]; then
+
+ safe=1
+
+fi
+
+if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
+ echo "USB Sound Card detected"
+ soundcard=1
+ /home/pi/CubeSatSim/config -L -1
+else
+ echo "No USB Sound Card detected"
+ soundcard=0
+fi
+
+gpio -g mode 7 up
+if [[ $(gpio -g read 7 | grep 0) ]] ; then
+ echo "TXC is present"
+ txc=1
+else
+ echo "TXC not present"
+ txc=0
+fi
+
+#timeout 1 rtl_test &> out.txt
+#if [[ $(grep "No supported" out.txt) ]] ; then
+# echo "No RTL-SDR detected"
+# rtl=0
+#else
+# echo "RTL-SDR detected."
+# rtl=1
+#fi
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+txfrequency="$7e3"
+rxfrequency="$8e3"
+
+echo -n "PacSat callsign is "
+echo $callsign
+echo -n "Transmit Frequency is "
+echo $txfrequency
+echo -n "Receive Frequency is "
+echo $rxfrequency
+echo
+
+sleep 2
+
+# if [ "$reset" = "0" ] ; then
+if [ ! -d "/home/pi/PacSat" ]; then
+
+# if [ ! -d "/home/pi/PacSat" ]; then
+
+# echo "Setting up PacSatSim default configuration"
+# echo
+
+# cd
+# sudo rm pacsat-dir.zip
+# mkdir /home/pi/PacSat
+# mkdir /home/pi/PacSat/pacsat
+# mkdir /home/pi/PacSat/pacsat/dir
+## wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.2/pacsat-dir.zip
+ # cp /home/pi/pi_pacsat/zip/pacsat-dir.zip .
+ # unzip pacsat-dir.zip
+ # sudo rm pacsat-dir.zip
+
+ # cd
+ # sudo rm /home/pi/pi_pacsat/Debug/pacsat.config
+ # sudo rm /home/pi/pi_pacsat/Debug/pacsat.state
+ # sudo rm /home/pi/pi_pacsat/Debug/pacsat_upload_table.dat
+ # sudo rm pi_pacsat.zip
+ ## wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.2/pi_pacsat.zip
+# cp /home/pi/pi_pacsat/zip/pi_pacsat.zip .
+ # unzip pi_pacsat.zip
+ # sudo rm pi_pacsat.zip
+#
+ # sudo sed -i 's/dir_max_file_age_in_seconds=4320000/dir_max_file_age_in_seconds=60480000/g' /home/pi/pi_pacsat/Debug/pacsat.state
+ # sudo sed -i 's/ftl0_max_upload_age_in_seconds=432000/ftl0_max_upload_age_in_seconds=60480000/g' /home/pi/pi_pacsat/Debug/pacsat.state
+
+ # echo
+ #echo "pacsat.state:"
+ # cat /home/pi/pi_pacsat/Debug/pacsat.state
+ # echo
+
+# fi
+
+# else
+
+ echo "Resetting pi_pacsat to empty configuration"
+ echo
+ sudo rm -r /home/pi/PacSat
+ mkdir /home/pi/PacSat
+ mkdir /home/pi/PacSat/pacsat
+ mkdir /home/pi/PacSat/pacsat/dir
+ mkdir /home/pi/PacSat/pacsat/txt
+ cp /home/pi/CubeSatSim/Welcome_Message.txt /home/pi/PacSat/pacsat/txt/Welcome_Message.txt
+ mkdir /home/pi/PacSat/pacsat/img
+ cp /home/pi/CubeSatSim/sstv/sstv_image_tiny.jpg /home/pi/PacSat/pacsat/img/sstv_image_tiny.jpg
+ cd /home/pi/pi_pacsat/Debug
+
+ sudo rm pacsat_last_command_time.dat
+ sudo rm pacsat_upload_table.dat
+ sudo rm pacsat.state
+
+ echo "bit_rate=9600" > pacsat.config
+ echo "bbs_callsign=AMSAT-12" >> pacsat.config
+ echo "broadcast_callsign=AMSAT-11" >> pacsat.config
+ echo "digi_callsign=AMSAT-1" >> pacsat.config
+ echo "max_frames_in_tx_buffer=5" >> pacsat.config
+
+ echo "pb_open=1" > pacsat.state
+ echo "uplink_open=1" >> pacsat.state
+ echo "pb_max_period_for_client_in_seconds=60" >> pacsat.state
+ echo "uplink_max_period_for_client_in_seconds=60" >> pacsat.state
+ echo "dir_max_file_age_in_seconds=6048000" >> pacsat.state
+
+ echo
+ echo "pacsat.state:"
+ cat pacsat.state
+ echo
+
+ touch /home/pi/pi_pacsat/Debug/pacsat_upload_table.dat
+
+# exit
+fi
+
+/home/pi/CubeSatSim/config -z
+
+value=`cat /home/pi/CubeSatSim/sim.cfg`
+echo "$value" > /dev/null
+set -- $value
+
+callsign="$1"
+frequency="$7e3"
+
+echo "Configured callsign is "
+echo $callsign
+
+oldcallsign=$(grep -oP '(?<=bbs_callsign=).*(?=-)' /home/pi/pi_pacsat/Debug/pacsat.config)
+
+echo "Callsign in pacsat.config is "
+echo $oldcallsign
+
+if [ ! "$callsign" = "$oldcallsign" ] ; then
+
+ sudo sed -i "s/bbs_callsign=$oldcallsign/bbs_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+ sudo sed -i "s/broadcast_callsign=$oldcallsign/broadcast_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+ sudo sed -i "s/digi_callsign=$oldcallsign/digi_callsign=$callsign/g" /home/pi/pi_pacsat/Debug/pacsat.config
+
+ echo "New pacsat.confg is"
+ echo
+
+ cat /home/pi/pi_pacsat/Debug/pacsat.config
+
+fi
+
+sudo /etc/init.d/alsa-utils stop
+sudo /etc/init.d/alsa-utils start
+
+# export LD_LIBRARY_PATH=/mnt/usb-disk/ariss/lib:/usr/local/lib/iors_common:$LD_LIBRARY_PATH
+
+export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
+
+#sudo systemctl stop cubesatsim
+
+#sudo systemctl stop transmit
+
+#sudo systemctl stop command &>/dev/null
+
+sudo modprobe snd-aloop
+
+#sudo systemctl stop openwebrx
+
+#sudo systemctl stop rtl_tcp &>/dev/null
+
+#pkill -o chromium &>/dev/null
+
+#sudo killall -9 rtl_fm &>/dev/null
+
+#sudo killall -9 direwolf &>/dev/null
+
+#udo killall -9 aplay &>/dev/null
+
+#sudo killall -9 qsstv &>/dev/null
+
+#sudo killall -9 rtl_tcp &>/dev/null
+
+#sudo killall -9 java &>/dev/null
+
+#sudo killall -9 CubicSDR &>/dev/null
+
+#sudo killall -9 zenity &>/dev/null
+
+sudo killall -9 pacsat_telem &>/dev/null
+
+sudo killall -9 pi_pacsat &>/dev/null
+
+echo
+
+
+#choice=2
+
+#fi
+
+
+# frequency=434900000
+ echo
+ echo "If your Pacsat Ground Station is transmitting packets, you will see them here"
+ echo
+
+
+#echo
+
+#echo "Note that the 'Tuned to' frequency will be different from the chosen frequency due to the way SDRs work."
+
+
+# echo -e "Auto decoding APRS Pacsat packets on $frequency Hz"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-loopback.conf -t 0 &
+
+ # /usr/bin/x-terminal-emulator --geometry=120x40 -e "/home/pi/CubeSatSim/pacsatsim-df.sh"
+
+sudo usermod -a -G gpio pi
+
+if [ "$loopback" = "1" ] ; then
+
+ echo "Using audio loopback"
+ ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+ value=`cat /home/pi/CubeSatSim/.mode`
+ echo "$value" > /dev/null
+ set -- $value
+
+ MODE=$1
+
+ if [ ! "$MODE" = "P" ] ; then
+
+ /home/pi/CubeSatSim/config -I n
+
+ fi
+
+# sudo /home/pi/CubeSatSim/pacsatsim-d.sh &
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-loopback.conf -t 0 &
+
+elif [ "$safe" = "1" ] ; then
+
+ echo "Safe mode - battery saver"
+# sudo /home/pi/CubeSatSim/pacsatsim-d.sh &
+
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-pwm-loopback.conf -t 0 &
+
+# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
+# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f $frequency &
+
+
+elif [ "$vox" = "1" ]; then
+
+ echo "Using Soundcard Audio TX and RX (VOX, no PTT)"
+ ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 17"
+# sudo /home/pi/CubeSatSim/pacsatsim-dj.sh &
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-jp14-half.conf -t 0 &
+
+elif [ "$pwm" = "1" ] ; then
+
+ echo "FM TXC using Soundcard input (JP13), PWM output"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-pwm.conf -t 0 &
+
+else
+
+ echo "FM TXC using Soundcard input (JP13) and output (JP14)"
+ ADEVICE="ADEVICE shared_mic plughw:CARD=Device,DEV=0"
+ PTT="PTT GPIOD gpiochip0 -20"
+# direwolf -P+ -D1 -qd -dp -r 48000 -c /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim-jp14.conf -t 0 &
+
+fi
+
+DIREWOLF_CONF="/home/pi/CubeSatSim/direwolf-pacsatsim-tmp.conf"
+
+echo "$ADEVICE" > $DIREWOLF_CONF
+echo "MYCALL $callsign-1" >> $DIREWOLF_CONF
+echo "$PTT" >> $DIREWOLF_CONF
+cat /home/pi/CubeSatSim/direwolf/direwolf-pacsatsim.conf >> $DIREWOLF_CONF
+
+echo
+echo "$DIREWOLF_CONF"
+echo
+cat $DIREWOLF_CONF
+echo
+
+#direwolf -P+ -D1 -qd -dp -r 48000 -c $DIREWOLF_CONF -t 0 &
+direwolf -qd -r 48000 -c $DIREWOLF_CONF &
+
+# arecord -D plughw:CARD=Loopback,DEV=1 -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 434900 &
+## arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
+
+## echo "Don't close the direwolf window or the Pacsatsim will stop running."
+
+export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
+
+/home/pi/pacsat_telem/Debug/pacsat_telem -v -d /home/pi/PacSat/pacsat &
+
+sleep 5
+
+value=`aplay -l | grep "Loopback"`
+echo "$value" > /dev/null
+set -- $value
+
+#rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -D hw:0,0 -r 48000 -t raw -f S16_LE -c 1 &
+
+cd /home/pi/pi_pacsat/Debug
+
+./pi_pacsat -c pacsat.config -d /home/pi/PacSat
+
+sleep 60
diff --git a/pushbutton.py b/pushbutton.py
new file mode 100644
index 00000000..bad883e5
--- /dev/null
+++ b/pushbutton.py
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+
+# originally based on listen-for-shutdown.py from pi-power-button
+
+import RPi.GPIO as GPIO
+import subprocess
+import time
+import os
+from time import sleep
+import configparser
+
+def read_config_ini():
+ global hotspot_ssid
+ global hotspot_password
+ global hotspot_default
+ global web_term_hotspot
+ global web_term_wifi
+# global dashboard_port
+ try:
+ # Initialize the parser
+ config = configparser.ConfigParser()
+
+ # Read the file
+ config.read('/home/pi/CubeSatSim/hotspot.ini')
+
+ # Access the values like a dictionary
+ hotspot_ssid = config['Hotspot']['hotspot_ssid']
+ hotspot_password = config['Hotspot']['hotspot_password']
+ hotspot_default = config['Hotspot']['hotspot_default']
+ web_term_hotspot = config['Hotspot']['web_term_hotspot']
+ web_term_wifi = config['Hotspot']['web_term_wifi']
+# dashboard_port = config.getint('Hotspot', 'dashboard_port')
+
+ print(f"SSID: {hotspot_ssid} Password: {hotspot_password} Hotspot Default: {hotspot_default} Term Hotspot: {web_term_hotspot} Term WiFi {web_term_wifi}") # : {dashboard_}")
+
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print(" failed, setting defaults")
+ hotspot_ssid = "CubeSat"
+ hotspot_password = "amsatcubesat"
+ hotspot_default = "no"
+ web_term_hotspot = "yes"
+ web_term_wifi = "no"
+# dashboard_port = 80
+
+def blink(times):
+ blink_time = 0.1
+ powerPin = 16
+ for i in range(times): # blink times
+ GPIO.output(powerPin, 0)
+ sleep(blink_time)
+ GPIO.output(powerPin, 1)
+ sleep(blink_time)
+ sleep(0.65)
+
+def change_mode():
+ push_button = 26
+ powerPin = 16
+ txPin = 27
+ sleep(0.75)
+ if GPIO.input(push_button):
+ print("sudo reboot -h now", flush=True)
+ os.system("echo 'reboot due to push button!' | wall")
+ GPIO.setwarnings(False)
+ GPIO.setup(powerPin, GPIO.OUT)
+ GPIO.output(powerPin, 0);
+ os.system("sudo reboot now")
+# subprocess.call(['reboot', '-h', 'now'], shell=False)
+ return
+ blink(1)
+ if GPIO.input(push_button):
+ print("switch to AFSK", flush=True)
+ os.system("echo 'switch to AFSK due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -a")
+ return
+ blink(2)
+ if GPIO.input(push_button):
+ print("switch to FSK", flush=True)
+ os.system("echo 'switch to FSK due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -f")
+ return
+ blink(3)
+ if GPIO.input(push_button):
+ print("switch to BPSK", flush=True)
+ os.system("echo 'switch to BPSK due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -b")
+ return
+ blink(4)
+ if GPIO.input(push_button):
+ print("switch to SSTV", flush=True)
+ os.system("echo 'switch to SSTV due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -s")
+ return
+ blink(5)
+ if GPIO.input(push_button):
+ print("switch to CW", flush=True)
+ os.system("echo 'switch to CW due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -m")
+ return
+ blink(6)
+ if GPIO.input(push_button):
+ print("switch to Repeater", flush=True)
+ os.system("echo 'switch to Repeater due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -e")
+ return
+ blink(7)
+ if GPIO.input(push_button):
+ print("switch to FunCube", flush=True)
+ os.system("echo 'switch to FunCube due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -j")
+ return
+ blink(8)
+ if GPIO.input(push_button):
+ print("switch to PacSat", flush=True)
+ os.system("echo 'switch to PacSat due to push button!' | wall")
+ os.system("/home/pi/CubeSatSim/config -G")
+ return
+ for i in range(3): # blink 3 times slowly
+ GPIO.output(powerPin, 0)
+ sleep(0.35)
+ GPIO.output(powerPin, 1)
+ sleep(0.35)
+ sleep(0.65)
+ if GPIO.input(push_button):
+ print("sudo shutdown -h now", flush=True)
+ os.system("echo 'shutdown due to push button!' | wall")
+ GPIO.setwarnings(False)
+ GPIO.setup(powerPin, GPIO.OUT)
+ subprocess.call(['shutdown', '-h', 'now'], shell=False)
+ return
+ for i in range(3): # blink two times even more slowly
+ GPIO.output(powerPin, 0)
+ sleep(0.7)
+ GPIO.output(powerPin, 1)
+ sleep(0.7)
+ sleep(0.7)
+ print("toggle command and control mode", flush=True)
+ try:
+ f = open("/home/pi/CubeSatSim/command_control", "r")
+ f.close()
+ print("command and control will be deactivated", flush=True)
+ os.system('sudo rm /home/pi/CubeSatSim/command_control')
+ os.system("echo 'command and control deactivated by push button!' | wall")
+ os.system('sudo systemctl restart command')
+ except:
+ print("command and control will be activated", flush=True)
+ os.system('touch /home/pi/CubeSatSim/command_control')
+ os.system("echo 'command and control activated by push button!' | wall")
+ os.system('sudo systemctl restart command')
+ sleep(1)
+
+powerPin = 16
+txPin = 27
+push_button = 26
+GPIO.setmode(GPIO.BCM)
+GPIO.setwarnings(False)
+GPIO.setup(txPin, GPIO.OUT)
+GPIO.output(txPin, 0)
+GPIO.setup(powerPin, GPIO.OUT)
+GPIO.output(powerPin, 0)
+
+GPIO.setup(push_button, GPIO.IN, pull_up_down=GPIO.PUD_UP)
+
+read_config_ini()
+if not GPIO.input(push_button) or hotspot_default == "yes": # if pushbutton is held down during boot or configured as default
+ print("Activating WiFi access point!", flush=True)
+ GPIO.output(powerPin, 1)
+ sleep(0.1)
+ GPIO.output(powerPin, 0)
+ sleep(0.1)
+ GPIO.output(powerPin, 1)
+ sleep(0.3)
+ GPIO.output(powerPin, 0)
+ sleep(0.1)
+ GPIO.output(powerPin, 1)
+ sleep(0.3)
+ GPIO.output(powerPin, 0)
+ success = 1
+ count = 0
+ while (success != 0) and (count < 5):
+ result = subprocess.run(['nmcli', 'device', 'wifi', 'hotspot', 'con-name', 'Hotspot', 'ifname', 'wlan0', 'ssid', hotspot_ssid, 'password', hotspot_password], capture_output=True, text=True)
+ print(result, flush=True) #.stdout)
+ count = count + 1
+ success = result.returncode
+ sleep(1)
+ print(f"Starting Wi-Fi Hotspot with SSID: {hotspot_ssid} and password: {hotspot_password}")
+ result = subprocess.run(['nmcli', 'connection', 'show'], capture_output=True, text=True)
+ print(result, flush=True)
+ sleep(2)
+ if web_term_hotspot == "yes":
+ subprocess.Popen(['sudo', '-u', 'pi', 'ttyd', '-W', '-p', '8081', 'bash'])
+ print("Starting web terminal on port 8081")
+elif web_term_wifi == "yes":
+ subprocess.Popen(['sudo', '-u', 'pi', 'ttyd', '-W', '-p', '8081', 'bash'])
+ print("Starting web terminal on port 8081")
+GPIO.setup(powerPin, GPIO.OUT)
+GPIO.output(powerPin, 1)
+while (True):
+ sleep(1)
+ GPIO.wait_for_edge(push_button, GPIO.FALLING)
+ change_mode()
+ sleep(5)
diff --git a/spacecraft/PacSatGround_0.46m/PacSatSim.dat b/spacecraft/PacSatGround_0.46m/PacSatSim.dat
new file mode 100644
index 00000000..92ae8f93
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46m/PacSatSim.dat
@@ -0,0 +1,15 @@
+Pacsat Telemetry Decoder Properties
+#Sat Nov 26 18:12:20 EST 2016
+numberOfLookupTables=0
+measurementsFileName=measurements.csv
+model=1
+layout0.filename=PACSAT_rttelemetry.csv
+layout0.name=TLMI_LAYOUT
+passMeasurementsFileName=passmeasurements.csv
+name=PacSatSim
+description=PacSatSim
+numberOfLayouts=1
+satId=3
+catalogNumber=0
+conversionCoefficients=pacsat-coef.csv
+layoutsUseBits=True
diff --git a/spacecraft/PacSatGround_0.46m/PacSatSim.properties b/spacecraft/PacSatGround_0.46m/PacSatSim.properties
new file mode 100644
index 00000000..e4ccad24
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46m/PacSatSim.properties
@@ -0,0 +1,20 @@
+#PacSat Ground Station Properties
+#Sun Feb 17 18:25:06 EST 2019
+sequence_num=3
+name=PacSatSim
+digiCallsign=AMSAT-1
+description=PacSatSim
+broadcastCallsign=AMSAT-11
+DIR_AGE=10
+bbsCallsign=AMSAT-12
+telemLayoutFile=PacSatSim.dat
+telem_server=tlm.amsatfox.org
+web_site_url=http://CubeSatSim.org
+show_system_files_on_dir_tab=false
+show_user_files=true
+supports_file_upload=true
+norad_id=30776
+psf_header_check_sums=false
+commandsFile=pacsat.commands
+is_command_station=true
+secret_key=ScKQLp2ZMvCaCTK5jAmOmKmA0JiSyJ6Y15+Yfg\=\=
diff --git a/spacecraft/PacSatGround_0.46o/PacSatGround.zip b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
new file mode 100644
index 00000000..6694f79a
Binary files /dev/null and b/spacecraft/PacSatGround_0.46o/PacSatGround.zip differ
diff --git a/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip b/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip
new file mode 100644
index 00000000..7efc92a7
Binary files /dev/null and b/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip differ
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv b/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv
new file mode 100644
index 00000000..cb9f0537
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim-coef.csv
@@ -0,0 +1,41 @@
+0,-,NONE,0,1,0,0,0,0,None,0,4096,None
+1,-,Boolean,0,1,0,0,0,0,Boolean,0,1,A Boolean value that prints TRUE or FALSE
+2,-,Counts,0,1,0,0,0,0,Counts,0,4096,An integer count value
+3,-,Date,0,1,0,0,0,0,Date,0,4096,A Unix epoch date time integer
+4,-,TXPower,0,1,0,0,0,0,None,0,4096,None
+5,-,IHUSpeed,0,0.1,0,0,0,0,None,0,4096,None
+6,-,RSSI_1,0,-1,0,0,0,0,Counts,0,4096,Signed 8 bit
+7,-,Mode,0,0,0,0,0,0,Enum,0,4096,SAFE:CREW:TELEM:X BAND RPT:APRS:SSTV:FS
+8,-,Battery,0,0.001,0,0,0,0,None,0,4096,Battery Voltage
+9,-,IHUTemp,0,0.1,0,0,0,0,None,0,4096,None
+10,-,Mode,0,1,0,0,0,0,None,0,4096,The spacecraft Mode
+11,-,FS_BYTES_PER_BLK,0,128,0,0,0,0,Counts,0,4096,The number of bytes per block in RED FS
+12,-,FS_FILE_NUMBER,-4,1,0,0,0,0,Counts,0,4096,The number of files in the FS excluding core OS folders
+13,-,SHTC3Temp,-45,0.002670288,0,0,0,0,None,0,4096,SHTC3 Temperature sensor
+14,-,SHTC3Humidity,0,0.001525879,0,0,0,0,None,0,4096,SHTC3 Humidity sensor
+15,-,LPS22Pressure,0,0.000244141,0,0,0,0,None,0,4096,LPS22 Pressure sensor
+16,-,LPS22Temp,0,0.01,0,0,0,0,None,0,4096,LPS22 Temperature of sensor
+17,-,IMUTemp,0,0.00390625,0,0,0,0,None,0,4096,Temperature of IMU = raw/256
+18,-,Acc,0,6.10E-05,0,0,0,0,Sint16,0,4096,Accelerometer is 2g full scale
+19,-,Gyro,0,0.000976563,0,0,0,0,Sint16,0,4096,Gyro scale for 32dps
+20,-,Mag,0,0.149975574,0,0,0,0,Sint16,0,4096,Mag is 4912 full scale
+21,-,AntMode,0,0,0,0,0,0,Enum,0,4096,MANUAL:AUTO:ORBIT
+22,-,ResetReason,0,0,0,0,0,0,Enum,0,4096,NONE:SHUTDOWN:REBOOT:RADIO:TNC:TNC LISTEN:RUN TWICE:RADIO REBOOT:TNC PS REBOOT:TNC REBOOT:SOFT:THERMAL
+23,-,LogLevel,0,0,0,0,0,0,Enum,0,4096,NONE:ERROR:WARN:INFO
+24,-,O2FromVolts,86.434,-0.0354,0,0,0,0,None,0,4096,O2 Conc from raw voltage as a percentage
+25,-,SensorState,0,0,0,0,0,0,Enum,0,4096,OFF:ON:ERR
+26,-,SPARE2,0,0,0,0,0,0,Counts,0,4096,SPARE
+27,-,O2Conc,0,0.01,0,0,0,0,Sint16,0,4096,O2 concentration as percentage
+28,-,SSTVMode,0,0,0,0,0,0,Enum,0,4096,MartinM1:MartinM2:ScottieS1:ScottieS2:Robot36:PasokonP3:PasokonP5:PasokonP7:PD90:PD120:PD160:PD180:PD240:PD290:Robot8BW:Robot24BW
+29,-,DivideBy100,0,0.01,0,0,0,0,None,0,4096,Divide by 100
+30,-,DivideBy100Offset,-20.48,0.01,0,0,0,0,None,0,4096,Divide by 100 with Offset
+31,-,Offset,-2048,1,0,0,0,0,Counts,0,4096,Offset
+32,-,DivideBy10Offset,-204.8,0.1,0,0,0,0,None,0,4096,Divide by 10 with Offset
+33,-,Status,0,0,0,0,0,0,Enum,0,4096,OFF:ON
+34,-,CommandStatus,0,0,0,0,0,0,Enum,0,4096,OFF:Carrier:DTMF/APRS
+35,-,FailStatus,0,0,0,0,0,0,Enum,0,4096,OK:FAIL
+36,-,AntStatus,0,0,0,0,0,0,Enum,0,4096,STOWED:DEPLOYED
+37,-,Times10,0,10.0,0,0,0,0,Counts,0,4096,Multiply by 10
+NOTES:,,,,,,,,,,,,
+Serial,Ignore,name,a,b,c,d,e,f,format,low limit,high limit,Comment
+Echo value = a + bx + cx^2 + dx^3 + ex^4 + fx^5,Echo value = a + bx + cx^2 + dx^3 + ex^4 + fx^5,,,,,,,,,,,
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.commands b/spacecraft/PacSatGround_0.46o/PacSatSim.commands
new file mode 100644
index 00000000..4e7a8073
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.commands
@@ -0,0 +1,37 @@
+# This is a list of commands that can be sent to the spacecraft
+# args are 16 bit except the special code 99099099 which is replaced with the unix time, or when special code MSB32BIT is used to combine two fields
+LIST, namespaces, None, Operations, Telem, File System
+LIST, IMAGE FOLDER, sstv_queue 1, sstv_queue 2, sstv_queue 3, sstv_queue 4, sstv_queue 5, sstv_queue 6, sstv_queue 7, sstv_queue 8, sstv_queue 9
+LIST, FOLDER, bin, lib, config, PACSAT dir, upload queue, wod queue, log queue, text queue, sensor wod queue, data1, data2, data3, data4, data5, data6, data7, data8, data9
+LIST, ENABLE, false, true
+LIST, ROLL AT STARTUP, false, true
+LIST, OVERWRITE, false, true
+LIST, FSK, false, true
+LIST, REMOVE ORPHAN FILES, false, true
+LIST, STATE, stop, start
+LIST, UPLINK MODE, Off, All stations, Command Stations Only
+LIST, FILENAME, use id for file name, user file name
+LIST, SHUTDOWN, reboot, shutdown
+LIST, RESET, reboot
+LIST, RATE, 1200, 9600
+LIST, FEC, Off, On
+LIST, FULL DUPLEX, false, true
+LIST, LOG NAME, Log, WOD
+LIST, LOG LEVEL, None, Error, Warnings, Info
+# Name, Name space, cmd, arg0, arg1, arg2, arg3, argName0, argName1, argName2, argName3, confirm, use reset/uptime, description
+#
+# PACSAT
+#
+Pacsat Broadcast,3,1,0,0,0,0,State,Period(sec),Timeout(sec),NONE,false,false,Enable or disable the Pacsat Broadcast module. The directory entries and individual files will be broadcast based on commands from ground stations.
+File Uploads,3,2,0,0,0,0,Uplink Mode,Period(sec),Timeout(sec),NONE,false,false,Enable or disable File Uploads. Limit file uploads to command stations that authenticate with a secret key.
+Install File,3,3,0,0,0,0,FileId,MSB32BIT,Folder,NONE,false,false,Copy a file from the PACSAT Directory to a folder and name it with a 4 byte hex name that matches the id or the user filename.
+Execute File,3,13,0,0,0,0,FileId,MSB32BIT,Arg1,Arg2,true,false,Execute a file on the ARISS-PI. The file must already be installed in the bin folder
+Delete File,3,4,0,0,0,0,FileId,MSB32BIT,Folder,NONE,true,false,Delete a file on the ARISS-PI. Typically this leaves the original copy in the PACSAT dir. To delete the original copy specify the PACSAT Dir folder
+Delete Folder Contents,3,5,0,0,0,0,Folder,Remove Orphan Files,NONE,NONE,true,false,Remove all files from the folder. The original files will remain in the PACSAT Directory unless deleted seperately. Orphan files are files in a folder without a corresponding Pacsat Dir file. NB: Deleting the entire Pacsat Dir is a desperate measure perhaps only useful in testing!
+Default File Expiry Period,3,6,0,0,0,0,Period(days),NONE,NONE,NONE,false,false,Set the default expiry period for files without a specific expiry time. The new value will be applied to all files.
+File Expiry Period,3,7,0,0,0,0,FileId,MSB32BIT,Date,MSB32BIT,false,false,Set the expiry date for a specific file`.
+Directory Maintenence Period,3,8,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period between checks to each node in the directory for file expiry.
+Uplink queue maintenance Period,3,9,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period to check the entire uplink queue for expired files.
+Int File Que Check Period,3,10,0,0,0,0,Period(s),NONE,NONE,NONE,false,false,Period to check the ingestion queues for newly generated internal files.
+Max File Size,3,11,0,0,0,0,Size(kb),NONE,NONE,NONE,false,false,Maximum size for an uploaded file
+Max Upload File Age,3,12,0,0,0,0,Age(days),NONE,NONE,NONE,false,false,Partially uploaded files not modified for more than this period will be removed from the upload queue.
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.dat b/spacecraft/PacSatGround_0.46o/PacSatSim.dat
new file mode 100644
index 00000000..7b738eb6
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.dat
@@ -0,0 +1,18 @@
+#Pacsat Telemetry Decoder Properties
+#Fri Feb 6 18:12:20 EST 2026
+numberOfLookupTables=0
+measurementsFileName=measurements.csv
+model=1
+layoutsUseToCallsignAsType=true
+numberOfLayouts=2
+layout0.filename=PacSatSim_rttelemetry.csv
+layout0.name=TLMP1
+layout1.filename=PacSatSim_rttelemetry.csv
+layout1.name=WOD
+passMeasurementsFileName=passmeasurements.csv
+name=CubeSatSim
+description=PacSatSim
+satId=3
+catalogNumber=0
+conversionCoefficients=PacSatSim-coef.csv
+layoutsUseBits=True
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim.properties b/spacecraft/PacSatGround_0.46o/PacSatSim.properties
new file mode 100644
index 00000000..8ff5be50
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim.properties
@@ -0,0 +1,21 @@
+#PacSat Ground Station Properties
+#Fri Feb 6 18:25:06 EST 2026
+sequence_num=3
+name=PacSatSim
+digiCallsign=AMSAT-1
+description=PacSatSim
+broadcastCallsign=AMSAT-11
+DIR_AGE=10
+bbsCallsign=AMSAT-12
+telemLayoutFile=PacSatSim.dat
+telem_server=tlm.amsatfox.org
+web_site_url=http://CubeSatSim.org
+show_system_files_on_dir_tab=false
+show_user_files=true
+supports_file_upload=true
+norad_id=30776
+psf_header_check_sums=false
+is_command_station=true
+secret_key=Not-required
+commandsFile=PacSatSim.commands
+echo_to_stdout=true
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv b/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv
new file mode 100644
index 00000000..30f05985
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim_conversion_curves.csv
@@ -0,0 +1,13 @@
+CurveName,a,bx,cx^2,dx^3,ex^4,fx^5,Description
+cubesatsim_voltage,0,0.01,0,0,0,0,Converts voltages read from the INA219 sensors
+cubesatsim_current,-2048,1,0,0,0,0,Converts positive and negative currents read from the INA219 sensors
+cubesatsim_temperature,0,0.1,0,0,0,0,Converts temperature of Pi
+cubesatsim_rotation,-2048,1,0,0,0,0,Converts positive and negative dps rotation
+cubesatsim_acceleration,-20.48,0.01,0,0,0,0,Converts positive and negative g acceleration
+cubesatsim_altitude,0,0.1,0,0,0,0,Converts altitude
+cubesatsim_pressure,0,1,0,0,0,0,Converts pressure
+cubesatsim_sensor1,0,1,0,0,0,0,Conversion of Sensor 1
+cubesatsim_sensor2,-2048,1,0,0,0,0,Conversion of Sensor 2
+cubesatsim_sensor3,-20.48,0.01,0,0,0,0,Conversion of Sensor 3
+cubesatsim_rpm,-204.8,0.1,0,0,0,0,Conversion of calculated RPM
+cubesatsim_rssi,-2048,1,0,0,0,0,Conversion of Received Signal Strength
diff --git a/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv b/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv
new file mode 100644
index 00000000..24298614
--- /dev/null
+++ b/spacecraft/PacSatGround_0.46o/PacSatSim_rttelemetry.csv
@@ -0,0 +1,63 @@
+62,TYPE,FIELD,BITS,UNIT,CONVERSION,MODULE,MODULE_NUM,MODULE_LINE,LINE_TYPE,SHORT_NAME,DESCRIPTION
+0,long,timestamp,32,Sec,0,NONE,0,0,0,timestamp,This is the unix time in seconds
+1,int,Sensor 2,12,integer,2,Experiments,6,8,3,Sensor 2,STEM Payload Extra Sensor 2
+2,int,Sensor 3,12,integer,2,Experiments,6,9,3,Sensor 3,STEM Payload Extra Sensor 3
+3,float,BATT_V,12,V,29,Battery,4,1,3,Battery Voltage,INA219 Battery Voltage
+4,float,SatelliteXAxisAcceleration,12,g,30,+X Panel,7,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around X Axis
+5,float,SatelliteYAxisAcceleration,12,g,30,+Y Panel,8,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around Y Axis
+6,float,SatelliteZAxisAcceleration,12,g,30,+Z Panel,9,4,3,Acceleration,STEM Payload Board MPU6050 Acceleration around Z Axis
+7,int,BATT_I,12,mA,31,Battery,4,2,3,Battery Current,INA219 Battery Current
+8,float,Temperature,12,C,5,Experiments,6,2,3,BME280 Temp,BME280 STEM Payload sensor temperature
+9,float,posXv,12,V,29,+X Panel,7,1,3,Voltage,INA219 +X solar panel Voltage
+10,float,posYv,12,V,29,+Y Panel,8,1,3,Voltage,INA219 +Y solar panel Voltage
+11,float,posZv,12,V,29,+Z Panel,9,1,3,Voltage,INA219 +Z solar panel Voltage
+12,float,negXv,12,V,29,-X Panel,10,1,3,Voltage,INA219 -X solar panel Voltage
+13,float,negYv,12,V,29,-Y Panel,11,1,3,Voltage,INA219 -Y solar panel Voltage
+14,float,negZv,12,V,29,-Z Panel,12,1,3,Voltage,INA219 -Z solar panel Voltage
+15,int,posXi,12,mA,31,+X Panel,7,2,3,Current,INA219 +X solar panel Current
+16,int,posYi,12,mA,31,+Y Panel,8,2,3,Current,INA219 +Y solar panel Current
+17,int,posZi,12,mA,31,+Z Panel,9,2,3,Current,INA219 +Z solar panel Current
+18,int,negXi,12,mA,31,-X Panel,10,2,3,Current,INA219 -X solar panel Current
+19,int,negYi,12,mA,31,-Y Panel,11,2,3,Current,INA219 -Y solar panel Current
+20,int,negZi,12,mA,31,-Z Panel,12,2,3,Current,INA219 -Z solar panel Current
+21,float,BATT2_V,12,V,29,Battery2,5,1,3,Battery2 Voltage,INA219 Battery2 Voltage
+22,float,spin,12,rpm,32,Computer Software,3,1,3,Spacecraft Spin,Calculated spin rate using solar cells
+23,int,Pressure,12,hPa,2,Experiments,6,3,3,BME280 Pressure,BME280 STEM Payload sensor pressure
+24,float,Altitude,12,m,37,Experiments,6,4,3,BME280 Altitude,BME280 STEM Payload sensor altitude
+25,float,Resets,12,-,12,NONE,3,2,3,Reset Count, Software Reset Count
+26,float,rssi,12,dBm,31,Radio,1,1,3,RSSI,Received Signal Strength Indication
+27,float,IHUcpuTemp,12,C,5,Computer Hardware,2,1,3,IHU Temp (Pi),Internal temperature of IHU from Pi
+28,float,SatelliteXAxisAngularVelocity,12,dps,31,+X Panel,7,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around X Axis
+29,float,SatelliteYAxisAngularVelocity,12,dps,31,+Y Panel,8,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around Y Axis
+30,float,SatelliteZAxisAngularVelocity,12,dps,31,+Z Panel,9,3,3,Rotation,STEM Payload Board MPU6050 Angular veolcity around Z Axis
+31,float,Humidity,12,%,5,Experiments,6,5,3,BME280 Humidity,BME280 Humidity
+32,int,BAT2_I,12,mA,31,Battery2,5,2,3,Battery2 Current,INA219 Battery2 Current
+33,float,DiodeTemp,12,C,32,Experiments,6,6,3,Diode Temp,STEM Payload Diode Temperature
+34,int,Sensor 1,12,integer,2,Experiments,6,7,3,Sensor 1,STEM Payload Extra Sensor 1
+35,float,STEMPayloadStatus,1,-,35,Experiments,6,1,0,STEM Payload Status, STEM Payload STEM Payload board failure Indicator
+36,float,SafeMode,1,-,33,Computer Software,3,2,0,Safe Mode, Safe Mode (Low Battery Voltage)
+37,float,SimulatedTelemetry,1,-,33,Computer Software,3,4,0,Simulated Telemetry,Simulated Telemetry Indicator
+38,float,PayloadStatus1,1,-,35,NONE,6,8,0,Exp 3,STEM Payload status 1 failure indicator
+39,float,I2CBus0Failure,1,-,35,NONE,2,2,0,I2C Bus 0,I2C bus 0 failure indicator
+40,float,I2CBus1Failure,1,-,35,Computer Hardware,2,2,0,I2C Bus 1,I2C bus 1 failure indicator
+41,float,I2CBus3Failure,1,-,35,Computer Hardware,2,3,0,I2C Bus 3,I2C bus 3 failure indicator
+42,float,CameraFailure,1,-,35,Computer Hardware,2,4,0,Camera,Camera failure indicator
+43,int,GroundCommands,4,-,2,Computer Software,3,3,0,Ground Commands,Number of ground commands received
+44,float,RxAntenna,1,-,36,Radio,1,3,0,RX Antenna,Receive antenna status
+45,float,TxAntenna,1,-,36,Radio,1,2,0,TX Antenna,Transmit antenna status
+46,float,C2CStatus,2,-,34,Computer Software,3,5,0,Command Control, Command & Control Status
+47,float,ICR3VProt,12,V,0,NONE,7,2,3,3V Prot,ICR 3V Proteted
+48,float,ICR2dot5V,12,V,0,NONE,7,3,3,2.5V,ICR 2.5V
+49,float,ICR2dot5VProt,12,V,0,NONE,7,4,3,2.5V Prot,ICR 2.5V Protected
+50,float,rf6,12,-,0,NONE,0,0,0,None,None
+51,float,rf7,12,-,0,NONE,0,0,0,None,None
+52,float,MuxTest,12,V,0,NONE,7,5,3,Sensor Power,Sensor Power Voltage at the ICR
+53,float,LtVGACtl,12,V,0,NONE,1,4,3,VGA Control,Control Voltage to the Variable Gain Amplifier (VGA)
+54,float,pad,4,-,34,NONE,0,0,0,None,Unused
+55,float,IHUdiagData,32,-,18,NONE,3,2,0,Diagnostic Info,Diagnostic Data on IHU Performance
+56,float,pad1,1,-,0,NONE,0,0,0,NONE,Filler
+57,float,wodSize,8,000s,36,NONE,3,3,0,WOD Stored,Number of WOD data payloads kept for each of Science and Housekeeping. In hundreds
+58,float,swCmds,32,-,35,NONE,7,6,0,Diagnostic,ICR Diagnostic information
+59,float,hwCmdCnt,6,-,1,NONE,7,7,0,HW Command Count,Number of hardware commands since last reset
+60,float,swCmdCnt,6,-,1,NONE,7,8,0,SW Command Count,Number of software commands since last reset
+61,float,pad2,27,-,0,NONE,0,0,0,NONE,Filler
diff --git a/sstv/sstv_image_tiny.jpg b/sstv/sstv_image_tiny.jpg
new file mode 100644
index 00000000..41a0a642
Binary files /dev/null and b/sstv/sstv_image_tiny.jpg differ
diff --git a/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/Payload_BME280_MPU6050_YPR_EEPROM.ino b/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/Payload_BME280_MPU6050_YPR_EEPROM.ino
new file mode 100644
index 00000000..90bdfe66
--- /dev/null
+++ b/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/Payload_BME280_MPU6050_YPR_EEPROM.ino
@@ -0,0 +1,904 @@
+// code for Pico or Pro Micro or STM32 on the CubeSat Simulator STEM Payload board
+// works wih CubeSatSim software v1.3.2 or later
+// extra sensors can be added in payload_extension.cpp file
+// adds absolute orientation yaw, pitch, roll as Sensor 1, 2, and 3.
+
+#include
+#include
+#include
+//#include
+#include "MPU6050_6Axis_MotionApps20.h"
+#if !defined(ARDUINO_ARCH_MBED_RP2040) // && defined(ARDUINO_ARCH_RP2040)
+#include
+#endif
+
+#if defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Arduino Mbed OS RP2040 Boards is used in Arduino IDE
+#include
+TinyGPSPlus gps;
+UART Serial2(8, 9, 0, 0);
+
+#elif !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards in Arduino IDE
+#include
+TinyGPSPlus gps;
+bool check_for_wifi();
+bool wifi = false;
+int led_builtin_pin;
+
+#else // if Sparkfun Pro Micro or STM32
+#include
+#endif
+
+#define SEALEVELPRESSURE_HPA (1013.25)
+
+Adafruit_BME280 bme;
+//MPU6050 mpu6050(Wire);
+
+MPU6050 mpu;
+int const INTERRUPT_PIN = 6;
+bool DMPReady = false;
+uint8_t devStatus;
+uint8_t MPUIntStatus; // Holds actual interrupt status byte from MPU
+uint16_t packetSize; // Expected DMP packet size (default is 42 bytes)
+uint8_t FIFOBuffer[64]; // FIFO storage buffer
+
+Quaternion q; // [w, x, y, z] Quaternion container
+VectorFloat gravity; // [x, y, z] Gravity vector
+float ypr[3]; // [yaw, pitch, roll] Yaw/Pitch/Roll container and gravity vector
+int16_t ax, ay, az;
+int16_t gx, gy, gz;
+float accelx, accely, accelz, acceleration;
+float gyrox, gyroy, gyroz, rotation;
+int yaw, pitch, roll;
+int reset_count;
+
+long timer = 0;
+int bmePresent;
+int RXLED = 17; // The RX LED has a defined Arduino pin
+int whiteLED = 9;
+int yellowLED = 8;
+int Sensor1 = 0;
+float Sensor2 = 0;
+float temp;
+int calibration = 0;
+
+void ee_prom_word_write(int addr, int val);
+short ee_prom_word_read(int addr);
+int first_time = true;
+int first_read = true;
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+float T2 = 24; // Temperature data point 1
+float R2 = 169; // Reading data point 1
+float T1 = 6; // Temperature data point 2
+float R1 = 181; // Reading data point 2
+#endif
+#if defined __AVR_ATmega32U4__
+float T2 = 26.3; // Temperature data point 1
+float R2 = 167; // Reading data point 1
+float T1 = 2; // Temperature data point 2
+float R1 = 179; // Reading data point 2
+#endif
+#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
+float T2 = 25; // Temperature data point 1
+float R2 = 671; // Reading data point 1
+float T1 = 15.5; // Temperature data point 2
+float R1 = 695; // Reading data point 2
+#endif
+
+int sensorValue;
+float Temp;
+float rest;
+
+char sensor_end_flag[] = "_END_FLAG_";
+char sensor_start_flag[] = "_START_FLAG_";
+bool show_gps = true; // set to false to not see all messages
+float flon = 0.0, flat = 0.0, flalt = 0.0;
+void get_gps();
+
+extern void payload_setup(); // sensor extension setup function defined in payload_extension.cpp
+extern void payload_loop(); // sensor extension read function defined in payload_extension.cpp
+
+volatile bool MPUInterrupt = false; // Indicates whether MPU6050 interrupt pin has gone high
+void DMPDataReady()
+{
+ MPUInterrupt = true;
+}
+
+void setup() {
+
+ Serial.begin(115200); // Serial Monitor for testing
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ Serial1.setRX(1);
+ delay(100);
+ Serial1.setTX(0);
+ delay(100);
+#endif
+
+ Serial1.begin(115200); // for communication with Pi Zero
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards in Arduino IDE
+ EEPROM.begin(512);
+#endif
+
+ delay(2000);
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) && (ARDUINO_ARCH_RP2040)
+ Serial.println("Pico with Mbed");
+#elif !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ Serial.println("Pico with RP2040");
+#elif defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
+ Serial.println("STM32");
+#elif defined __AVR_ATmega32U4__
+ Serial.println("Pro Micro");
+#else
+ Serial.println("Unknown board");
+#endif
+
+ Serial.println("Starting!");
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+ Serial.println("Starting Serial2 for optional GPS on JP12");
+// Serial2.begin(9600); // serial from - some modules need 115200
+ Serial2.begin(9600); // serial from GPS or other serial sensor. Some GPS need 115200
+
+ // set all Pico GPIO connected pins to input
+ for (int i = 10; i < 22; i++) {
+ pinMode(i, INPUT);
+ }
+ pinMode(26, INPUT);
+ pinMode(27, INPUT);
+ pinMode(28, INPUT);
+ pinMode(15, INPUT_PULLUP); // squelch
+#endif
+
+ blink_setup();
+
+ blink(500);
+ delay(250);
+ blink(500);
+ delay(250);
+ led_set(whiteLED, HIGH);
+ delay(250);
+ led_set(whiteLED, LOW);
+ led_set(yellowLED, HIGH);
+ delay(250);
+ led_set(yellowLED, LOW);
+
+ if (bme.begin(0x76)) {
+ bmePresent = 1;
+ } else {
+ Serial.println("Could not find a valid BME280 sensor, check wiring!");
+ bmePresent = 0;
+ }
+
+// mpu6050.begin();
+
+ ax = 0;
+ ay = 0;
+ az = 0;
+ gx = 0;
+ gy = 0;
+ gz = 0;
+ yaw = 0;
+ pitch = 0;
+ roll = 0;
+ accelx = 0;
+ accely = 0;
+ accelz = 0;
+ acceleration = 1.0;
+ gyrox = 0;
+ gyroy = 0;
+ gyroz = 0;
+
+ mpu.initialize(ACCEL_FS::A2G, GYRO_FS::G250DPS);
+// mpu.initialize();
+
+ pinMode(INTERRUPT_PIN, INPUT);
+
+ // Verify connection
+ if (mpu.testConnection())
+ {
+ Serial.println("MPU6050 connection successful");
+ }
+ else
+ {
+ Serial.println("MPU6050 connection failed");
+ }
+
+ /* Initializate and configure the DMP*/
+ Serial.println(F("Initializing DMP..."));
+ devStatus = mpu.dmpInitialize();
+
+ if (eeprom_word_read(0) == 0xA08)
+ {
+ Serial.println("Reading gyro and accel offsets from EEPROM\n");
+
+ int axOffset = eeprom_word_read(1);
+ int ayOffset = eeprom_word_read(2);
+ int azOffset = eeprom_word_read(3);
+ int gxOffset = eeprom_word_read(4);
+ int gyOffset = eeprom_word_read(5);
+ int gzOffset = eeprom_word_read(6);
+
+ Serial.println(axOffset, DEC);
+ Serial.println(ayOffset, DEC);
+ Serial.println(azOffset, DEC);
+ Serial.println(gxOffset, DEC);
+ Serial.println(gyOffset, DEC);
+ Serial.println(gzOffset, DEC);
+
+ mpu.setXGyroOffset(gxOffset);
+ mpu.setYGyroOffset(gyOffset);
+ mpu.setZGyroOffset(gzOffset);
+ mpu.setXAccelOffset(axOffset);
+ mpu.setYAccelOffset(ayOffset);
+ mpu.setZAccelOffset(azOffset);
+
+ mpu.PrintActiveOffsets();
+
+ Serial.println("\nTemperature calibration data from EEPROM\n");
+
+ T1 = ((float)eeprom_word_read(7)) / 10.0;
+ R1 = ((float)eeprom_word_read(8));
+ T2 = ((float)eeprom_word_read(9)) / 10.0;
+ R2 = ((float)eeprom_word_read(10));
+
+ Serial.println(T1, DEC);
+ Serial.println(R1, DEC);
+ Serial.println(" ");
+ Serial.println(T2, DEC);
+ Serial.println(R2, DEC);
+ Serial.println(" ");
+
+ }
+ else
+ {
+ // Serial.println("Calculating gyro offsets\n");
+ // mpu6050.calcGyroOffsets(true);
+
+ if (devStatus == 0)
+ {
+ // if (first_read == true) {
+ mpu.CalibrateAccel(6); // Calibration Time: generate offsets and calibrate our MPU6050
+ mpu.CalibrateGyro(6);
+ Serial.println("These are the Active offsets: ");
+ mpu.PrintActiveOffsets();
+
+ int16_t *offsets;
+ offsets = mpu.GetActiveOffsets();
+
+ // A_OFFSET_H_READ_A_OFFS(Data);
+ Serial.print((float)offsets[0], 5); Serial.print(",\t");
+ Serial.print((float)offsets[1], 5); Serial.print(",\t");
+ Serial.print((float)offsets[2], 5); Serial.print(",\t");
+
+ // XG_OFFSET_H_READ_OFFS_USR(Data);
+ Serial.print((float)offsets[3], 5); Serial.print(",\t");
+ Serial.print((float)offsets[4], 5); Serial.print(",\t");
+ Serial.print((float)offsets[5], 5); Serial.print("\n\n");
+
+// }
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) // && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+ Serial.println("Storing gyro and accel offsets in EEPROM\n");
+
+ eeprom_word_write(0, 0xA08);
+ /* eeprom_word_write(1, (int)(mpu6050.getGyroXoffset() * 100.0) + 0.5);
+ eeprom_word_write(2, (int)(mpu6050.getGyroYoffset() * 100.0) + 0.5);
+ eeprom_word_write(3, (int)(mpu6050.getGyroZoffset() * 100.0) + 0.5);
+ */
+ /*
+ Serial.println(eeprom_word_read(0), HEX);
+ Serial.println(((float)eeprom_word_read(1)) / 100.0, DEC);
+ Serial.println(((float)eeprom_word_read(2)) / 100.0, DEC);
+ Serial.println(((float)eeprom_word_read(3)) / 100.0, DEC);
+*/
+ eeprom_word_write(1, offsets[0]);
+ eeprom_word_write(2, offsets[1]);
+ eeprom_word_write(3, offsets[2]);
+ eeprom_word_write(4, offsets[3]);
+ eeprom_word_write(5, offsets[4]);
+ eeprom_word_write(6, offsets[5]);
+
+ Serial.println("\nStoring temperature calibration data in EEPROM\n");
+
+ eeprom_word_write(7, (int)(T1 * 10.0) + 0.5);
+ eeprom_word_write(8, (int) R1);
+ eeprom_word_write(9, (int)(T2 * 10.0) + 0.5);
+ eeprom_word_write(10, (int) R2);
+
+ T1 = ((float)eeprom_word_read(7)) / 10.0;
+ R1 = ((float)eeprom_word_read(8));
+ T2 = ((float)eeprom_word_read(9)) / 10.0;
+ R2 = ((float)eeprom_word_read(10));
+
+ Serial.println(T1, DEC);
+ Serial.println(R1, DEC);
+ Serial.println(" ");
+ Serial.println(T2, DEC);
+ Serial.println(R2, DEC);
+ Serial.println(" ");
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+ if (EEPROM.commit()) {
+ Serial.println("EEPROM successfully committed\n");
+ } else {
+ Serial.println("ERROR! EEPROM commit failed\n");
+ }
+#endif
+#endif
+ }
+ }
+
+ /* Supply your gyro offsets here, scaled for min sensitivity */
+/* mpu.setXGyroOffset(57);
+ mpu.setYGyroOffset(99);
+ mpu.setZGyroOffset(19);
+ mpu.setXAccelOffset(-4922);
+ mpu.setYAccelOffset(-2136);
+ mpu.setZAccelOffset(3104);
+
+ mpu.setXGyroOffset(0);
+ mpu.setYGyroOffset(0);
+ mpu.setZGyroOffset(0);
+ mpu.setXAccelOffset(0);
+ mpu.setYAccelOffset(0);
+ mpu.setZAccelOffset(0);
+*/
+ if (devStatus == 0)
+ {
+/* if (first_read == true) {
+ mpu.CalibrateAccel(6); // Calibration Time: generate offsets and calibrate our MPU6050
+ mpu.CalibrateGyro(6);
+ Serial.println("These are the Active offsets: ");
+ mpu.PrintActiveOffsets();
+ }
+ */
+ Serial.println(F("Enabling DMP...")); // Turning ON DMP
+ mpu.setDMPEnabled(true);
+
+ Serial.print(F("Enabling interrupt detection (Arduino external interrupt "));
+ Serial.print(digitalPinToInterrupt(INTERRUPT_PIN));
+ Serial.println(F(")..."));
+ attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), DMPDataReady, RISING);
+ MPUIntStatus = mpu.getIntStatus();
+
+ /* Set the DMP Ready flag so the main loop() function knows it is okay to use it */
+ Serial.println(F("DMP ready! Waiting for first interrupt..."));
+ DMPReady = true;
+ packetSize = mpu.dmpGetFIFOPacketSize();
+ // Serial.print(packetSize);
+ }
+ else
+ {
+ Serial.print(F("DMP Initialization failed (code ")); // Print the error code
+ Serial.print(devStatus);
+ Serial.println(F(")"));
+ // 1 = initial memory load failed
+ // 2 = DMP configuration updates failed
+ }
+
+
+ payload_setup(); // sensor extension setup function defined in payload_extension.cpp
+
+ reset_count = 100;
+}
+
+void loop() {
+
+ blink(50);
+
+ if (Serial1.available() > 0) {
+ Serial.print("Received serial data!!!\n");
+ delay(10);
+ while (Serial1.available() > 0) {
+ char result = Serial1.read();
+ Serial.print(result);
+ }
+ Serial.println(" ");
+ }
+ {
+// if (result == '?')
+ {
+ if (bmePresent) {
+ Serial1.print(sensor_start_flag);
+ Serial1.print("OK BME280 ");
+ Serial1.print(bme.readTemperature());
+ Serial1.print(" ");
+ Serial1.print(bme.readPressure() / 100.0F);
+ Serial1.print(" ");
+ Serial1.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
+ Serial1.print(" ");
+ Serial1.print(bme.readHumidity());
+
+ Serial.print("OK BME280 ");
+ temp = bme.readTemperature();
+ Serial.print(temp);
+ Serial.print(" ");
+ Serial.print(bme.readPressure() / 100.0F);
+ Serial.print(" ");
+ Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
+ Serial.print(" ");
+ Serial.print(bme.readHumidity());
+ } else
+ {
+ Serial1.print(sensor_start_flag);
+ Serial1.print("OK BME280 0.0 0.0 0.0 0.0");
+
+ Serial.print("OK BME280 0.0 0.0 0.0 0.0");
+ }
+
+ /*
+ mpu6050.update();
+
+ Serial1.print(" MPU6050 ");
+ Serial1.print(mpu6050.getGyroX());
+ Serial1.print(" ");
+ Serial1.print(mpu6050.getGyroY());
+ Serial1.print(" ");
+ Serial1.print(mpu6050.getGyroZ());
+
+ Serial1.print(" ");
+ Serial1.print(mpu6050.getAccX());
+ Serial1.print(" ");
+ Serial1.print(mpu6050.getAccY());
+ Serial1.print(" ");
+ Serial1.print(mpu6050.getAccZ());
+
+ Serial.print(" MPU6050 ");
+ Serial.print(mpu6050.getGyroX());
+ Serial.print(" ");
+ Serial.print(mpu6050.getGyroY());
+ Serial.print(" ");
+ Serial.print(mpu6050.getGyroZ());
+
+ Serial.print(" ");
+ Serial.print(mpu6050.getAccX());
+ Serial.print(" ");
+ Serial.print(mpu6050.getAccY());
+ Serial.print(" ");
+ Serial.print(mpu6050.getAccZ());
+*/
+
+// if (MPUInterrupt) {
+// if (true) {
+
+ if (mpu.dmpGetCurrentFIFOPacket(FIFOBuffer))
+ {
+ /* Display Euler angles in degrees */
+ mpu.dmpGetQuaternion(&q, FIFOBuffer);
+ mpu.dmpGetGravity(&gravity, &q);
+ mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
+
+ mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
+
+ accelx = ax / 16384.0;
+ accely = ay / 16384.0;
+ accelz = (az - 16384) / 16384.0;
+ acceleration = sqrt(accelx*accelx + accely*accely + accelz*accelz);
+
+ gyrox = gx / 6.75;
+ gyroy = gy / 6.75;
+ gyroz = gz / 6.75;
+ rotation = sqrt(gyrox*gyrox + gyroy*gyroy + gyroz*gyroz);
+
+ yaw = ypr[0] * 180 / M_PI;
+ if (yaw < 0) yaw += 360;
+ pitch = ypr[1] * 180 / M_PI;
+ if (pitch < 0) pitch += 360;
+ roll = ypr[2] * 180 / M_PI;
+ if (roll < 0) roll += 360;
+
+ // Serial.print("_"); Serial.print(yaw); Serial.print("_");
+ // } else
+ // Serial.print("*");
+
+ MPUInterrupt = false;
+ } else
+ // Serial.print("/");
+
+ Serial1.print(" "); // Don't know why this is needed
+ Serial1.print(" MPU6050 ");
+ Serial1.print(gyrox); Serial1.print(" ");
+ Serial1.print(gyroy); Serial1.print(" ");
+ Serial1.print(gyroz); Serial1.print(" ");
+ Serial1.print(accelx); Serial1.print(" ");
+ Serial1.print(accely); Serial1.print(" ");
+ Serial1.print(accelz);
+
+ Serial.print(" MPU6050 ");
+ Serial.print(gyrox); Serial.print(" ");
+ Serial.print(gyroy); Serial.print(" ");
+ Serial.print(gyroz); Serial.print(" ");
+ Serial.print(accelx); Serial.print(" ");
+ Serial.print(accely); Serial.print(" ");
+ Serial.print(accelz);
+
+/*
+ } else {
+ Serial1.print("OK MPU6050 0.0 0.0 0.0 0.0 0.0 0.0");
+ Serial.print("OK MPU6050 0.0 0.0 0.0 0.0 0.0 0.0");
+ }
+*/
+ sensorValue = read_analog();
+
+// Serial.println(sensorValue);
+ Temp = T1 + (sensorValue - R1) *((T2 - T1)/(R2 - R1));
+
+// Serial1.print(" GPS 0 0 0 TMP ");
+
+ Serial1.print(" GPS ");
+ Serial1.print(flat,4);
+ Serial1.print(" ");
+ Serial1.print(flon,4);
+ Serial1.print(" ");
+ Serial1.print(flalt,2);
+
+ Serial1.print(" TMP ");
+ Serial1.print(Temp);
+
+// Serial1.print(" ");
+// Serial1.println(Sensor2);
+
+ Serial.print(" GPS ");
+ Serial.print(flat,4);
+ Serial.print(" ");
+ Serial.print(flon,4);
+ Serial.print(" ");
+ Serial.print(flalt,2);
+
+// Serial.print(" GPS 0 0 0 TMP ");
+ Serial.print(" TMP ");
+ Serial.print(Temp);
+// Serial.print(" ");
+// Serial.println(Sensor2);
+
+// float rotation = 0;
+// rotation = sqrt(mpu6050.getGyroX()*mpu6050.getGyroX() + mpu6050.getGyroY()*mpu6050.getGyroY() + mpu6050.getGyroZ()*mpu6050.getGyroZ());
+// float acceleration = 0;
+// acceleration = sqrt(mpu6050.getAccX()*mpu6050.getAccX() + mpu6050.getAccY()*mpu6050.getAccY() + mpu6050.getAccZ()*mpu6050.getAccZ());
+// Serial.println(" ");
+// Serial.print(rotation);
+// Serial.print(" ");
+// Serial.println(acceleration);
+
+ if (first_read == true) {
+ first_read = false;
+ rest = acceleration;
+ Serial.println(" ");
+ Serial.print("rest acceleration: ");
+ Serial.println(rest);
+ }
+
+ if (acceleration > 1.1 * rest)
+ led_set(whiteLED, HIGH);
+ else
+ led_set(whiteLED, LOW);
+
+ if (rotation > 20)
+ led_set(yellowLED, HIGH);
+ else
+ led_set(yellowLED, LOW);
+ }
+
+ Serial1.print(" YPR ");
+ Serial1.print(yaw);
+ Serial1.print(" ");
+ Serial1.print(pitch);
+ Serial1.print(" ");
+ Serial1.print(roll);
+ Serial1.print(" ");
+
+ Serial.print(" YPR ");
+ Serial.print(yaw);
+ Serial.print(" ");
+ Serial.print(pitch);
+ Serial.print(" ");
+ Serial.print(roll);
+ Serial.println(" ");
+
+ payload_loop(); // sensor extension read function defined in payload_extension.cpp
+
+// Serial1.println(" ");
+ Serial1.println(sensor_end_flag);
+ Serial.println(" ");
+
+ }
+
+ if (Serial.available() > 0) {
+ blink(50);
+ char result = Serial.read();
+// Serial.println(result);
+// Serial.println("OK");
+// Serial.println(counter++);
+//#if !defined (ARDUINO_ARCH_RP2040)
+ if (result == 'R' || result == 'r') {
+// Serial1.println("OK");
+// delay(100);
+ Serial.println("Resetting\n");
+ first_read = true;
+ setup();
+ }
+ else if (result == 'D' || result == 'd') {
+ Serial.println("\nCurrent temperature calibration data\n");
+ Serial.println(T1, DEC);
+ Serial.println(R1, DEC);
+ Serial.println(" ");
+ Serial.println(T2, DEC);
+ Serial.println(R2, DEC);
+
+ Serial.println("\nCurrent raw temperature reading\n");
+ Serial.println(sensorValue, DEC);
+ Serial.println(" ");
+ }
+ else if (result == 'C' || result == 'c') {
+ Serial.println("\nClearing stored gyro and accel offsets in EEPROM\n");
+ eeprom_word_write(0, 0x00);
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+
+ if (EEPROM.commit()) {
+ Serial.println("EEPROM successfully committed\n");
+ } else {
+ Serial.println("ERROR! EEPROM commit failed\n");
+ }
+#endif
+ first_time = true;
+ setup();
+ }
+ else if (result == 'S' || result == 's') {
+ Serial.print("\nStoring temperature calibration data point "); // in EEPROM\n");
+ Serial.print(calibration + 1);
+ Serial.print(" in EEPROM\n");
+
+ Serial.println(temp);
+ Serial.println(sensorValue);
+ Serial.println(" ");
+
+ eeprom_word_write(calibration * 2 + 7 , (int)(temp * 10.0) + 0.5);
+ eeprom_word_write(calibration * 2 + 8, sensorValue);
+
+ if (calibration == 0) {
+ T1 = temp;
+ R1 = sensorValue;
+ calibration = 1;
+ } else {
+ T2 = temp;
+ R2 = sensorValue;
+ calibration = 0;
+ }
+
+// calibration = (calibration + 1) % 2;
+// Serial.println(calibration + 1);
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+
+ if (EEPROM.commit()) {
+ Serial.println("EEPROM successfully committed\n");
+ } else {
+ Serial.println("ERROR! EEPROM commit failed\n");
+ }
+#endif
+
+ }
+//#endif
+ }
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+ Serial.print("Squelch: ");
+ Serial.println(digitalRead(15));
+
+ get_gps();
+#else
+ delay(1000); // not needed due to gps 1 second polling delay
+
+#endif
+// if (reset_count-- == 0)
+// setup();
+}
+
+void eeprom_word_write(int addr, int val)
+{
+#if !defined(ARDUINO_ARCH_MBED_RP2040) // && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+ EEPROM.write(addr * 2, lowByte(val));
+ EEPROM.write(addr * 2 + 1, highByte(val));
+#endif
+}
+
+short eeprom_word_read(int addr)
+{
+ int result = 0;
+#if !defined(ARDUINO_ARCH_MBED_RP2040) // && defined(ARDUINO_ARCH_RP2040) // if Raspberry Pi RP2040 Boards is used in Arduino IDE
+ result = ((EEPROM.read(addr * 2 + 1) << 8) | EEPROM.read(addr * 2));
+#endif
+ return result;
+}
+
+void blink_setup()
+{
+#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
+ // initialize digital pin PB1 as an output.
+ pinMode(PC13, OUTPUT);
+ pinMode(PB9, OUTPUT);
+ pinMode(PB8, OUTPUT);
+#endif
+
+#if defined __AVR_ATmega32U4__
+ pinMode(RXLED, OUTPUT); // Set RX LED as an output
+ // TX LED is set as an output behind the scenes
+ pinMode(whiteLED, OUTPUT);
+ pinMode(yellowLED,OUTPUT);
+#endif
+
+#if defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ pinMode(LED_BUILTIN, OUTPUT);
+ pinMode(18, OUTPUT); // yellow LED (was blue LED on STEM Payload Board v1.3.2)
+ pinMode(19, OUTPUT); // white LED (was green LED on STEM Payload Board v1.3.2)
+#endif
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ if (check_for_wifi()) {
+ wifi = true;
+ led_builtin_pin = LED_BUILTIN; // use default GPIO for Pico W
+ pinMode(LED_BUILTIN, OUTPUT);
+// configure_wifi();
+ } else {
+ led_builtin_pin = 25; // manually set GPIO 25 for Pico board
+// pinMode(25, OUTPUT);
+ pinMode(led_builtin_pin, OUTPUT);
+ }
+ pinMode(18, OUTPUT);
+ pinMode(19, OUTPUT);
+#endif
+}
+
+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_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ digitalWrite(LED_BUILTIN, HIGH); // set the built-in LED ON
+#endif
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ if (wifi)
+ digitalWrite(LED_BUILTIN, HIGH); // set the built-in LED ON
+ else
+ digitalWrite(led_builtin_pin, HIGH); // set the built-in LED ON
+#endif
+
+delay(length);
+
+#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_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ digitalWrite(LED_BUILTIN, LOW); // set the built-in LED OFF
+#endif
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+ if (wifi)
+ digitalWrite(LED_BUILTIN, LOW); // set the built-in LED ON
+ else
+ digitalWrite(led_builtin_pin, LOW); // set the built-in LED ON
+#endif
+}
+
+void led_set(int ledPin, bool state)
+{
+#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
+ if (ledPin == whiteLED)
+ digitalWrite(PB9, state);
+ else if (ledPin == yellowLED)
+ digitalWrite(PB8, state);
+#endif
+
+#if defined __AVR_ATmega32U4__
+ digitalWrite(ledPin, state);
+#endif
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+ if (ledPin == whiteLED)
+ digitalWrite(19, state);
+ else if (ledPin == yellowLED)
+ digitalWrite(18, state);
+#endif
+}
+
+int read_analog()
+{
+ int sensorValue;
+ #if defined __AVR_ATmega32U4__
+ sensorValue = analogRead(A3);
+#endif
+
+#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
+ sensorValue = analogRead(PA7);
+#endif
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+ sensorValue = analogRead(28);
+#endif
+ return(sensorValue);
+}
+
+#if !defined(ARDUINO_ARCH_MBED_RP2040) && defined(ARDUINO_ARCH_RP2040)
+bool check_for_wifi() {
+
+ pinMode(29, INPUT);
+ const float conversion_factor = 3.3f / (1 << 12);
+ uint16_t result = analogRead(29);
+// Serial.printf("ADC3 value: 0x%03x, voltage: %f V\n", result, result * conversion_factor);
+
+ if (result < 0x10) {
+ Serial.println("\nPico W detected!\n");
+ return(true);
+ }
+ else {
+ Serial.println("\nPico detected!\n");
+ return(false);
+ }
+}
+#endif
+
+#if defined (ARDUINO_ARCH_MBED_RP2040) || (ARDUINO_ARCH_RP2040)
+void get_gps() {
+// Serial.println("Getting GPS data");
+ bool newData = false;
+ unsigned long start = millis();
+
+// for (unsigned long start = millis(); millis() - start < 1000;) // 5000;)
+ while ((millis() - start) < 1000) // 5000;)
+ {
+ while (Serial2.available())
+ {
+ char c = Serial2.read();
+ if (show_gps)
+ Serial.write(c); // uncomment this line if you want to see the GPS data flowing
+ if (gps.encode(c)) // Did a new valid sentence come in?
+ newData = true;
+ }
+ }
+ if (newData) {
+ Serial.print("GPS read new data in ms: ");
+ Serial.println(millis() - start);
+
+// float flon = 0.0, flat = 0.0, flalt = 0.0;
+// unsigned long age;
+// starting = millis();
+// gps.f_get_position(&flat, &flon, &age);
+
+ Serial.print(F("Location: "));
+ if (gps.location.isValid())
+ {
+ Serial.print(gps.location.lat(), 6);
+ Serial.print(F(","));
+ Serial.print(gps.location.lng(), 6);
+
+ flat = gps.location.lat();
+ flon = gps.location.lng();
+ flalt = gps.altitude.meters();
+ }
+ else
+ {
+ Serial.print(F("INVALID"));
+ }
+ Serial.print("\r\n");
+
+ } else
+// Serial.printf("GPS read no new data: %d\n", millis() - start);
+ ;
+}
+#endif
diff --git a/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/payload_extension.cpp b/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/payload_extension.cpp
new file mode 100644
index 00000000..5b8dd2ec
--- /dev/null
+++ b/stempayload/Payload_BME280_MPU6050_YPR_EEPROM/payload_extension.cpp
@@ -0,0 +1,25 @@
+// Use this template for adding additional sensors
+// see Payload_BME280_MPU6050_XS_Extended for an example
+
+// put your library includes here
+#include "Arduino.h"
+
+// put your globals here
+
+// put your setup code here
+void payload_setup() {
+
+// Serial.println("Starting new sensor!");
+
+}
+
+// put your loop code here
+// Very Important: only use print, not println!!
+void payload_loop() {
+
+/*
+ Serial1.print(" NEW 0.0"); // send sensor data over serial to Pi Zero
+ Serial.print(" NEW 0.0"); // send sensor data over serial monitor for testing
+*/
+
+}
diff --git a/stempayload/README.md b/stempayload/README.md
index a7116d5e..7d234259 100644
--- a/stempayload/README.md
+++ b/stempayload/README.md
@@ -20,7 +20,9 @@ bme280test Displays the results of reading the BME280 sensor: Temperature, Press
GetAllData Displays the results of reading the MPU6050 sensor: Temperature, X, Y, and Z Axes: Acceleration, Gyor (Rotation Rate), and Angle. Requires the following libraries: MPU6050_tockn.
-Payload_BME280_MPU6050_XS This code answers the query from the Raspberry Pi CubeSatSim software over the UART so that the STEM Payload is marked "OK" in the FoxTelem CubeSatSim-FSK or CubeSatSim-BPSK Health tab and also replies with BME280 and MPU6050 sensor data. In FoxTelem, this is displayed as the X, Y, and Z Gyro (dps) and in AFSK mode, it is appended to the telemetry string.
+Payload_BME280_MPU6050_XS This code answers the query from the Raspberry Pi CubeSatSim software over the UART so that the STEM Payload is marked "OK" in the FoxTelem CubeSatSim-FSK or CubeSatSim-BPSK Health tab and also replies with BME280 and MPU6050 sensor data. In FoxTelem, this is displayed as the X, Y, and Z Gyro (dps) and in AFSK mode, it is appended to the telemetry string. This code also supports a serial GPS module.
+
+ayload_BME280_MPU6050_YPR_EEPROM This code adds to the Payload_BME280_MPU6050_XS code Yaw Pitch and Roll (YPR) determination.
For information about programming the Sparkfun Pro Micro or STM32, see the v1.2 wiki instructions: https://github.com/alanbjohnston/CubeSatSim/wiki/v1.2-8.-STEM-Payload-Board
diff --git a/systemd/OliveTin.service b/systemd/OliveTin.service
new file mode 100644
index 00000000..f2a6777f
--- /dev/null
+++ b/systemd/OliveTin.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=OliveTin
+
+Requires=network-online.target
+After=network-online.target
+Requires=local-fs.target
+After=local-fs.target
+
+[Service]
+ExecStart=/usr/local/bin/OliveTin
+Restart=always
+Environment="PORT=80"
+# User=pi
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/command.service b/systemd/command.service
index 9354154f..eb4a5a56 100644
--- a/systemd/command.service
+++ b/systemd/command.service
@@ -8,7 +8,9 @@ WorkingDirectory=/home/pi/CubeSatSim
StandardOutput=inherit
StandardError=inherit
Restart=always
-User=root
+User=pi
+CPUQuota=50%
+CPUWeight=50
[Install]
WantedBy=default.target
diff --git a/systemd/frequency.service b/systemd/frequency.service
new file mode 100644
index 00000000..b4a690a5
--- /dev/null
+++ b/systemd/frequency.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=frequency
+
+[Service]
+TimeoutStopSec=5
+ExecStart=python3 -u /home/pi/CubeSatSim/frequency.py
+WorkingDirectory=/home/pi/CubeSatSim
+StandardOutput=inherit
+StandardError=inherit
+Restart=always
+User=pi
+CPUQuota=15%
+CPUWeight=70
+CPUAccounting=true
+
+[Install]
+WantedBy=default.target
diff --git a/systemd/pacsatsim.service b/systemd/pacsatsim.service
new file mode 100644
index 00000000..d5163bd6
--- /dev/null
+++ b/systemd/pacsatsim.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=PacsatSim
+
+[Service]
+TimeoutStopSec=5
+ExecStart=/home/pi/CubeSatSim/pacsatsim.sh
+WorkingDirectory=/home/pi/CubeSatSim
+StandardOutput=inherit
+StandardError=inherit
+Restart=always
+User=pi
+
+[Install]
+WantedBy=default.target
diff --git a/systemd/pushbutton.service b/systemd/pushbutton.service
new file mode 100644
index 00000000..da0fbdef
--- /dev/null
+++ b/systemd/pushbutton.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=pushbutton
+
+[Service]
+TimeoutStopSec=5
+ExecStart=python3 -u /home/pi/CubeSatSim/pushbutton.py
+WorkingDirectory=/home/pi/CubeSatSim
+StandardOutput=inherit
+StandardError=inherit
+Restart=always
+User=root
+
+[Install]
+WantedBy=default.target
diff --git a/systemd/transmit.service b/systemd/transmit.service
index ab6dd815..0b77ff50 100644
--- a/systemd/transmit.service
+++ b/systemd/transmit.service
@@ -8,7 +8,7 @@ WorkingDirectory=/home/pi/CubeSatSim
StandardOutput=inherit
StandardError=inherit
Restart=always
-User=root
+User=pi
[Install]
WantedBy=default.target
diff --git a/telem.c b/telem.c
index ce4f14c3..46f81d63 100644
--- a/telem.c
+++ b/telem.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
}
}
- printf("CubeSatSim v2.2 INA219 Voltage and Current Telemetry\n");
+ printf("CubeSatSim v2.3 INA219 Voltage and Current Telemetry\n");
map[MINUS_X] = MINUS_Y;
map[PLUS_Z] = MINUS_X;
map[MINUS_Y] = PLUS_Z;
@@ -30,6 +30,9 @@ int main(int argc, char *argv[]) {
strcat(pythonConfigStr, " s");
char cmdbuffer[1000];
+
+// FILE *file2 = sopen(pythonVenv); // activate venv
+
FILE *file1 = sopen(pythonConfigStr); // try new function
fgets(cmdbuffer, 1000, file1);
if (debug == ON)
diff --git a/transmit.py b/transmit.py
index 4375bff2..9a20b8a5 100644
--- a/transmit.py
+++ b/transmit.py
@@ -1,7 +1,5 @@
#!/usr/bin/env python
-import RPi.GPIO as GPIO
-from RPi.GPIO import output
#import subprocess
import time
from time import sleep
@@ -14,6 +12,60 @@ import serial
import random
import subprocess
+def output(pin, value):
+ command = "gpio -g write " + str(pin) + " " + str(value)
+ system(command)
+### print(command)
+
+def uptime_seconds():
+ try:
+ system("sudo 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)
+ file.close()
+ return uptime
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print(" failed")
+
+def input(pin):
+ # command = "gpio -g read " + str(pin)
+ query = ["gpio", "-g", "read", str(pin)] # Read GPIO pin
+ command = "gpio -g read " + str(pin)
+ try:
+ result = subprocess.run(query, capture_output=True, text=True, check=True)
+# print(f"Command run was: {query}")
+# print("Sucess!")
+# print(f"Output of the command (stdout): {result.stdout}")
+# print(f"{command}: {result.stdout}")
+ return int(result.stdout)
+ except subprocess.CalledProcessError as e:
+# print(f"Command failed with return code: {e.returncode}")
+# print(f"Command run was: {e.cmd}")
+# print(f"Output of the command (stdout): {e.stdout}")
+# print(f"Error output of the command (stderr): {e.stderr}")
+ print(f"{command}: -1")
+ return -1
+
+def setup(pin, config):
+ if config == "in" or config == "out" or config == "up" or config == "down":
+ command = "gpio -g mode " + str(pin) + " " + config
+ system(command)
+### print(command)
+ else:
+ print(f"Unknown gpio setup configuration: {config}")
+
+def blink(times):
+ powerPin = 16
+ for i in range(times):
+ system("gpio -g write " + str(powerPin) + " 0") # blink two times
+ sleep(0.1)
+ system("gpio -g write " + str(powerPin) + " 1")
+ sleep(0.1)
+
def sim_failure_check():
try:
global card
@@ -43,7 +95,8 @@ def sim_failure_check():
print("Other failure mode")
card = "Headphones"
sim_mode = True
- except:
+ except Exception as e:
+ print(f"An error occurred: {e}")
print("No failure mode")
card = "Headphones"
if sim_config:
@@ -64,9 +117,9 @@ def battery_saver_check():
def blink(times):
powerPin = 16
for i in range(times):
- GPIO.output(powerPin, 0) # blink two times
+ output(powerPin, 0) # blink
sleep(0.1)
- GPIO.output(powerPin, 1)
+ output(powerPin, 1)
sleep(0.1)
def increment_mode():
@@ -75,10 +128,10 @@ def increment_mode():
try:
file = open("/home/pi/CubeSatSim/.mode")
mode = file.read(1)
- except:
+ except Exception as e:
+ print(f"An error occurred: {e}")
# mode = "f"
- if (debug_mode == 1):
- print("Can't open .mode file") # , defaulting to FSK")
+ print("Can't open .mode file") # , defaulting to FSK")
file.close()
print("Mode is: ")
print(mode)
@@ -86,21 +139,30 @@ def increment_mode():
mode = 'f'
blink(2)
sleep(2.5)
-
elif (mode == 'f'):
mode = 'b'
blink(3)
- sleep(2.5)
-
+ sleep(2.5)
elif (mode == 'b'):
mode = 's'
blink(4)
sleep(2.5)
-
elif (mode == 's'):
mode = 'm'
blink(5)
sleep(2.5)
+ elif (mode == 'm'):
+ mode = 'e'
+ blink(6)
+ sleep(2.5)
+ elif (mode == 'e'):
+ mode = 'j'
+ blink(7)
+ sleep(2.5)
+ elif (mode == 'j'):
+ mode = 'p'
+ blink(8)
+ sleep(2.5)
else:
mode = 'a'
blink(1)
@@ -113,13 +175,11 @@ def increment_mode():
file.close()
print(".mode file written")
- GPIO.setwarnings(False)
- GPIO.output(txLed, 0)
- GPIO.output(powerPin, 0)
+ output(txLed, 0)
+ output(powerPin, 0)
print("sudo reboot -h now")
- GPIO.setwarnings(False)
- GPIO.setup(powerPin, GPIO.OUT)
- GPIO.output(powerPin, 0);
+ setup(powerPin, "out")
+ output(powerPin, 0);
# system("reboot -h now")
# release = True;
@@ -128,16 +188,21 @@ def increment_mode():
system("reboot -h now")
sleep(10);
- except:
+ except Exception as e:
+ print(f"An error occurred: {e}")
print("can't write to .mode file")
def camera_photo():
global cam_fail
+ global os_status
sim_failure_check()
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg")
stored_image = False
try:
- system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
+ if os_status == "bookworm":
+ system("rpicam-still -n -o /home/pi/CubeSatSim/camera_out.jpg --width 320 --height 256") # > /dev/null 2>&1")
+ else:
+ system("raspistill -n -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256")
f = open("/home/pi/CubeSatSim/camera_out.jpg")
f.close()
print("Photo taken")
@@ -145,7 +210,8 @@ def camera_photo():
system("cp /home/pi/CubeSatSim/sstv//sstv_image_2_320_x_256.jpeg /home/pi/CubeSatSim/camera_out.jpg")
print("Using stored image")
stored_image = True
- except:
+ except Exception as e:
+ print(f"An error occurred: {e}")
system("cp /home/pi/CubeSatSim/sstv//sstv_image_2_320_x_256.jpeg /home/pi/CubeSatSim/camera_out.jpg")
print("Using stored image")
stored_image = True
@@ -157,7 +223,8 @@ def camera_photo():
try:
filep = open("/home/pi/CubeSatSim/telem_string.txt")
telem_string = filep.readline()
- except:
+ except Exception as e:
+ print(f"An error occurred: {e}")
telem_string = ""
if (debug_mode == 1):
print("Can't read telem_string.txt")
@@ -166,14 +233,403 @@ def camera_photo():
img = Image.open(file)
draw = ImageDraw.Draw(img)
# draw.text((10, 10), callsign, font=font2, fill='white')
- # draw.text((120, 10), telem_string, font=font2, fill='white')
+ # draw.text((120, 10), telem_string, font=font2, fill='white')
draw.text((12, 12), callsign, font=font1, fill='black')
draw.text((10, 10), callsign, font=font1, fill='white')
draw.text((112, 12), telem_string, font=font2, fill='black') # was 122
draw.text((110, 10), telem_string, font=font2, fill='white') # was 120
img.save(file)
-print("CubeSatSim v2.2 transmit.py starting...")
+ return True
+ else:
+ return False
+
+def program_fm(rx, tx, rxpl_value, sq, txpl_value):
+
+ try:
+ global gpsd_status
+ global pd
+ global ptt
+ global two_meter_rpitx
+ global txc
+ global restore_txc
+
+ if (gpsd_status == "active"):
+ print("Stopping gpsd.socket")
+ system("sudo systemctl stop gpsd.socket")
+ print("Programming FM module!\n");
+ txf = float(tx)
+ rxf = float(rx)
+
+ if (txf > 144.0) and (txf < 148.0):
+ two_meter_rpitx = True
+ print("Transmitting in 2m band using rptix")
+# if (txc):
+# restore_txc = True
+# print("Restore FM with 70cm band")
+ txc = False
+ tx = "434.9000"
+# elif (two_meter_rpitx):
+# two_meter_rpitx = False
+# print("Stop transmitting in 2m bacnd using rptix")
+# if (restore_txc):
+# txc = True
+# restore_txc = False
+# print("Restoring FM with 70cm band")
+# print("Rebooting")
+# system("sudo reboot now")
+
+ if (txf > 450.0) or ((txf < 420.0) and (txf > 148.0)) or (txf < 144.0) :
+ tx = "434.9000"
+ print("Transmit frequency out of amateur bands")
+
+ if (rxf > 450.0) or (rxf < 420.0):
+ rx = "435.0000"
+ print("Receive frequency out of FM bounds")
+ output(pd, 1)
+ output (ptt, 1)
+ 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 + "," + 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()
+ ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("Error in serial write")
+ # output(pd, 0) # Don't turn off receiver
+ if (gpsd_status == "active"):
+ print("Restarting gpsd.socket")
+ system("sudo systemctl restart gpsd.socket")
+ sleep(2)
+ system("sudo systemctl restart gpsd.socket")
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("program_fm failed")
+
+def start_repeater(tx_freq_hz, rx_freq_hz):
+ global txLed
+ try:
+ print("Starting repeater")
+
+ if abs(rx_freq_hz - 3 * tx_freq_hz) < 10000:
+ tx_freq_hz = tx_freq_hz + 30000
+ print("Adjusting Repeater TX frequency to avoid 3rd harmonic RX")
+
+ output(txLed, 1)
+ txr = "{:.3f}".format(tx_freq_hz/1e3)
+ print(txr)
+ system("sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + txr + " > /dev/null 2>&1 &")
+ sleep(0.5)
+ system("sudo arecord -D shared_mic -r48000 -fS16_LE -c1 | nc localhost 8011 &")
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("start_repeater failed")
+
+def stop_repeater():
+ global txLed
+ try:
+ # print("No carrier detected, stopping repeater")
+ output(txLed, 0)
+ system("sudo rpitx -i null > /dev/null 2>&1")
+ system("sudo killall -9 arecord > /dev/null 2>&1")
+ system("sudo killall -9 nc > /dev/null 2>&1")
+ # system("sudo killall -9 rpitx > /dev/null 2>&1")
+ print("Resetting audio")
+ system("sudo /etc/init.d/alsa-utils stop")
+ system("sudo /etc/init.d/alsa-utils start")
+ print("Finished resetting audio")
+ # print("Ready to detect carrier")
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("stop_repeater failed")
+
+def update_doppler(fm="yes"):
+
+ try:
+ global start_time
+ global tx_doppler_freq_hz
+ global rx_doppler_freq_hz
+ global new_tx_frequency
+ global new_rx_frequency
+ global rxpl_value
+ global txpl_value
+ global sq
+ global mode
+ global tx
+ global rxf
+ global txr
+ global rigctl
+## print("update_doppler")
+ try:
+ with open("/home/pi/CubeSatSim/freq.txt", "r") as file:
+ frequencies = file.read().split()
+ except Exception as e:
+ print(f"An error 1 occurred: {e}")
+ print("reading file freq.txt failed")
+ try:
+ tx_frequency = int(frequencies[0])
+ rx_frequency = int(frequencies[1])
+ except Exception as e:
+ print(f"An error 2 occurred: {e}")
+ print("reading freq.txt failed")
+ sleep(0.1)
+ try:
+ with open("/home/pi/CubeSatSim/freq.txt", "r") as file:
+ frequencies = file.read().split()
+ except Exception as e:
+ print(f"An error 3 occurred: {e}")
+ print("reading file freq.txt failed")
+ try:
+ tx_frequency = int(frequencies[0])
+ rx_frequency = int(frequencies[1])
+ print("Success reading freq.txt again")
+ except Exception as e:
+ print(f"An error 4 occurred: {e}")
+ print("reading freq.txt failed")
+ return
+# if (len(frequencies) > 0):
+# tx_frequency = int(frequencies[0])
+# else:
+# print("error 1 in reading freq.txt")
+# print(frequencies)
+# tx_frequency = 434900000
+# if (len(frequencies) > 1):
+# rx_frequency = int(frequencies[1]) # Not used right now as FT857 emulation only updates transmit frequency
+# else:
+# print("error 2 in reading freq.txt")
+# print(frequencies)
+# rx_frequency = 435000000
+## print(f"New TX Frequency: {tx_frequency}, new RX Frequency: {rx_frequency}")
+
+ if rigctl:
+ if (tx_frequency > 145955000) and (tx_frequency <= 145965000):
+ tx_center = 145960000 # AO-91
+ rx_center = 435250000
+ print("AO-91 detected!")
+ elif (tx_frequency > 145965000) and (tx_frequency < 145975000):
+ tx_center = 145970000 # AO-73 is shifted up 10kHz to avoid overlap with AO-91
+ rx_center = 435140000
+ print("AO-73 detected!")
+ elif (tx_frequency > 145795000) and (tx_frequency < 145805000):
+ tx_center = 145800000 # ISS U/V Repeater
+ rx_center = 437800000
+ print("ISS U/V detected!")
+ elif (tx_frequency > 145945000) and (tx_frequency <= 145955000):
+ tx_center = 145950000 # AO-7
+ rx_center = 432150000
+ print("AO-7 detected!")
+ else:
+ tx_center = tx_frequency
+ rx_center = rxf * 1e6 # default RX requency
+ print(f"No Satellite detected. TX frequency: {tx_frequency:.0f} Using default RX frequency with no doppler shift")
+
+ if (rx_center != rxf * 1e6): # don't Doppler shift default RX frequency since don't know the shift
+ tx_doppler_shift = tx_frequency - tx_center
+ rx_doppler_shift = -1 * (rx_center/tx_center) * tx_doppler_shift
+ new_tx_frequency = tx_frequency
+ new_rx_frequency = rx_center + rx_doppler_shift
+ print("Calculating RX frequency using offset from TX frequency!")
+## print(f"Tx Doppler Shift: {tx_doppler_shift:.0f} Frequency: {new_tx_frequency:.0f}")
+## print(f"Rx Doppler Shift: {rx_doppler_shift:.0f} Frequency: {new_rx_frequency:.0f}")
+ else:
+ print("Don't doppler shift RX frequency")
+ new_tx_frequency = tx_frequency
+ new_rx_frequency = rxf * 1e6 # default RX frequency or should we use same as tx frequency with doppler shift?
+## print(f"Tx Frequency: {new_tx_frequency:.0f}")
+## print(f"Rx Frequency: {new_rx_frequency:.0f}")
+ else:
+ new_tx_frequency = tx_frequency
+ new_rx_frequency = rx_frequency
+
+# check_frequency()
+ new_tx_frequency = check_frequency(new_tx_frequency)
+ new_rx_frequency = check_frequency(new_rx_frequency)
+
+ print(f"writing actual tx and rx frequency to frequency.txt Tx Frequency: {new_tx_frequency:.0f} Rx Frequency: {new_rx_frequency:.0f}")
+ with open("/home/pi/CubeSatSim/frequency.txt", "w") as file:
+ file.write(f"{new_tx_frequency:.0f} {new_rx_frequency:.0f}")
+
+ if (tx_doppler_freq_hz != new_tx_frequency) or (rx_doppler_freq_hz != new_rx_frequency):
+ tx_doppler_freq_hz = new_tx_frequency
+ rx_doppler_freq_hz = new_rx_frequency
+ print(f"Applying Doppler shift! Tx Frequency: {new_tx_frequency:.0f} Rx Frequency: {new_rx_frequency:.0f}")
+# print(f"Tx Doppler shift: {tx_doppler_freq_hz:.0f}")
+# rx_doppler_freq_hz = rx_doppler_start_hz + rx_doppler_shift_hz
+# print(f"Tx Doppler shift: {tx_doppler_freq_hz:.0f}")
+ rx = "{:.4f}".format(rx_doppler_freq_hz/1e6)
+ if (mode != 'e'):
+ tx = "{:.4f}".format(tx_doppler_freq_hz/1e6)
+# print(tx)
+ else:
+ txr = "{:.3f}".format(tx_doppler_freq_hz/1e6)
+ if (fm != "no"):
+ program_fm(rx,tx,rxpl_value,sq,txpl_value)
+## else:
+## print("Not applying Doppler shift!")
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("update_doppler failed")
+
+def check_frequency(frequency):
+
+ if frequency > 450000000:
+ frequency = 435200000
+ print("Frequency out of band!")
+ elif (frequency < 420000000) and (frequency > 148000000):
+ frequency = 434700000
+ print("Frequency out of band!")
+ elif (frequency < 144000000):
+ frequency = 434600000
+ print("Frequency out of band!")
+
+ return(frequency)
+
+morse_table = [ # 0-9, A-Z only by (ASCII - 48)
+ [ 3, 3, 3, 3, 3, 0 ], # 0
+ [ 1, 3, 3, 3, 3, 0 ], # 1
+ [ 1, 1, 3, 3, 3, 0 ], # 2
+ [ 1, 1, 1, 3, 3, 0 ], # 3
+ [ 1, 1, 1, 1, 3, 0 ], # 4
+ [ 1, 1, 1, 1, 1, 0 ], # 5
+ [ 3, 1, 1, 1, 1, 0 ], # 6
+ [ 3, 3, 1, 1, 1, 0 ], # 7
+ [ 3, 3, 3, 1, 1, 0 ], # 8
+ [ 3, 3, 3, 3, 1, 0 ], # 9
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 0, 0, 0, 0, 0, 0 ], # -
+ [ 1, 3, 0, 0, 0, 0 ], # A
+ [ 3, 1, 1, 1, 0, 0 ], # B
+ [ 3, 1, 3, 1, 0, 0 ], # C
+ [ 3, 1, 1, 0, 0, 0 ], # D
+ [ 1, 0, 0, 0, 0, 0 ], # E
+ [ 1, 1, 3, 1, 0, 0 ], # F
+ [ 3, 3, 1, 0, 0, 0 ], # G
+ [ 1, 1, 1, 1, 0, 0 ], # H
+ [ 1, 1, 0, 0, 0, 0 ], # I
+ [ 1, 3, 3, 3, 0, 0 ], # J
+ [ 3, 1, 3, 0, 0, 0 ], # K
+ [ 1, 3, 1, 1, 0, 0 ], # L
+ [ 3, 3, 0, 0, 0, 0 ], # M
+ [ 3, 1, 0, 0, 0, 0 ], # N
+ [ 3, 3, 3, 0, 0, 0 ], # O
+ [ 1, 3, 3, 1, 0, 0 ], # P
+ [ 3, 3, 1, 3, 0, 0 ], # Q
+ [ 1, 3, 1, 0, 0, 0 ], # R
+ [ 1, 1, 1, 0, 0, 0 ], # S
+ [ 3, 0, 0, 0, 0, 0 ], # T
+ [ 1, 1, 3, 0, 0, 0 ], # U
+ [ 1, 1, 1, 3, 0, 0 ], # V
+ [ 1, 3, 3, 0, 0, 0 ], # W
+ [ 3, 1, 1, 3, 0, 0 ], # X
+ [ 3, 1, 3, 3, 0, 0 ], # Y
+ [ 3, 3, 1, 1, 0, 0 ] # Z
+]
+
+def cw_transmit_fm(morse, tx):
+ global txLed
+# global no_command
+ global debug_mode
+# global sim_mode
+# global callsign
+# global tx
+# global txr
+
+ try:
+ output(txLed, 1)
+ print("Transmit FM CW " + morse)
+# status = ""
+# if not no_command:
+# status = status + " C"
+# if sim_mode:
+# status = status + " S"
+# if (mode != 'e'):
+ if (debug_mode == 1):
+ system("echo 'hi hi de " + morse + "' > 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 " + morse + "' > 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 " + morse + "' > 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 " + txr + "e3")
+# else:
+# system("echo 'hi hi de " + morse + "' > 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 " + txr + "e3 > /dev/null 2>&1")
+
+ output(txLed, 0)
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("cw_transmit_fm failed")
+
+def cw_transmit_string(string):
+ global morse_timing
+ try:
+ for character in string:
+ if (character != ' '):
+ update_doppler()
+ cw_transmit_char(character);
+ else:
+ sleep(7.0 * morse_timing);
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("cw_transmit_string failed")
+
+def cw_transmit_char(character):
+ global morse_timing
+ try:
+ # update_doppler("no")
+ i = 0
+ duration = morse_table[(ord(character.upper()) - ord('0')) % 44][i]
+ if duration == 1:
+ duration = 1.2
+ # print(duration)
+ while (duration != 0):
+ transmit_carrier(duration * morse_timing)
+ sleep(morse_timing * 0.4) # 6)
+ i=i+1
+ duration = morse_table[(ord(character.upper()) - ord('0')) % 44][i]
+ if duration == 1:
+ duration = 1.2
+ sleep(morse_timing * 2.0) # 3) # 1.5);
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("cw_transmit_char failed")
+
+def transmit_carrier(duration):
+ global tx_doppler_freq_hz
+ global txLed
+ try:
+ update_doppler("no")
+ command = "timeout -k 0.5 " + str(duration) + " sudo tune -f " + str(tx_doppler_freq_hz) + " > /dev/null 2>&1" # 434.9e6
+ start = "sudo tune -f " + str(tx_doppler_freq_hz) + " &" # + " & > /dev/null 2>&1" # 434.9e6
+ stop = "sudo rpitx -f 434.9e6 &"
+ # killrpitx = "sudo killall -9 rpitx &"
+ killtune = "sudo killall -9 tune &"
+ output(txLed, 1)
+ # system(start)
+ system(command)
+ system("gpio -g mode 20 out && gpio -g write 20 1")
+ # sleep(duration)
+ # system(stop)
+ output(txLed, 0)
+ # system(killrpitx)
+ # system(killtune)
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("transmit_carrier failed")
+
+print("CubeSatSim v2.3 transmit.py starting...")
+
+system("sudo systemctl restart frequency")
pd = 21
ptt = 20
@@ -181,65 +637,62 @@ txc_pin = 7
squelch = 6
green = 16
powerPin = 16
+morse_timing = 0.09 # 0.1
+two_meter_rpitx = False
+restore_txc = False
command_tx = True
-GPIO.setmode(GPIO.BCM)
-GPIO.setwarnings(False)
-GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP)
-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)
+setup(13, "up")
+setup(12, "up")
+setup(27, "up")
+setup(txc_pin, "up")
+setup(green, "out")
+output(powerPin, 1)
transmit = False
txLed = 27
-txLedOn = 1
-txLedOff = 0
-if GPIO.input(12) == False:
+if input(12) == False:
print("LPF present")
transmit = True
else:
print("No LPF")
+setup(txLed, "out")
-# GPIO.setup(txLed, GPIO.OUT)
-# output(txLed, txLedOff)
-
-GPIO.setmode(GPIO.BCM) # Repeat to make LED work on Pi 4
-GPIO.setwarnings(False)
-GPIO.setup(txLed, GPIO.OUT)
-
-GPIO.setup(pd, GPIO.OUT)
+setup(pd, "out")
#output(pd, 1)
output(pd, 0)
-GPIO.setup(ptt, GPIO.OUT)
-output (ptt, 1)
+setup(ptt, "out")
+output(ptt, 1)
txc = False
-if GPIO.input(txc_pin) == False:
+if input(txc_pin) == False:
print("TXC is present")
- txc = True;
+ txc = True
else:
print("TXC not present")
-# txc = False # forcing it off
-output(txLed, txLedOn)
+# False # forcing it off
+output(txLed, 1)
sleep(1)
-output(txLed, txLedOff)
+output(txLed, 0)
battery_saver_check()
-# print(txLedOn)
+# print(1)
print(txLed)
-# GPIO.setup(27, GPIO.OUT)
-# GPIO.output(27, 0)
debug_mode = 0 # change to 1 to debug transmit
skip = False
+tx_doppler_freq_hz = 0
+rx_doppler_freq_hz = 0
+
+new_tx_frequency = 0
+new_rx_frequency = 0
+
if __name__ == "__main__":
mode = "y"
if (len(sys.argv)) > 1:
@@ -264,22 +717,22 @@ if __name__ == "__main__":
except:
print("Pi Zero 2 not detected")
- try:
- 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 < uptime_time):
- print("Uptime < threshold seconds")
- else:
- print("Uptime > threshold seconds")
- print("Skip CW ID")
- skip = True
- file.close()
- except:
- print("Can't open /proc/uptime")
+# try:
+# system("sudo 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_seconds() < uptime_time):
+ print("Uptime < threshold seconds")
+ else:
+ print("Uptime > threshold seconds")
+ print("Skip CW ID")
+ skip = True
+# file.close()
+# except:
+# print("Can't open /proc/uptime")
print(skip)
if ( mode == "y"):
@@ -303,6 +756,9 @@ if __name__ == "__main__":
print("Can't open beacon_off file, defaulting to False")
print("Command_tx: ")
print(command_tx)
+
+ if (mode != "p") or (command_tx == False):
+ system("sudo systemctl stop pacsatsim")
try:
file = open("/home/pi/CubeSatSim/command_count.txt", "r")
@@ -328,6 +784,8 @@ if __name__ == "__main__":
sim_mode = False
sim_config = False
hab_mode = False
+ doppler_mode = False
+ rigctl = False
try:
file = open("/home/pi/CubeSatSim/sim.cfg")
@@ -340,18 +798,6 @@ if __name__ == "__main__":
sim_config = True
print("Simulated telemetry mode is configured")
else:
-# query = ["timeout", "2", "i2cdetect", "-y", "3"] # Test if Solar board is present
-# try:
-# result = subprocess.run(query, capture_output=True, text=True, check=True)
-# print(f"Command run was: {query}")
-# print("Sucess!")
-# print(f"Output of the command (stdout): {result}")
-# except subprocess.CalledProcessError as e:
-# print(f"Command failed with return code: {e.returncode}")
-# print(f"Command run was: {e.cmd}")
-# print(f"Output of the command (stdout): {e.stdout}")
-# print(f"Error output of the command (stderr): {e.stderr}")
-
try:
if path.isfile("/home/pi/CubeSatSim/sim_mode_auto"):
print("Simulated telemetry mode automatically turned on!")
@@ -360,41 +806,64 @@ if __name__ == "__main__":
except:
if (debug_mode == 1):
print("/home/pi/CubeSatSim/sim_mode_auto not found")
- if len(config) > 5:
- sq = config[5]
- if (mode == 'p') or (mode == 'P'):
- sq = 0 # turn off squelch for Pacsat
- print(sq)
+ if len(config) > 5:
+ if (mode != 'p') and (mode != 'P'): # squelch off for Pacsat
+ sq = config[5]
+ print(f'squelch: {sq}')
if len(config) > 6:
txf = float(config[6])
+ tx = "{:.4f}".format(txf)
+ txrf = 0
if (mode == 'e'):
- txr = (txf - 290.0) # - 0.1 # Cross Band Repeater mode transmit frequency in 2m band
- tx = "{:.4f}".format(txr)
+ if (txf > 420.0) and (txf < 450.0):
+ txrf = (txf - 290.0) # - 0.1 # Cross Band Repeater mode transmit frequency in 2m band
+ print("Repeater mode subtracting 290 MHz from TX Frequency")
+ elif (txf > 144.0) and (txf < 148.0):
+ txrf = txf # Cross Band Repeater mode transmit frequency is already in 2m band
+ print("Repeater mode using 2m TX Frequency")
+ else:
+ txf = 144.9
+ txr = "{:.4f}".format(txrf)
+ print("Transmit frequency: ",txr)
else:
- tx = "{:.4f}".format(txf)
- print("Transmit frequency: ",tx)
+ print("Transmit frequency: ",tx)
if len(config) > 7:
- rxf = float(config[7])
-# print(rxf)
-# print( "{:.4f}".format(rxf))
- rx = "{:.4f}".format(rxf)
- print(rx)
+ rxf = float(config[7])
+ if (rxf > 450) or (rxf < 420):
+ print("RX Frequency out of band!")
+ rxf = 435
+ rx = "{:.4f}".format(rxf)
+ print(rx)
if len(config) > 8:
if config[8] == 'y' or config[8] == 'yes':
hab_mode = True
print("Balloon (HAB) mode is configured.")
if len(config) > 9:
- rxpl = float(config[9])
- # print(rxpl)
- # print( "{:.0f}".format(rxpl))
- rxpl_value = "{:.0f}".format(rxpl)
- print(rxpl_value)
+ 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])
+ txpl = float(config[10])
# print(txpl)
# print( "{:.0f}".format(txpl))
- txpl_value = "{:.0f}".format(txpl)
- print(txpl_value)
+ txpl_value = "{:.0f}".format(txpl)
+ print(txpl_value)
+ if len(config) > 13:
+ if config[13] == 'sim':
+ doppler_mode = True
+# system("sudo systemctl restart frequency")
+ print("Simulated Doppler frequency shift is enabled.")
+ elif config[13] == 'rig':
+ doppler_mode = True
+ rigctl = True
+# system("sudo systemctl restart frequency")
+ print("rigctl Doppler frequency shift is enabled.")
+# else:
+# system("sudo systemctl stop rigctld")
+ else:
+ system("sudo systemctl stop rigctld")
print(config)
print
# print(callsign)
@@ -414,30 +883,42 @@ if __name__ == "__main__":
no_command = True
try:
f = open("/home/pi/CubeSatSim/command_control", "r")
+ no_command = False
f.close()
- GPIO.setmode(GPIO.BCM)
- GPIO.setwarnings(False)
- GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected
- if GPIO.input(squelch) == False:
- print("squelch not set correctly, no command input!")
- else:
- if (mode != 'n') and (mode != 'x'):
- print("command and control is activated")
- no_command = False
- system("sudo systemctl start command")
- else:
- print("Command and control not activated since Transmit Commands mode")
- txc = True # Transmit commands only works with FM transceiver, so bypass Battery Saver if activated
+# setup(squelch, "up") ## pull up in case pin is not connected
+# if input(squelch) == False:
+# print("squelch not set correctly, no command input!")
+# else:
+# if (mode != 'n') and (mode != 'x'):
+# print("command and control is activated")
+# no_command = False
+# system("sudo systemctl start command")
+# else:
+# print("Command and control not activated since Transmit Commands mode")
+# txc = True # Transmit commands only works with FM transceiver, so bypass Battery Saver if activated
except:
print("command and control not activated")
-
print(callsign)
- GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4
- print(txLed)
- print(txLedOn)
- GPIO.setup(txLed, GPIO.OUT)
+ query = ["grep", "VERSION_CODENAME=bullseye", "/etc/os-release"]
+ try:
+ result = subprocess.run(query, capture_output=True, text=True, check=True)
+ print(f"Command run was: {query}")
+ os_status = result.stdout.strip()
+ print(f"Output of the command (stdout): {os_status}")
+ except subprocess.CalledProcessError as e:
+# print(f"Command failed with return code: {e.returncode}")
+ print(f"Command run was: {e.cmd}")
+ os_status = e.stdout.strip()
+ print(f"Output of the command (stdout): {e.stdout}")
+# print(f"Error output of the command (stderr): {e.stderr}")
+ if os_status != "VERSION_CODENAME=bullseye":
+ os_status = "bookworm"
+ else:
+ os_status = "bullseye"
+ print (os_status)
+
card = "Headphones" # default using pcm audio output of Pi Zero
# card = "Device" # using USB sound card for audio output
@@ -454,52 +935,83 @@ if __name__ == "__main__":
print(f"Output of the command (stdout): {e.stdout}")
# print(f"Error output of the command (stderr): {e.stderr}")
- if (mode != 'e'):
-
+# if (mode != 'e'):
+ program_fm(rx,tx,rxpl_value,sq,txpl_value)
+
+ if ((doppler_mode == True) and (rigctl == True) and (command_tx == True) and (skip == False)) or (mode == 'e'):
+ cw_transmit_fm(callsign + " QSY", tx)
+
+ if (doppler_mode == True):
+
if (gpsd_status == "active"):
- print("Stopping gpsd.socket")
+ gpsd_status = "inactive"
+ print("Turning off gpsd since Doppler mode")
system("sudo systemctl stop gpsd.socket")
- print("Programming FM module!\n");
- output(pd, 1)
- output (ptt, 1)
- 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 + "," + 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()
- ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data
- except:
- print("Error in serial write")
- output(pd, 0)
- if (gpsd_status == "active"):
- print("Restarting gpsd.socket")
- system("sudo systemctl restart gpsd.socket")
+ system("sudo systemctl stop gpsd")
+
+# if (command_tx == True) and (skip == False):
+# cw_transmit_fm("QSY", tx)
+ if (mode == 'e'):
+ tx_doppler_start_hz = txrf * 1e6
+ else:
+ tx_doppler_start_hz = txf * 1e6
+ tx_doppler_shift_hz = 0
+ print(f"Tx center frequency: {tx_doppler_start_hz}")
+ rx_doppler_start_hz = rxf * 1e6
+ rx_doppler_shift_hz = 0
+ print(f"Rx center frequency: {rx_doppler_start_hz}")
+
+# TARGET_PASS = 85 # Maximum elevation profile
+
+# doppler_table = iss_doppler_passes[TARGET_PASS]
+# print(f"Pass Max Elevation: {TARGET_PASS}°")
+
+ print("MODE: ")
+ print(mode)
+
+ update_doppler()
+ if (mode == 'm') and (skip == False):
+ print("Sleeping 15 seconds")
+ sleep(15) # avoid CW jumping around at start
+
+ result = subprocess.run("systemctl get-default | grep graphical.target", shell=True, capture_output=True, text=True)
+ gui_result = result.stdout.strip()
+ print(gui_result)
+ if gui_result == "graphical.target":
+ print("Sleep another 30 seconds")
+ sleep(30) # sleep another 30 seconds for cpu to settle down
+
sim_failure_check()
+
+ status = ""
+ if not no_command:
+ status = status + " C"
+ if sim_mode:
+ status = status + " S"
+
if (hab_mode == True) and (mode == 'a'):
print("Don't transmit CW ID since APRS HAB mode is active")
else:
- if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j')) and (command_tx == True) and (skip == False)) or ((mode == 'e') and (command_tx == True)): # 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)
- print("Transmit CW ID")
- status = ""
- if not no_command:
- status = status + " C"
- if sim_mode:
- status = status + " S"
- if (debug_mode == 1):
- system("echo 'hi hi de " + callsign + status + "' > 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")
+ if (((mode == 'a') or (mode == 'b') or (mode == 'f') or (mode == 's') or (mode == 'j') or (mode == 'p') or (mode == 'P')) and (command_tx == True) and (skip == False)) or ((mode == 'e') and (command_tx == True)): # battery_saver_mode
+
+# output(txLed, 1)
+# print("Transmit CW ID")
+
+ if (mode != 'e'):
+ cw_transmit_fm(callsign + status, tx)
+# if (debug_mode == 1):
+# system("echo 'hi hi de " + callsign + status + "' > 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 + status + "' > 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:
- system("echo 'hi hi de " + callsign + status + "' > 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)
+ cw_transmit_fm(callsign + status, txr)
+# if (debug_mode == 1):
+# system("echo 'hi hi de " + callsign + status + "' > 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 " + txr + "e3")
+# else:
+# system("echo 'hi hi de " + callsign + status + "' > 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 " + txr + "e3 > /dev/null 2>&1")
+#
+# output(txLed, 0)
sleep(1)
else:
@@ -511,14 +1023,64 @@ if __name__ == "__main__":
# if (len(sys.argv)) > 1:
# print("There are arguments!")
- if (mode == 'a') or (mode == 'x') or (mode == 'n'):
+ if (mode == 'a') or (mode == 'x') or (mode == 'n') or (mode == 'p') or (mode == 'P'):
# command_control_check()
output(pd, 1)
output(ptt, 1)
if (mode == 'a'):
print("AFSK")
+ elif (mode == 'p') or (mode == 'P'):
+ if (mode == 'P'):
+ print("Pacsat Ground Station")
+ else:
+ print("Pacsat")
+ if (command_tx == True):
+ system("sudo systemctl restart pacsatsim")
+ print("Starting PacSatSim")
+ output(txLed, 0)
+ print("0")
+ rpitx = "arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &"
+# stop_rpitx = "sudo killall -9 rpitx && sudo killall -9 arecord && sudo rpitx -m RF -f 434.9e3 > /dev/null 2>&1"
+ stop_rpitx = "sudo killall -9 arecord && sudo rpitx -m RF -f 434.9e3 > /dev/null 2>&1"
+ if not txc:
+ print("txc is:")
+ print(txc)
+ system(stop_rpitx)
+# system(rpitx)
+ print("Safe Mode!!")
+ while (True):
+ if (txc):
+ sleep(0.1)
+ while (input(ptt) != 0):
+ sleep(0.2)
+ output(txLed, 1)
+# print("1")
+ while (input(ptt) != 1):
+ sleep(0.2)
+ output(txLed, 0)
+ if (mode == 'p') and (doppler_mode):
+ update_doppler()
+# print("0")
+ else:
+# sleep(0.1)
+ while (input(17) == 0):
+ sleep(0.05)
+ system(rpitx)
+ output(txLed, 1)
+# print("1")
+ while (input(17) == 1):
+ sleep(0.05)
+ system(stop_rpitx)
+ output(txLed, 0)
+ if (mode == 'p') and (doppler_mode):
+ update_doppler() # "no")
+ rpitx = "arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f " + tx + "e3 > /dev/null 2>&1 &"
+
+# print("0")
+
+# sleep(10)
+
else:
-# GPIO.output(powerPin, 0)
print("Transmit APRS Commands")
system("sudo systemctl stop command")
# while True:
@@ -535,26 +1097,25 @@ 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)
-# sleep(.1)
-#
-# battery_saver_check()
+ output(txLed, 1)
+ if (doppler_mode == True):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
if (txc):
sim_failure_check()
# 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 plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/telem.wav")
+ system("aplay -D plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/telem.wav")
sleep(0.2) # add more time at end
output (ptt, 1)
# output(pd, 0)
else:
- system("echo 'AMSAT-11>APCSS:010101/hi hi ' >> t.txt")
+# system("echo 'AMSAT-11>APCSS:010101/hi hi ' >> t.txt")
+ system("echo 'AMSAT-11>APCSS:010101/hi hi ' | sudo tee -a /home/pi/CubeSatSim/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:
@@ -563,7 +1124,7 @@ if __name__ == "__main__":
sleep(0.1)
# output (ptt, 1)
# output(pd, 0)
- output(txLed, txLedOff)
+ output(txLed, 0)
system("sudo rm /home/pi/CubeSatSim/ready")
f.close()
@@ -572,7 +1133,8 @@ if __name__ == "__main__":
sleep(0.5)
- except:
+ except Exception as e:
+# print(f"An error occurred: {e}")
# command_control_check()
sleep(1)
elif (mode == 'm'):
@@ -581,44 +1143,63 @@ if __name__ == "__main__":
while True:
# command_control_check()
output (pd, 1)
- output (ptt, 1)
+ output (ptt, 1)
try:
f = open("/home/pi/CubeSatSim/cwready")
f.close()
system("sudo rm /home/pi/CubeSatSim/cwready")
## ch = 1
- for chan in range(7):
- command = "gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw" + str(chan) + ".txt -r 48000 > /dev/null 2>&1"
- print(command)
- 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):
- sim_failure_check()
-# output (pd, 1)
- sleep(0.3)
- output (ptt, 0)
- system("aplay -D plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/morse.wav")
- sleep(0.1)
- output (ptt, 1)
-# output (pd, 0)
- else:
- if (debug_mode == 1):
- 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")
- else:
- 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()
- sleep(2)
- f.close()
- sleep(10)
+ try:
+ for chan in range(7):
+ if (doppler_mode):
+ if (command_tx == True):
+ try:
+ # update_doppler()
+ filename="/home/pi/CubeSatSim/cw" + str(chan) + ".txt"
+ print(filename)
+ file = open(filename)
+ cw_string = file.readline()
+ print(cw_string)
+ cw_transmit_string(cw_string)
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ print("error reading cw string " + str(chan))
+ else:
+ command = "gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw" + str(chan) + ".txt -r 48000 > /dev/null 2>&1"
+ print(command)
+ system(command)
+ ## chan = chan + 1
+ if (command_tx == True):
+ output(txLed, 1)
+ if (doppler_mode == True):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+ if (txc):
+ sim_failure_check()
+ # output (pd, 1)
+ sleep(0.3)
+ output (ptt, 0)
+ system("aplay -D plughw:CARD=" + card + ",DEV=0 /home/pi/CubeSatSim/morse.wav")
+ sleep(0.1)
+ output (ptt, 1)
+ # output (pd, 0)
+ else:
+ if (debug_mode == 1):
+ 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")
+ else:
+ 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, 0)
+
+ # command_control_check()
+ sleep(2)
+ f.close()
+ sleep(10)
+ except Exception as e:
+ print(f"An error occurred: {e}")
except:
# command_control_check()
+# print("cw not ready")
sleep(1)
elif (mode == 's'):
print("SSTV")
@@ -630,7 +1211,10 @@ if __name__ == "__main__":
# from pysstv.sstv import SSTV
# camera = PiCamera()
print("Testing for camera")
- system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256")
+ if os_status == "bookworm":
+ system("rpicam-still -n -o /home/pi/CubeSatSim/camera_out.jpg --width 320 --height 256") # > /dev/null 2>&1")
+ else:
+ system("raspistill -n -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256")
f = open("/home/pi/CubeSatSim/camera_out.jpg")
f.close()
print("Camera present")
@@ -642,7 +1226,7 @@ if __name__ == "__main__":
camera_present = 0
# while 1:
- output(txLed, txLedOff)
+ output(txLed, 0)
# output (ptt, 1)
# output(pd, 0)
if (camera_present == 1):
@@ -654,9 +1238,11 @@ if __name__ == "__main__":
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)
+ if (doppler_mode):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+ output(txLed, 1)
# battery_saver_check()
if (txc):
@@ -672,7 +1258,7 @@ if __name__ == "__main__":
else:
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 > /dev/null 2>&1")
- output(txLed, txLedOff)
+ output(txLed, 0)
# sleep(1)
except:
@@ -683,13 +1269,14 @@ if __name__ == "__main__":
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()
-
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)
+ if (doppler_mode):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+
+ output(txLed, 1)
# battery_saver_check()
if (txc):
@@ -706,7 +1293,7 @@ if __name__ == "__main__":
else:
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 > /dev/null 2>&1")
- output(txLed, txLedOff)
+ output(txLed, 0)
# output (ptt, 1)
# output(pd, 0)
@@ -725,9 +1312,11 @@ if __name__ == "__main__":
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)
+ if (doppler_mode):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+ output(txLed, 1)
# battery_saver_check()
@@ -744,7 +1333,7 @@ if __name__ == "__main__":
else:
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 > /dev/null 2>&1")
- output(txLed, txLedOff)
+ output(txLed, 0)
# output (ptt, 1)
# output(pd, 0)
sleep(1)
@@ -758,14 +1347,14 @@ if __name__ == "__main__":
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
while 1:
-
-# 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)
+ if (doppler_mode):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+
+ output(txLed, 1)
# battery_saver_check()
if (txc):
@@ -781,7 +1370,7 @@ if __name__ == "__main__":
else:
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 > /dev/null 2>&1")
- output(txLed, txLedOff)
+ output(txLed, 0)
# output (ptt, 1)
# output(pd, 0)
sleep(10)
@@ -792,13 +1381,11 @@ if __name__ == "__main__":
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()
-
- 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 (doppler_mode):
+ update_doppler()
+ txf = tx_doppler_freq_hz / 1e6
+ tx = "{:.4f}".format(txf)
+ output(txLed, 1)
if (txc):
sim_failure_check()
@@ -810,7 +1397,7 @@ if __name__ == "__main__":
else:
sleep(60)
- output(txLed, txLedOff)
+ output(txLed, 0)
# output (ptt, 1)
# output(pd, 0)
sleep(10)
@@ -818,15 +1405,14 @@ if __name__ == "__main__":
elif (mode == 'b') or (mode == 'j'):
# command_control_check()
if (mode == 'b'):
- print("BPSK")
+ print("BPSK")
else:
print("FUNcube")
+ if (doppler_mode):
+ print("No doppler shift in this mode")
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 &")
@@ -836,20 +1422,16 @@ if __name__ == "__main__":
print("Initial image_id: " + str(image_id) + "\n")
while 1:
# print ("LED on")
- output(txLed, txLedOff)
+ output(txLed, 0)
sleep(0.4)
# if (command_tx == False):
-# output(txLed, txLedOn)
+# output(txLed, 1)
# sleep(0.03)
-# output(txLed, txLedOff)
+# output(txLed, 0)
# 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)
+ output(txLed, 1)
if (mode == 'b'):
sleep(4.2)
@@ -885,65 +1467,55 @@ if __name__ == "__main__":
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)
-# GPIO.setup(powerPin, GPIO.OUT)
- GPIO.setup(squelch, GPIO.IN, pull_up_down=GPIO.PUD_UP) ## pull up in case pin is not connected
-# GPIO.output(powerPin, 1) # was 0
+ setup(squelch, "up") ## pull up in case pin is not connected
# txf = float(tx) - 288.9
# print("Transmit frequency: ",txf)
if (command_tx != True):
print("Beacon mode off so no repeater transmission")
print("Ready to detect carrier")
+# if (doppler_mode):
+# update_doppler()
+# txr = "{:.3f}".format(tx_doppler_freq_hz/1e6)
+# cw_transmit_fm(callsign + status, txr)
+ start_time = time.perf_counter()
+
while True:
- if (GPIO.input(squelch) == False) and (command_tx == True):
- 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("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 > /dev/null 2>&1 &")
- sleep(0.5)
- system("sudo arecord -D shared_mic -r48000 -fS16_LE -c1 | nc localhost 8011 &")
- while (GPIO.input(squelch) == False):
+ if (input(squelch) == False) and (command_tx == True):
+ print("Carrier detected")
+ if (doppler_mode):
+ update_doppler()
+ start_repeater(tx_doppler_freq_hz, rx_doppler_freq_hz)
+ else:
+ start_repeater(txrf * 1e6, rxf * 1e6)
+ while (input(squelch) == False):
sleep(1)
- print("No carrier detected, stopping repeater")
- output(txLed, txLedOff)
- system("sudo rpitx -i null > /dev/null 2>&1")
- system("sudo killall -9 arecord > /dev/null 2>&1")
- system("sudo killall -9 nc > /dev/null 2>&1")
- system("sudo killall -9 rpitx > /dev/null 2>&1")
- print("Resetting audio")
- system("sudo /etc/init.d/alsa-utils stop")
- system("sudo /etc/init.d/alsa-utils start")
- print("Finished resetting audio")
- print("Ready to detect carrier")
+ print("No carrier detected")
+ stop_repeater()
+ if ((time.perf_counter() - start_time) > 10) and doppler_mode:
+ update_doppler()
+ start_time = time.perf_counter()
else:
print("FSK")
+ if (doppler_mode):
+ print("No doppler shift in this mode")
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")
while 1:
- output(txLed, txLedOff)
+ output(txLed, 0)
sleep(0.4)
# if (command_tx == False):
-# output(txLed, txLedOn)
+# output(txLed, 1)
# sleep(0.03)
-# output(txLed, txLedOff)
+# output(txLed, 0)
# 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)
+ output(txLed, 1)
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 LPF.")
diff --git a/update b/update
deleted file mode 100755
index 4fe1187a..00000000
--- a/update
+++ /dev/null
@@ -1,481 +0,0 @@
-#!/bin/bash
-
-echo -e "\nupdate script for CubeSatSim v2.2\n"
-
-FLAG=0
-checkout=0
-
-if [ -z "$1" ] ; then
- checkout=0
-else
- checkout=1
- branch="$1"
- echo -n "changing to branch "
- echo $branch
- FLAG=1
-fi
-
-if [ "$1" = "n" ] ; 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 -y
-
- sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev python3-pip minicom gpsd gpsd-clients libgps-dev python3-gps
-
-#fi
-
-sudo apt-get install -y gpsd gpsd-clients libgps-dev python3-gps
-
-# sudo apt-get install -y python3-smbus libusb-1.0
-
-sudo sed -i 's/update.sh/update /g' /etc/motd
-
-sudo sed -i 's/installed and/installed\nand/g' /etc/motd
-
-sudo sed -i 's/more information/more\ninformation/g' /etc/motd
-
-sudo sed -i 's/update to/update\nto/g' /etc/motd
-
-sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2
-
-sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/cmdline.txt # single core if Pi Zero 2
-
-sudo sed -i 's/DEVICES=""/DEVICES="\/dev\/serial0"/g' /etc/default/gpsd
-
-sudo sed -i 's/GPSD_OPTIONS=""/GPSD_OPTIONS="-s 9600"/g' /etc/default/gpsd
-
-sudo systemctl disable gpsd > /dev/null 2>&1
-sudo systemctl disable gpsd.socket > /dev/null 2>&1
-
-cd /home/pi/CubeSatSim
-
-git pull --no-rebase > .updated
-
-if [ $checkout -eq 1 ]; then
- git checkout $branch
- git pull --no-rebase > .updated
- FLAG=1
- echo "Running update script again"
- /home/pi/CubeSatSim/update
-fi
-
-make debug
-
-FILE=/home/pi/CubeSatSim/command_tx
-if [ -f "$FILE" ]; then
- echo "$FILE exists."
-else
- echo "creating $FILE"
- echo "True\n" > /home/pi/CubeSatSim/command_tx
-fi
-
-FILE=/home/pi/CubeSatSim/command_count.txt
-if [ -f "$FILE" ]; then
- echo "$FILE exists."
-else
- echo "creating $FILE"
- echo "0\n" > /home/pi/CubeSatSim/command_count.txt
-fi
-
-if [[ $(diff systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service) ]]; then
- echo "changed cubesatsim.service."
- sudo cp /home/pi/CubeSatSim/systemd/cubesatsim.service /etc/systemd/system/cubesatsim.service
- FLAG=1
-else
- echo "no changes to cubesatsim.service."
-fi
-
-FILE=/etc/systemd/system/rpitx.service
-if [ -f "$FILE" ]; then
- sudo systemctl disable rpitx
- sudo rm /etc/systemd/system/rpitx.service
-fi
-
-FILE=/etc/systemd/system/transmit.service
-if [ -f "$FILE" ]; then
- if [[ $(diff systemd/transmit.service /etc/systemd/system/transmit.service) ]]; then
- echo "changed transmit.service."
- sudo cp /home/pi/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service
- FLAG=1
- else
- echo "no change to transmit.service."
- fi
-else
- echo "creating transmit.service."
- sudo cp /home/pi/CubeSatSim/systemd/transmit.service /etc/systemd/system/transmit.service
- FLAG=1
-fi
-
-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=/etc/asound.conf
-if [ -f "$FILE" ]; then
- if [[ $(diff /home/pi/CubeSatSim/asound.conf /etc/asound.conf) ]]; then
- echo "changed /etc/asound.conf."
- sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf
- FLAG=1
- else
- echo "no change to /etc/asound.conf."
- fi
-else
- echo "creating /etc/asound.conf."
- sudo cp /home/pi/CubeSatSim/asound.conf /etc/asound.conf
- FLAG=1
-fi
-
-FILE=/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
-if [ ! -f "$FILE" ]; then
- echo "Copying SSTV image 1."
- cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg
-fi
-
-FILE=/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
-if [ ! -f "$FILE" ]; then
- echo "Copying SSTV image 2."
- cp /home/pi/CubeSatSim/sstv/sstv_image_2_320_x_256.jpg /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg
-fi
-
-grep 'update' /home/pi/CubeSatSim/.updated
-if [[ $(grep 'update' /home/pi/CubeSatSim/.updated) ]]; then
- echo "update script updated, running again"
- /home/pi/CubeSatSim/update
-fi
-
-if [ ! -d "/home/pi/PiSSTVpp" ]; then
-
-# 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
-
-
- cd
-
- git clone https://github.com/alanbjohnston/PiSSTVpp.git
-
- cd PiSSTVpp
-
- make pisstvpp
-
- cd
-
-
- sudo raspi-config nonint do_camera 0
-
-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 library 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/alanbjohnston/WiringPi
- cd WiringPi
- ./build debian
-
- sudo dpkg -i debian-template/wiringpi-2.61-1.deb
-
- cd
-
- cd CubeSatSim
- make debug
-
- FLAG=1
-
- cd
-
-fi
-
-if [ ! -d "/home/pi/ssdv" ]; then
-
- echo "Installing SSDV for FUNcube mode"
- cd
- git clone https://github.com/alanbjohnston/ssdv.git # install ssdv for FUNcube images
- cd ssdv
- make
- cd
- FLAG=1
-fi
-
-if [ ! -d "/home/pi/fctelem" ]; then
- echo "Installing fctelem binary v0.2 for FUNcube mode"
- cd
- 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 -u fctelem.zip
- FLAG=1
-elif [ ! -f "/home/pi/fctelem/v0.2" ]; then
- echo "Updating fctelem binary to version v0.2 for FUNcube mode"
- cd
- cd /home/pi/fctelem
- sudo mv fctelem fctelem.bk
- sudo mv fcdecode.conf fcdecode.conf.bk
- sudo mv fctelem.zip fctelem.zip.1
- wget https://github.com/alanbjohnston/go/releases/download/v0.2/fctelem.zip
- unzip -u fctelem.zip
- FLAG=1
-fi
-
-if [ ! -f "/home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi/mpu6050" ]; then
- echo "Installing MPU6050-C-CPP-Library-for-Raspberry-Pi"
- sudo apt-get install -y libi2c-dev
- cd
- git clone https://github.com/alanbjohnston/MPU6050-C-CPP-Library-for-Raspberry-Pi.git
- cd MPU6050-C-CPP-Library-for-Raspberry-Pi
- sudo make install
- make payload
-fi
-
-cd /home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi
-git checkout master
-git pull --no-rebase > .updated_p
-
-if [[ $(grep 'changed' /home/pi/MPU6050-C-CPP-Library-for-Raspberry-Pi/.updated_p) ]]; then
-
- echo "updating MPU6050-C-CPP-Library-for-Raspberry-Pi"
- sudo make install
- make payload
-else
- echo "nothing to do for MPU6050-C-CPP-Library-for-Raspberry-Pi."
-fi
-
-if [ ! -f "/home/pi/raspberry-pi-bme280/bme280" ]; then
- echo "Installing raspberry-pi-bme280"
- sudo apt-get install -y libi2c-dev
- cd
- git clone https://github.com/alanbjohnston/raspberry-pi-bme280.git
- cd raspberry-pi-bme280
- git checkout payload
- make
-fi
-
-cd /home/pi/raspberry-pi-bme280
-git checkout payload
-git pull --no-rebase > .updated_p
-
-if [[ $(grep 'changed' /home/pi/raspberry-pi-bme280/.updated_p) ]]; then
-
- echo "updating raspberry-pi-bme280"
- make
-
-else
- echo "nothing to do for raspberry-pi-bme280."
-fi
-
-if [ ! -f "/home/pi/fcdctl/fcdctl" ]; then
- 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
-fi
-
-cd /home/pi/pi-power-button
-
- git pull --no-rebase > .updated_p
-
- git checkout master
-
-# grep 'changed' /home/pi/pi-power-button/.updated_p
-# if [[ $(grep 'changed' /home/pi/pi-power-button/.updated_p) ]]; then
-
- echo "updating pi-power-button."
-
- script/install
-
- FLAG=1
-
- # else
- # echo "nothing to do for pi-power-button."
- # fi
-
-cd /home/pi/ssdv
-
- git checkout master
-
- git pull --no-rebase > .updated_p
-
- grep 'changed' /home/pi/ssdv/.updated_p
- if [[ $(grep 'changed' /home/pi/ssdv/.updated_p) ]]; then
-
- echo "updating ssdv."
-
-# git checkout master
-
- script/install
-
- FLAG=1
-
- else
- echo "nothing to do for ssdv."
- fi
-
-
- if [[ $(grep 'dtparam=audio=on' /boot/config.txt) ]]; then
- echo "dtparam=audio=on already in /boot/config.txt"
- else
- echo "adding dtparam=audio=on to /boot/config.txt"
- sudo sh -c 'echo "\ndtparam=audio=on" >> /boot/config.txt'
- FLAG=1
- fi
-
- if [[ $(grep 'dtoverlay=audremap,enable_jack=on' /boot/config.txt) ]]; then
- echo "dtoverlay=audremap,enable_jack=on already in /boot/config.txt"
- else
- echo "adding dtoverlay=audremap,enable_jack=on to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=audremap,enable_jack=on" >> /boot/config.txt'
- FLAG=1
- fi
-
- if [[ $(grep 'dtoverlay=pwm,pin=18,func=2' /boot/config.txt) ]]; then
- echo "dtoverlay=pwm,pin=18,func=2 already in /boot/config.txt"
- else
- echo "adding dtoverlay=pwm,pin=18,func=2 to /boot/config.txt"
- sudo sh -c 'echo "\ndtoverlay=pwm,pin=18,func=2" >> /boot/config.txt'
- FLAG=1
-
-# cd /home/pi/pi-power-button
-# git pull --no-rebase
-# git checkout reboot-mode-change
-# script/install
-
-## 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 -y adafruit-blinka RPI.GPIO adafruit-extended-bus adafruit-circuitpython-ina219 pillow
-
- fi
-
- if [[ $(grep 'disable_splash=1' /boot/config.txt) ]]; then
- echo "disable_splash=1 already in /boot/config.txt"
- else
- echo "adding to /boot/config.txt"
- sudo sh -c 'echo "\ndisable_splash=1" >> /boot/config.txt'
- FLAG=1
- fi
-
- if [[ $(grep 'boot_delay=0' /boot/config.txt) ]]; then
- echo "boot_delay=0 already in /boot/config.txt"
- else
- echo "adding to /boot/config.txt"
- sudo sh -c 'echo "\nboot_delay=0" >> /boot/config.txt'
- FLAG=1
- fi
-
- if ! grep -q force_turbo=1 /boot/config.txt ; then
- sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'
- FLAG=1
- fi
-
-#if [ ! -f "/home/pi/CubeSatSim/telem_string.txt" ]; then
-
-# 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
-
-#fi
-
-changed=0
-value=`cat /home/pi/CubeSatSim/sim.cfg`
-# echo "$value"
-echo "$value" > /dev/null
-set -- $value
-
-if [ -z "$1" ] ; then n1="AMSAT" ; changed=1 ; else n1=$1 ; fi # callsign
-if [ -z "$2" ] ; then n2="0" ; changed=1 ; else n2=$2 ; fi # reset count
-if [ -z "$3" ] ; then n3="0" ; changed=1 ; else n3=$3 ; fi # lat
-if [ -z "$4" ] ; then n4="0" ; changed=1 ; else n4=$4 ; fi # lon
-if [ -z "$5" ] ; then n5="no" ; changed=1 ; else n5=$5 ; fi # sim mode
-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 ${10} ${11}
- echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
- echo
- 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 [ "$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
- if [ $FLAG -eq 1 ]; then
- echo "reboot needed for changes to take effect" | wall
- fi
-fi
-
-echo "CubeSatSim update complete."
diff --git a/update b/update
new file mode 120000
index 00000000..f7ffc47a
--- /dev/null
+++ b/update
@@ -0,0 +1 @@
+install
\ No newline at end of file
diff --git a/venv.sh b/venv.sh
new file mode 100755
index 00000000..c286ba1d
--- /dev/null
+++ b/venv.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. /home/pi/venv/bin/activate