From 926aabe07843b0362bb5490bfa29caa0bf868f32 Mon Sep 17 00:00:00 2001 From: Adrian Bowyer Date: Tue, 19 Nov 2013 15:00:23 +0000 Subject: [PATCH] Added z-probe type selection. See M558. --- GCodes.cpp | 5 +++++ Platform.cpp | 2 +- Platform.h | 11 ++++++++++- SD-image/www/reprap.htm | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/GCodes.cpp b/GCodes.cpp index ab97893..647b591 100644 --- a/GCodes.cpp +++ b/GCodes.cpp @@ -1260,6 +1260,11 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb) } break; + case 558: // Set Z probe type + if(gb->Seen('P')) + platform->SetZProbeType(gb->GetIValue()); + break; + case 906: // Set Motor currents for(uint8_t i = 0; i < DRIVES; i++) { diff --git a/Platform.cpp b/Platform.cpp index 13925b3..3932e9c 100644 --- a/Platform.cpp +++ b/Platform.cpp @@ -98,7 +98,7 @@ void Platform::Init() potWipes = POT_WIPES; senseResistor = SENSE_RESISTOR; maxStepperDigipotVoltage = MAX_STEPPER_DIGIPOT_VOLTAGE; - zProbePin = Z_PROBE_PIN; + zProbePin = -1; // Default is to use the switch zProbeCount = 0; zProbeSum = 0; zProbeValue = 0; diff --git a/Platform.h b/Platform.h index aa8635e..ced8d55 100644 --- a/Platform.h +++ b/Platform.h @@ -89,7 +89,7 @@ Licence: GPL #define MAX_STEPPER_DIGIPOT_VOLTAGE ( 3.3*2.5/(2.7+2.5) ) // Stepper motor current reference voltage #define Z_PROBE_AD_VALUE 400 #define Z_PROBE_STOP_HEIGHT 0.7 // mm -#define Z_PROBE_PIN -1 // Analogue pin number +#define Z_PROBE_PIN 0 // Analogue pin number #define MAX_FEEDRATES {50.0, 50.0, 3.0, 16.0} // mm/sec #define ACCELERATIONS {800.0, 800.0, 10.0, 250.0} // mm/sec^2 #define DRIVE_STEPS_PER_UNIT {91.4286, 91.4286, 4000.0, 910.0} @@ -464,6 +464,7 @@ class Platform void SetZProbeStopHeight(float z); long ZProbe(); void SetZProbe(int iZ); + void SetZProbeType(int iZ); // Heat and temperature @@ -799,6 +800,14 @@ inline void Platform::SetZProbe(int iZ) zProbeADValue = iZ; } +inline void Platform::SetZProbeType(int pt) +{ + if(pt != 0) + zProbePin = Z_PROBE_PIN; + else + zProbePin = -1; +} + //******************************************************************************************************** diff --git a/SD-image/www/reprap.htm b/SD-image/www/reprap.htm index 3375d38..98f72db 100644 --- a/SD-image/www/reprap.htm +++ b/SD-image/www/reprap.htm @@ -725,7 +725,7 @@ function viewModel() }; - +/* if (window.File && window.FileReader && window.FileList && window.Blob) { setTimeout(function() { @@ -736,7 +736,7 @@ function viewModel() { alert('The File APIs are not fully supported by your browser. GCode upload may not work.'); } - +*/ onControlPage = false; self.getName(); //self.getPoll();