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

Example PR for the example code #102

Closed
wants to merge 1 commit into from
Closed

Example PR for the example code #102

wants to merge 1 commit into from

Conversation

rotorflight
Copy link
Owner

This is an example PR, for showing how the reviews are done.

NOT TO BE MERGED!

// CLI access to the new parameter.
// The VAR_ type must match the definition
// Profile parameters also need PROFILE_VALUE
{ "example_parameter", VAR_UINT16 | PROFILE_VALUE, .config.minmaxUnsigned = { 1, 2500 }, PG_PID_PROFILE, offsetof(pidProfile_t, example_parameter) },
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every CLI parameter needs a line like this.

@@ -174,6 +174,8 @@ typedef struct pidProfile_s {
uint8_t cyclic_cross_coupling_ratio;
uint8_t cyclic_cross_coupling_cutoff;

uint16_t example_parameter; // A new parameter in the profile

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the config storage for the parameter.

@@ -87,6 +87,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
.cyclic_cross_coupling_gain = 25,
.cyclic_cross_coupling_ratio = 0,
.cyclic_cross_coupling_cutoff = 15,
.example_parameter = 100, // Default value for the new parameter
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each parameter should have a default value defined.

@@ -120,6 +120,8 @@ typedef struct pid_s {

float collective;

float exampleFloat; // Active value to be used in PID

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually parameters are not used directly from the config storage variable, but copied to a local "runtime" variable.
This is important specifically with PID parameters.

@rotorflight rotorflight marked this pull request as draft April 23, 2024 10:39
@rotorflight
Copy link
Owner Author

Closing this. It can be still looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants