mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
[OSD] Split OSD configuration into osdConfig_t and osdLayoutsConfig_t
osdLayoutsConfig_t stores the config for the layouts, with the visible items and their positions. osdLayoutsConfig_t stores the rest.
This commit is contained in:
parent
f50329b44d
commit
e786889c86
7 changed files with 208 additions and 200 deletions
|
@ -1105,7 +1105,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, osdConfig()->dist_alarm);
|
||||
sbufWriteU16(dst, osdConfig()->neg_alt_alarm);
|
||||
for (int i = 0; i < OSD_ITEM_COUNT; i++) {
|
||||
sbufWriteU16(dst, osdConfig()->item_pos[0][i]);
|
||||
sbufWriteU16(dst, osdLayoutsConfig()->item_pos[0][i]);
|
||||
}
|
||||
#else
|
||||
sbufWriteU8(dst, OSD_DRIVER_NONE); // OSD not supported
|
||||
|
@ -2308,7 +2308,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
} else {
|
||||
// set a position setting
|
||||
if ((dataSize >= 3) && (tmp_u8 < OSD_ITEM_COUNT)) // tmp_u8 == addr
|
||||
osdConfigMutable()->item_pos[0][tmp_u8] = sbufReadU16(src);
|
||||
osdLayoutsConfigMutable()->item_pos[0][tmp_u8] = sbufReadU16(src);
|
||||
else
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
|
@ -2755,7 +2755,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
if (!sbufReadU8Safe(&item, src)) {
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
if (!sbufReadU16Safe(&osdConfigMutable()->item_pos[layout][item], src)) {
|
||||
if (!sbufReadU16Safe(&osdLayoutsConfigMutable()->item_pos[layout][item], src)) {
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
// If the layout is not already overriden and it's different
|
||||
|
@ -3175,11 +3175,11 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
|
|||
*ret = MSP_RESULT_ERROR;
|
||||
break;
|
||||
}
|
||||
sbufWriteU16(dst, osdConfig()->item_pos[layout][item]);
|
||||
sbufWriteU16(dst, osdLayoutsConfig()->item_pos[layout][item]);
|
||||
} else {
|
||||
// Asking for an specific layout
|
||||
for (unsigned ii = 0; ii < OSD_ITEM_COUNT; ii++) {
|
||||
sbufWriteU16(dst, osdConfig()->item_pos[layout][ii]);
|
||||
sbufWriteU16(dst, osdLayoutsConfig()->item_pos[layout][ii]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue