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

Add ability to read Programming PID status via MSP #6625

Merged
merged 2 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
sbufWriteU16(dst, programmingPids(i)->gains.FF);
}
break;
case MSP2_INAV_PROGRAMMING_PID_STATUS:
for (int i = 0; i < MAX_PROGRAMMING_PID_COUNT; i++) {
sbufWriteU32(dst, programmingPidGetOutput(i));
}
break;
#endif
case MSP2_COMMON_MOTOR_MIXER:
for (uint8_t i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/msp/msp_protocol_v2_inav.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#define MSP2_INAV_GVAR_STATUS 0x2027
#define MSP2_INAV_PROGRAMMING_PID 0x2028
#define MSP2_INAV_SET_PROGRAMMING_PID 0x2029
#define MSP2_INAV_PROGRAMMING_PID_STATUS 0x202A

#define MSP2_PID 0x2030
#define MSP2_SET_PID 0x2031
Expand All @@ -79,4 +80,3 @@
#define MSP2_INAV_SET_SAFEHOME 0x2039

#define MSP2_INAV_MISC2 0x203A

2 changes: 1 addition & 1 deletion src/main/programming/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void programmingPidInit(void)
}
}

int programmingPidGetOutput(uint8_t i) {
int32_t programmingPidGetOutput(uint8_t i) {
return programmingPidState[constrain(i, 0, MAX_PROGRAMMING_PID_COUNT)].output;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/programming/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ typedef struct programmingPidState_s {
void programmingPidUpdateTask(timeUs_t currentTimeUs);
void programmingPidInit(void);
void programmingPidReset(void);
int programmingPidGetOutput(uint8_t i);
int32_t programmingPidGetOutput(uint8_t i);