Debugging pin guard

pull/100/head
Tim Evers 2017-12-10 22:01:13 +01:00
parent 764e55052a
commit b35914a325
6 changed files with 31 additions and 23 deletions

View File

@ -86,7 +86,7 @@ void CurrentState::setEndStopState(unsigned int axis, unsigned int position, boo
endStopState[axis][position] = state;
}
void CurrentState::setStepsPerMm(int stepsX, int stepsY, int stepsZ)
void CurrentState::setStepsPerMm(long stepsX, long stepsY, long stepsZ)
{
stepsPerMmX = stepsX;
stepsPerMmY = stepsY;

View File

@ -43,16 +43,16 @@ public:
void resetEmergencyStop();
bool isEmergencyStop();
void setStepsPerMm(int stepsX, int stepsY, int stepsZ);
void setStepsPerMm(long stepsX, long stepsY, long stepsZ);
private:
CurrentState();
CurrentState(CurrentState const &);
void operator=(CurrentState const &);
int stepsPerMmX;
int stepsPerMmY;
int stepsPerMmZ;
long stepsPerMmX;
long stepsPerMmY;
long stepsPerMmZ;
bool emergencyStop = false;
};

View File

@ -826,7 +826,7 @@ int StepperControl::calibrateAxis(int axis)
encoderEnabled = &motorConsEncoderEnabled[2];
axisStatus = &axisSubStep[2];
//axisStepsPerMm = &axisStepsPerMm[2];
axisStepsPerMm = &stepsPerMm[1];
axisStepsPerMm = &stepsPerMm[2];
break;
default:
Serial.print("R99 Calibration error: invalid axis selected\r\n");

View File

@ -173,6 +173,7 @@ void setup()
pinMode(X_STEP_PIN, OUTPUT);
pinMode(X_DIR_PIN, OUTPUT);
pinMode(X_ENABLE_PIN, OUTPUT);
pinMode(E_STEP_PIN, OUTPUT);
pinMode(E_DIR_PIN, OUTPUT);
pinMode(E_ENABLE_PIN, OUTPUT);
@ -222,7 +223,7 @@ void setup()
pinMode(UTM_E, INPUT_PULLUP);
pinMode(UTM_F, INPUT_PULLUP);
pinMode(UTM_G, INPUT_PULLUP);
pinMode(UTM_H, INPUT_PULLUP);
if (UTM_H > 0) { pinMode(UTM_H, INPUT_PULLUP) };
pinMode(UTM_I, INPUT_PULLUP);
pinMode(UTM_J, INPUT_PULLUP);
pinMode(UTM_K, INPUT_PULLUP);
@ -268,6 +269,9 @@ void setup()
// Initialize the inactivity check
lastAction = millis();
pinGuardCurrentTime = millis();
pinGuardLastCheck = millis();
if (ParameterList::getInstance()->getValue(MOVEMENT_HOME_AT_BOOT_Z) == 1)
{
Serial.print("R99 HOME Z ON STARTUP\r\n");
@ -301,24 +305,25 @@ void loop()
StepperControl::getInstance()->handleMovementInterrupt();
}
pinGuardCurrentTime = millis();
if (pinGuardCurrentTime < pinGuardLastCheck)
{
pinGuardLastCheck = pinGuardCurrentTime;
}
else
{
if (pinGuardCurrentTime - pinGuardLastCheck >= 1000)
{
pinGuardLastCheck += 1000;
// check the pins for timeouts
PinGuard::getInstance()->checkPins();
}
}
if (Serial.available())
{
unsigned long pinGuardLastCheck;
pinGuardCurrentTime = millis();
if (pinGuardCurrentTime < pinGuardLastCheck)
{
pinGuardLastCheck = pinGuardCurrentTime;
}
else
{
if (pinGuardLastCheck - pinGuardCurrentTime >= 999)
{
// check the pins for timeouts
PinGuard::getInstance()->checkPins();
}
}
// Save current time stamp for timeout actions
lastAction = millis();

View File

@ -134,13 +134,16 @@
#define X_STEP_PIN 26 // X1_STEP_PIN
#define X_DIR_PIN 27 // X1_DIR_PIN
#define X_ENABLE_PIN 25 // X1_ENABLE_PIN
#define E_STEP_PIN 15 // X2_STEP_PIN
#define E_DIR_PIN 30 // X2_DIR_PIN
#define E_ENABLE_PIN 14 // X2_ENABLE_PIN
#define X_MIN_PIN 69
#define X_MAX_PIN 68
#define X_ENCDR_A 16
#define X_ENCDR_B 17
#define X2_ENCDR_A 22
#define X2_ENCDR_B 39
#define X_ENCDR_A_Q -1 // N/A

View File

@ -174,7 +174,7 @@
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties vm.programmer_name="avrisp" arduino.upload.port="COM4" />
<UserProperties vm.programmer_name="avrisp" arduino.upload.port="COM5" />
</VisualStudio>
</ProjectExtensions>
</Project>