Removed not needed config for pen. Use inkscape interface.
This commit is contained in:
@@ -72,8 +72,8 @@ extern SerialCommand SCmd;
|
|||||||
|
|
||||||
extern int penMin;
|
extern int penMin;
|
||||||
extern int penMax;
|
extern int penMax;
|
||||||
extern int penUpPos;
|
extern int g_iPEN_UP_POS;
|
||||||
extern int penDownPos;
|
extern int g_iPEN_DOWN_POS;
|
||||||
extern int servoRateUp;
|
extern int servoRateUp;
|
||||||
extern int servoRateDown;
|
extern int servoRateDown;
|
||||||
extern long rotStepError;
|
extern long rotStepError;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ button { margin-top: 18px; border: 0; background: #0b5ed7; color: white; padding
|
|||||||
let lastSeq = 0;
|
let lastSeq = 0;
|
||||||
|
|
||||||
async function loadConfig() {
|
async function loadConfig() {
|
||||||
const resp = await fetch('/api/config');
|
const resp = await fetch('/api/config', { cache: 'no-store' });
|
||||||
if (!resp.ok) throw new Error('Konfiguration konnte nicht geladen werden');
|
if (!resp.ok) throw new Error('Konfiguration konnte nicht geladen werden');
|
||||||
return resp.json();
|
return resp.json();
|
||||||
}
|
}
|
||||||
@@ -92,6 +92,8 @@ async function saveConfig() {
|
|||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
throw new Error(text || 'Speichern fehlgeschlagen');
|
throw new Error(text || 'Speichern fehlgeschlagen');
|
||||||
}
|
}
|
||||||
|
const saved = await resp.json();
|
||||||
|
renderForm(saved);
|
||||||
status.textContent = 'Gespeichert';
|
status.textContent = 'Gespeichert';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +145,9 @@ void handleGetConfig() {
|
|||||||
server.send(500, "text/plain", "Config storage not available");
|
server.send(500, "text/plain", "Config storage not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
server.sendHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
server.sendHeader("Pragma", "no-cache");
|
||||||
|
server.sendHeader("Expires", "0");
|
||||||
server.send(200, "application/json", buildConfigJson());
|
server.send(200, "application/json", buildConfigJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,17 +164,18 @@ void handlePostConfig() {
|
|||||||
|
|
||||||
String error;
|
String error;
|
||||||
if (!applyConfigJson(server.arg("plain"), error)) {
|
if (!applyConfigJson(server.arg("plain"), error)) {
|
||||||
|
Log(String("Config JSON fehlerhaft: ") + error);
|
||||||
server.send(400, "text/plain", error);
|
server.send(400, "text/plain", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saveConfigToFile()) {
|
if (!saveConfigToFile()) {
|
||||||
|
Log("Config konnte nicht gespeichert werden");
|
||||||
server.send(500, "text/plain", "Could not save config");
|
server.send(500, "text/plain", "Could not save config");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// penState = penUpPos;
|
Log(String("Config gespeichert: penUpPos=") + g_iPEN_UP_POS + ", penDownPos=" + g_iPEN_DOWN_POS);
|
||||||
// penServo.write(penState);
|
|
||||||
server.send(200, "application/json", buildConfigJson());
|
server.send(200, "application/json", buildConfigJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,11 +186,19 @@ void handleGetLogs() {
|
|||||||
}
|
}
|
||||||
server.send(200, "application/json", buildLogsJson(since));
|
server.send(200, "application/json", buildLogsJson(since));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleNotFound() {
|
||||||
|
if (server.uri().startsWith("/api/")) {
|
||||||
|
server.send(404, "text/plain", "API endpoint not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handleRoot();
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ConfigParameter configParameters[] = {
|
ConfigParameter configParameters[] = {
|
||||||
{"penUpPos", &penUpPos, "Pen Up Position", 5},
|
// {"penUpPos", &g_iPEN_UP_POS, "Pen Up Position", 5},
|
||||||
{"penDownPos", &penDownPos, "Pen Down Position", 20},
|
// {"penDownPos", &g_iPEN_DOWN_POS, "Pen Down Position", 20},
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t configParameterCount = sizeof(configParameters) / sizeof(configParameters[0]);
|
const size_t configParameterCount = sizeof(configParameters) / sizeof(configParameters[0]);
|
||||||
@@ -203,6 +217,7 @@ bool loadConfigFromFile() {
|
|||||||
|
|
||||||
File file = SPIFFS.open(kConfigPath, "r");
|
File file = SPIFFS.open(kConfigPath, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
Log("config.json fehlt, defaults werden gespeichert");
|
||||||
return saveConfigToFile();
|
return saveConfigToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,6 +225,7 @@ bool loadConfigFromFile() {
|
|||||||
DeserializationError err = deserializeJson(doc, file);
|
DeserializationError err = deserializeJson(doc, file);
|
||||||
file.close();
|
file.close();
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Log("config.json ist ungueltig, defaults werden gespeichert");
|
||||||
return saveConfigToFile();
|
return saveConfigToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,6 +246,7 @@ bool loadConfigFromFile() {
|
|||||||
param->description = item["description"].as<String>();
|
param->description = item["description"].as<String>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log(String("Config geladen: penUpPos=") + g_iPEN_UP_POS + ", penDownPos=" + g_iPEN_DOWN_POS);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -237,6 +254,7 @@ bool loadConfigFromFile() {
|
|||||||
bool saveConfigToFile() {
|
bool saveConfigToFile() {
|
||||||
File file = SPIFFS.open(kConfigPath, "w");
|
File file = SPIFFS.open(kConfigPath, "w");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
Log("SPIFFS open write failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +268,11 @@ bool saveConfigToFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ok = serializeJsonPretty(doc, file) > 0;
|
bool ok = serializeJsonPretty(doc, file) > 0;
|
||||||
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
if (!ok) {
|
||||||
|
Log("serializeJsonPretty failed");
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +346,7 @@ void startWebInterface() {
|
|||||||
server.on("/api/config", HTTP_GET, handleGetConfig);
|
server.on("/api/config", HTTP_GET, handleGetConfig);
|
||||||
server.on("/api/config", HTTP_POST, handlePostConfig);
|
server.on("/api/config", HTTP_POST, handlePostConfig);
|
||||||
server.on("/api/logs", HTTP_GET, handleGetLogs);
|
server.on("/api/logs", HTTP_GET, handleGetLogs);
|
||||||
server.onNotFound(handleRoot);
|
server.onNotFound(handleNotFound);
|
||||||
server.begin();
|
server.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,84 +1,95 @@
|
|||||||
#include "EggDuino.h"
|
#include "EggDuino.h"
|
||||||
|
|
||||||
|
void queryPen()
|
||||||
void queryPen() {
|
{
|
||||||
char state;
|
char state;
|
||||||
if (penState==penUpPos)
|
if (penState == g_iPEN_UP_POS)
|
||||||
state='1';
|
state = '1';
|
||||||
else
|
else
|
||||||
state='0';
|
state = '0';
|
||||||
Serial.print(String(state)+"\r\n");
|
Serial.print(String(state) + "\r\n");
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryButton() {
|
void queryButton()
|
||||||
Serial.print(String(prgButtonState) +"\r\n");
|
{
|
||||||
|
Serial.print(String(prgButtonState) + "\r\n");
|
||||||
sendAck();
|
sendAck();
|
||||||
prgButtonState = 0;
|
prgButtonState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryLayer() {
|
void queryLayer()
|
||||||
Serial.print(String(layer) +"\r\n");
|
{
|
||||||
|
Serial.print(String(layer) + "\r\n");
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLayer() {
|
void setLayer()
|
||||||
uint32_t value=0;
|
{
|
||||||
|
uint32_t value = 0;
|
||||||
char *arg1;
|
char *arg1;
|
||||||
arg1 = SCmd.next();
|
arg1 = SCmd.next();
|
||||||
if (arg1 != NULL) {
|
if (arg1 != NULL)
|
||||||
|
{
|
||||||
value = atoi(arg1);
|
value = atoi(arg1);
|
||||||
layer=value;
|
layer = value;
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryNodeCount() {
|
void queryNodeCount()
|
||||||
Serial.print(String(nodeCount) +"\r\n");
|
{
|
||||||
|
Serial.print(String(nodeCount) + "\r\n");
|
||||||
sendAck();
|
sendAck();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNodeCount() {
|
void setNodeCount()
|
||||||
uint32_t value=0;
|
{
|
||||||
|
uint32_t value = 0;
|
||||||
char *arg1;
|
char *arg1;
|
||||||
arg1 = SCmd.next();
|
arg1 = SCmd.next();
|
||||||
if (arg1 != NULL) {
|
if (arg1 != NULL)
|
||||||
|
{
|
||||||
value = atoi(arg1);
|
value = atoi(arg1);
|
||||||
nodeCount=value;
|
nodeCount = value;
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nodeCountIncrement() {
|
void nodeCountIncrement()
|
||||||
nodeCount=nodeCount++;
|
{
|
||||||
|
nodeCount = nodeCount++;
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nodeCountDecrement() {
|
void nodeCountDecrement()
|
||||||
nodeCount=nodeCount--;
|
{
|
||||||
|
nodeCount = nodeCount--;
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stepperMove() {
|
void stepperMove()
|
||||||
uint16_t duration=0; //in ms
|
{
|
||||||
int penStepsEBB=0; //Pen
|
uint16_t duration = 0; // in ms
|
||||||
int rotStepsEBB=0; //Rot
|
int penStepsEBB = 0; // Pen
|
||||||
|
int rotStepsEBB = 0; // Rot
|
||||||
|
|
||||||
moveToDestination();
|
moveToDestination();
|
||||||
|
|
||||||
if (!parseSMArgs(&duration, &penStepsEBB, &rotStepsEBB)) {
|
if (!parseSMArgs(&duration, &penStepsEBB, &rotStepsEBB))
|
||||||
|
{
|
||||||
sendError();
|
sendError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendAck();
|
sendAck();
|
||||||
|
|
||||||
if ( (penStepsEBB==0) && (rotStepsEBB==0) ) {
|
if ((penStepsEBB == 0) && (rotStepsEBB == 0))
|
||||||
|
{
|
||||||
delay(duration);
|
delay(duration);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,48 +97,59 @@ void stepperMove() {
|
|||||||
prepareMove(duration, penStepsEBB, rotStepsEBB);
|
prepareMove(duration, penStepsEBB, rotStepsEBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPen(){
|
void setPen()
|
||||||
|
{
|
||||||
int cmd;
|
int cmd;
|
||||||
int value;
|
int value;
|
||||||
char *arg;
|
char *arg;
|
||||||
|
char cstrMsg[20];
|
||||||
|
|
||||||
moveToDestination();
|
moveToDestination();
|
||||||
|
|
||||||
arg = SCmd.next();
|
arg = SCmd.next();
|
||||||
if (arg != NULL) {
|
if (arg != NULL)
|
||||||
|
{
|
||||||
cmd = atoi(arg);
|
cmd = atoi(arg);
|
||||||
switch (cmd) {
|
switch (cmd)
|
||||||
case 0:
|
{
|
||||||
penServo.write(penUpPos);
|
case 0:
|
||||||
penState=penUpPos;
|
penServo.write(g_iPEN_UP_POS);
|
||||||
break;
|
penState = g_iPEN_UP_POS;
|
||||||
|
sprintf(cstrMsg, "PEN down: %d", g_iPEN_UP_POS);
|
||||||
|
Log(cstrMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
penServo.write(penDownPos);
|
penServo.write(g_iPEN_DOWN_POS);
|
||||||
penState=penDownPos;
|
penState = g_iPEN_DOWN_POS;
|
||||||
break;
|
sprintf(cstrMsg, "PEN up: %d", g_iPEN_DOWN_POS);
|
||||||
|
Log(cstrMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char *val;
|
char *val;
|
||||||
val = SCmd.next();
|
val = SCmd.next();
|
||||||
if (val != NULL) {
|
if (val != NULL)
|
||||||
|
{
|
||||||
value = atoi(val);
|
value = atoi(val);
|
||||||
sendAck();
|
sendAck();
|
||||||
delay(value);
|
delay(value);
|
||||||
}
|
}
|
||||||
if (val==NULL && arg !=NULL) {
|
if (val == NULL && arg != NULL)
|
||||||
|
{
|
||||||
sendAck();
|
sendAck();
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
// Serial.println("delay");
|
// Serial.println("delay");
|
||||||
if (val==NULL && arg ==NULL)
|
if (val == NULL && arg == NULL)
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void togglePen(){
|
void togglePen()
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
char *arg;
|
char *arg;
|
||||||
|
|
||||||
@@ -144,17 +166,22 @@ void togglePen(){
|
|||||||
delay(value);
|
delay(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doTogglePen() {
|
void doTogglePen()
|
||||||
if (penState==penUpPos) {
|
{
|
||||||
penServo.write(penDownPos);
|
if (penState == g_iPEN_UP_POS)
|
||||||
penState=penDownPos;
|
{
|
||||||
} else {
|
penServo.write(g_iPEN_DOWN_POS);
|
||||||
penServo.write(penUpPos);
|
penState = g_iPEN_DOWN_POS;
|
||||||
penState=penUpPos;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
penServo.write(g_iPEN_UP_POS);
|
||||||
|
penState = g_iPEN_UP_POS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableMotors(){
|
void enableMotors()
|
||||||
|
{
|
||||||
int cmd;
|
int cmd;
|
||||||
int value;
|
int value;
|
||||||
char *arg;
|
char *arg;
|
||||||
@@ -165,35 +192,44 @@ void enableMotors(){
|
|||||||
val = SCmd.next();
|
val = SCmd.next();
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
value = atoi(val);
|
value = atoi(val);
|
||||||
//values parsed
|
// values parsed
|
||||||
if ((arg != NULL) && (val == NULL)){
|
if ((arg != NULL) && (val == NULL))
|
||||||
switch (cmd) {
|
{
|
||||||
case 0: motorsOff();
|
switch (cmd)
|
||||||
sendAck();
|
{
|
||||||
break;
|
case 0:
|
||||||
case 1: motorsOn();
|
motorsOff();
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
default:
|
case 1:
|
||||||
sendError();
|
motorsOn();
|
||||||
|
sendAck();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//the following implementaion is a little bit cheated, because i did not know, how to implement different values for first and second argument.
|
// the following implementaion is a little bit cheated, because i did not know, how to implement different values for first and second argument.
|
||||||
if ((arg != NULL) && (val != NULL)){
|
if ((arg != NULL) && (val != NULL))
|
||||||
switch (value) {
|
{
|
||||||
case 0: motorsOff();
|
switch (value)
|
||||||
sendAck();
|
{
|
||||||
break;
|
case 0:
|
||||||
case 1: motorsOn();
|
motorsOff();
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
default:
|
case 1:
|
||||||
sendError();
|
motorsOn();
|
||||||
|
sendAck();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stepperModeConfigure(){
|
void stepperModeConfigure()
|
||||||
|
{
|
||||||
int cmd;
|
int cmd;
|
||||||
int value;
|
int value;
|
||||||
char *arg;
|
char *arg;
|
||||||
@@ -204,63 +240,75 @@ void stepperModeConfigure(){
|
|||||||
val = SCmd.next();
|
val = SCmd.next();
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
value = atoi(val);
|
value = atoi(val);
|
||||||
if ((arg != NULL) && (val != NULL)){
|
if ((arg != NULL) && (val != NULL))
|
||||||
switch (cmd) {
|
{
|
||||||
case 4: penDownPos= (int) ((float) (value-6000)/(float) 133.3); // transformation from EBB to PWM-Servo
|
switch (cmd)
|
||||||
storePenDownPosInEE();
|
{
|
||||||
sendAck();
|
case 4:
|
||||||
break;
|
g_iPEN_DOWN_POS = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo
|
||||||
case 5: penUpPos= (int)((float) (value-6000)/(float) 133.3); // transformation from EBB to PWM-Servo
|
Log(String("SC set PEN_DOWN_POS -> ") + g_iPEN_DOWN_POS + " (raw " + value + ")");
|
||||||
storePenUpPosInEE();
|
storePenDownPosInEE();
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
case 6: //rotMin=value; ignored
|
case 5:
|
||||||
sendAck();
|
g_iPEN_UP_POS = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo
|
||||||
break;
|
Log(String("SC set PEN_UP_POS -> ") + g_iPEN_UP_POS + " (raw " + value + ")");
|
||||||
case 7: //rotMax=value; ignored
|
storePenUpPosInEE();
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
case 11: servoRateUp=value;
|
case 6: // rotMin=value; ignored
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
case 12: servoRateDown=value;
|
case 7: // rotMax=value; ignored
|
||||||
sendAck();
|
sendAck();
|
||||||
break;
|
break;
|
||||||
default:
|
case 11:
|
||||||
sendError();
|
servoRateUp = value;
|
||||||
|
sendAck();
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
servoRateDown = value;
|
||||||
|
sendAck();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendVersion(){
|
void sendVersion()
|
||||||
|
{
|
||||||
Serial.print(initSting);
|
Serial.print(initSting);
|
||||||
Serial.print("\r\n");
|
Serial.print("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void unrecognized(const char *command){
|
void unrecognized(const char *command)
|
||||||
|
{
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ignore(){
|
void ignore()
|
||||||
|
{
|
||||||
sendAck();
|
sendAck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeComInterface(){
|
void makeComInterface()
|
||||||
SCmd.addCommand("v",sendVersion);
|
{
|
||||||
SCmd.addCommand("EM",enableMotors);
|
SCmd.addCommand("v", sendVersion);
|
||||||
SCmd.addCommand("SC",stepperModeConfigure);
|
SCmd.addCommand("EM", enableMotors);
|
||||||
SCmd.addCommand("SP",setPen);
|
SCmd.addCommand("SC", stepperModeConfigure);
|
||||||
SCmd.addCommand("SM",stepperMove);
|
SCmd.addCommand("SP", setPen);
|
||||||
SCmd.addCommand("SE",ignore);
|
SCmd.addCommand("SM", stepperMove);
|
||||||
SCmd.addCommand("TP",togglePen);
|
SCmd.addCommand("SE", ignore);
|
||||||
SCmd.addCommand("PO",ignore); //Engraver command, not implemented, gives fake answer
|
SCmd.addCommand("TP", togglePen);
|
||||||
SCmd.addCommand("NI",nodeCountIncrement);
|
SCmd.addCommand("PO", ignore); // Engraver command, not implemented, gives fake answer
|
||||||
SCmd.addCommand("ND",nodeCountDecrement);
|
SCmd.addCommand("NI", nodeCountIncrement);
|
||||||
SCmd.addCommand("SN",setNodeCount);
|
SCmd.addCommand("ND", nodeCountDecrement);
|
||||||
SCmd.addCommand("QN",queryNodeCount);
|
SCmd.addCommand("SN", setNodeCount);
|
||||||
SCmd.addCommand("SL",setLayer);
|
SCmd.addCommand("QN", queryNodeCount);
|
||||||
SCmd.addCommand("QL",queryLayer);
|
SCmd.addCommand("SL", setLayer);
|
||||||
SCmd.addCommand("QP",queryPen);
|
SCmd.addCommand("QL", queryLayer);
|
||||||
SCmd.addCommand("QB",queryButton); //"PRG" Button,
|
SCmd.addCommand("QP", queryPen);
|
||||||
|
SCmd.addCommand("QB", queryButton); //"PRG" Button,
|
||||||
SCmd.setDefaultHandler(unrecognized); // Handler for command that isn't matched (says "What?")
|
SCmd.setDefaultHandler(unrecognized); // Handler for command that isn't matched (says "What?")
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,10 @@ void initHardware()
|
|||||||
{
|
{
|
||||||
if (!initConfigStore())
|
if (!initConfigStore())
|
||||||
{
|
{
|
||||||
penUpPos = 5;
|
g_iPEN_UP_POS = 5;
|
||||||
penDownPos = 20;
|
g_iPEN_DOWN_POS = 20;
|
||||||
}
|
}
|
||||||
penState = penUpPos;
|
penState = g_iPEN_UP_POS;
|
||||||
|
|
||||||
g_stepEngine.init();
|
g_stepEngine.init();
|
||||||
g_pStepperRotate = g_stepEngine.stepperConnectToPin(step1);
|
g_pStepperRotate = g_stepEngine.stepperConnectToPin(step1);
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ Button motorsToggle(motorsButton, toggleMotors);
|
|||||||
// Variables... be careful, by messing around here, everything has a reason and crossrelations...
|
// Variables... be careful, by messing around here, everything has a reason and crossrelations...
|
||||||
int penMin = 0;
|
int penMin = 0;
|
||||||
int penMax = 0;
|
int penMax = 0;
|
||||||
int penUpPos = 5; // can be overwritten from EBB-Command SC
|
int g_iPEN_UP_POS = 5; // can be overwritten from EBB-Command SC
|
||||||
int penDownPos = 20; // can be overwritten from EBB-Command SC
|
int g_iPEN_DOWN_POS = 20; // can be overwritten from EBB-Command SC
|
||||||
int servoRateUp = 0; // from EBB-Protocol not implemented on machine-side
|
int servoRateUp = 0; // from EBB-Protocol not implemented on machine-side
|
||||||
int servoRateDown = 0; // from EBB-Protocol not implemented on machine-side
|
int servoRateDown = 0; // from EBB-Protocol not implemented on machine-side
|
||||||
long rotStepError = 0;
|
long rotStepError = 0;
|
||||||
long penStepError = 0;
|
long penStepError = 0;
|
||||||
int penState = penUpPos;
|
int penState = g_iPEN_UP_POS;
|
||||||
uint32_t nodeCount = 0;
|
uint32_t nodeCount = 0;
|
||||||
unsigned int layer = 0;
|
unsigned int layer = 0;
|
||||||
boolean prgButtonState = 0;
|
boolean prgButtonState = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user