You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bit of code in stm32_mcu.cpp reads off the end of the pinTimers array if there is more than one motor. It doesn't always crash, which made it very difficult to narrow down where the problem was.
int scoreCombination(int numPins, PinMap* pinTimers[]) {
// check already used - TODO move this to outer loop also...
for (int i=0; i<numTimerPinsUsed; i++) {
if (pinTimers[i]->peripheral == timerPinsUsed[i]->peripheral
&& STM_PIN_CHANNEL(pinTimers[i]->function) == STM_PIN_CHANNEL(timerPinsUsed[i]->function))
return -2; // bad combination - timer channel already used
}
...
I think this is the proper fix for it, but hopefully whoever wrote the original can verify that the logic is correct.
// check already used - TODO move this to outer loop also...
for (int i=0; i<numPins; i++) {
for (int j=0; j<numTimerPinsUsed; j++) {
if (pinTimers[i] != NP && pinTimers[i]->peripheral == timerPinsUsed[j]->peripheral
&& STM_PIN_CHANNEL(pinTimers[i]->function) == STM_PIN_CHANNEL(timerPinsUsed[j]->function))
return -2; // bad combination - timer channel already used
}
}
The text was updated successfully, but these errors were encountered:
This bit of code in stm32_mcu.cpp reads off the end of the pinTimers array if there is more than one motor. It doesn't always crash, which made it very difficult to narrow down where the problem was.
I think this is the proper fix for it, but hopefully whoever wrote the original can verify that the logic is correct.
The text was updated successfully, but these errors were encountered: