From 0ebf3538ca975218e6012a47460facfbc5d59a0a Mon Sep 17 00:00:00 2001 From: "@jcassel" Date: Wed, 28 Dec 2022 09:57:47 -0500 Subject: [PATCH] added Several Keywords that were missing, added AbsoluteJog and refactored to reuse a main HeadJog method --- OctoPrintAPI.cpp | 11 ++++++++++- OctoPrintAPI.h | 2 ++ keywords.txt | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/OctoPrintAPI.cpp b/OctoPrintAPI.cpp index 4905d5c..028732e 100644 --- a/OctoPrintAPI.cpp +++ b/OctoPrintAPI.cpp @@ -402,7 +402,14 @@ bool OctoprintApi::octoPrintPrintHeadHome() { return (httpStatusCode == 204); } +bool OctoprintApi::octoPrintPrintHeadAbsoluteJog(double x, double y, double z, double f) { + return octoPrintPrintHeadJog(x,y,z,f,true); +} bool OctoprintApi::octoPrintPrintHeadRelativeJog(double x, double y, double z, double f) { + return octoPrintPrintHeadJog(x,y,z,f,false); +} + +bool OctoprintApi::octoPrintPrintHeadJog(double x, double y, double z, double f,bool absolute) { // { // "command": "jog", // "x": 10, @@ -432,7 +439,9 @@ bool OctoprintApi::octoPrintPrintHeadRelativeJog(double x, double y, double z, d snprintf(tmp, 128, ", \"speed\": %f", f); strcat(postData, tmp); } - strcat(postData, ", \"absolute\": false"); + if(absolute){strcat(postData, ", \"absolute\": true");} + else{strcat(postData, ", \"absolute\": false");} + strcat(postData, " }"); if (_debug) Serial.println(postData); diff --git a/OctoPrintAPI.h b/OctoPrintAPI.h index ca668bd..d382a80 100644 --- a/OctoPrintAPI.h +++ b/OctoPrintAPI.h @@ -104,6 +104,8 @@ class OctoprintApi { bool octoPrintConnectionFakeAck(); bool octoPrintPrintHeadHome(); bool octoPrintPrintHeadRelativeJog(double x, double y, double z, double f); + bool octoPrintPrintHeadAbsoluteJog(double x, double y, double z, double f); + bool octoPrintPrintHeadJog(double x, double y, double z, double f,bool absolute); bool octoPrintExtrude(double amount); bool octoPrintSetBedTemperature(uint16_t t); bool octoPrintSetTool0Temperature(uint16_t t); diff --git a/keywords.txt b/keywords.txt index cdaf8ef..d905e20 100644 --- a/keywords.txt +++ b/keywords.txt @@ -23,6 +23,13 @@ octoPrintConnectionDisconnect KEYWORD2 octoPrintConnectionAutoConnect KEYWORD2 octoPrintConnectionFakeAck KEYWORD2 octoPrintPrintHeadHome KEYWORD2 +octoPrintPrintHeadRelativeJog KEYWORD2 +octoPrintPrintHeadAbsoluteJog KEYWORD2 +octoPrintPrintHeadJog KEYWORD2 +octoPrintExtrude KEYWORD2 +octoPrintSetBedTemperature KEYWORD2 +octoPrintSetTool0Temperature KEYWORD2 +octoPrintSetTool1Temperature KEYWORD2 octoPrintGetPrinterSD KEYWORD2 octoPrintPrinterSDInit KEYWORD2 octoPrintPrinterSDRefresh KEYWORD2 @@ -35,6 +42,9 @@ octoPrintPrinterCommand KEYWORD2 octoPrintJobPause KEYWORD2 octoPrintJobResume KEYWORD2 octoPrintFileSelect KEYWORD2 +octoPrintCoreShutdown KEYWORD2 +octoPrintCoreReboot KEYWORD2 +octoPrintCoreRestart KEYWORD2 ####################################### # Instances (KEYWORD2)