Skip to content

Commit

Permalink
Add MSP_EXPERIMENTAL and MSP_SET_EXPERIMENTAL (#183)
Browse files Browse the repository at this point in the history
Add a placeholder for adjusting experimental parameters from LUA.
This allows devs to quickly expose parameters to LUA for field tuning,
without create their own LUA.
  • Loading branch information
gongtao0607 authored Oct 15, 2024
1 parent a864b66 commit 68f0af0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/msp/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,15 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
break;
}

case MSP_EXPERIMENTAL:
/*
* Send your experimental parameters to LUA. Like:
*
* sbufWriteU8(dst, currentPidProfile->yourFancyParameterA);
* sbufWriteU8(dst, currentPidProfile->yourFancyParameterB);
*/
break;

default:
return false;
}
Expand Down Expand Up @@ -3523,6 +3532,17 @@ static mspResult_e mspCommonProcessInCommand(mspDescriptor_t srcDesc, int16_t cm
break;
#endif // OSD

case MSP_SET_EXPERIMENTAL:
/*
* Receive your experimental parameters from LUA. Like:
*
* if (sbufBytesRemaining(src) >= 2) {
* currentPidProfile->yourFancyParameterA = sbufReadU8(src);
* currentPidProfile->yourFancyParameterB = sbufReadU8(src);
* }
*/
break;

default:
return mspProcessInCommand(srcDesc, cmdMSP, src);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/msp/msp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@
#define MSP_LED_STRIP_SETTINGS 150
#define MSP_SET_LED_STRIP_SETTINGS 151

#define MSP_EXPERIMENTAL 158
#define MSP_SET_EXPERIMENTAL 159

#define MSP_UID 160

#define MSP_GPSSVINFO 164
Expand Down

0 comments on commit 68f0af0

Please sign in to comment.