Alan Johnston 5 years ago
commit 9281fd99f4

@ -117,8 +117,11 @@ int bitRate, mode, bufLen, rsFrames, payloads, rsFrameLen, dataLen, headerLen, s
float sleepTime;
int sampleTime = 0, frames_sent = 0;
int cw_id = ON;
int vB4 = FALSE, vB5 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF;
int vB4 = FALSE, vB5 = FALSE, vB3 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF;
float batteryThreshold = 3.0, batteryVoltage;
float latitude = 39.027702, longitude = -77.078064;
float lat_file, long_file;
int test_i2c_bus(int bus);
const char pythonCmd[] = "python3 /home/pi/CubeSatSim/python/voltcurrent.py ";
@ -180,13 +183,19 @@ int main(int argc, char *argv[]) {
fclose(config_file);
config_file = fopen("/home/pi/CubeSatSim/sim.cfg","r");
}
char* cfg_buf[100];
fscanf(config_file, "%s %d", call, &reset_count);
fscanf(config_file, "%s %d %f %f", call, &reset_count, &lat_file, &long_file);
fclose(config_file);
printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d\n", call, reset_count);
printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f\n", call, reset_count, lat_file, long_file);
reset_count = (reset_count + 1) % 0xffff;
if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0))
{
printf("Valid latitude and longitude in config file\n");
latitude = lat_file;
longitude = long_file;
}
wiringPiSetup ();
// Check for SPI and AX-5043 Digital Transceiver Board
@ -239,6 +248,7 @@ int main(int argc, char *argv[]) {
if (digitalRead(2) != HIGH)
{
printf("vB3 with TFB Present\n");
vB3 = TRUE;
txLed = 3;
txLedOn = LOW;
txLedOff = HIGH;
@ -295,7 +305,8 @@ int main(int argc, char *argv[]) {
#endif
config_file = fopen("sim.cfg","w");
fprintf(config_file, "%s %d", call, reset_count);
fprintf(config_file, "%s %d %8.4f %8.4f", call, reset_count, lat_file, long_file);
// fprintf(config_file, "%s %d", call, reset_count);
fclose(config_file);
config_file = fopen("sim.cfg","r");
@ -338,7 +349,7 @@ else
// try connecting to Arduino payload using UART
if (!ax5043) // don't test if AX5043 is present
if (!ax5043 && !vB3) // don't test if AX5043 is present
{
payload = OFF;
@ -650,10 +661,15 @@ for (int j = 0; j < frameCnt; j++)
char tlm_str[1000];
char header_str[] = "\x03\xf0hi hi ";
char header_str3[] = "echo '";
char header_str2[] = ">CQ:hi hi ";
//char header_str2[] = ">CQ:>041440zhi hi ";
//char header_str2[] = ">CQ:=4003.79N\\07534.33WShi hi ";
char header_str2[] = ">CQ:";
char header_str2b[30]; // for APRS coordinates
char header_lat[10];
char header_long[10];
char header_str4[] = "hi hi ";
char footer_str1[] = "\' > t.txt && echo \'";
char footer_str[] = ">CQ:hi hi ' >> t.txt && gen_packets -o telem.wav t.txt -r 48000 > /dev/null 2>&1 && cat telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1";
char footer_str[] = ">CQ:010101/hi hi ' >> t.txt && gen_packets -o telem.wav t.txt -r 48000 > /dev/null 2>&1 && cat telem.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1";
if (ax5043)
{
@ -666,6 +682,19 @@ for (int j = 0; j < frameCnt; j++)
{
strcat(str, call);
strcat(str, header_str2);
// sprintf(header_str2b, "=%7.2f%c%c%c%08.2f%cShi hi ",4003.79,'N',0x5c,0x5c,07534.33,'W'); // add APRS lat and long
if (latitude > 0)
sprintf(header_lat, "%7.2f%c",latitude * 100.0,'N'); // lat
else
sprintf(header_lat, "%7.2f%c",latitude * (-100.0),'S'); // lat
if (longitude > 0)
sprintf(header_long, "%08.2f%c",longitude * 100.0,'E'); // long
else
sprintf(header_long, "%08.2f%c",longitude * (-100.0),'W'); // long
sprintf(header_str2b, "=%s%c%c%sShi hi ",header_lat,0x5c,0x5c,header_long); // add APRS lat and long
printf("\n\nString is %s \n\n", header_str2b);
strcat(str, header_str2b);
} else
{
strcat(str, header_str4);

@ -2,20 +2,26 @@
echo -e "\nDemo of CubeSatSim at 434.9 MHz\n"
sleep 10
sudo systemctl restart rpitx
if [ "$1" = "a" ]; then
if [ "$1" = "c" ]; then
echo "Mode cycling"
y=$(last reboot | grep ^reboot | wc -l)
echo $y
echo $(($y % 4))
fi
if [[ ("$1" = "a" ) || (("$1" = "c") && ("$(($y %4))" = 3)) ]]; then
echo "Mode is continuous AFSK"
/home/pi/CubeSatSim/radioafsk afsk
elif [ "$1" = "b" ]; then
elif [[ ("$1" = "b" ) || (("$1" = "c") && ("$(($y %4))" = 1)) ]]; then
echo "Mode is continuous BPSK"
/home/pi/CubeSatSim/radioafsk bpsk
elif [ "$1" = "s" ]; then
elif [[ ("$1" = "s" ) || (("$1" = "c") && ("$(($y %4))" = 2)) ]]; then
echo "Mode is continuous SSTV"
while true; do sleep 5; done
else
echo "Mode is continuous FSK"
/home/pi/CubeSatSim/radioafsk fsk
else
echo "Mode is continuous FSK"
/home/pi/CubeSatSim/radioafsk fsk
fi

@ -5,15 +5,14 @@
"modulation": "nfm"
},
{
"name": "ISS SSTV",
"frequency": 145819000,
"name": "ISS SSTV/Voice",
"frequency": 145800000,
"modulation": "nfm"
},
{
"name": "ARISS Repeater Downlink",
"frequency": 437800000,
"modulation": "nfm"
},
{
"name": "AO-27",
@ -133,7 +132,7 @@
{
"name": "CubeSatSim",
"frequency": 434900000,
"modulation": "nfm"
"modulation": "packet"
},
{
"name": "APRS EU",

@ -132,7 +132,7 @@ sdrs = {
"start_mod": "nfm",
},
"2m": {
"name": "2m Band",
"name": "2m Ham Band",
"center_freq": 145000000,
"rf_gain": 20,
"samp_rate": 2400000,
@ -140,12 +140,21 @@ sdrs = {
"start_mod": "nfm",
},
"70cm": {
"name": "70cm Band",
"name": "70cm Ham Band 435 MHz",
"center_freq": 435500000,
"rf_gain": 20,
"samp_rate": 2400000,
"start_freq": 4355000000,
"start_mod": "nfm",
},
"70cm-2": {
"name": "70cm Ham Band 438 MHz",
"center_freq": 438000000,
"rf_gain": 30,
"samp_rate": 2400000,
"start_freq": 437800000,
"start_mod": "nfm",
},
"fm": {
"name": "FM Band",
@ -171,6 +180,14 @@ sdrs = {
"start_freq": 51000000,
"start_mod": "usb",
},
"108MHz": {
"name": "108 MHz",
"center_freq": 108000000,
"rf_gain": 30,
"samp_rate": 2400000,
"start_freq": 108000000,
"start_mod": "nfm",
},
"110MHz": {
"name": "110 MHz",
"center_freq": 110000000,
@ -509,12 +526,20 @@ sdrs = {
},
"438mhz": {
"name": "438 MHz 70cm Ham Band",
"center_freq": 138000000,
"center_freq": 438000000,
"rf_gain": 30,
"samp_rate": 2400000,
"start_freq": 438000000,
"start_mod": "nfm",
},
"440mhz": {
"name": "440 MHz 70cm Ham Band",
"center_freq": 440000000,
"rf_gain": 30,
"samp_rate": 2400000,
"start_freq": 440000000,
"start_mod": "nfm",
},
"446mhz": {
"name": "446 MHz",
"center_freq": 446000000,

@ -5,7 +5,9 @@ echo -e "\nUpdating configurations. \n"
cd ~/CubeSatSim && git pull
sudo modprobe snd-aloop
if [ "$1" = "make" ]; then
make debug
fi
sudo cp ~/CubeSatSim/groundstation/config_webrx.py /etc/openwebrx/config_webrx.py

@ -2,4 +2,24 @@
echo -e "\nrpitx for CubeSatSim at 434.9 MHz using python\n"
python -u /home/pi/CubeSatSim/rpitx.py $1
if [ "$1" = "c" ]; then
echo "Mode cycling"
y=$(last reboot | grep ^reboot | wc -l)
echo $y
if [ $(($y % 4)) = 3 ]; then
echo "Mode is continuous AFSK"
python -u /home/pi/CubeSatSim/rpitx.py a
elif [ $(($y % 4)) = 1 ]; then
echo "Mode is continuous BPSK"
python -u /home/pi/CubeSatSim/rpitx.py b
elif [ $(($y % 4)) = 2 ]; then
echo "Mode is continuous SSTV"
python -u /home/pi/CubeSatSim/rpitx.py s
else
echo "Mode is continuous FSK"
python -u /home/pi/CubeSatSim/rpitx.py f
fi
else
python -u /home/pi/CubeSatSim/rpitx.py $1
fi

Loading…
Cancel
Save

Powered by TurnKey Linux.