Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dshot: check for bad pulses and handle wrap correctly #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tridge
Copy link
Member

@tridge tridge commented Aug 30, 2024

new variant of #76
this ensures we handle timer wrap correctly, fixing bad dshot frames with ArduPilot, and also checks for much too narrow or wide pulses

by making variables static this also saves flash and ram. Using REF_F031 as the benchmark we get:

current REF_F031:

Memory region         Used Size  Region Size  %age Used
            SRAM:          0 GB        192 B      0.00%
             RAM:        3760 B       3904 B     96.31%
    FLASH_VECTAB:         192 B        192 B    100.00%
   FLASH_VERSION:          16 B         16 B    100.00%
           FLASH:       23260 B      27408 B     84.87%
       FILE_NAME:          32 B         32 B    100.00%
          EEPROM:          0 GB         1 KB      0.00%

with this PR:

Memory region         Used Size  Region Size  %age Used
            SRAM:          0 GB        192 B      0.00%
             RAM:        3704 B       3904 B     94.88%
    FLASH_VECTAB:         192 B        192 B    100.00%
   FLASH_VERSION:          16 B         16 B    100.00%
           FLASH:       23244 B      27408 B     84.81%
       FILE_NAME:          32 B         32 B    100.00%
          EEPROM:          0 GB         1 KB      0.00%

so we save 54 bytes of ram and 16 bytes of flash, while fixing the wrap issue and adding pulse width checks

this ensures we handle timer wrap correctly, fixing bad dshot frames
with ArduPilot, and also checks for much too narrow or wide pulses

by making variables static this also saves flash and ram. Using
REF_F031 as the benchmark we get:

current REF_F031:

Memory region         Used Size  Region Size  %age Used
            SRAM:          0 GB        192 B      0.00%
             RAM:        3760 B       3904 B     96.31%
    FLASH_VECTAB:         192 B        192 B    100.00%
   FLASH_VERSION:          16 B         16 B    100.00%
           FLASH:       23260 B      27408 B     84.87%
       FILE_NAME:          32 B         32 B    100.00%
          EEPROM:          0 GB         1 KB      0.00%

with this PR:

Memory region         Used Size  Region Size  %age Used
            SRAM:          0 GB        192 B      0.00%
             RAM:        3704 B       3904 B     94.88%
    FLASH_VECTAB:         192 B        192 B    100.00%
   FLASH_VERSION:          16 B         16 B    100.00%
           FLASH:       23244 B      27408 B     84.81%
       FILE_NAME:          32 B         32 B    100.00%
          EEPROM:          0 GB         1 KB      0.00%

so we save 54 bytes of ram and 16 bytes of flash, while fixing the
wrap issue and adding pulse width checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants