def on_flash_firmware(self, widget=None, data=None):
        app = get_app()
        try:
            connected = self.proxy != None
            if not connected:
                self.check_device_name_and_version()
            if connected:
                port = self.proxy.port
                # disconnect
                del self.proxy
                self.proxy = None

                from arduino_helpers.upload import upload
                from base_node_rpc import get_firmwares

                logger.info(upload('uno', lambda b: get_firmwares()[b][0], port))
                app.main_window_controller.info("Firmware updated successfully.",
                                                "Firmware update")
        except Exception, why:
            logger.error("Problem flashing firmware. ""%s" % why)
예제 #2
0
from arduino_helpers.upload import upload, parse_args

from .. import get_firmwares


if __name__ == '__main__':
    args = parse_args()

    print upload(args.board_name, lambda b: get_firmwares()[b][0], args.port,
                 args.arduino_install_home, verify=not args.skip_verify)
예제 #3
0
import sys
from collections import OrderedDict

from arduino_helpers.upload import get_arg_parser, upload
from .. import get_firmwares


def parse_args(firmwares, argv=None):
    if argv is None:
        argv = sys.argv[1:]

    parser = get_arg_parser()
    parser.add_argument('board_version', nargs='?', choices=firmwares,
                        default=firmwares[-1])

    return parser.parse_args(argv)


if __name__ == '__main__':
    firmware_versions = [(p.parent.name.replace('_', '.'), p)
                         for p in get_firmwares()['mega2560']]
    firmware_versions.sort()
    firmwares = OrderedDict(firmware_versions)
    args = parse_args(firmwares.keys())

    print upload(args.board_name, lambda b: firmwares[args.board_version], args.port,
                 args.arduino_install_home, verify=not args.skip_verify)
예제 #4
0
from arduino_helpers.upload import upload, parse_args

from .. import get_firmwares

if __name__ == '__main__':
    args = parse_args()

    print upload(args.board_name,
                 lambda b: get_firmwares()[0],
                 args.port,
                 args.arduino_install_home,
                 verify=not args.skip_verify)