Skip to content

Commit

Permalink
fix max lapse duration fps
Browse files Browse the repository at this point in the history
  • Loading branch information
nlef committed Nov 24, 2021
1 parent eae80f4 commit 4cea3be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bot/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def _calculate_fps(self, frames_count: int):
fps = math.ceil(frames_count / self._min_lapse_duration)
return fps if fps >= 1 else 1
elif actual_duration > self._max_lapse_duration > 0:
return math.ceil(frames_count / self._min_lapse_duration)
return math.ceil(frames_count / self._max_lapse_duration)

def _create_timelapse(self, printing_filename: str, gcode_name: str, info_mess: Message) -> (BytesIO, BytesIO, int, int, str, str):
while self.light_need_off:
Expand Down
5 changes: 3 additions & 2 deletions bot/klippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ def check_connection(self) -> str:
try:
response = requests.get(f"http://{self._host}/printer/info", headers=self._headers, timeout=2)
return '' if response.ok else f"Connection failed. {response.reason}"
except Exception:
return 'f"Connection failed.'
except Exception as ex:
logger.error(ex, exc_info=True)
return f"Connection failed."

@staticmethod
def sensor_message(sensor: str, sens_key: str, response) -> str:
Expand Down

0 comments on commit 4cea3be

Please sign in to comment.