<font size="3">Hi,
I want to add an additional Extramotor Gcode. I implemented the additional code in the Driver.h / Driver.ccp
Driver.h:</font>
[...]
class MotorDriverInterface
{
public:
virtual void initialize() = 0;
virtual float getPosition() = 0;
virtual void setCurrentAs(float newPos) = 0;
virtual void gotoPosition(float newPos) = 0;
virtual void enable() = 0;
virtual void disable() = 0;
virtual float getEndstopStatus() = 0;
};
/**
Simple class to drive a stepper motor with fixed speed.
*/
template<int stepPin, int dirPin, int enablePin,bool invertDir, bool invertEnable, int endstopPin >
class StepperDriver : public MotorDriverInterface
[...]
#if defined(NUM_MOTOR_DRIVERS) && NUM_MOTOR_DRIVERS > 0
class GCode;
extern void commandG201(GCode &code);
extern void commandG202(GCode &code);
extern void commandG203(GCode &code);
extern void commandG204(GCode &code);
extern void commandG205(GCode &code); //Homing
extern void disableAllMotorDrivers();
extern Mo<font size="2">torDriverInterface *getMotorDriver(int idx);
extern void initializeAl</font>lMotorDrivers();
#endif
<font size="3">and Driver.ccp
[...]
<font size="2">void commandG205(GCode &code)
{
int id = 0;
if(code.hasP())
id = code.P;
if(id < 0) id = 0;
if(id >= NUM_MOTOR_DRIVERS) id = 0;
motorDrivers[id]->setCurrentAs(300);
while(motorDrivers[id]->getEndstopStatus() == 1){
for(float i =300; i > 0; i--){
motorDrivers[id]->gotoPosition(i);
if(motorDrivers[id]->getEndstopStatus() == 0){
break;
}
}
}
motorDrivers[id]->setCurrentAs(0);
}</font>
[...]
But the Problem is, that I can't name it G205, because when I try to start the Gcode in Repetier-Host, it tells me "Unknown command: N14 G205". However when i rename my homing function to G204, which is allready used for the enable/disable the motor, it works how it should be.
Do you have any ideas how to solve this problem?
Thanks in advance
Jpod
</font>