diff options
-rw-r--r-- | trunk/electronics/Pololu-electronics/pololu-steppers-power-side.brd | bin | 24619 -> 24931 bytes | |||
-rw-r--r-- | trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.brd | bin | 19678 -> 20110 bytes | |||
-rw-r--r-- | trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.sch | bin | 101995 -> 101995 bytes | |||
-rwxr-xr-x | trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde | 4 | ||||
-rwxr-xr-x | trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/cartesian_dda.h | 24 | ||||
-rwxr-xr-x | trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/configuration.h.dist | 6 | ||||
-rwxr-xr-x | trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/process_g_code.pde | 12 | ||||
-rwxr-xr-x | trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/vectors.h | 34 |
8 files changed, 77 insertions, 3 deletions
diff --git a/trunk/electronics/Pololu-electronics/pololu-steppers-power-side.brd b/trunk/electronics/Pololu-electronics/pololu-steppers-power-side.brd Binary files differindex a6a1fc32..2b839d98 100644 --- a/trunk/electronics/Pololu-electronics/pololu-steppers-power-side.brd +++ b/trunk/electronics/Pololu-electronics/pololu-steppers-power-side.brd diff --git a/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.brd b/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.brd Binary files differindex b414133d..474adc0d 100644 --- a/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.brd +++ b/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.brd diff --git a/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.sch b/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.sch Binary files differindex 77890670..67ecd215 100644 --- a/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.sch +++ b/trunk/electronics/Pololu-electronics/pololu-steppers-signal-side.sch diff --git a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde index beb5ac66..5ffc9c29 100755 --- a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde +++ b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde @@ -117,6 +117,10 @@ word interruptBlink; FloatPoint where_i_am; +// The coordinates of the last zero positions + +LongPoint zeroHit; + // Our interrupt function /* diff --git a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/cartesian_dda.h b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/cartesian_dda.h index 946a2541..2095601a 100755 --- a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/cartesian_dda.h +++ b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/cartesian_dda.h @@ -113,6 +113,8 @@ public: void set_units(); bool get_units(); + FloatPoint returnUnits(); + // Kill - stop all activity and turn off steppers void shutdown(); @@ -121,6 +123,10 @@ public: // Short functions inline to save memory; particularly useful in the Arduino +inline FloatPoint cartesian_dda::returnUnits() +{ + return units; +} inline bool cartesian_dda::get_units() { @@ -185,10 +191,16 @@ inline bool cartesian_dda::xCanStep(long current, long target, bool dir) #if ENDSTOPS_MIN_ENABLED == 1 #if X_ENDSTOP_INVERTING if(!dir && !digitalRead(X_MIN_PIN) ) + { + zeroHit.x = current; return false; + } #else if(!dir && digitalRead(X_MIN_PIN) ) + { + zeroHit.x = current; return false; + } #endif #endif @@ -221,10 +233,16 @@ inline bool cartesian_dda::yCanStep(long current, long target, bool dir) #if ENDSTOPS_MIN_ENABLED == 1 #if Y_ENDSTOP_INVERTING if(!dir && !digitalRead(Y_MIN_PIN) ) + { + zeroHit.y = current; return false; + } #else if(!dir && digitalRead(Y_MIN_PIN) ) + { + zeroHit.y = current; return false; + } #endif #endif @@ -257,10 +275,16 @@ inline bool cartesian_dda::zCanStep(long current, long target, bool dir) #if ENDSTOPS_MIN_ENABLED == 1 #if Z_ENDSTOP_INVERTING if(!dir && !digitalRead(Z_MIN_PIN) ) + { + zeroHit.z = current; return false; + } #else if(!dir && digitalRead(Z_MIN_PIN) ) + { + zeroHit.z = current; return false; + } #endif #endif diff --git a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/configuration.h.dist b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/configuration.h.dist index 0d9faad9..d028af06 100755 --- a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/configuration.h.dist +++ b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/configuration.h.dist @@ -96,7 +96,7 @@ // Comment out the next line if you are running a Darwin with a MOTHERBOARD > 1 -#define MENDEL 1 +//#define MENDEL 1 // Set to 1 if enable pins are inverting // For RepRap stepper boards version 1.x the enable pins are *not* inverting. @@ -149,7 +149,7 @@ #if MOTHERBOARD == 3 -#define MENDEL 1 +//#define MENDEL 1 // Comment out this if you are using a thermocouple #define USE_THERMISTOR @@ -322,6 +322,8 @@ inline void resetTimer() TCNT2 = 0; } +extern LongPoint zeroHit; + #endif //************************************************************************* diff --git a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/process_g_code.pde b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/process_g_code.pde index 1656f0f2..648c3b1d 100755 --- a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/process_g_code.pde +++ b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/process_g_code.pde @@ -595,11 +595,21 @@ void process_string(char instruction[], int size) talkToHost.setCoords(where_i_am); break; + //Reserved for return version number + case 115: + //talkToHost.sendVersion(); + break; + // TODO: make this work properly case 116: ex[extruder_in_use]->waitForTemperature(); - break; + break; + + //custom code for returning zero-hit coordinates + case 117: + talkToHost.setCoords(from_steps(cdda[0]->returnUnits(), zeroHit)); + break; // The valve (real, or virtual...) is now the way to control any extruder (such as // a pressurised paste extruder) that cannot move using E codes. diff --git a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/vectors.h b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/vectors.h index 938cfe0c..4bb97ce9 100755 --- a/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/vectors.h +++ b/trunk/software/firmware/FiveD_GCode/FiveD_GCode_Interpreter/vectors.h @@ -6,6 +6,8 @@ #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) +struct LongPoint; + // Real-world units struct FloatPoint { @@ -14,8 +16,20 @@ struct FloatPoint float z; float e; // Extrude length float f; // Feedrate + FloatPoint(); + FloatPoint(const LongPoint& a); }; +inline FloatPoint::FloatPoint() +{ + x = 0; + y = 0; + z = 0; + e = 0; + f = 0; +} + + inline FloatPoint operator+(const FloatPoint& a, const FloatPoint& b) { FloatPoint result; @@ -127,4 +141,24 @@ inline LongPoint to_steps(const FloatPoint& units, const FloatPoint& position) return roundv(units*position); } +inline FloatPoint from_steps(const FloatPoint& units, const LongPoint& position) +{ + FloatPoint inv = units; + inv.x = 1.0/inv.x; + inv.y = 1.0/inv.y; + inv.z = 1.0/inv.z; + inv.e = 1.0/inv.e; + inv.f = 1.0/inv.f; + return roundv(inv*position); +} + +inline FloatPoint::FloatPoint(const LongPoint& a) +{ + x = a.x; + y = a.y; + z = a.z; + e = a.e; + f = a.f; +} + #endif |