From b888ffe97a2db2d185abc5c52626135804f8999e Mon Sep 17 00:00:00 2001 From: caternuson Date: Wed, 3 Aug 2016 08:36:26 -0700 Subject: [PATCH] added more LCD messages, set LED on --- boot_menu.py | 2 +- camera_server.py | 17 ++++++++++++++--- campi.py | 12 ++++++------ templates/configure.html | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/boot_menu.py b/boot_menu.py index 729bb33..4cb1869 100755 --- a/boot_menu.py +++ b/boot_menu.py @@ -15,7 +15,7 @@ import campi camera = campi.Campi() -#camera.LCD_LED_On() +camera.LCD_LED_On() selection = 1 diff --git a/camera_server.py b/camera_server.py index 8418b66..cba6a7d 100755 --- a/camera_server.py +++ b/camera_server.py @@ -24,7 +24,7 @@ camera = campi.Campi() camera.set_cam_config("resolution",(1920, 1080)) -#camera.LCD_LED_On() +camera.LCD_LED_On() # timelapse control thread timelapse = None @@ -104,8 +104,16 @@ def send_status(self, ): if timelapse == None: return status = timelapse.get_status() - camera.disp_msg("Timelapse Running. {0} of {1}".format( - status['image_count'], status['total_imgs'])) + if status['is_alive']: + camera.disp_msg(' Timelapse '+\ + ' running... '+\ + ' {0} of {1} '.format( + status['image_count'], + status['total_imgs']) + ) + else: + camera.disp_msg(' Timelapse '+\ + ' DONE ') self.write_message(json.dumps(status)) class TimelapseCancelHandler(tornado.web.RequestHandler): @@ -232,4 +240,7 @@ def __init__(self): if __name__ == '__main__': tornado.httpserver.HTTPServer(MainServerApp()).listen(PORT) print "Server started on port {0}.".format(PORT) + camera.disp_msg(' '+\ + ' SERVER '+\ + ' STARTED ') tornado.ioloop.IOLoop.instance().start() diff --git a/campi.py b/campi.py index af1741d..4810359 100755 --- a/campi.py +++ b/campi.py @@ -156,7 +156,7 @@ def capture_with_histogram(self, filename, fill=False): im_in = Image.open(hname) im_out = Image.new('RGBA', im_in.size) im_out.paste(im_in) - width, height = im_in.size + width, height = im_out.size draw = ImageDraw.Draw(im_out) # add rule of thirds lines @@ -185,14 +185,14 @@ def capture_with_histogram(self, filename, fill=False): bl.append((int(i*xs),height-int(bh[i]*ys))) # draw it - lw = max(5,int((0.005*max(im_out.size)))) + lw = int((0.01*max(im_out.size))) if (fill): rpoly = [(0,height)] + rl + [(width,height)] gpoly = [(0,height)] + gl + [(width,height)] bpoly = [(0,height)] + bl + [(width,height)] - draw.polygon(rpoly, fill=(255,0,0,90)) - draw.polygon(gpoly, fill=(0,255,0,90)) - draw.polygon(bpoly, fill=(0,0,255,90)) + draw.polygon(rpoly, fill=(255,0,0,40)) + draw.polygon(gpoly, fill=(0,255,0,40)) + draw.polygon(bpoly, fill=(0,0,255,40)) draw.line(rl, fill='red', width=lw) draw.line(gl, fill='green', width=lw) draw.line(bl, fill='blue', width=lw) @@ -213,7 +213,7 @@ def capture_with_histogram(self, filename, fill=False): draw.text((10,10+N*fh), line, font=font) N += 1 - # save it and clean up + # save it and clean up im_out.save(filename, quality=95) os.remove(hname) diff --git a/templates/configure.html b/templates/configure.html index 817b2fb..c9371ab 100755 --- a/templates/configure.html +++ b/templates/configure.html @@ -132,7 +132,7 @@ return power_down(); }); $("#preview").attr("src","static/test_pattern.jpg") - send_config(JSON.parse('{% raw config %}')); + update_ui(JSON.parse('{% raw config %}')); }); function send_config() {