Adding few improvements:
- motors toggle button: allows for manual adjustments and silences motors - pen toggle button: pen up and down positions are stored in EEPROM - SMQB command: allows faster and smoother operation with custom version of eggbot extension (bartebor/eggbot_extensions) - PRG button fix
This commit is contained in:
@@ -1,16 +1,38 @@
|
||||
void initHardware(){
|
||||
// enable eeprom wait in avr/eeprom.h functions
|
||||
SPMCSR &= ~SELFPRGEN;
|
||||
|
||||
loadPenPosFromEE();
|
||||
|
||||
pinMode(enableRotMotor, OUTPUT);
|
||||
pinMode(enablePenMotor, OUTPUT);
|
||||
pinMode(prgButton, INPUT_PULLUP);
|
||||
pinMode(penToggleButton, INPUT_PULLUP);
|
||||
pinMode(motorsButton, INPUT_PULLUP);
|
||||
|
||||
rotMotor.setMaxSpeed(2000.0);
|
||||
rotMotor.setAcceleration(10000.0);
|
||||
penMotor.setMaxSpeed(2000.0);
|
||||
penMotor.setAcceleration(10000.0);
|
||||
digitalWrite(enableRotMotor, HIGH) ;
|
||||
digitalWrite(enablePenMotor, HIGH) ;
|
||||
motorsOff();
|
||||
penServo.attach(servoPin);
|
||||
penServo.write(penUpPos);
|
||||
penServo.write(penState);
|
||||
}
|
||||
|
||||
|
||||
void inline loadPenPosFromEE() {
|
||||
penUpPos = eeprom_read_word(penUpPosEEAddress);
|
||||
penDownPos = eeprom_read_word(penDownPosEEAddress);
|
||||
penState = penUpPos;
|
||||
}
|
||||
|
||||
void inline storePenUpPosInEE() {
|
||||
eeprom_update_word(penUpPosEEAddress, penUpPos);
|
||||
}
|
||||
|
||||
void inline storePenDownPosInEE() {
|
||||
eeprom_update_word(penDownPosEEAddress, penDownPos);
|
||||
}
|
||||
|
||||
void inline sendAck(){
|
||||
Serial.print("OK\r\n");
|
||||
}
|
||||
@@ -18,3 +40,4 @@ void inline sendAck(){
|
||||
void inline sendError(){
|
||||
Serial.print("unknown CMD\r\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user