From d9894c04a1132060326304575041ede35ee06d8d Mon Sep 17 00:00:00 2001 From: Peidong Liu Date: Fri, 13 Nov 2015 13:56:31 +0100 Subject: [PATCH 1/5] enabled solo-cli to flash pixhawk firmware from local drive --- soloutils/__main__.py | 1 + soloutils/flash.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/soloutils/__main__.py b/soloutils/__main__.py index d72a331..041f3d4 100644 --- a/soloutils/__main__.py +++ b/soloutils/__main__.py @@ -6,6 +6,7 @@ solo wifi --name= [--password=

] solo flash (drone|controller|both) (latest|current|factory|) [--clean] solo flash --list + solo flash pixhawk [--fileName=] solo provision solo resize solo logs (download) diff --git a/soloutils/flash.py b/soloutils/flash.py index bd0c19a..0e3fa45 100644 --- a/soloutils/flash.py +++ b/soloutils/flash.py @@ -218,6 +218,29 @@ def flash(target, firmware_file, firmware_md5, args): return code +def flash_px4(firmware_file): + errprinter('connecting to Solo...') + client = soloutils.connect_solo(await=True) + soloutils.command_stream(client, 'rm -rf /firmware/loaded') + + # Upload the files. + errprinter('uploading files...') + scp = SCPClient(client.get_transport()) + scp.put(firmware_file, '/firmware') + scp.close() + + # shutdown solo for firmware reflash + code = soloutils.command_stream(client, 'shutdown -r now') + errprinter('Solo will update once it reboots!') + + dt = datetime.today() + timedelta(minutes=4) + errprinter('please wait up to four minutes longer for the installation to complete (by {}).'.format(dt.strftime('%-I:%M'))) + + # Complete! + client.close() + + sys.exit(0) + def download_firmware(target, version): if target == 'controller': product = [1, 10] @@ -239,6 +262,11 @@ def main(args): list() return + if args['pixhawk']: + firmware_file=args['--fileName'] + flash_px4(firmware_file) + return + if args['both']: group = 'Solo and the Controller' if args['drone']: From 51b958c4bb262dd739868301cea86274b615a7fc Mon Sep 17 00:00:00 2001 From: ladmin Date: Sat, 14 Nov 2015 13:58:19 +0100 Subject: [PATCH 2/5] change command to solo flash pixhawk --- soloutils/__main__.py | 2 +- soloutils/flash.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/soloutils/__main__.py b/soloutils/__main__.py index 041f3d4..d131d78 100644 --- a/soloutils/__main__.py +++ b/soloutils/__main__.py @@ -6,7 +6,7 @@ solo wifi --name= [--password=

] solo flash (drone|controller|both) (latest|current|factory|) [--clean] solo flash --list - solo flash pixhawk [--fileName=] + solo flash pixhawk solo provision solo resize solo logs (download) diff --git a/soloutils/flash.py b/soloutils/flash.py index 0e3fa45..079d891 100644 --- a/soloutils/flash.py +++ b/soloutils/flash.py @@ -263,9 +263,10 @@ def main(args): return if args['pixhawk']: - firmware_file=args['--fileName'] - flash_px4(firmware_file) - return + if args['']: + firmware_file = args[''] + flash_px4(firmware_file) + return if args['both']: group = 'Solo and the Controller' From c0c48d2eb3b7279fdcdeb78764488a1ddb97368d Mon Sep 17 00:00:00 2001 From: ladmin Date: Sat, 14 Nov 2015 14:00:36 +0100 Subject: [PATCH 3/5] updated README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c3d607..9cb0941 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Usage: solo wifi --name= [--password=

] solo flash (drone|controller|both) (latest|current|factory|) [--clean] solo flash --list + solo flash pixhawk solo provision solo resize solo logs (download) From 4c1586b8b2ad10694f0e659aa71a1e8b13168b47 Mon Sep 17 00:00:00 2001 From: Peidong Liu Date: Mon, 16 Nov 2015 12:43:49 +0100 Subject: [PATCH 4/5] modified git flash pixhawk --- soloutils/flash.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soloutils/flash.py b/soloutils/flash.py index 079d891..99a2bd1 100644 --- a/soloutils/flash.py +++ b/soloutils/flash.py @@ -231,6 +231,7 @@ def flash_px4(firmware_file): # shutdown solo for firmware reflash code = soloutils.command_stream(client, 'shutdown -r now') + #code = soloutils.command_stream(client, 'loadPixhawk.py') errprinter('Solo will update once it reboots!') dt = datetime.today() + timedelta(minutes=4) @@ -266,7 +267,7 @@ def main(args): if args['']: firmware_file = args[''] flash_px4(firmware_file) - return + return if args['both']: group = 'Solo and the Controller' From 9cb76e147d76cfed597d2d260beed303877b8020 Mon Sep 17 00:00:00 2001 From: Peidong Liu Date: Mon, 16 Nov 2015 12:57:47 +0100 Subject: [PATCH 5/5] flash pixhawk without reboot --- soloutils/flash.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/soloutils/flash.py b/soloutils/flash.py index 99a2bd1..bf3cadd 100644 --- a/soloutils/flash.py +++ b/soloutils/flash.py @@ -230,12 +230,12 @@ def flash_px4(firmware_file): scp.close() # shutdown solo for firmware reflash - code = soloutils.command_stream(client, 'shutdown -r now') - #code = soloutils.command_stream(client, 'loadPixhawk.py') - errprinter('Solo will update once it reboots!') - - dt = datetime.today() + timedelta(minutes=4) - errprinter('please wait up to four minutes longer for the installation to complete (by {}).'.format(dt.strftime('%-I:%M'))) + #code = soloutils.command_stream(client, 'shutdown -r now') + code = soloutils.command_stream(client, 'loadPixhawk.py') + #errprinter('Solo will update once it reboots!') + errprinter('Pixhawk has been updated to new firmware') + #dt = datetime.today() + timedelta(minutes=4) + #errprinter('please wait up to four minutes longer for the installation to complete (by {}).'.format(dt.strftime('%-I:%M'))) # Complete! client.close()