Skip to content

Commit b8ced8f

Browse files
committed
Endstop strength depends on angle and not scaled counts.
Makes endstop stiffness the same for every range setting and not more intense for smaller ranges.
1 parent abc032c commit b8ced8f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Firmware/FFBoard/Inc/Axis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class Axis : public PersistentStorage, public CommandHandler, public ErrorHandle
225225
float torqueScaler = 0; // power * fx_ratio as a ratio between 0 & 1
226226
bool invertAxis = false;
227227
uint8_t endstopStrength = 127; // Sets how much extra torque per count above endstop is added. High = stiff endstop. Low = softer
228-
const float endstopGain = 0.75; // Overall max endstop intensity
228+
const float endstopGain = 50; // Overall max endstop intensity
229229

230230

231231
uint8_t idlespringstrength = 127;

Firmware/FFBoard/Src/Axis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ int16_t Axis::updateEndstop(){
508508
if(clipdir == 0){
509509
return 0;
510510
}
511-
int32_t addtorque = clip<int32_t,int32_t>(abs(metric.current.pos)-0x7fff,-0x7fff,0x7fff);
512-
addtorque *= (float)endstopStrength * endstopGain * torqueScaler; // Apply endstop gain for stiffness. 0.15f
511+
float addtorque = clipdir*metric.current.posDegrees - (float)this->degreesOfRotation/2.0; // degress of rotation counts total range so multiply by 2
512+
addtorque *= (float)endstopStrength * endstopGain * torqueScaler; // Apply endstop gain for stiffness.
513513
addtorque *= -clipdir;
514514

515515
return clip<int32_t,int32_t>(addtorque,-0x7fff,0x7fff);

0 commit comments

Comments
 (0)