Skip to content

Commit

Permalink
Commented out all info logging bugging out and filling up memory
Browse files Browse the repository at this point in the history
  • Loading branch information
valemaio2 committed Jan 5, 2023
1 parent b6c833e commit 7d0acc8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions octoprint_filamentsensorsimplified/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def on_api_command(self, command, data):

def is_filament_present(self, pin, power, triggered_mode):
if self.read_sensor_multiple(pin, power, triggered_mode):
self._logger.info("Filament detected")
# Commenting out this info log due to spamming the log file and filling up the memory quickly.
# See https://github.com/LuckyX182/Filament_sensor_simplified/issues/64
#self._logger.info("Filament detected")
return 0
else:
self._logger.info("Filament not detected")
Expand All @@ -140,7 +142,9 @@ def send_out_of_filament(self):
self._printer.pause_print()

def sensor_callback(self, _):
self._logger.info("Sensor callback called")
# Commenting out this info log due to spamming the log file and filling up the memory quickly.
# See https://github.com/LuckyX182/Filament_sensor_simplified/issues/64
#self._logger.info("Sensor callback called")
filamentPresentInt = self.is_filament_present(self.setting_pin, self.setting_power, self.setting_triggered)
if filamentPresentInt is 1:
self._logger.info("Sensor was triggered")
Expand All @@ -150,7 +154,9 @@ def sensor_callback(self, _):
self._plugin_manager.send_plugin_message(self._identifier, dict(type="filamentStatus", noFilament=True,
msg="Printer ran out of filament!"))
elif filamentPresentInt is 0:
self._logger.info("Sensor was not triggered")
# Commenting out this info log due to spamming the log file and filling up the memory quickly.
# See https://github.com/LuckyX182/Filament_sensor_simplified/issues/64
#self._logger.info("Sensor was not triggered")
# change navbar icon to filament present
self._plugin_manager.send_plugin_message(self._identifier, dict(type="filamentStatus", noFilament=False,
msg="Filament inserted!"))
Expand Down Expand Up @@ -357,7 +363,9 @@ def init_icon(self, pin, power, triggered):
msg="Initial filament read"))

def read_sensor_multiple(self, pin, power, trigger_mode):
self._logger.info("Reading sensor values")
# Commenting out this info log due to spamming the log file and filling up the memory quickly.
# See https://github.com/LuckyX182/Filament_sensor_simplified/issues/64
#self._logger.info("Reading sensor values")
oldTrigger = None
x = 0

Expand All @@ -375,7 +383,9 @@ def read_sensor_multiple(self, pin, power, trigger_mode):
#self._logger.info("Repeating sensor read due to false positives")

if x >= 10:
self._logger.info("Reading result: %s" % newTrigger)
# Commenting out this info log due to spamming the log file and filling up the memory quickly.
# See https://github.com/LuckyX182/Filament_sensor_simplified/issues/64
#self._logger.info("Reading result: %s" % newTrigger)
return newTrigger

# plugin disabled if pin set to 0
Expand Down Expand Up @@ -492,3 +502,4 @@ def __plugin_load__():
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.gcode_response_received,
"octoprint.comm.protocol.gcode.sending": __plugin_implementation__.sending_gcode
}

0 comments on commit 7d0acc8

Please sign in to comment.