Save new pen up and down position only if changed.

This commit is contained in:
2026-03-07 21:14:08 +01:00
parent 1a9db68067
commit 3bb4f8d02d

View File

@@ -189,20 +189,12 @@ void setPen()
void togglePen() void togglePen()
{ {
Log(__FUNCTION__); Log(__FUNCTION__);
int value;
char *arg; char *arg;
// moveToDestination();
arg = nextCommandArg(); arg = nextCommandArg();
if (arg != NULL)
value = atoi(arg);
else
value = 500;
doTogglePen(); doTogglePen();
sendAck(); sendAck();
// delay(value);
} }
void doTogglePen() void doTogglePen()
@@ -276,6 +268,7 @@ void stepperModeConfigure()
Log(__FUNCTION__); Log(__FUNCTION__);
int cmd; int cmd;
int value; int value;
int iTmpPenPos;
char *arg; char *arg;
arg = nextCommandArg(); arg = nextCommandArg();
if (arg != NULL) if (arg != NULL)
@@ -289,13 +282,21 @@ void stepperModeConfigure()
switch (cmd) switch (cmd)
{ {
case 4: case 4:
g_iPenDownPos = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo iTmpPenPos = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo
storePenDownPosInEE(); if (g_iPenDownPos != iTmpPenPos)
{
g_iPenDownPos = iTmpPenPos;
storePenDownPosInEE();
}
sendAck(); sendAck();
break; break;
case 5: case 5:
g_iPenUpPos = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo iTmpPenPos = (int)((float)(value - 6000) / (float)133.3); // transformation from EBB to PWM-Servo
storePenUpPosInEE(); if (g_iPenUpPos != iTmpPenPos)
{
g_iPenUpPos = iTmpPenPos;
storePenUpPosInEE();
}
sendAck(); sendAck();
break; break;
case 6: // rotMin=value; ignored case 6: // rotMin=value; ignored