add is idle condition on RGBL lib

This commit is contained in:
Clement 2024-01-18 21:01:02 +01:00
parent 8bdd4a9be2
commit 76ebc00763
2 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@ class iGRBL{
public:
virtual void init(int speed, double pas, int accel, String mode = "distance") = 0;
virtual void mouveForward(int mm) = 0;
virtual bool isIddle() = 0;
};
class GRBL : public iGRBL{
@ -15,6 +16,7 @@ public:
GRBL(int grblAddr);
void init(int speed, double pas, int accel, String mode = "distance") override;
void mouveForward(int mm = 5) override;
bool isIddle() override;
private:
Module_GRBL* grbl;
};

View File

@ -32,3 +32,13 @@ void GRBL::mouveForward(int mm){
sprintf(s, "G1 X%d", mm);
this->grbl->sendGcode(s);
}
bool GRBL::isIddle(){
bool sortie = false;
if(this->grbl->readStatus().indexOf("IDLE") != -1){
sortie = true;
}
return sortie;
}