Skip to content

Commit bab31b2

Browse files
committed
fix crash
1 parent 40d6204 commit bab31b2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

PiSideCode/camera/camera_info.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,19 @@ def get(self, control_name: str):
183183
def get_format(self) -> None:
184184
try:
185185
curr_format = self.controller.get_format()
186-
except FileNotFoundError:
187-
CameraInfo.logger.fatal(f"Camera {self.identifier} disconnected. Cannot read information.")
186+
self.valid_frame_rates = {
187+
round(1 / float(i)): i
188+
for i in self.controller.get_available_frame_intervals(*curr_format)
189+
}
188190

189-
self.valid_frame_rates = {
190-
round(1 / float(i)): i
191-
for i in self.controller.get_available_frame_intervals(*curr_format)
192-
}
191+
self.frame_rate = round(1 / float(self.controller.get_frame_interval()))
193192

194-
self.frame_rate = round(1 / float(self.controller.get_frame_interval()))
193+
self.color_format = curr_format[0].description
194+
self.resolution: tuple[int, int] = (curr_format[1].width, curr_format[1].height)
195+
196+
except FileNotFoundError:
197+
CameraInfo.logger.fatal(f"Camera {self.identifier} disconnected. Cannot read information.")
195198

196-
self.color_format = curr_format[0].description
197-
self.resolution: tuple[int, int] = (curr_format[1].width, curr_format[1].height)
198199

199200
def export_configs(self) -> dict[str : int | str | float | bool]:
200201
self.get_format()

0 commit comments

Comments
 (0)