2023-06-27 Model CFG
For each aircraft model + board we need to be able to configure all peripherals.
AM access cfg data
Motors
Number of motors
What type motor (servo, bldc)
Motor action (roll, thrust), + direction
Peripheral + driver (pwm huart2, dshot)
AM cfg data
Tuning data (P, I, D values)
Control limits
Safety check
Compatible flight modes
Other verification of compatibility with hardware setup?
Sensors
Type of sensor
driver + peripheral
Â
Given PRYT values
AM read cfg, determines for each motor which driver to use, and its hardware connection / ID
AM calls PWM or DSHOT driver (subclass of motor driver)
pass in specific hardware corresponding to the motor
Â
Implementation details:
Want cfg files to be readable, easily modifiable.
Â
Existing solutions:
E.g. devicetree + kconfig
Complicated, probably overkill
Â
Custom cfg files
e.g. json, yaml, ini, (key-value pairs) etc
Could be either static or dynamic
If dynamic, changes do not require recompilation
(Just requires changing the file)
Needs some script so the c++ code can interpret and access the data
Could use existing libraries for interpretation
Flexible, readable
Simpler for non-firmware members to use
Can be added later on a case-by-case basis if there is a need
Â
Pure C++ cfg
For each model, unique h++, and maybe C++ file
Statically selected and compiled through build script options
C++ project directly uses cfg
Familiar for firmware members
Not as understandable for non-firmware members
Changing any parameter requires recompilation
Should have strong focus on clear documentation (to offset reduced readability)
Â
Decision: Pure C++ cfg
Â
Â
Static vs Dynamic CFG
Static configuration is sufficient for the near future
More simple to implement
Soft resets possible using dynamic
Decision:
Static. If neccessary, dynamic cfg can be added gradually.
Â
Future Discussion:
How exactly the header cfg files will look
Number of files (e.g. one per model)
Exact data structures
How they will be included/accessed
Â