mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Added adc, beeper, sonar, and ledStrip config() macros
This commit is contained in:
parent
e89f0a0299
commit
57a9393f5f
5 changed files with 30 additions and 26 deletions
|
@ -963,7 +963,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
#ifdef LED_STRIP
|
||||
case MSP_LED_COLORS:
|
||||
for (int i = 0; i < LED_CONFIGURABLE_COLOR_COUNT; i++) {
|
||||
hsvColor_t *color = &masterConfig.ledStripConfig.colors[i];
|
||||
hsvColor_t *color = &ledStripConfig()->colors[i];
|
||||
sbufWriteU16(dst, color->h);
|
||||
sbufWriteU8(dst, color->s);
|
||||
sbufWriteU8(dst, color->v);
|
||||
|
@ -972,7 +972,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
|
||||
case MSP_LED_STRIP_CONFIG:
|
||||
for (int i = 0; i < LED_MAX_STRIP_LENGTH; i++) {
|
||||
ledConfig_t *ledConfig = &masterConfig.ledStripConfig.ledConfigs[i];
|
||||
ledConfig_t *ledConfig = &ledStripConfig()->ledConfigs[i];
|
||||
sbufWriteU32(dst, *ledConfig);
|
||||
}
|
||||
break;
|
||||
|
@ -982,19 +982,19 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
for (int j = 0; j < LED_DIRECTION_COUNT; j++) {
|
||||
sbufWriteU8(dst, i);
|
||||
sbufWriteU8(dst, j);
|
||||
sbufWriteU8(dst, masterConfig.ledStripConfig.modeColors[i].color[j]);
|
||||
sbufWriteU8(dst, ledStripConfig()->modeColors[i].color[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < LED_SPECIAL_COLOR_COUNT; j++) {
|
||||
sbufWriteU8(dst, LED_MODE_COUNT);
|
||||
sbufWriteU8(dst, j);
|
||||
sbufWriteU8(dst, masterConfig.ledStripConfig.specialColors.color[j]);
|
||||
sbufWriteU8(dst, ledStripConfig()->specialColors.color[j]);
|
||||
}
|
||||
|
||||
sbufWriteU8(dst, LED_AUX_CHANNEL);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, masterConfig.ledStripConfig.ledstrip_aux_channel);
|
||||
sbufWriteU8(dst, ledStripConfig()->ledstrip_aux_channel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -1770,7 +1770,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
#ifdef LED_STRIP
|
||||
case MSP_SET_LED_COLORS:
|
||||
for (int i = 0; i < LED_CONFIGURABLE_COLOR_COUNT; i++) {
|
||||
hsvColor_t *color = &masterConfig.ledStripConfig.colors[i];
|
||||
hsvColor_t *color = &ledStripConfig()->colors[i];
|
||||
color->h = sbufReadU16(src);
|
||||
color->s = sbufReadU8(src);
|
||||
color->v = sbufReadU8(src);
|
||||
|
@ -1783,7 +1783,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
if (i >= LED_MAX_STRIP_LENGTH || dataSize != (1 + 4)) {
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
ledConfig_t *ledConfig = &masterConfig.ledStripConfig.ledConfigs[i];
|
||||
ledConfig_t *ledConfig = &ledStripConfig()->ledConfigs[i];
|
||||
*ledConfig = sbufReadU32(src);
|
||||
reevaluateLedConfig();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue