Skip to content

Commit

Permalink
Merge pull request #31 from NilsRo/Development
Browse files Browse the repository at this point in the history
Correction for not processed files
  • Loading branch information
NilsRo authored Aug 7, 2022
2 parents 609c6bb + 04316b1 commit f8b2e0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions octoprint_SlicerEstimator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ def on_event(self, event, payload):
if slicer_additional["slicer"] == SLICER_SIMPLIFY3D:
# Simplify3D has no embedded time left
self._estimator.use_progress = True
self._estimator.time_total = slicer_additional["printtime"]
else:
self._estimator.use_progress = False
self._estimator.time_total = slicer_additional["printtime"]
self._slicer_filament_change = self._file_manager._storage_managers["local"].get_additional_metadata(path,"slicer_filament_change")
self._send_metadata_print_event(origin, path)
self._send_filament_change_event(origin, path)
Expand All @@ -189,7 +189,9 @@ def on_event(self, event, payload):
# Init of Class variables for new estimation
self._slicer_estimation = None
self._sliver_estimation_str = None
self._estimator.estimated_time = -1
self._estimator.time_left = -1.0
self._estimator.time_total = -1.0
self._estimator.use_progress = False
self._slicer_filament_change = None
self._logger.debug("Event received: {}".format(event))

Expand Down Expand Up @@ -345,11 +347,11 @@ def get_metadata_file(self, plugin_identifier, target, origin, path):
return_list = []
meta_selected = filter(lambda elem: elem["targets"][plugin_identifier][target] == True, self._metadata_list)
additional_metadata = self._file_manager._storage_managers[origin].get_additional_metadata(path, "slicer")
for meta_item in meta_selected:
additional_metadata = self._file_manager._storage_managers[origin].get_additional_metadata(path, "slicer")
if meta_item["id"] in additional_metadata:
return_item = [meta_item["id"], meta_item["description"], additional_metadata[meta_item["id"]]]
return_list.append(return_item)
if additional_metadata:
for meta_item in meta_selected:
if meta_item["id"] in additional_metadata:
return_item = [meta_item["id"], meta_item["description"], additional_metadata[meta_item["id"]]]
return_list.append(return_item)
return return_list
else:
self._logger.error("Target {} of plugin {} not registered.".format(target, plugin_identifier))
Expand Down
6 changes: 3 additions & 3 deletions octoprint_SlicerEstimator/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ def __init__(self, job_type):

def estimate(self, progress, printTime, cleanedPrintTime, statisticalTotalPrintTime, statisticalTotalPrintTimeType):
std_estimator = PrintTimeEstimator.estimate(self, progress, printTime, cleanedPrintTime, statisticalTotalPrintTime, statisticalTotalPrintTimeType)
logger.debug("SlicerEstimator: Time Left {}, Use Progress {}, Progress {}, Cleaned Print Time {}, Stat. Total Print Time {}, Stat. Total Print Time Type {}".format(self.time_left, self.use_progress, progress, cleanedPrintTime, statisticalTotalPrintTime, statisticalTotalPrintTimeType))

if self._job_type != "local" or ( self.time_left == -1.0 and not self.use_progress ) or cleanedPrintTime is None or progress is None:
# using standard estimator
self.time_left = std_estimator[0]
# using standard estimator
return std_estimator
elif std_estimator[1] == "average" and self.average_prio:
# average more important than estimation
self.time_left = std_estimator[0]
return std_estimator
elif self.use_progress:
# progress based estimation - as GCODe position based not very accurate
# progress based estimation - as GCODE position based not very accurate
self.time_left = self.time_total - (progress * 0.01 * self.time_total)
logger.debug("SlicerEstimator: Estimation Reported {}".format(self.time_left))
return self.time_left, "slicerestimator"
Expand Down

0 comments on commit f8b2e0c

Please sign in to comment.