def __init__(self, *args, **kwargs): try: update = kwargs.pop('update') except KeyError: update = True self.console_output = OutputStream() sys.stdout = self.console_output sys.stderr = self.console_output self.log_file = None log = kwargs.pop('log') reset = kwargs.pop('reset') try: self.link = serial_link.SerialLink(*args, **kwargs) self.link.add_callback(ids.PRINT, self.print_message_callback) self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback) # Setup logging if log: log_name = serial_link.generate_log_filename() self.log_file = open(log_name, 'w+') print "Logging at %s." % log_name self.link.add_global_callback(serial_link.default_log_callback(self.log_file)) if reset: self.link.send_message(ids.RESET, '') settings_read_finished_functions = [] self.tracking_view = TrackingView(self.link) self.solution_view = SolutionView(self.link) self.baseline_view = BaselineView(self.link) self.observation_view = ObservationView(self.link, name='Rover', relay=False) self.observation_view_base = ObservationView(self.link, name='Base', relay=True) self.system_monitor_view = SystemMonitorView(self.link) self.update_view = UpdateView(self.link, prompt=update) settings_read_finished_functions.append(self.update_view.compare_versions) self.settings_view = \ SettingsView(self.link, settings_read_finished_functions) self.update_view.settings = self.settings_view.settings self.python_console_env = { 'send_message': self.link.send_message, 'link': self.link, } self.python_console_env.update(self.tracking_view.python_console_cmds) self.python_console_env.update(self.solution_view.python_console_cmds) self.python_console_env.update(self.baseline_view.python_console_cmds) self.python_console_env.update(self.observation_view.python_console_cmds) self.python_console_env.update(self.system_monitor_view.python_console_cmds) self.python_console_env.update(self.update_view.python_console_cmds) self.python_console_env.update(self.settings_view.python_console_cmds) except: import traceback traceback.print_exc()
def __init__(self, link, download_dir=None, prompt=True, serial_upgrade=False): """ Traits tab with UI for updating Piksi firmware. Parameters ---------- link : sbp.client.handler.Handler Link for SBP transfer to/from Piksi. prompt : bool Prompt user to update console/firmware if out of date. """ self.link = link self.settings = {} self.prompt = prompt self.python_console_cmds = {'update': self} try: self.update_dl = UpdateDownloader() if download_dir: self.update_dl.set_root_path(download_dir) except URLError: self.update_dl = None pass self.erase_en = True self.stm_fw = FirmwareFileDialog('bin') self.stm_fw.on_trait_change(self._manage_enables, 'status') self.nap_fw = FirmwareFileDialog('M25') self.nap_fw.on_trait_change(self._manage_enables, 'status') self.stream = OutputStream() self.serial_upgrade = serial_upgrade self.last_call_fw_version = None if not self.serial_upgrade: self._write( "1. Insert the USB flash drive provided with your Piki Multi into " "your computer. Select the flash drive root directory as the " "firmware download destination using the \"Please " "choose a directory for downloaded firmware files\" directory " "chooser above. Press the \"Download Latest Firmware\" button. " "This will download the latest Piksi Multi firmware file onto the " "USB flashdrive.\n" "2. Eject the drive from your computer and plug it " "into the Piksi Multi evaluation board.\n" "3. Reset your Piksi Multi and it will upgrade to the version " "on the USB flash drive. This should take less than 5 minutes.\n" "4. When the upgrade completes you will be prompted to remove the " "USB flash drive and reset your Piksi Multi.\n" "5. Verify that the firmware version has upgraded via inspection " "of the Current Firmware Version box on the Firmware Update Tab " "of the Swift Console.\n")
def __init__(self, link, update): self.console_output = OutputStream() sys.stdout = self.console_output sys.stderr = self.console_output try: self.link = link self.link.add_callback(self.print_message_callback, SBP_MSG_PRINT) self.link.add_callback(self.debug_var_callback, SBP_MSG_DEBUG_VAR) self.link.add_callback(self.ext_event_callback, SBP_MSG_EXT_EVENT) self.link.start() settings_read_finished_functions = [] self.tracking_view = TrackingView(self.link) self.solution_view = SolutionView(self.link) self.baseline_view = BaselineView(self.link) self.observation_view = ObservationView(self.link, name='Rover', relay=False) self.observation_view_base = ObservationView(self.link, name='Base', relay=True) self.system_monitor_view = SystemMonitorView(self.link) self.update_view = UpdateView(self.link, prompt=update) settings_read_finished_functions.append(self.update_view.compare_versions) # Once we have received the settings, update device_serial with the Piksi # serial number which will be displayed in the window title def update_serial(): serial_string = self.settings_view.settings['system_info']['serial_number'].value self.device_serial = 'PK%04d' % int(serial_string) settings_read_finished_functions.append(update_serial) self.settings_view = \ SettingsView(self.link, settings_read_finished_functions) self.update_view.settings = self.settings_view.settings self.python_console_env = { 'send_message': self.link.send, 'link': self.link, } self.python_console_env.update(self.tracking_view.python_console_cmds) self.python_console_env.update(self.solution_view.python_console_cmds) self.python_console_env.update(self.baseline_view.python_console_cmds) self.python_console_env.update(self.observation_view.python_console_cmds) self.python_console_env.update(self.system_monitor_view.python_console_cmds) self.python_console_env.update(self.update_view.python_console_cmds) self.python_console_env.update(self.settings_view.python_console_cmds) except: import traceback traceback.print_exc()
def __init__(self, link, prompt=True): self.link = link self.settings = {} self.prompt = prompt self.python_console_cmds = { 'update': self } self.update_dl = None self.stm_fw = IntelHexFileDialog('STM') self.stm_fw.on_trait_change(self._manage_enables, 'status') self.nap_fw = IntelHexFileDialog('M25') self.nap_fw.on_trait_change(self._manage_enables, 'status') self.stream = OutputStream() self.get_latest_version_info()
def __init__(self, port=serial_link.DEFAULT_PORT): self.console_output = OutputStream() self.link = serial_link.SerialLink(port) self.link.add_callback(serial_link.MSG_PRINT, self.print_message_callback) self.tracking_view = TrackingView(self.link) self.almanac_view = AlmanacView(self.link) self.solution_view = SolutionView(self.link) self.flash = flash.Flash(self.link) self.flash.start() self.python_console_env = { 'send_message': self.link.send_message, 'link': self.link, 'flash': self.flash } self.python_console_env.update(self.tracking_view.python_console_cmds) self.python_console_env.update(self.almanac_view.python_console_cmds) self.python_console_env.update(self.solution_view.python_console_cmds)
def __init__(self, link, prompt=True): """ Traits tab with UI for updating Piksi firmware. Parameters ---------- link : sbp.client.handler.Handler Link for SBP transfer to/from Piksi. prompt : bool Prompt user to update console/firmware if out of date. """ self.link = link self.settings = {} self.prompt = prompt self.python_console_cmds = {'update': self} self.update_dl = None self.stm_fw = IntelHexFileDialog('STM') self.stm_fw.on_trait_change(self._manage_enables, 'status') self.nap_fw = IntelHexFileDialog('M25') self.nap_fw.on_trait_change(self._manage_enables, 'status') self.stream = OutputStream() self.get_latest_version_info()
def __init__(self, *args, **kwargs): try: update = kwargs.pop('update') except KeyError: update = True self.console_output = OutputStream() sys.stdout = self.console_output sys.stderr = self.console_output try: self.link = serial_link.SerialLink(*args, **kwargs) self.link.add_callback(ids.PRINT, self.print_message_callback) self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback) settings_read_finished_functions = [] self.tracking_view = TrackingView(self.link) self.almanac_view = AlmanacView(self.link) self.solution_view = SolutionView(self.link) self.baseline_view = BaselineView(self.link) self.observation_view = ObservationView(self.link, name='Rover', relay=False) self.observation_view_base = ObservationView(self.link, name='Base', relay=True) self.system_monitor_view = SystemMonitorView(self.link) self.simulator_view = SimulatorView(self.link) self.settings_view = SettingsView(self.link) if update: self.ocu = OneClickUpdate(self.link, self.console_output) settings_read_finished_functions.append(self.ocu.start) self.settings_view = \ SettingsView(self.link, settings_read_finished_functions) if update: self.ocu.point_to_settings(self.settings_view.settings) self.python_console_env = { 'send_message': self.link.send_message, 'link': self.link, } self.python_console_env.update( self.tracking_view.python_console_cmds) self.python_console_env.update( self.almanac_view.python_console_cmds) self.python_console_env.update( self.solution_view.python_console_cmds) self.python_console_env.update( self.baseline_view.python_console_cmds) self.python_console_env.update( self.observation_view.python_console_cmds) self.python_console_env.update( self.system_monitor_view.python_console_cmds) except: import traceback traceback.print_exc()