def manage_firmware_updates(self, device): """ Update Piksi firmware. Erase entire STM flash (other than bootloader) if so directed. Flash NAP only if new firmware is available. """ self.updating = True update_nap = False self._write('') if not self.is_v2: self.manage_multi_firmware_update() self.updating = False return elif device == "STM": self.manage_stm_firmware_update() elif device == "M25": update_nap = self.manage_nap_firmware_update() else: self.manage_stm_firmware_update() update_nap = self.manage_nap_firmware_update(check_version=True) # Must tell Piksi to jump to application after updating firmware. if device == "STM" or update_nap: self.link(MsgBootloaderJumpToApp(jump=0)) self._write("Firmware update finished.") self._write("") self.updating = False
def _deprecated_handshake_callback(self, sbp_msg, **metadata): if len(sbp_msg.payload) == 1 and struct.unpack( 'B', sbp_msg.payload[0]) == 0: self.diagnostics['versions']['bootloader'] = "v0.1" else: self.diagnostics['versions']['bootloader'] = sbp_msg.payload self.handshake_received = True self.link(MsgBootloaderJumpToApp(jump=0))
def _handshake_callback(self, sbp_msg, **metadata): msg = MsgBootloaderHandshakeDevice(sbp_msg) self.diagnostics['versions']['bootloader'] = msg.version self.handshake_received = True self.link(MsgBootloaderJumpToApp(jump=0))
def jump_to_app(self): """ Request Piksi bootloader jump to application. """ self.link(MsgBootloaderJumpToApp(jump=0))