Skip to content

Commit

Permalink
DIR_PIN was set incorrectly, causing the motor to turn in the oppos…
Browse files Browse the repository at this point in the history
…ite direction of what was indicated & increase microSteps and rmsCurrent
  • Loading branch information
mwood77 committed Dec 21, 2024
1 parent cd794ce commit 3fd6476
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/platformio/osww-server/src/utils/MotorControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ MotorControl* MotorControl::instance = nullptr;
static bool timerConfigured = false;

// For stepper timing control (RPM)
uint16_t microSteps = 8;
uint16_t rmsCurrent = 800;
uint16_t microSteps = 4;
uint16_t rmsCurrent = 600;
uint64_t timerMicroSecondInterval = 400; // 937 microseconds for 40 RPM / 400 microseconds for 100 RPM

#endif
Expand Down Expand Up @@ -123,7 +123,7 @@ void MotorControl::clockwise()
// Set the direction pin
if (timerConfigured) timerAlarmDisable(timer);

digitalWrite(DIR_PIN, LOW);
digitalWrite(DIR_PIN, HIGH);
delay(10);

if (timerConfigured) timerAlarmEnable(timer);
Expand All @@ -144,7 +144,7 @@ void MotorControl::countClockwise()
// Set the direction pin
if (timerConfigured) timerAlarmDisable(timer);

digitalWrite(DIR_PIN, HIGH);
digitalWrite(DIR_PIN, LOW);
delay(10);

if (timerConfigured) timerAlarmEnable(timer);
Expand Down

0 comments on commit 3fd6476

Please sign in to comment.