Skip to content

Commit

Permalink
removed motorStop() method
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Jan 26, 2025
1 parent 0faab20 commit 52afe82
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion include/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class SS2K {
void updateStealthChop();
void updateStepperSpeed(int speed = 0);
void checkDriverTemperature();
void motorStop(bool releaseTension = false);
void FTMSModeShiftModifier();
static void rxSerial(void);
void txSerial();
Expand Down
5 changes: 2 additions & 3 deletions src/ERG_Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,9 +1204,8 @@ void ErgMode::_updateValues(int newCadence, Measurement& newWatts, float newIncl

bool ErgMode::_userIsSpinning(int cadence, float incline) {
if (cadence <= MIN_ERG_CADENCE) {
if (!this->engineStopped) { // Test so motor stop command only happens once.
ss2k->motorStop(); // release tension
rtConfig->setTargetIncline(incline - WATTS_PER_SHIFT); // release incline
if (!this->engineStopped) { // Test so motor stop command only happens once. // release tension
rtConfig->setTargetIncline(0); // release incline
this->engineStopped = true;
}
return false; // Cadence too low, nothing to do here
Expand Down
17 changes: 0 additions & 17 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,23 +713,6 @@ void SS2K::checkDriverTemperature() {
}
}

/**
* @brief Stops the motor and optionally releases tension.
*
* This function stops the motor by calling the stopMove() method on the stepper object.
* It then sets the current position of the stepper to the target position stored in ss2k.
* If the releaseTension parameter is true, the function moves the stepper to a position
* that releases tension by subtracting a calculated shift step from the target position.
*
* @param releaseTension A boolean flag indicating whether to release tension after stopping the motor.
*/
void SS2K::motorStop(bool releaseTension) {
stepper->stopMove();
if (releaseTension) {
rtConfig->setTargetIncline(ss2k->getCurrentPosition() - userConfig->getShiftStep());
}
}

void SS2K::txSerial() { // Serial.printf(" Before TX ");
if (PELOTON_TX && (txCheck >= 1)) {
static int alternate = 0;
Expand Down

0 comments on commit 52afe82

Please sign in to comment.