Skip to content

Commit

Permalink
adjusted speed and sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Nov 5, 2024
1 parent 3529a77 commit e5ab1d6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,14 @@ void SS2K::goHome(bool bothDirections) {
}
SS2K_LOG(MAIN_LOG_TAG, "Homing...");
int _IFCNT = driver.IFCNT(); // Number of UART commands rx by driver
while (driver.IFCNT() < _IFCNT + 3) {
SS2K_LOG(MAIN_LOG_TAG, "Updating driver...");
updateStepperPower(100);
vTaskDelay(50 / portTICK_PERIOD_MS);
driver.irun(2); // low power
vTaskDelay(50 / portTICK_PERIOD_MS);
driver.ihold((uint8_t)(1));
vTaskDelay(50 / portTICK_PERIOD_MS);
this->updateStepperSpeed(800);
}
SS2K_LOG(MAIN_LOG_TAG, "Updating driver...");
updateStepperPower(100);
vTaskDelay(50 / portTICK_PERIOD_MS);
driver.irun(2); // low power
vTaskDelay(50 / portTICK_PERIOD_MS);
driver.ihold((uint8_t)(1));
vTaskDelay(50 / portTICK_PERIOD_MS);
this->updateStepperSpeed(1500);
bool stalled = false;
int threshold = 0;
vTaskDelay(1000 / portTICK_PERIOD_MS);
Expand All @@ -583,7 +581,8 @@ void SS2K::goHome(bool bothDirections) {
Serial.printf("%d ", driver.SG_RESULT());
vTaskDelay(250 / portTICK_PERIOD_MS);
while (!stalled) {
stalled = (driver.SG_RESULT() < threshold - 75);
// stalled = (threshold < 200); // Were we already at the stop?
stalled = (driver.SG_RESULT() < threshold - 100);
}
stalled = false;
stepper->forceStop();
Expand Down

0 comments on commit e5ab1d6

Please sign in to comment.