mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-26 08:47:49 +01:00
fix wrong delay computations, some debug output
This commit is contained in:
@@ -28,10 +28,10 @@ void adjustRPM() {
|
|||||||
if (stepsX != 0 && stepsY != 0) {
|
if (stepsX != 0 && stepsY != 0) {
|
||||||
if (stepsX > stepsY) {
|
if (stepsX > stepsY) {
|
||||||
eggStepperDelay =
|
eggStepperDelay =
|
||||||
(float)servoStepperDelay * (float)stepsY / (float)stepsX;
|
(float)servoStepperDelay * (float)stepsX / (float)stepsY;
|
||||||
} else {
|
} else {
|
||||||
servoStepperDelay =
|
servoStepperDelay =
|
||||||
(float)eggStepperDelay * (float)stepsX / (float)stepsY;
|
(float)eggStepperDelay * (float)stepsY / (float)stepsX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,13 +157,28 @@ ISR(TIMER2_COMPA_vect) {
|
|||||||
newTick = true;
|
newTick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volatile unsigned int tps = 0;
|
||||||
|
volatile unsigned long long oldmillis = 0;
|
||||||
void loop() {
|
void loop() {
|
||||||
if (newCommand) {
|
if (newCommand) {
|
||||||
execCommand(command);
|
execCommand(command);
|
||||||
}
|
}
|
||||||
if (newTick) {
|
if (newTick) {
|
||||||
steppersRoutine();
|
steppersRoutine();
|
||||||
|
tps++;
|
||||||
newTick = false;
|
newTick = false;
|
||||||
}
|
}
|
||||||
|
if (millis() - oldmillis > 1000) {
|
||||||
|
oldmillis = millis();
|
||||||
|
Serial.println(tps);
|
||||||
|
Serial.print(eggStepper.getRemainingSteps());
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.println(servoStepper.getRemainingSteps());
|
||||||
|
Serial.print(eggStepperDelay);
|
||||||
|
Serial.print(" ");
|
||||||
|
Serial.println(servoStepperDelay);
|
||||||
|
|
||||||
|
tps = 0;
|
||||||
|
}
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user