From 31be067dea46b57f3f46fc3a7a38c85885c23481 Mon Sep 17 00:00:00 2001 From: Hakan Bastedt Date: Fri, 8 Mar 2024 09:00:55 +0100 Subject: [PATCH] After test in lathe. Basically ok, always use real Tstartf, not 1/n --- Firmware/src/StepGen2.cpp | 5 ++--- Firmware/src/main.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Firmware/src/StepGen2.cpp b/Firmware/src/StepGen2.cpp index 30d4fa2..2904764 100755 --- a/Firmware/src/StepGen2.cpp +++ b/Firmware/src/StepGen2.cpp @@ -68,12 +68,11 @@ uint32_t StepGen2::handleStepper(uint64_t irqTime) } void StepGen2::startTimerCB() { - startTimer->pause(); // Once is enough. - digitalWrite(dirPin, nSteps > 0 ? HIGH : LOW); + digitalWrite(dirPin, nSteps < 0 ? HIGH : LOW); // There will be a short break here for t2 usecs, in the future. timerPulseSteps = abs(nSteps); - pulseTimer->setMode(pulseTimerChan, TIMER_OUTPUT_COMPARE_PWM1, stepPin); + pulseTimer->setMode(pulseTimerChan, TIMER_OUTPUT_COMPARE_PWM2, stepPin); pulseTimer->setOverflow(timerFrequency, HERTZ_FORMAT); pulseTimer->setCaptureCompare(pulseTimerChan, 5, MICROSEC_COMPARE_FORMAT); // 5 usecs pulseTimer->resume(); diff --git a/Firmware/src/main.cpp b/Firmware/src/main.cpp index 6ce6c6a..bbbe8d8 100755 --- a/Firmware/src/main.cpp +++ b/Firmware/src/main.cpp @@ -41,7 +41,7 @@ extend32to64 longTime; void cb_set_outputs(void) // Master outputs gets here, slave inputs, first operation { Encoder1.setLatch(Obj.IndexLatchEnable); - Encoder1.setScale(500); + Encoder1.setScale(2000); // Step2.reqPos(Obj.CommandedPosition2); // Step2.setScale(Obj.StepsPerMM2);