@@ -152,15 +152,12 @@ def __init__(self):
152152 self .imu = self .pipeline .create (dai .node .IMU )
153153 self .xoutIMU = self .pipeline .create (dai .node .XLinkOut )
154154 self .xoutIMU .setStreamName ("IMU" )
155- if 'lite' in test_type :
156- self .imu .enableFirmwareUpdate (True )
155+ self .imu .enableFirmwareUpdate (True )
157156 self .imu .enableIMUSensor (dai .IMUSensor .ACCELEROMETER_RAW , 500 )
158157 self .imu .setBatchReportThreshold (1 )
159158 self .imu .setMaxBatchReports (10 )
160159 self .imu .out .link (self .xoutIMU .input )
161160
162-
163-
164161 self .videoEnc = self .pipeline .create (dai .node .VideoEncoder )
165162 self .camRgb .video .link (self .videoEnc .input )
166163 self .xoutJpeg = self .pipeline .create (dai .node .XLinkOut )
@@ -957,14 +954,16 @@ def setupUi(self):
957954 self .update_imu = True
958955 self .timer = QtCore .QTimer ()
959956 self .timer .timeout .connect (self .set_result )
960- self .timer .start (1000 // FPS )
957+ self .timer .start (100 )
961958
962959 # self.connect_timer = QtCore.QTimer()
963960 # self.connect_timer.connect(test_connexion)
964961 # self.timer.stop()
965962
966963 self .threadpool = QThreadPool ()
967964 self .scanning = False
965+ self .last_progress_val = 0.0
966+ self .cycle = 0
968967
969968 def retranslateUi (self , UI_tests ):
970969 _translate = QtCore .QCoreApplication .translate
@@ -1076,11 +1075,11 @@ def connexion_slot(self, signal):
10761075 self .print_logs ('No camera detected, check the connexion and try again...' , 'ERROR' )
10771076 return
10781077 self .print_logs ('Camera connected, starting tests...' , 'GREEN' )
1079- # self.connect_but.setText("FLASHING")
1080- # self.connect_but.adjustSize()
1081- # self.connect_but.setChecked(False)
1082- # self.connect_but.setCheckable(False)
1083- # self.connect_but.setEnabled(False)
1078+ self .connect_but .setText ("FLASHING" )
1079+ self .connect_but .adjustSize ()
1080+ self .connect_but .setChecked (False )
1081+ self .connect_but .setCheckable (False )
1082+ self .connect_but .setEnabled (False )
10841083 # Update BL if PoE
10851084 # if test_type == 'OAK-D-PRO-POE':
10861085 eeprom_written = False
@@ -1093,7 +1092,12 @@ def connexion_slot(self, signal):
10931092 usbBootHeader = [77 , 65 , 50 , 120 , 176 , 0 , 0 , 0 , 128 , 10 , 0 , 0 ,
10941093 0 , 0 , 0 , 0 , 0 , 58 , 32 , 95 , 6 , 0 , 0 , 0 , 0 ]
10951094 self .print_logs ('NOR flash: writing USB boot header...' )
1096- device .flashWrite (usbBootHeader )
1095+ try :
1096+ device .flashWrite (usbBootHeader )
1097+ except RuntimeError as ex :
1098+ self .print_logs (f'SPI Flash failed! - { ex } ' , log_level = 'ERROR' )
1099+ self .update_imu = False
1100+ return
10971101 self .print_logs ('Programmed, data: ' + str (device .flashRead (len (usbBootHeader ))))
10981102
10991103 if not eeprom_written :
@@ -1107,18 +1111,19 @@ def connexion_slot(self, signal):
11071111
11081112 except RuntimeError as ex :
11091113 self .print_logs (f"Something went wrong, check connexion! - { ex } " , log_level = 'ERROR' )
1114+ self .update_imu = False
11101115 return
11111116 # self.update_imu = True
1112- # if imu_upgrade:
1113- # self.depth_camera.device.setLogLevel(dai.LogLevel.INFO)
1114- # self.depth_camera.device.addLogCallback(self.logMonitorImuFwUpdateCallback)
1115- # else:
1116- self .connect_but .setChecked (False )
1117- self .connect_but .setCheckable (True )
1118- self .connect_but .setEnabled (True )
1119- self .connect_but .setText ('DISCONNECT AND SAVE' )
1120- self .connect_but .adjustSize ()
1121- self .update_imu = True
1117+ if imu_upgrade :
1118+ self .depth_camera .device .setLogLevel (dai .LogLevel .INFO )
1119+ self .depth_camera .device .addLogCallback (self .logMonitorImuFwUpdateCallback )
1120+ else :
1121+ self .connect_but .setChecked (False )
1122+ self .connect_but .setCheckable (True )
1123+ self .connect_but .setEnabled (True )
1124+ self .connect_but .setText ('DISCONNECT AND SAVE' )
1125+ self .connect_but .adjustSize ()
1126+ self .update_imu = True
11221127 location = WIDTH , 0
11231128 self .rgb = Camera (lambda : self .depth_camera .get_image ('RGB' ), colorMode , 'RGB Preview' , location )
11241129 self .rgb .show ()
@@ -1153,6 +1158,13 @@ def connexion_slot(self, signal):
11531158
11541159 def set_result (self ):
11551160 global update_res
1161+ if not self .connect_but .isCheckable () and self .prog_bar .value () == self .last_progress_val :
1162+ self .cycle += 1
1163+ else :
1164+ self .cycle = 0
1165+ self .last_progress_val = self .prog_bar .value ()
1166+ if self .cycle >= 100 :
1167+ self .update_imu = False
11561168 if not self .update_imu :
11571169 self .connect_but .setChecked (False )
11581170 self .connect_but .setCheckable (True )
0 commit comments