Code cleanup.

- firmware now supports SM buffering, so SMQB command is no longer needed
- commmented code and repeated fragments removed
This commit is contained in:
Bartosz Borkowski
2015-05-28 22:19:04 +02:00
parent 6505252c20
commit 7464762465
4 changed files with 34 additions and 75 deletions

View File

@@ -6,18 +6,6 @@ void initHardware(){
pinMode(enableRotMotor, OUTPUT);
pinMode(enablePenMotor, OUTPUT);
#ifdef prgButton
pinMode(prgButton, INPUT_PULLUP);
#endif
#ifdef penToggleButton
pinMode(penToggleButton, INPUT_PULLUP);
#endif
#ifdef motorsButton
pinMode(motorsButton, INPUT_PULLUP);
#endif
rotMotor.setMaxSpeed(2000.0);
rotMotor.setAcceleration(10000.0);
@@ -26,7 +14,7 @@ void initHardware(){
motorsOff();
penServo.attach(servoPin);
penServo.write(penState);
}
}
void inline loadPenPosFromEE() {
penUpPos = eeprom_read_word(penUpPosEEAddress);
@@ -92,7 +80,7 @@ bool parseSMArgs(uint16_t *duration, int *penStepsEBB, int *rotStepsEBB) {
return false;
}
void doMove(uint16_t duration, int penStepsEBB, int rotStepsEBB) {
void prepareMove(uint16_t duration, int penStepsEBB, int rotStepsEBB) {
if (!motorsEnabled) {
motorsOn();
}
@@ -126,12 +114,20 @@ void doMove(uint16_t duration, int penStepsEBB, int rotStepsEBB) {
penMotor.move(penStepsToGo);
penMotor.setSpeed( penSpeed );
}
/*
}
void moveOneStep() {
if ( penMotor.distanceToGo() || rotMotor.distanceToGo() ) {
penMotor.runSpeedToPosition(); // Moving.... moving... moving....
rotMotor.runSpeedToPosition();
}
}
void moveToDestination() {
while ( penMotor.distanceToGo() || rotMotor.distanceToGo() ) {
penMotor.runSpeedToPosition(); // Moving.... moving... moving....
rotMotor.runSpeedToPosition();
}
*/
}
void setprgButtonState(){