Added home direction logic

The direction which an axis homes in is either "-1" for min or "1" for
max
This commit is contained in:
Tony 2013-11-08 20:19:44 +00:00
parent fa9b0d1478
commit 707b0cc64a
3 changed files with 13 additions and 5 deletions

View file

@ -292,7 +292,7 @@ bool GCodes::DoHome()
if(homeX) if(homeX)
{ {
action[X_AXIS] = true; action[X_AXIS] = true;
moveToDo[X_AXIS] = -2.0*platform->AxisLength(X_AXIS); moveToDo[X_AXIS] = platform->HomeDirection(X_AXIS)*2.0*platform->AxisLength(X_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS); moveToDo[DRIVES] = platform->HomeFeedRate(X_AXIS);
if(DoCannedCycleMove(moveToDo, action, true)) if(DoCannedCycleMove(moveToDo, action, true))
{ {
@ -305,7 +305,7 @@ bool GCodes::DoHome()
if(homeY) if(homeY)
{ {
action[Y_AXIS] = true; action[Y_AXIS] = true;
moveToDo[Y_AXIS] = -2.0*platform->AxisLength(Y_AXIS); moveToDo[Y_AXIS] = platform->HomeDirection(Y_AXIS)*2.0*platform->AxisLength(Y_AXIS);
moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS); moveToDo[DRIVES] = platform->HomeFeedRate(Y_AXIS);
if(DoCannedCycleMove(moveToDo, action, true)) if(DoCannedCycleMove(moveToDo, action, true))
{ {
@ -331,7 +331,7 @@ bool GCodes::DoHome()
return false; return false;
}else }else
{ {
moveToDo[Z_AXIS] = -2.0*platform->AxisLength(Z_AXIS); moveToDo[Z_AXIS] = platform->HomeDirection(Z_AXIS)*2.0*platform->AxisLength(Z_AXIS);
if(DoCannedCycleMove(moveToDo, action, true)) if(DoCannedCycleMove(moveToDo, action, true))
homeZFinalMove = true; homeZFinalMove = true;
return false; return false;

View file

@ -86,6 +86,7 @@ void Platform::Init()
disableDrives = DISABLE_DRIVES; disableDrives = DISABLE_DRIVES;
lowStopPins = LOW_STOP_PINS; lowStopPins = LOW_STOP_PINS;
highStopPins = HIGH_STOP_PINS; highStopPins = HIGH_STOP_PINS;
homeDirection = HOME_DIRECTION;
maxFeedrates = MAX_FEEDRATES; maxFeedrates = MAX_FEEDRATES;
accelerations = ACCELERATIONS; accelerations = ACCELERATIONS;
driveStepsPerUnit = DRIVE_STEPS_PER_UNIT; driveStepsPerUnit = DRIVE_STEPS_PER_UNIT;

View file

@ -79,6 +79,7 @@ Licence: GPL
#define DISABLE_DRIVES {false, false, true, false} // Set true to disable a drive when it becomes idle #define DISABLE_DRIVES {false, false, true, false} // Set true to disable a drive when it becomes idle
#define LOW_STOP_PINS {11, 28, 60, 31} #define LOW_STOP_PINS {11, 28, 60, 31}
#define HIGH_STOP_PINS {-1, -1, -1, -1} #define HIGH_STOP_PINS {-1, -1, -1, -1}
#define HOME_DIRECTION {1,1,1,1} // 1 for Max/High, -1 for Min/ Low TODO replace with logic based on low/high pin allocations
#define ENDSTOP_HIT 1 // when a stop == this it is hit #define ENDSTOP_HIT 1 // when a stop == this it is hit
#define POT_WIPES {0, 1, 2, 3} // Indices for motor current digipots (if any) #define POT_WIPES {0, 1, 2, 3} // Indices for motor current digipots (if any)
#define SENSE_RESISTOR 0.1 // Stepper motor current sense resistor #define SENSE_RESISTOR 0.1 // Stepper motor current sense resistor
@ -150,7 +151,7 @@ Licence: GPL
/****************************************************************************************************/ /****************************************************************************************************/
// Networking // Networking
//FIXME does not currently override the default in \libraries\EMAC\conf_eth.h
// Enter a MAC address and IP address for your controller below. // Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network: // The IP address will be dependent on your local network:
//#define MAC { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //#define MAC { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
@ -448,7 +449,7 @@ class Platform
float HomeFeedRate(int8_t drive); float HomeFeedRate(int8_t drive);
EndStopHit Stopped(int8_t drive); EndStopHit Stopped(int8_t drive);
float AxisLength(int8_t drive); float AxisLength(int8_t drive);
int8_t HomeDirection(int8_t drive);
float ZProbeStopHeight(); float ZProbeStopHeight();
void SetZProbeStopHeight(float z); void SetZProbeStopHeight(float z);
long ZProbe(); long ZProbe();
@ -497,6 +498,7 @@ class Platform
bool driveEnabled[DRIVES]; bool driveEnabled[DRIVES];
int8_t lowStopPins[DRIVES]; int8_t lowStopPins[DRIVES];
int8_t highStopPins[DRIVES]; int8_t highStopPins[DRIVES];
int8_t homeDirection[DRIVES];
float maxFeedrates[DRIVES]; float maxFeedrates[DRIVES];
float accelerations[DRIVES]; float accelerations[DRIVES];
float driveStepsPerUnit[DRIVES]; float driveStepsPerUnit[DRIVES];
@ -715,6 +717,11 @@ inline float Platform::AxisLength(int8_t drive)
return axisLengths[drive]; return axisLengths[drive];
} }
inline int8_t Platform::HomeDirection(int8_t drive)
{
return homeDirection[drive];
}
inline float Platform::MaxFeedrate(int8_t drive) inline float Platform::MaxFeedrate(int8_t drive)
{ {
return maxFeedrates[drive]; return maxFeedrates[drive];