ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.81k stars 17.27k forks source link

NAVIO2:Provide a source without preprocessor for feature inclusion/exclusion. #26690

Closed muramura closed 2 months ago

muramura commented 5 months ago

Feature request

Is your feature request related to a problem? Please describe.

Many built-in preprocessors for functions are described, making the process difficult to understand.

Describe the solution you'd like

Provide a source that does not have a built-in function preprocessor.

Describe alternatives you've considered

Provide source for Raspi.

Platform [ X ] All [ ] AntennaTracker [ ] Copter [ ] Plane [ ] Rover [ ] Submarine

Additional context

Screenshot from 2024-04-05 06-40-40

muramura commented 5 months ago

[ ] I am currently removing the AP_XXXX_ENABLED preprocessor.

rmackay9 commented 5 months ago

I agree that the preprocessor lines are ugly and make the code harder to read. They are important though because they allow AP to turn on/off features so that the application can fit onto all the boards we support and makes the custom build server possible.

Sadly I don't see an alternative to what we're doing.

muramura commented 5 months ago

@rmackay9 san Thanks for the comment. ArduPilot also supports FC with no 2M byte limit. I would remove the preprocessor for FC without the 2M byte limit. GIT can merge changes in favor of new code. This feature works well.

WORKING: https://github.com/ArduPilot/ardupilot/compare/master...muramura:AP_RASPI

peterbarker commented 2 months ago

We are not going to maintain two branches, one with #ifs and one without. It would be completely unmaintainable.

We need the preprocessor defines or most of our stm32 boards would stop working.