Commit 51ffa059 authored by Nicholas Gar Hei Chan's avatar Nicholas Gar Hei Chan
Browse files

Added probe sampling commands for RPi

parent 6186ba0f
......@@ -9,6 +9,9 @@ from __future__ import absolute_import
#
# Take a look at the documentation on what other plugin mixins are available.
import wiringpi
import subprocess
import octoprint.plugin
import sys
import os
......@@ -28,6 +31,9 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
# Implement custom logic and driving code here #
# ------------------------------------------------------------------------- #
def startup_actions(self, **kwargs):
wiringpi.
def send_layer(self, layer):
""" Sends a layer to the Octoprint client
......@@ -75,12 +81,10 @@ class AutofdpPlugin(octoprint.plugin.SettingsPlugin,
self._printer.commands('G0 X{} Y{} Z{}'.format(x+self.offsets['x'],
y+self.offsets['y'],
z+self.offsets['z']))
#TODO: EXTEND PROBE HERE
#TODO: READ PROBE VALUE HERE
reading = subprocess.run("./sample.sh", capture_output=True).stdout.decode("utf-8").strip() == '1'
#TODO: RETURN PROBE READING HERE
return True
return reading
# ------------------------------------------------------------------------- #
# OCTOPRINT DEFINED FUNCTIONS #
......
#!/bin/bash
gpio mode 0 in
gpio mode 1 out
gpio write 7 1
sleep 0.2
gpio read 0
gpio write 7 0
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