Commit 5bc9b2e9 authored by Nicholas Gar Hei Chan's avatar Nicholas Gar Hei Chan
Browse files

Changes to __init__.py and settings tab

parent c16e3272
......@@ -129,9 +129,9 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
while(self.movement_lock):
pass
reading = subprocess.run("./sample.sh", capture_output=True).stdout.decode("utf-8").strip() == '1'
reading = subprocess.run("./sample.sh", capture_output=True).stdout.decode("utf-8").strip() == '0'
return True #RETURN ALL TRUE FOR NOW
return reading
# ------------------------------------------------------------------------- #
# OCTOPRINT DEFINED FUNCTIONS #
......@@ -149,6 +149,8 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
self.offsets = dict([('x', 0), ('y', 0), ('z', 0)])
self.file_payload = []
##~~ SimpleApiPlugin mixin
def get_api_commands(self):
return dict(
......@@ -166,7 +168,11 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
self.curr_layer -= 1
self.send_layer(self.curr_layer)
elif command == "reload_model":
self._logger.info('reloading model')
if self.file_payload:
self._logger.info('reloading model')
self.on_event('FileSelected', self.file_payload)
else:
self._logger.info('no GCODE selected')
elif command == "test_command":
self._logger.info(data)
......@@ -175,6 +181,7 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
global sampling
if event == 'FileSelected':
self._logger.info('File selected: "{}" at path "{}"'.format(payload['name'], payload['path']))
self.file_payload = payload
self.process_gcode(payload)
self._logger.info('GCODE Processed: {} layers'.format(self.num_layers))
self.send_layer(0)
......
......@@ -63,8 +63,8 @@ default sampling parameters.
<div class="controls">
<select data-bind="value: settings.plugins.autoFDP.sampling_algo">
<option>Random sampling</option>
<option>Perimeter sampling</option>
<option>Uniform sampling</option>
<option>Min-max</option>
<option>Inside-outside</option>
</select>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment