Compare commits

...

26 Commits

Author SHA1 Message Date
Alan Johnston 0ec6f2520b
Update config add gpsd config default
2 days ago
Alan Johnston 3d9d4ae3c8
Update config after gpsd toggle, reboot
2 days ago
Alan Johnston 563e2da48d
Update config to change frequency, disable gpsd
2 days ago
Alan Johnston c6d4e69d3f
Update update install gpsd but disable
2 days ago
Alan Johnston 3985e9ee13
Update update move gps install
2 days ago
Alan Johnston a245228689
Update config add gpsmon print
2 days ago
Alan Johnston 1277cbbdab
Update config fix enable disable gpsd
2 days ago
Alan Johnston 46fddd90ac
Update config gpsd and gpsd.socket
2 days ago
Alan Johnston dcd09063da
Update config add -u for change gpsd state
2 days ago
Alan Johnston 0a46f27f1e
Update transmit.py don't program fm if gpsd running
2 days ago
Alan Johnston 0db5b8793b
Update transmit.py
2 days ago
Alan Johnston 8134f7752b
Update transmit.py add strip()
2 days ago
Alan Johnston 6bfade0231
Update transmit.py print typo
2 days ago
Alan Johnston bcfdb97796
Update transmit.py print gpsd status
2 days ago
Alan Johnston 4612435c8f
Update transmit.py handle success
2 days ago
Alan Johnston 6a4f538949
Update transmit.py fix is-active cmd
2 days ago
Alan Johnston d9d9ab7a98
Update transmit.py gpsd status check
2 days ago
Alan Johnston 9374fe4a0f
Update transmit.py fix e.result
2 days ago
Alan Johnston c82ae5ba9c
Update transmit.py fix gpsd query
2 days ago
Alan Johnston 3685b91984
Update transmit.py fix tabs
2 days ago
Alan Johnston 2d3c717386
Update transmit.py command error
2 days ago
Alan Johnston df3189a288
Update transmit.py add gpsd check before programming FM
2 days ago
Alan Johnston 748c791200
Update update fix gpsd sed
2 days ago
Alan Johnston 8aca688530
Update install fix sed
2 days ago
Alan Johnston 45f78ae3b6
Update update add python3 gpsd
2 days ago
Alan Johnston 3a45aa4c6a
Update install for gpsd
2 days ago

@ -1188,24 +1188,25 @@ elif [ "$1" = "-F" ]; then
rx="$8" rx="$8"
echo "Keeping value of" $rx echo "Keeping value of" $rx
fi fi
# else echo -e "\nCubeSatSim configuration sim.cfg file updated to: \n"
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}
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} > /home/pi/CubeSatSim/sim.cfg
# fi
echo
# if [ "$norestart" = "1" ]; then echo "Restarting CubeSatSim with new configuration file"
# echo
# else if [[ $(sudo systemctl is-active gpsd.socket | grep inactive) ]]; then
sudo systemctl restart transmit
else
echo echo
echo "Restarting CubeSatSim with new configuration file" echo "temporarily disabling gpsd and rebooting to program FM module"
## echo echo "this will take about 40 seconds"
# reboot=1 sudo systemctl stop gpsd.socket
## sudo reboot now
sudo systemctl restart transmit sudo systemctl restart transmit
# fi sleep 10
reboot=1
fi
elif [ "$1" = "-o" ]; then elif [ "$1" = "-o" ]; then
@ -1771,7 +1772,47 @@ elif [ "$1" = "-U" ]; then
if [ "${12}" != "$sim" ] || [ "${13}" != "$time" ] ; then if [ "${12}" != "$sim" ] || [ "${13}" != "$time" ] ; then
reboot=1 reboot=1
fi fi
elif [ "$1" = "-u" ]; then
echo
echo "Change gpsd state"
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
if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then
echo "gpsd set to ON"
sudo systemctl enable gpsd
sudo systemctl enable gpsd.socket
echo
echo "Unless you configure gpsd otherwise, the gps is connected to serial0 on the Pi."
echo "To monitor your gps device, use the command gpsmon"
echo
reboot=1
fi
else
echo "gpsd is active"
echo
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
elif [ "$1" = "-h" ]; then elif [ "$1" = "-h" ]; then
echo "config OPTION" echo "config OPTION"

@ -48,7 +48,7 @@ sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get remove pulseaudio -y sudo apt-get remove pulseaudio -y
# removed wiringpi and python-picamera python3-picamera # removed wiringpi and python-picamera python3-picamera
sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom sudo apt-get install -y git libasound2-dev i2c-tools build-essential libgd-dev libmagic-dev minicom gpsd gpsd-clients libgps-dev python3-gps
cd /tmp cd /tmp
@ -270,6 +270,8 @@ sudo raspi-config nonint do_legacy 0
sudo sh -c 'echo "\n" >> /boot/config.txt' sudo sh -c 'echo "\n" >> /boot/config.txt'
sudo sed -i 's/DEVICES=""/DEVICES="\/dev\/serial0"/g' /etc/default/gpsd
changed=0 changed=0
value=`cat /home/pi/CubeSatSim/sim.cfg` value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null echo "$value" > /dev/null

@ -11,6 +11,7 @@ from os import system
from PIL import Image, ImageDraw, ImageFont, ImageColor from PIL import Image, ImageDraw, ImageFont, ImageColor
import serial import serial
import random import random
import subprocess
def sim_failure_check(): def sim_failure_check():
try: try:
@ -395,7 +396,20 @@ if __name__ == "__main__":
card = "Headphones" # default using pcm audio output of Pi Zero card = "Headphones" # default using pcm audio output of Pi Zero
# card = "Device" # using USB sound card for audio output # card = "Device" # using USB sound card for audio output
if (mode != 'e'): query = ["sudo", "systemctl", "is-active", "gpsd.socket"]
try:
result = subprocess.run(query, capture_output=True, text=True, check=True)
print(f"Command run was: {query}")
gpsd_status = result.stdout.strip()
print(f"Output of the command (stdout): {gpsd_status}")
except subprocess.CalledProcessError as e:
# print(f"Command failed with return code: {e.returncode}")
print(f"Command run was: {e.cmd}")
gpsd_status = e.stdout.strip()
print(f"Output of the command (stdout): {e.stdout}")
# print(f"Error output of the command (stderr): {e.stderr}")
if (mode != 'e') and (gpsd_status != "active"):
print("Programming FM module!\n"); print("Programming FM module!\n");
output(pd, 1) output(pd, 1)
output (ptt, 1) output (ptt, 1)

@ -31,10 +31,12 @@ if [ "$1" = "u" ]; then
# sudo apt-get update && sudo apt-get dist-upgrade -y # sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get update -y sudo apt-get 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 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 fi
sudo apt-get install -y gpsd gpsd-clients libgps-dev python3-gps
# sudo apt-get install -y python3-smbus libusb-1.0 # sudo apt-get install -y python3-smbus libusb-1.0
sudo sed -i 's/update.sh/update /g' /etc/motd sudo sed -i 's/update.sh/update /g' /etc/motd
@ -49,7 +51,10 @@ sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # si
sudo sed -i 's/maxcpus=2/maxcpus=1/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/DEVICES=""/DEVICES="\/dev\/serial0"/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 cd /home/pi/CubeSatSim

Loading…
Cancel
Save

Powered by TurnKey Linux.