noisymime / speeduino

Speeduino - Arduino based engine management
http://speeduino.com
GNU General Public License v2.0
1.31k stars 526 forks source link

Fix for Stepper Motor Idle Control out of range issues #159

Closed ric355 closed 5 years ago

ric355 commented 5 years ago

Summary here is that the stepper cranking table is not being read correctly, which causes huge stepper targets that the system can't meet due to int values being read from a byte based table.

See the post here for a full explanation:

https://speeduino.com/forum/viewtopic.php?p=28200#p28200

Here is the fix, which goes in idle.ino in the initialization code. Note that the same fault is repeated in the IAC_ALGORITHM_STEP_CL section as well, so it needs fixing in both places.

    case IAC_ALGORITHM_STEP_OL:
      //Case 2 is Stepper open loop
      iacStepTable.xSize = 10;
      iacStepTable.valueSize = SIZE_BYTE;
      iacStepTable.values = configPage6.iacOLStepVal;
      iacStepTable.axisX = configPage6.iacBins;

      iacCrankStepsTable.xSize = 4;

// THIS LINE IS MISSING FROM THE JUNE 2018 FIRMWARE (and probably from older versions).
      iacCrankStepsTable.valueSize = SIZE_BYTE;
// 

      iacCrankStepsTable.values = configPage6.iacCrankSteps;
      iacCrankStepsTable.axisX = configPage6.iacCrankBins;
      iacStepTime = configPage6.iacStepTime * 1000;

      completedHomeSteps = 0;
      idleStepper.curIdleStep = 0;
      idleStepper.stepperStatus = SOFF;
      break;
noisymime commented 5 years ago

Thanks for the report! Will apply the fix and commit shortly.