Further updates for better debugging and reliability (hopefully!)

pull/16/head
Mark Jessop 2024-09-15 15:31:38 +09:30
rodzic e404294075
commit eb073db8ed
4 zmienionych plików z 13 dodań i 8 usunięć

Wyświetl plik

@ -97,6 +97,7 @@ class PacketTX(object):
if log_file != None:
self.log_file = open(log_file,'a')
print(f"Opened log file {log_file}")
self.log_file.write("Started Transmitting at %s\n" % datetime.datetime.utcnow().isoformat())
else:
self.log_file = None
@ -247,6 +248,7 @@ class PacketTX(object):
if self.log_file != None:
self.log_file.write(datetime.datetime.now().isoformat() + "," + log_string + "\n")
self.log_file.flush()
print(log_string)

Wyświetl plik

@ -269,9 +269,9 @@ class WenetPiCamera2(object):
# Resize image to the desired resolution.
self.debug_message("Resizing image.")
return_code = os.system("convert %s -resize %dx%d\! picam_temp.jpg" % (filename, self.tx_resolution[0], self.tx_resolution[1]))
return_code = os.system("timeout -k 5 60 convert %s -resize %dx%d\! picam_temp.jpg" % (filename, self.tx_resolution[0], self.tx_resolution[1]))
if return_code != 0:
self.debug_message("Resize operation failed!")
self.debug_message("Resize operation failed! (Possible kernel Oops? Maybe set arm_freq to 700 MHz)")
return "FAIL"
# Get non-extension part of filename.
@ -448,7 +448,7 @@ class WenetPiCamera2(object):
return -1
# Basic transmission test script.
# Basic transmission test script. TODO - Fix this, this is all incorrect..
if __name__ == "__main__":
import PacketTX
import argparse
@ -469,7 +469,7 @@ if __name__ == "__main__":
tx.start_tx()
picam = WenetPiCam(src_resolution=(1920,1088),
picam = WenetPiCamera2(src_resolution=(1920,1088),
tx_resolution=(1920,1088),
callsign=callsign,
num_images=5,

Wyświetl plik

@ -21,7 +21,7 @@ from radio_wrappers import *
parser = argparse.ArgumentParser()
parser.add_argument("callsign", default="N0CALL", help="Payload Callsign")
parser.add_argument("--gps", default="/dev/ttyACM0", help="uBlox GPS Serial port. Defaults to /dev/ttyACM0")
parser.add_argument("--gps", default="none", help="uBlox GPS Serial port. Defaults to /dev/ttyACM0")
parser.add_argument("--logo", default="none", help="Optional logo to overlay on image.")
parser.add_argument("--rfm98w", default=0, type=int, help="If set, configure a RFM98W on this SPI device number.")
parser.add_argument("--frequency", default=443.500, type=float, help="Transmit Frequency (MHz). (Default: 443.500 MHz)")
@ -175,7 +175,7 @@ def post_process_image(filename):
gps_string = ""
# Build up our imagemagick 'convert' command line
overlay_str = "convert %s -gamma 0.8 -font Helvetica -pointsize 40 -gravity North " % filename
overlay_str = "timeout -k 5 60 convert %s -gamma 0.8 -font Helvetica -pointsize 40 -gravity North " % filename
overlay_str += "-strokewidth 2 -stroke '#000C' -annotate +0+5 \"%s\" " % gps_string
overlay_str += "-stroke none -fill white -annotate +0+5 \"%s\" " % gps_string
# Add on logo overlay argument if we have been given one.
@ -185,7 +185,9 @@ def post_process_image(filename):
overlay_str += filename
tx.transmit_text_message("Adding overlays to image.")
os.system(overlay_str)
return_code = os.system(overlay_str)
if return_code != 0:
tx.transmit_text_message("Image Overlay operation failed! (Possible kernel Oops? Maybe set arm_freq to 700 MHz)")
return

Wyświetl plik

@ -1240,6 +1240,7 @@ if __name__ == "__main__":
parser.add_argument("--waitforlock", default=None, type=int, help="If set, exit after the GPS has obtained lock, or a timeout (in minutes) is reached.")
parser.add_argument("--lockcount", default=60, type=int, help="If waitforlock is specified, wait until the GPS reports lock for this many sequential fixes. Default: 60")
parser.add_argument("--locksats", default=None, type=int, help="If waitforlock is specified, also wait until the GPS reports this many SVs used in its solution. Default: None")
parser.add_argument("--ntp", action='store_true', default=False, help="Push time updates into NTPDSHM.")
parser.add_argument("-v", "--verbose", action='store_true', default=False, help="Show additional debug info.")
args = parser.parse_args()
@ -1288,7 +1289,7 @@ if __name__ == "__main__":
callback=gps_callback,
update_rate_ms=500,
dynamic_model=DYNAMIC_MODEL_AIRBORNE1G,
ntpd_update=False
ntpd_update=args.ntp
)
try: