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) diff --git a/soloutils/__main__.py b/soloutils/__main__.py index d72a331..d131d78 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 solo provision solo resize solo logs (download) diff --git a/soloutils/flash.py b/soloutils/flash.py index bd0c19a..bf3cadd 100644 --- a/soloutils/flash.py +++ b/soloutils/flash.py @@ -218,6 +218,30 @@ 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') + 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() + + sys.exit(0) + def download_firmware(target, version): if target == 'controller': product = [1, 10] @@ -239,6 +263,12 @@ def main(args): list() return + if args['pixhawk']: + if args['']: + firmware_file = args[''] + flash_px4(firmware_file) + return + if args['both']: group = 'Solo and the Controller' if args['drone']: