OllisGit / OctoPrint-SpoolManager

Plugin for managing Spools
169 stars 59 forks source link

Setting non-integer safety buffer silently prevents printing #341

Closed James-Coyne closed 8 months ago

James-Coyne commented 9 months ago

While the user is allowed to enter a decimal value for the safety buffer, doing so will cause errors that prevent prints from starting without notifying the user of the cause. Can checks/warnings be added to prevent using decimals, or handle cases where decimal values are used?

2023-10-06 10:42:08,862 - octoprint.settings - WARNING - Could not convert '42.3' to a valid integer when getting option ['plugins', 'SpoolManager', 'safetyLength']
2023-10-06 10:42:08,862 - octoprint - ERROR - Exception on /plugin/SpoolManager/allowedToPrint [GET]
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/oprint/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1686, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_SpoolManager/api/SpoolManagerAPI.py", line 356, in allowed_to_print
    requiredWeightResult = self.checkRemainingFilament(toolIndex)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_SpoolManager/__init__.py", line 83, in checkRemainingFilament
    requiredWeightResult = self._evaluateRequiredWeight(selectedSpools, forToolIndex, shouldWarn)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_SpoolManager/__init__.py", line 333, in _evaluateRequiredWeight
    saftyRequiredWeight = self._calculateWeight(saftyLengthInMM, diameter, density)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_SpoolManager/__init__.py", line 381, in _calculateWeight
    volume = length * math.pi * (radius * radius) / 1000
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
github-actions[bot] commented 8 months ago

This issue has been automatically marked for closing, because it has not had activity in 30 days. It will be closed if no further activity occurs in 10 days.

github-actions[bot] commented 8 months ago

This issue was closed, because it has been already marked for 10 days with no activity.