Update transmit.py camera_photo function, -q 2

fc-jy-img
Alan Johnston 11 months ago committed by GitHub
parent a5a0f1a8a1
commit 024e2cdf32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -135,6 +135,33 @@ def increment_mode():
except: except:
print("can't write to .mode file") print("can't write to .mode file")
def camera_photo():
system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
print("Photo taken")
file='/home/pi/CubeSatSim/camera_out.jpg'
font1 = ImageFont.truetype('DejaVuSerif.ttf', 20)
font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16)
try:
filep = open("/home/pi/CubeSatSim/telem_string.txt")
telem_string = filep.readline()
except:
telem_string = ""
if (debug_mode == 1):
print("Can't read telem_string.txt")
print(telem_string)
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((12, 12), callsign, font=font1, fill='black')
draw.text((10, 10), callsign, font=font1, fill='white')
draw.text((122, 12), telem_string, font=font2, fill='black')
draw.text((120, 10), telem_string, font=font2, fill='white')
img.save(file)
print("CubeSatSim v2.0 transmit.py starting...") print("CubeSatSim v2.0 transmit.py starting...")
@ -580,32 +607,32 @@ if __name__ == "__main__":
print("image 2 did not load - copy from CubeSatSim/sstv directory") print("image 2 did not load - copy from CubeSatSim/sstv directory")
while 1: while 1:
# command_control_check() # command_control_check()
camera_photo()
system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
print("Photo taken") ## print("Photo taken")
##
file='/home/pi/CubeSatSim/camera_out.jpg' ## file='/home/pi/CubeSatSim/camera_out.jpg'
font1 = ImageFont.truetype('DejaVuSerif.ttf', 20) ## font1 = ImageFont.truetype('DejaVuSerif.ttf', 20)
font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16) ## font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16)
##
try: ## try:
filep = open("/home/pi/CubeSatSim/telem_string.txt") ## filep = open("/home/pi/CubeSatSim/telem_string.txt")
telem_string = filep.readline() ## telem_string = filep.readline()
except: ## except:
telem_string = "" ## telem_string = ""
if (debug_mode == 1): ## if (debug_mode == 1):
print("Can't read telem_string.txt") ## print("Can't read telem_string.txt")
print(telem_string) ## print(telem_string)
##
img = Image.open(file) ## img = Image.open(file)
draw = ImageDraw.Draw(img) ## draw = ImageDraw.Draw(img)
# draw.text((10, 10), callsign, font=font2, fill='white') # 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((12, 12), callsign, font=font1, fill='black')
draw.text((10, 10), callsign, font=font1, fill='white') ## draw.text((10, 10), callsign, font=font1, fill='white')
draw.text((122, 12), telem_string, font=font2, fill='black') ## draw.text((122, 12), telem_string, font=font2, fill='black')
draw.text((120, 10), telem_string, font=font2, fill='white') ## draw.text((120, 10), telem_string, font=font2, fill='white')
img.save(file) ## img.save(file)
# command_control_check() # command_control_check()
@ -786,9 +813,10 @@ if __name__ == "__main__":
image_present = False image_present = False
if (image_present == False): if (image_present == False):
system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") camera_photo()
print("Photo taken") ## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 3 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin") ## print("Photo taken")
system("/home/pi/ssdv/ssdv -e -n -i " + str(image_index) + " -q 2 -J /home/pi/CubeSatSim/camera_out.jpg /home/pi/CubeSatSim/image_file.bin")
print("image_index " + str(image_index) + "\n") print("image_index " + str(image_index) + "\n")
image_index = ( image_index + 1 ) % 256 image_index = ( image_index + 1 ) % 256
sleep(2) sleep(2)

Loading…
Cancel
Save

Powered by TurnKey Linux.