samx3-due: Fix null result from tryAllocateQueue()#351
Conversation
…ion of _step_pin as 0 in fas_queue object
|
Thanks for the PR. Could you please check, if the issue is still present in v1.2.1 ? |
|
The issue is still present in v1.2.1, at least on my hardware (Genuine Arduino Due, 2x units). Upon finding the issue, I updated to the latest version v1.2.1 but encountered the same issue. Issue was present both using PlatformIO, as well as a fresh install of v1.2.1 through the Ardiuno IDE. |
|
Thanks for checking with v1.2.1 |
When attempting to run
stepperConnectToPin()on Arduino Due (SAM3X), anullresult is returned.In
sam_queue.cpp:tryAllocateQueue():The function can only return a valid result
if (fas_queue[i]._step_pin == PIN_UNDEFINED)(i.e. the pin is unallocated)Since _step_pin is initialised by default as
0on Due, compared toPIN_UNDEFINED = 255,tryAllocateQueue()returnsnullProposed Fix: Update definition in
sam_queue.hof the classStepperQueueto explicitly initialise_step_pinasPIN_UNDEFINED:uint8_t _step_pin = PIN_UNDEFINED;Tested as working on Arduino Due hardware using PlatformIO