From de41b6c66fae7e1dc732a2dbe16e01bda5820cab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 18 Feb 2024 09:22:36 -0500 Subject: [PATCH 01/27] Update rpitx.py add command_control check --- rpitx.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rpitx.py b/rpitx.py index ccdb6038..41df0ec1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -153,14 +153,6 @@ 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.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!") - no_command = True -else: - no_command = False - transmit = False if GPIO.input(12) == False: print("Version is v1 with UHF BPF") @@ -311,6 +303,23 @@ if __name__ == "__main__": if (debug_mode == 1): print("Can't read callsign from sim.cfg file, defaulting to AMSAT") file.close() + + try: + f = open("/home/pi/CubeSatSim/command_control", "r") + 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!") + no_command = True + else: + print("command and control is activated") + no_command = False + except: + print("command and control not activated") + no_command = True + print(callsign) GPIO.setmode(GPIO.BCM) # added to make Tx LED work on Pi 4 GPIO.setup(txLed, GPIO.OUT) From afccc69a1b41e0b551df3c32ec89d5386f73cca5 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 18 Feb 2024 14:46:31 -0500 Subject: [PATCH 02/27] Update config added reading command_control setting --- config | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config b/config index 491f9565..161064d8 100755 --- a/config +++ b/config @@ -60,6 +60,13 @@ if [ "$1" = "" ]; then echo $6 echo + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo "Radio command and control is ON" + else + echo "Radio command and control is OFF" + fi + FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then echo "Battery saver mode is ON" From 28324acb97c3c4789751f519fd4ae701f47495b7 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 18 Feb 2024 15:07:21 -0500 Subject: [PATCH 03/27] Update config add newline --- config | 1 + 1 file changed, 1 insertion(+) diff --git a/config b/config index 161064d8..8554d1bc 100755 --- a/config +++ b/config @@ -66,6 +66,7 @@ if [ "$1" = "" ]; then else echo "Radio command and control is OFF" fi + echo FILE=/home/pi/CubeSatSim/battery_saver if [ -f "$FILE" ]; then From 91f568dff1725308e2b41db9ab314b2940352987 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 Feb 2024 17:21:23 -0500 Subject: [PATCH 04/27] Update rpitx.py check c&c APRS every two seconds --- rpitx.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/rpitx.py b/rpitx.py index 41df0ec1..2850aced 100644 --- a/rpitx.py +++ b/rpitx.py @@ -424,6 +424,12 @@ if __name__ == "__main__": output(txLed, txLedOff) system("sudo rm /home/pi/CubeSatSim/ready") f.close() + + if (debug_mode == 1): + print("Ready for next packet!") + + sleep(0.5) + except: output(pd, 1) output(ptt, 1) sleep(1) @@ -459,14 +465,7 @@ if __name__ == "__main__": else: print("No carrier received!") output(pd, 0) - - if (debug_mode == 1): - print("Ready for next packet!") - - sleep(0.5) - except: - - sleep(0.5) + sleep(1) elif (mode == 'm'): print("CW") # sleep(4) From 8fc19a80d3bd115d3f3589d846fe53d24d57529d Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 Feb 2024 17:24:46 -0500 Subject: [PATCH 05/27] Update config cleanup --- config | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config b/config index 8554d1bc..9d74c031 100755 --- a/config +++ b/config @@ -15,15 +15,15 @@ if [ "$1" = "" ]; then set -- $value if [ "$1" = "a" ]; then - echo "APRS mode is set" + echo "Mode is APRS" elif [ "$1" = "m" ]; then - echo "CW mode is set" + echo "Mode is CW" elif [ "$1" = "f" ]; then - echo "FSK mode is set" + echo "Mode is FSK" elif [ "$1" = "b" ]; then - echo "BPSK mode is set" + echo "Mode is BPSK" elif [ "$1" = "s" ]; then - echo "SSTV mode is set" + echo "Mode is SSTV" else echo fi @@ -103,7 +103,7 @@ elif [ "$1" = "-a" ]; then echo "Battery saver mode is ON." # if ! grep -q force_turbo=1 /boot/config.txt ; then sudo sh -c 'echo "force_turbo=1" >> /boot/config.txt'; fi else - echo "Battery saver mode os OFF." + echo "Battery saver mode is OFF." # sudo sed -i ':a;N;$!ba;s/\nforce_turbo=1//g' /boot/config.txt fi From bc45f23e44c860e3f8ef4d2ff3b95fdadab44361 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 Feb 2024 17:42:18 -0500 Subject: [PATCH 06/27] Update rpitx.py define command_control_check --- rpitx.py | 81 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/rpitx.py b/rpitx.py index 2850aced..df264df1 100644 --- a/rpitx.py +++ b/rpitx.py @@ -11,6 +11,51 @@ from os import system from PIL import Image, ImageDraw, ImageFont, ImageColor import serial +def command_control_check(): + + global command_control + global no_command + global debug_mode + global command_count + + output(pd, 1) + output(ptt, 1) + sleep(1) + if (no_command == False and GPIO.input(squelch) == False): + print("carrier received!") + # command_tx = not command_tx +# print(command_tx) + + try: + command_count += 1 + filec = open("/home/pi/CubeSatSim/command_count.txt", "w") + command_count_string = str(command_count) + print(command_count_string) + string = filec.write(command_count_string) + filec.close() + except: + if (debug_mode == 1): + print("Can't write command_count file!") + print("Command_count: ") + print(command_count) + + increment_mode() + +# if (command_tx == True): +# print("Turning on transmit") +# system("echo > command_tx True") +# output(txLed, txLedOn) +# sleep(0.5) +# output(txLed, txLedff) +# else: +# print("Turning off transmit") +# system("echo > command_tx False") + else: + print("No carrier received!") + output(pd, 0) +# sleep(1) + + def battery_saver_check(): try: global txc @@ -430,41 +475,7 @@ if __name__ == "__main__": sleep(0.5) except: - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") -# output(txLed, txLedOn) -# sleep(0.5) -# output(txLed, txLedff) - else: - print("Turning off transmit") - system("echo > command_tx False") - else: - print("No carrier received!") - output(pd, 0) + command_control_check() sleep(1) elif (mode == 'm'): print("CW") From d284d0cbefb8c89783e0e7a076bb4250fdb1cb42 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 25 Feb 2024 17:50:39 -0500 Subject: [PATCH 07/27] Update rpitx.py add more command_control_check to sstv --- rpitx.py | 183 ++++++------------------------------------------------- 1 file changed, 17 insertions(+), 166 deletions(-) diff --git a/rpitx.py b/rpitx.py index df264df1..7bd6ba95 100644 --- a/rpitx.py +++ b/rpitx.py @@ -510,40 +510,7 @@ if __name__ == "__main__": # output (ptt, 1) sleep(5) while True: - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") -# output(txLed, txLedOn) -# sleep(0.5) -# output(txLed, txLedff) - else: - print("Turning off transmit") - system("echo > command_tx False") - sleep(5) - output(pd, 1) # changed from 0 to 1 + command_control_check() try: f = open("/home/pi/CubeSatSim/cwready") @@ -625,6 +592,8 @@ if __name__ == "__main__": except: print("image 2 did not load - copy from CubeSatSim/sstv directory") while 1: + command_control_check() + system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") @@ -651,42 +620,12 @@ if __name__ == "__main__": draw.text((120, 10), telem_string, font=font2, fill='white') img.save(file) + command_control_check() + system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/camera_out.jpg") system("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1") - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") -# output(txLed, txLedOn) -# sleep(0.5) -# output(txLed, txLedff) - else: - print("Turning off transmit") - system("echo > command_tx False") - output(pd, 0) + command_control_check() if (command_tx == True): print ("Sending SSTV image") @@ -713,9 +652,14 @@ if __name__ == "__main__": sleep(1) else: try: + command_control_check() + file = open("/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") print("First SSTV stored image detected") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") + + command_control_check() + if (command_tx == True): print ("Sending SSTV image") @@ -742,43 +686,15 @@ if __name__ == "__main__": except: print("image 1 did not load - copy from CubeSatSim/sstv directory") try: + command_control_check() + file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") print("Second SSTV stored image detected") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") + while 1: - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") -# output(txLed, txLedOn) -# sleep(0.5) -# output(txLed, txLedff) - else: - print("Turning off transmit") - system("echo > command_tx False") - output(pd, 0) + command_control_check() if (command_tx == True): print ("Sending SSTV image") @@ -841,40 +757,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") - system("sudo nc -l 8080 | csdr convert_i16_f | csdr fir_interpolate_cc 2 | csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo /home/pi/rpitx/sendiq -i /dev/stdin -s 96000 -f " + tx + "e6 -t float &") - else: - print("Turning off transmit") # and rebooting") - system("echo > command_tx False") - system("sudo systemctl restart rpitx") -# system("sudo reboot now") - sleep(60) - output(pd, 0) + command_control_check() if (command_tx == True): output(txLed, txLedOn) @@ -894,39 +777,7 @@ if __name__ == "__main__": # output(txLed, txLedOn) # sleep(0.03) # output(txLed, txLedOff) - output(pd, 1) - output(ptt, 1) - sleep(1) - if (no_command == False and GPIO.input(squelch) == False): - print("carrier received!") - # command_tx = not command_tx - print(command_tx) - - try: - command_count += 1 - filec = open("/home/pi/CubeSatSim/command_count.txt", "w") - command_count_string = str(command_count) - print(command_count_string) - string = filec.write(command_count_string) - filec.close() - except: - if (debug_mode == 1): - print("Can't write command_count file!") - print("Command_count: ") - print(command_count) - - increment_mode() - - if (command_tx == True): - print("Turning on transmit") - system("echo > command_tx True") - 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 &") - else: - print("Turning of transmit and rebooting") - system("echo > command_tx False") - system("sudo systemctl restart rpitx") -# system("sudo reboot now") - sleep(60) + command_control_check() if (command_tx == True): output(txLed, txLedOn) sleep(4.0) From 86c23b25f83a276d1f4a3ce8010aeb84dfe2c3b4 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:22:34 -0500 Subject: [PATCH 08/27] Update main.h renamed XS to GPS added DTEMP --- main.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.h b/main.h index 076c0523..926fa3b2 100644 --- a/main.h +++ b/main.h @@ -44,9 +44,10 @@ #define ACCEL_X 10 #define ACCEL_Y 11 #define ACCEL_Z 12 -#define XS1 14 -#define XS2 15 -#define XS3 16 +#define GPS1 14 +#define GPS2 15 +#define GPS3 16 +#define DTEMP 17 #define RSSI 0 #define IHU_TEMP 2 From de4b8fb7380f94b967bf8698c831ac51a023d700 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:24:19 -0500 Subject: [PATCH 09/27] Update main.c changed XS to GPS, added DTEMP --- main.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/main.c b/main.c index d16a1af3..7441d968 100644 --- a/main.c +++ b/main.c @@ -683,18 +683,18 @@ int main(int argc, char * argv[]) { } } printf("\n"); -// if (sensor[XS1] != 0) { - if ((sensor[XS1] > -90.0) && (sensor[XS1] < 90.0) && (sensor[XS1] != 0.0)) { - if (sensor[XS1] != latitude) { - latitude = sensor[XS1]; +// if (sensor[GPS1] != 0) { + if ((sensor[GPS1] > -90.0) && (sensor[GPS1] < 90.0) && (sensor[GPS1] != 0.0)) { + if (sensor[GPS1] != latitude) { + latitude = sensor[GPS1]; printf("Latitude updated to %f \n", latitude); newGpsTime = millis(); } } -// if (sensor[XS2] != 0) { - if ((sensor[XS2] > -180.0) && (sensor[XS2] < 180.0) && (sensor[XS2] != 0.0)) { - if (sensor[XS2] != longitude) { - longitude = sensor[XS2]; +// if (sensor[GPS2] != 0) { + if ((sensor[GPS2] > -180.0) && (sensor[GPS2] < 180.0) && (sensor[GPS2] != 0.0)) { + if (sensor[GPS2] != longitude) { + longitude = sensor[GPS2]; printf("Longitude updated to %f \n", longitude); newGpsTime = millis(); } @@ -879,18 +879,18 @@ int main(int argc, char * argv[]) { } } printf("\n"); -// if (sensor[XS1] != 0) { - if ((sensor[XS1] > -90.0) && (sensor[XS1] < 90.0) && (sensor[XS1] != 0.0)) { - if (sensor[XS1] != latitude) { - latitude = sensor[XS1]; +// if (sensor[GPS1] != 0) { + if ((sensor[GPS1] > -90.0) && (sensor[GPS1] < 90.0) && (sensor[GPS1] != 0.0)) { + if (sensor[GPS1] != latitude) { + latitude = sensor[GPS1]; printf("Latitude updated to %f \n", latitude); newGpsTime = millis(); } } -// if (sensor[XS2] != 0) { - if ((sensor[XS2] > -180.0) && (sensor[XS2] < 180.0) && (sensor[XS2] != 0.0)) { - if (sensor[XS2] != longitude) { - longitude = sensor[XS2]; +// if (sensor[GPS2] != 0) { + if ((sensor[GPS2] > -180.0) && (sensor[GPS2] < 180.0) && (sensor[GPS2] != 0.0)) { + if (sensor[GPS2] != longitude) { + longitude = sensor[GPS2]; printf("Longitude updated to %f \n", longitude); newGpsTime = millis(); } @@ -1588,10 +1588,10 @@ void get_tlm_fox() { encodeA(b_max, 42 + head_offset, (int)(sensor_max[GYRO_Y] + 0.5) + 2048); encodeB(b_max, 43 + head_offset, (int)(sensor_max[GYRO_Z] + 0.5) + 2048); - encodeA(b_max, 48 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5) + 2048); - encodeB(b_max, 49 + head_offset, (int)(sensor_max[XS2] * 10 + 0.5) + 2048); + encodeA(b_max, 48 + head_offset, (int)(sensor_max[GPS1] * 10 + 0.5) + 2048); + encodeB(b_max, 49 + head_offset, (int)(sensor_max[GPS2] * 10 + 0.5) + 2048); encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); - encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[] * 10 + 0.5)); } else { @@ -1641,8 +1641,8 @@ void get_tlm_fox() { encodeA(b_min, 42 + head_offset, (int)(sensor_min[GYRO_Y] + 0.5) + 2048); encodeB(b_min, 43 + head_offset, (int)(sensor_min[GYRO_Z] + 0.5) + 2048); - encodeA(b_min, 48 + head_offset, (int)(sensor_min[XS1] * 10 + 0.5) + 2048); - encodeB(b_min, 49 + head_offset, (int)(sensor_min[XS2] * 10 + 0.5) + 2048); + encodeA(b_min, 48 + head_offset, (int)(sensor_min[DTEMP] * 10 + 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)); } @@ -1679,8 +1679,8 @@ void get_tlm_fox() { encodeA(b, 45 + head_offset, (int)(sensor[HUMI] * 10 + 0.5)); // in place of sensor1 encodeB(b, 46 + head_offset, PSUCurrent); - encodeA(b, 48 + head_offset, (int)(sensor[XS1] * 10 + 0.5) + 2048); - encodeB(b, 49 + head_offset, (int)(sensor[XS2] * 10 + 0.5) + 2048); + encodeA(b, 48 + head_offset, (int)(sensor[GPS1] * 10 + 0.5) + 2048); + encodeB(b, 49 + head_offset, (int)(sensor[GPS2] * 10 + 0.5) + 2048); FILE * command_count_file = fopen("/home/pi/CubeSatSim/command_count.txt", "r"); if (command_count_file != NULL) { From 589db3663370ff0463109681c1dec85611e64bec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:24:46 -0500 Subject: [PATCH 10/27] Update main.h added XS1 --- main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main.h b/main.h index 926fa3b2..863f53c5 100644 --- a/main.h +++ b/main.h @@ -48,6 +48,7 @@ #define GPS2 15 #define GPS3 16 #define DTEMP 17 +#define XS1 18 #define RSSI 0 #define IHU_TEMP 2 From 40aa67cd80dab53c1b5a77e5bcf9c5827928424b Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:25:55 -0500 Subject: [PATCH 11/27] Update main.c fixed typo --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 7441d968..c51ac64f 100644 --- a/main.c +++ b/main.c @@ -1591,7 +1591,7 @@ void get_tlm_fox() { encodeA(b_max, 48 + head_offset, (int)(sensor_max[GPS1] * 10 + 0.5) + 2048); encodeB(b_max, 49 + head_offset, (int)(sensor_max[GPS2] * 10 + 0.5) + 2048); encodeB(b_max, 10 + head_offset, (int)(sensor_max[TEMP] * 10 + 0.5)); - encodeA(b_max, 45 + head_offset, (int)(sensor_max[] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5)); } else { From 3017cd83d4a4b1083775ec62bc8bcd8f429b77dd Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:32:50 -0500 Subject: [PATCH 12/27] Update main.h increased sensor size to 20 --- main.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.h b/main.h index 863f53c5..b56faaee 100644 --- a/main.h +++ b/main.h @@ -148,7 +148,7 @@ float axis[3], angle[3], volts_max[3], amps_max[3], batt, speed, period, tempS, int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; -float voltage[9], current[9], sensor[17], other[3]; +float voltage[9], current[9], sensor[20], other[3]; char sensor_payload[500]; int test_i2c_bus(int bus); @@ -159,7 +159,7 @@ char pythonStr[100], pythonConfigStr[100], busStr[10]; int map[8] = {0, 1, 2, 3, 4, 5, 6, 7}; char src_addr[5] = ""; char dest_addr[5] = "APCSS"; -float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[17], sensor_min[17], other_max[3], other_min[3]; +float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[20], sensor_min[20], other_max[3], other_min[3]; int get_payload_serial(int debug_camera); int finished = FALSE; From 600185c4783a1691fc70ad22c968d9465e5b02ec Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:34:13 -0500 Subject: [PATCH 13/27] Update main.c increased sensor size to 20 --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index c51ac64f..b76fd737 100644 --- a/main.c +++ b/main.c @@ -567,7 +567,7 @@ int main(int argc, char * argv[]) { voltage_max[i] = -1000.0; current_max[i] = -1000.0; } - for (int i = 0; i < 17; i++) { + for (int i = 0; i < 20; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; // printf("Sensor min and max initialized!"); @@ -673,7 +673,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 17; count1++) { + for (count1 = 0; count1 < 20; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -712,7 +712,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 17; count1++) { + for (int count1 = 0; count1 < 20; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -869,7 +869,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 17; count1++) { + for (count1 = 0; count1 < 20; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -908,7 +908,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 17; count1++) { + for (int count1 = 0; count1 < 20; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -1435,7 +1435,7 @@ void get_tlm_fox() { if (loop % 32 == 0) { // was 8 printf("Sending MIN frame \n"); frm_type = 0x03; - for (int count1 = 0; count1 < 17; count1++) { + for (int count1 = 0; count1 < 20; count1++) { if (count1 < 3) other[count1] = other_min[count1]; if (count1 < 8) { @@ -1449,7 +1449,7 @@ void get_tlm_fox() { if ((loop + 16) % 32 == 0) { // was 8 printf("Sending MAX frame \n"); frm_type = 0x02; - for (int count1 = 0; count1 < 17; count1++) { + for (int count1 = 0; count1 < 20; count1++) { if (count1 < 3) other[count1] = other_max[count1]; if (count1 < 8) { From 6276514e8ba01fab81d1d2a4bcb5c16939d247ac Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:39:01 -0500 Subject: [PATCH 14/27] Update main.h sensor 22 --- main.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.h b/main.h index b56faaee..97a865cc 100644 --- a/main.h +++ b/main.h @@ -148,7 +148,7 @@ float axis[3], angle[3], volts_max[3], amps_max[3], batt, speed, period, tempS, int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; -float voltage[9], current[9], sensor[20], other[3]; +float voltage[9], current[9], sensor[22], other[3]; char sensor_payload[500]; int test_i2c_bus(int bus); @@ -159,7 +159,7 @@ char pythonStr[100], pythonConfigStr[100], busStr[10]; int map[8] = {0, 1, 2, 3, 4, 5, 6, 7}; char src_addr[5] = ""; char dest_addr[5] = "APCSS"; -float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[20], sensor_min[20], other_max[3], other_min[3]; +float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[22], sensor_min[22], other_max[3], other_min[3]; int get_payload_serial(int debug_camera); int finished = FALSE; From de309e8891f8df42b3c192a9c26d00d66fbf50fe Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:41:00 -0500 Subject: [PATCH 15/27] Update main.c sensor to 22 --- main.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index b76fd737..1fbea536 100644 --- a/main.c +++ b/main.c @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902122'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -374,7 +374,7 @@ int main(int argc, char * argv[]) { { payload = OFF; - if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 + if ((uart_fd = serialOpen("/dev/ttyAMA0", 115220)) >= 0) { // was 9600 printf("Serial opened to Pico\n"); payload = ON; /* @@ -413,7 +413,7 @@ int main(int argc, char * argv[]) { sleep(2); // delay to give payload time to get ready } else { - printf("\nSTEM Payload not present!\n -> Is STEM Payload programed and Serial1 set to 115200 baud?\n"); + printf("\nSTEM Payload not present!\n -> Is STEM Payload programed and Serial1 set to 115220 baud?\n"); printf("Turning on Payload anyway\n"); payload = ON; @@ -457,9 +457,9 @@ int main(int argc, char * argv[]) { speed = rnd_float(1.0, 2.5); eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; period = rnd_float(150, 300); - tempS = rnd_float(20, 55); + tempS = rnd_float(22, 55); temp_max = rnd_float(50, 70); - temp_min = rnd_float(10, 20); + temp_min = rnd_float(10, 22); #ifdef DEBUG_LOGGING for (int i = 0; i < 3; i++) @@ -483,7 +483,7 @@ int main(int argc, char * argv[]) { } if (mode == FSK) { - bitRate = 200; + bitRate = 220; rsFrames = 1; payloads = 1; rsFrameLen = 64; @@ -504,7 +504,7 @@ 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) { - bitRate = 1200; + bitRate = 1220; rsFrames = 3; payloads = 6; rsFrameLen = 159; @@ -520,7 +520,7 @@ int main(int argc, char * argv[]) { samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; // samplePeriod = 3000; // sleepTime = 3.0; - //samplePeriod = 2200; // reduce dut to python and sensor querying delays + //samplePeriod = 2220; // reduce dut to python and sensor querying delays sleepTime = 2.2f; frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms @@ -567,7 +567,7 @@ int main(int argc, char * argv[]) { voltage_max[i] = -1000.0; current_max[i] = -1000.0; } - for (int i = 0; i < 20; i++) { + for (int i = 0; i < 22; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; // printf("Sensor min and max initialized!"); @@ -673,7 +673,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 20; count1++) { + for (count1 = 0; count1 < 22; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -712,7 +712,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 20; count1++) { + for (int count1 = 0; count1 < 22; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -869,7 +869,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 20; count1++) { + for (count1 = 0; count1 < 22; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -908,7 +908,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 20; count1++) { + for (int count1 = 0; count1 < 22; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -1435,7 +1435,7 @@ void get_tlm_fox() { if (loop % 32 == 0) { // was 8 printf("Sending MIN frame \n"); frm_type = 0x03; - for (int count1 = 0; count1 < 20; count1++) { + for (int count1 = 0; count1 < 22; count1++) { if (count1 < 3) other[count1] = other_min[count1]; if (count1 < 8) { @@ -1449,7 +1449,7 @@ void get_tlm_fox() { if ((loop + 16) % 32 == 0) { // was 8 printf("Sending MAX frame \n"); frm_type = 0x02; - for (int count1 = 0; count1 < 20; count1++) { + for (int count1 = 0; count1 < 22; count1++) { if (count1 < 3) other[count1] = other_max[count1]; if (count1 < 8) { From db09f46f04235b7f060d8441edc99e17461a0463 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 08:41:53 -0500 Subject: [PATCH 16/27] Update main.h defined XS1, XS2, XS3 --- main.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.h b/main.h index 97a865cc..6d72daf3 100644 --- a/main.h +++ b/main.h @@ -48,7 +48,9 @@ #define GPS2 15 #define GPS3 16 #define DTEMP 17 -#define XS1 18 +#define XS1 19 +#define XS2 20 +#define XS3 21 #define RSSI 0 #define IHU_TEMP 2 From a86c733dd3bfc429e6924dd1eb06f58e523100fb Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:04:58 -0500 Subject: [PATCH 17/27] Update main.c fix change to 20 --- main.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index 1fbea536..d3137984 100644 --- a/main.c +++ b/main.c @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) { char resbuffer[1000]; - const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902122'"; + const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '902120'"; FILE *file_test = sopen(testStr); // see if Pi Zero 2 fgets(resbuffer, 1000, file_test); fprintf(stderr, "Pi test result: %s\n", resbuffer); @@ -374,7 +374,7 @@ int main(int argc, char * argv[]) { { payload = OFF; - if ((uart_fd = serialOpen("/dev/ttyAMA0", 115220)) >= 0) { // was 9600 + if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600 printf("Serial opened to Pico\n"); payload = ON; /* @@ -413,7 +413,7 @@ int main(int argc, char * argv[]) { sleep(2); // delay to give payload time to get ready } else { - printf("\nSTEM Payload not present!\n -> Is STEM Payload programed and Serial1 set to 115220 baud?\n"); + printf("\nSTEM Payload not present!\n -> Is STEM Payload programed and Serial1 set to 115200 baud?\n"); printf("Turning on Payload anyway\n"); payload = ON; @@ -457,9 +457,9 @@ int main(int argc, char * argv[]) { speed = rnd_float(1.0, 2.5); eclipse = (rnd_float(-1, +4) > 0) ? 1.0 : 0.0; period = rnd_float(150, 300); - tempS = rnd_float(22, 55); + tempS = rnd_float(20, 55); temp_max = rnd_float(50, 70); - temp_min = rnd_float(10, 22); + temp_min = rnd_float(10, 20); #ifdef DEBUG_LOGGING for (int i = 0; i < 3; i++) @@ -483,7 +483,7 @@ int main(int argc, char * argv[]) { } if (mode == FSK) { - bitRate = 220; + bitRate = 200; rsFrames = 1; payloads = 1; rsFrameLen = 64; @@ -504,7 +504,7 @@ 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) { - bitRate = 1220; + bitRate = 1200; rsFrames = 3; payloads = 6; rsFrameLen = 159; @@ -520,7 +520,7 @@ int main(int argc, char * argv[]) { samplePeriod = ((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))))/(float)bitRate) * 1000 - 1800; // samplePeriod = 3000; // sleepTime = 3.0; - //samplePeriod = 2220; // reduce dut to python and sensor querying delays + //samplePeriod = 2200; // reduce dut to python and sensor querying delays sleepTime = 2.2f; frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms @@ -567,7 +567,7 @@ int main(int argc, char * argv[]) { voltage_max[i] = -1000.0; current_max[i] = -1000.0; } - for (int i = 0; i < 22; i++) { + for (int i = 0; i <22; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; // printf("Sensor min and max initialized!"); @@ -673,7 +673,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 22; count1++) { + for (count1 = 0; count1 <22; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -712,7 +712,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 22; count1++) { + for (int count1 = 0; count1 <22; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -869,7 +869,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 < 22; count1++) { + for (count1 = 0; count1 <22; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -908,7 +908,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 < 22; count1++) { + for (int count1 = 0; count1 <22; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -1435,7 +1435,7 @@ void get_tlm_fox() { if (loop % 32 == 0) { // was 8 printf("Sending MIN frame \n"); frm_type = 0x03; - for (int count1 = 0; count1 < 22; count1++) { + for (int count1 = 0; count1 <22; count1++) { if (count1 < 3) other[count1] = other_min[count1]; if (count1 < 8) { @@ -1449,7 +1449,7 @@ void get_tlm_fox() { if ((loop + 16) % 32 == 0) { // was 8 printf("Sending MAX frame \n"); frm_type = 0x02; - for (int count1 = 0; count1 < 22; count1++) { + for (int count1 = 0; count1 <22; count1++) { if (count1 < 3) other[count1] = other_max[count1]; if (count1 < 8) { From 0e5186603466343aca38cc59a2286faa4198271c Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:16:16 -0500 Subject: [PATCH 18/27] Update main.h changed to SENSOR_FIELDS --- main.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.h b/main.h index 6d72daf3..b0e39cd7 100644 --- a/main.h +++ b/main.h @@ -51,6 +51,7 @@ #define XS1 19 #define XS2 20 #define XS3 21 +#define SENSOR_FIELDS 25 #define RSSI 0 #define IHU_TEMP 2 @@ -150,7 +151,7 @@ float axis[3], angle[3], volts_max[3], amps_max[3], batt, speed, period, tempS, int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; -float voltage[9], current[9], sensor[22], other[3]; +float voltage[9], current[9], sensor[SENSOR_FIELDS], other[3]; char sensor_payload[500]; int test_i2c_bus(int bus); @@ -161,7 +162,7 @@ char pythonStr[100], pythonConfigStr[100], busStr[10]; int map[8] = {0, 1, 2, 3, 4, 5, 6, 7}; char src_addr[5] = ""; char dest_addr[5] = "APCSS"; -float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[22], sensor_min[22], other_max[3], other_min[3]; +float voltage_min[9], current_min[9], voltage_max[9], current_max[9], sensor_max[SENSOR_FIELDS], sensor_min[SENSOR_FIELDS], other_max[3], other_min[3]; int get_payload_serial(int debug_camera); int finished = FALSE; From bcedda0c3431ebdea2236183a9398849c6c37e73 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:18:13 -0500 Subject: [PATCH 19/27] Update main.h increased SENSOR_FIELDS to 26 --- main.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.h b/main.h index b0e39cd7..ae558a8a 100644 --- a/main.h +++ b/main.h @@ -47,11 +47,11 @@ #define GPS1 14 #define GPS2 15 #define GPS3 16 -#define DTEMP 17 -#define XS1 19 -#define XS2 20 -#define XS3 21 -#define SENSOR_FIELDS 25 +#define DTEMP 21 +#define XS1 23 +#define XS2 24 +#define XS3 25 +#define SENSOR_FIELDS 26 #define RSSI 0 #define IHU_TEMP 2 From 422371af1c6eef23bdd490f5eac74748e9577ef2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:18:46 -0500 Subject: [PATCH 20/27] Update main.c changed to SENSOR_FIELDS --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index d3137984..fd07adaa 100644 --- a/main.c +++ b/main.c @@ -567,7 +567,7 @@ int main(int argc, char * argv[]) { voltage_max[i] = -1000.0; current_max[i] = -1000.0; } - for (int i = 0; i <22; i++) { + for (int i = 0; i < SENSOR_FIELDS; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; // printf("Sensor min and max initialized!"); @@ -673,7 +673,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 <22; count1++) { + for (count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -712,7 +712,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -869,7 +869,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 <22; count1++) { + for (count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -908,7 +908,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -1435,7 +1435,7 @@ void get_tlm_fox() { if (loop % 32 == 0) { // was 8 printf("Sending MIN frame \n"); frm_type = 0x03; - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) other[count1] = other_min[count1]; if (count1 < 8) { @@ -1449,7 +1449,7 @@ void get_tlm_fox() { if ((loop + 16) % 32 == 0) { // was 8 printf("Sending MAX frame \n"); frm_type = 0x02; - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) other[count1] = other_max[count1]; if (count1 < 8) { From e0262da14bf145d4b4ba547d7a4a71829ddb0e27 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:27:08 -0500 Subject: [PATCH 21/27] Update main.h fixed DTEMP --- main.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.h b/main.h index ae558a8a..b820688c 100644 --- a/main.h +++ b/main.h @@ -34,23 +34,23 @@ #define MINUS_Y 5 #define PLUS_Z 6 #define MINUS_Z 7 -#define TEMP 2 +#define TEMP 2 // OK BME is positions 0 and 1 #define PRES 3 #define ALT 4 #define HUMI 5 -#define GYRO_X 7 +#define GYRO_X 7 // MPU6050 is posisition 6 #define GYRO_Y 8 #define GYRO_Z 9 #define ACCEL_X 10 #define ACCEL_Y 11 #define ACCEL_Z 12 -#define GPS1 14 +#define GPS1 14 // GPS is position 13 #define GPS2 15 #define GPS3 16 -#define DTEMP 21 -#define XS1 23 -#define XS2 24 -#define XS3 25 +#define DTEMP 18 // TMP is position 17 +#define XS1 20 // NEW user defined token will be position 19 +#define XS2 21 +#define XS3 22 #define SENSOR_FIELDS 26 #define RSSI 0 From d87dfb8b76be85d85604348f647669c2ff66f4cf Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:30:13 -0500 Subject: [PATCH 22/27] Update main.c fixed DTEMP --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index fd07adaa..679a7073 100644 --- a/main.c +++ b/main.c @@ -1588,10 +1588,10 @@ void get_tlm_fox() { encodeA(b_max, 42 + head_offset, (int)(sensor_max[GYRO_Y] + 0.5) + 2048); encodeB(b_max, 43 + head_offset, (int)(sensor_max[GYRO_Z] + 0.5) + 2048); - encodeA(b_max, 48 + head_offset, (int)(sensor_max[GPS1] * 10 + 0.5) + 2048); - encodeB(b_max, 49 + head_offset, (int)(sensor_max[GPS2] * 10 + 0.5) + 2048); + encodeA(b_max, 48 + head_offset, (int)(sensor_max[DTEMP] * 10 + 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)); - encodeA(b_max, 45 + head_offset, (int)(sensor_max[XS1] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[XS2] * 10 + 0.5)); } else { @@ -1644,7 +1644,7 @@ void get_tlm_fox() { encodeA(b_min, 48 + head_offset, (int)(sensor_min[DTEMP] * 10 + 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)); + encodeA(b_min, 45 + head_offset, (int)(sensor_min[XS2] * 10 + 0.5)); } else { @@ -1679,8 +1679,8 @@ void get_tlm_fox() { encodeA(b, 45 + head_offset, (int)(sensor[HUMI] * 10 + 0.5)); // in place of sensor1 encodeB(b, 46 + head_offset, PSUCurrent); - encodeA(b, 48 + head_offset, (int)(sensor[GPS1] * 10 + 0.5) + 2048); - encodeB(b, 49 + head_offset, (int)(sensor[GPS2] * 10 + 0.5) + 2048); + encodeA(b, 48 + head_offset, (int)(sensor[DTEMP] * 10 + 0.5) + 2048); + encodeB(b, 49 + head_offset, (int)(sensor[XS1] * 10 + 0.5) + 2048); FILE * command_count_file = fopen("/home/pi/CubeSatSim/command_count.txt", "r"); if (command_count_file != NULL) { From d1458169199c277fcf7549a548345328b8087265 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:34:32 -0500 Subject: [PATCH 23/27] Update main.c fix humidity max min --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 679a7073..3a39deed 100644 --- a/main.c +++ b/main.c @@ -1591,7 +1591,7 @@ void get_tlm_fox() { encodeA(b_max, 48 + head_offset, (int)(sensor_max[DTEMP] * 10 + 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)); - encodeA(b_max, 45 + head_offset, (int)(sensor_max[XS2] * 10 + 0.5)); + encodeA(b_max, 45 + head_offset, (int)(sensor_max[HUMI] * 10 + 0.5)); } else { @@ -1644,7 +1644,7 @@ void get_tlm_fox() { encodeA(b_min, 48 + head_offset, (int)(sensor_min[DTEMP] * 10 + 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[XS2] * 10 + 0.5)); + encodeA(b_min, 45 + head_offset, (int)(sensor_min[HUMI] * 10 + 0.5)); } else { From 7d4e62b60c5b37c9a1b158380393d0fba3106dc0 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 10:41:14 -0500 Subject: [PATCH 24/27] Update config fixed -T command and control setting --- config | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/config b/config index 9d74c031..e3a40b49 100755 --- a/config +++ b/config @@ -183,7 +183,7 @@ elif [ "$1" = "-h" ]; then 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 " -T Change command state" + echo " Change command and control state" echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change battery saver mode manually" echo " -q Change the Squelch setting for command receiver" @@ -449,29 +449,38 @@ elif [ "$1" = "-C" ]; then elif [ "$1" = "-T" ]; then echo - echo "Change command state" + echo "Change command and control state" echo - echo "Current command state is:" - cat /home/pi/CubeSatSim/command_tx - echo + FILE=/home/pi/CubeSatSim/command_control + if [ -f "$FILE" ]; then + echo "Radio command and control is ON" + echo "Do you want to turn command and control to OFF (y/n) " + read reset + echo + + if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then + echo "Command and control set to OFF" + sudo rm /home/pi/CubeSatSim/command_control + echo "rebooting" + sudo systemctl stop rpitx + sudo reboot now + fi + + else + echo "Radio command and control is OFF" + echo "Do you want to set beacon transmit 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 "rebooting" + sudo systemctl stop rpitx + sudo reboot now + fi - echo "Do you want to set beacon transmit to ON (y/n) " - read reset - echo - - if [ "$reset" = "y" ] || [ "$reset" = "yes" ] ; then - sudo sed -i 's/False/True/g' /home/pi/CubeSatSim/command_tx - echo "Command state set to True to enable beacon" - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now - else - sudo sed -i 's/True/False/g' /home/pi/CubeSatSim/command_tx - echo "Command state set to False to disable beacon" - echo "rebooting" - sudo systemctl stop rpitx - sudo reboot now fi elif [ "$1" = "-R" ]; then From d155f730a0dbbed5f6ef8ea6b1183a6a996caeab Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 10:44:54 -0500 Subject: [PATCH 25/27] Update config cleanup --- config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config b/config index e3a40b49..2a226ba8 100755 --- a/config +++ b/config @@ -455,6 +455,7 @@ elif [ "$1" = "-T" ]; 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 @@ -469,7 +470,8 @@ elif [ "$1" = "-T" ]; then else echo "Radio command and control is OFF" - echo "Do you want to set beacon transmit to ON (y/n) " + echo + echo "Do you want to set command and control to ON (y/n) " read reset echo From 18bea17904b7bc23624eec9de7c42bb6497dce38 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 10:53:06 -0500 Subject: [PATCH 26/27] Update config with message if invalid option chosen --- config | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config b/config index 2a226ba8..7f603977 100755 --- a/config +++ b/config @@ -183,7 +183,7 @@ elif [ "$1" = "-h" ]; then 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 " Change command and control state" + echo " -T Change command and control state" echo " -R Change the Commands Count in the file command_count.txt" echo " -B Change battery saver mode manually" echo " -q Change the Squelch setting for command receiver" @@ -712,6 +712,11 @@ elif [ "$1" = "-v" ]; then echo /home/pi/CubeSatSim/telem +else + echo + echo "Unknown option. Try config -h for a list of supported options." + echo + fi # sudo systemctl restart cubesatsim From cbb79bd4505adf83a2e1230012080235ab546eee Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 10:56:05 -0500 Subject: [PATCH 27/27] Update main.h sensor extension documentation --- main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.h b/main.h index b820688c..7e7a8507 100644 --- a/main.h +++ b/main.h @@ -34,7 +34,7 @@ #define MINUS_Y 5 #define PLUS_Z 6 #define MINUS_Z 7 -#define TEMP 2 // OK BME is positions 0 and 1 +#define TEMP 2 // OK and BME280 is positions 0 and 1 #define PRES 3 #define ALT 4 #define HUMI 5