Skip to content

Conversation

@AntonEvmenenko
Copy link
Contributor

@AntonEvmenenko AntonEvmenenko commented Dec 16, 2024

Hello,

Found this bug while trying to get this code to work:

STM32HWEncoder e(1000, PA0, PA1);

This is the related part of my platformio.ini config:

platform = ststm32
board = nucleo_g474re
framework = arduino

In this case, PA0 is 192 and PA1 is 193. Currently, when you pass pins to the STM32HWEncoder constructor, they're trimmed down to the int8_t, which is incorrect. In my case 192 and 193 do not actually fit into the int8_t, and trimming then leads to incorrect operation of the digitalPinToPinName function. So I just changed int8_t to int

@runger1101001
Copy link
Member

Hey, thanks a lot for this contribution! I’ll look more closely tonight when I’m not on my phone but it looks like a good find…

@runger1101001 runger1101001 self-assigned this May 28, 2025
@runger1101001 runger1101001 added the bug Something isn't working label May 28, 2025
@runger1101001 runger1101001 added this to the 1.0.9 milestone May 28, 2025
@runger1101001 runger1101001 merged commit 58e82d4 into simplefoc:dev May 28, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants