(self)
| 127 | queue.put(control, data) |
| 128 | |
| 129 | def run(self): |
| 130 | |
| 131 | led_backend = self._led_backend_factory() |
| 132 | |
| 133 | self._led_count.put(led_backend.get_led_count()) |
| 134 | |
| 135 | cam = Camera(self._device) |
| 136 | |
| 137 | timeout_controller = TimeoutController() |
| 138 | |
| 139 | # we quickly switch to dark mode here to throw any exceptions about the camera early |
| 140 | set_cam_dark(cam, self._dark_exposure) |
| 141 | set_cam_default(cam) |
| 142 | |
| 143 | while not self._exit_event.is_set(): |
| 144 | |
| 145 | if not self._request_detections_queue.empty(): |
| 146 | |
| 147 | led_id_from, led_id_to, view_id = ( |
| 148 | self._request_detections_queue.get_id_from_id_to_view() |
| 149 | ) |
| 150 | |
| 151 | success = backend_black(led_backend) |
| 152 | if not success: |
| 153 | logger.debug("failed to blacken backend due to missing attribute") |
| 154 | |
| 155 | # scan start here |
| 156 | set_cam_dark(cam, self._dark_exposure) |
| 157 | |
| 158 | # Firstly, if there are leds visible, break out |
| 159 | if find_led(cam, self._threshold, self._display) is not None: |
| 160 | logger.error( |
| 161 | "Detector process can detect an LED when no LEDs should be visible" |
| 162 | ) |
| 163 | for queue in self._output_queues: |
| 164 | queue.put(DetectionControlEnum.FAIL, None) |
| 165 | set_cam_default(cam) |
| 166 | continue |
| 167 | |
| 168 | leds = detect_leds( |
| 169 | led_id_from, |
| 170 | led_id_to, |
| 171 | cam, |
| 172 | led_backend, |
| 173 | view_id, |
| 174 | timeout_controller, |
| 175 | self._threshold, |
| 176 | self._display, |
| 177 | self._output_queues, |
| 178 | ) |
| 179 | |
| 180 | if leds is not None and len(leds) > 0: |
| 181 | |
| 182 | movement = False |
| 183 | if self._check_movement: |
| 184 | led_first = leds[0] |
| 185 | |
| 186 | led_current = enable_and_find_led( |
nothing calls this directly
no test coverage detected