print("If the board does not respond, unplug and re-plug the USB connector.",file=sys.stderr)
print("If the board does not respond, unplug and re-plug the USB connector.",file=sys.stderr)
try:
try:
send_fct=self.__send
ifuse_protocol_splitter_format:
send_fct=self.send_protocol_splitter_format
# try MAVLINK command first
# try MAVLINK command first
self.port.flush()
self.port.flush()
self.__send(uploader.MAVLINK_REBOOT_ID1)
send_fct(uploader.MAVLINK_REBOOT_ID1)
self.__send(uploader.MAVLINK_REBOOT_ID0)
send_fct(uploader.MAVLINK_REBOOT_ID0)
# then try reboot via NSH
# then try reboot via NSH
self.__send(uploader.NSH_INIT)
send_fct(uploader.NSH_INIT)
self.__send(uploader.NSH_REBOOT_BL)
send_fct(uploader.NSH_REBOOT_BL)
self.__send(uploader.NSH_INIT)
send_fct(uploader.NSH_INIT)
self.__send(uploader.NSH_REBOOT)
send_fct(uploader.NSH_REBOOT)
self.port.flush()
self.port.flush()
self.port.baudrate=self.baudrate_bootloader
self.port.baudrate=self.baudrate_bootloader
exceptException:
exceptException:
@ -726,9 +751,13 @@ def main():
parser.add_argument('--baud-flightstack',action="store",default="57600",help="Comma-separated list of baud rate of the serial port (default is 57600) when communicating with flight stack (Mavlink or NSH), only required for true serial ports.")
parser.add_argument('--baud-flightstack',action="store",default="57600",help="Comma-separated list of baud rate of the serial port (default is 57600) when communicating with flight stack (Mavlink or NSH), only required for true serial ports.")
parser.add_argument('--force',action='store_true',default=False,help='Override board type check, or silicon errata checks and continue loading')
parser.add_argument('--force',action='store_true',default=False,help='Override board type check, or silicon errata checks and continue loading')
parser.add_argument('--boot-delay',type=int,default=None,help='minimum boot delay to store in flash')
parser.add_argument('--boot-delay',type=int,default=None,help='minimum boot delay to store in flash')
parser.add_argument('--use-protocol-splitter-format',action='store_true',help='use protocol splitter format for reboot')
parser.add_argument('firmware',action="store",help="Firmware file to be uploaded")
parser.add_argument('firmware',action="store",help="Firmware file to be uploaded")
args=parser.parse_args()
args=parser.parse_args()
ifargs.use_protocol_splitter_format:
print("Using protocol splitter format to reboot pixhawk!")
# warn people about ModemManager which interferes badly with Pixhawk
# warn people about ModemManager which interferes badly with Pixhawk