mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
px_uploader: fixed a couple small PEP8 warnings
This commit is contained in:
@@ -74,6 +74,7 @@ if sys.version_info[0] < 3:
|
|||||||
else:
|
else:
|
||||||
runningPython3 = True
|
runningPython3 = True
|
||||||
|
|
||||||
|
|
||||||
class firmware(object):
|
class firmware(object):
|
||||||
'''Loads a firmware file'''
|
'''Loads a firmware file'''
|
||||||
|
|
||||||
@@ -226,7 +227,6 @@ class uploader(object):
|
|||||||
except serial.SerialException:
|
except serial.SerialException:
|
||||||
# if open fails, try again later
|
# if open fails, try again later
|
||||||
time.sleep(0.04)
|
time.sleep(0.04)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -507,7 +507,7 @@ class uploader(object):
|
|||||||
for byte in range(0, 32*6, 4):
|
for byte in range(0, 32*6, 4):
|
||||||
x = self.__getOTP(byte)
|
x = self.__getOTP(byte)
|
||||||
self.otp = self.otp + x
|
self.otp = self.otp + x
|
||||||
#print(binascii.hexlify(x).decode('Latin-1') + ' ', end='')
|
# print(binascii.hexlify(x).decode('Latin-1') + ' ', end='')
|
||||||
# see src/modules/systemlib/otp.h in px4 code:
|
# see src/modules/systemlib/otp.h in px4 code:
|
||||||
self.otp_id = self.otp[0:4]
|
self.otp_id = self.otp[0:4]
|
||||||
self.otp_idtype = self.otp[4:5]
|
self.otp_idtype = self.otp[4:5]
|
||||||
@@ -555,7 +555,7 @@ class uploader(object):
|
|||||||
|
|
||||||
if self.fw_maxsize > fw.property('image_maxsize') and not force:
|
if self.fw_maxsize > fw.property('image_maxsize') and not force:
|
||||||
raise RuntimeError("Board can accept larger flash images (%u bytes) than board config (%u bytes). Please use the correct board configuration to avoid lacking critical functionality."
|
raise RuntimeError("Board can accept larger flash images (%u bytes) than board config (%u bytes). Please use the correct board configuration to avoid lacking critical functionality."
|
||||||
% (self.fw_maxsize, fw.property('image_maxsize')))
|
% (self.fw_maxsize, fw.property('image_maxsize')))
|
||||||
else:
|
else:
|
||||||
# If we're still on bootloader v4 on a Pixhawk, we don't know if we
|
# If we're still on bootloader v4 on a Pixhawk, we don't know if we
|
||||||
# have the silicon errata and therefore need to flash px4fmu-v2
|
# have the silicon errata and therefore need to flash px4fmu-v2
|
||||||
@@ -620,7 +620,7 @@ class uploader(object):
|
|||||||
self.__send(uploader.NSH_REBOOT)
|
self.__send(uploader.NSH_REBOOT)
|
||||||
self.port.flush()
|
self.port.flush()
|
||||||
self.port.baudrate = self.baudrate_bootloader
|
self.port.baudrate = self.baudrate_bootloader
|
||||||
except:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
self.port.flush()
|
self.port.flush()
|
||||||
self.port.baudrate = self.baudrate_bootloader
|
self.port.baudrate = self.baudrate_bootloader
|
||||||
@@ -784,6 +784,7 @@ def main():
|
|||||||
print("\n Upload aborted by user.")
|
print("\n Upload aborted by user.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user