mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
msp for display and layout
This commit is contained in:
parent
b01103e655
commit
8b581d945b
5 changed files with 46 additions and 17 deletions
|
@ -421,19 +421,7 @@ static void resetConf(void)
|
|||
#endif
|
||||
|
||||
#ifdef OSD
|
||||
featureSet(FEATURE_OSD);
|
||||
masterConfig.osdProfile.video_system = AUTO;
|
||||
masterConfig.osdProfile.item_pos[OSD_MAIN_BATT_VOLTAGE] = -29;
|
||||
masterConfig.osdProfile.item_pos[OSD_RSSI_VALUE] = -59;
|
||||
masterConfig.osdProfile.item_pos[OSD_TIMER] = -39;
|
||||
masterConfig.osdProfile.item_pos[OSD_THROTTLE_POS] = -9;
|
||||
masterConfig.osdProfile.item_pos[OSD_CPU_LOAD] = 26;
|
||||
masterConfig.osdProfile.item_pos[OSD_VTX_CHANNEL] = 1;
|
||||
masterConfig.osdProfile.item_pos[OSD_VOLTAGE_WARNING] = -80;
|
||||
masterConfig.osdProfile.item_pos[OSD_ARMED] = -107;
|
||||
masterConfig.osdProfile.item_pos[OSD_DISARMED] = -109;
|
||||
masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON] = 1;
|
||||
masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS] = -1;
|
||||
resetOsdConfig();
|
||||
#endif
|
||||
|
||||
#ifdef USE_RTC6705
|
||||
|
|
|
@ -721,4 +721,21 @@ void osdInit(void)
|
|||
|
||||
}
|
||||
|
||||
void resetOsdConfig(void)
|
||||
{
|
||||
featureSet(FEATURE_OSD);
|
||||
masterConfig.osdProfile.video_system = AUTO;
|
||||
masterConfig.osdProfile.item_pos[OSD_MAIN_BATT_VOLTAGE] = -29;
|
||||
masterConfig.osdProfile.item_pos[OSD_RSSI_VALUE] = -59;
|
||||
masterConfig.osdProfile.item_pos[OSD_TIMER] = -39;
|
||||
masterConfig.osdProfile.item_pos[OSD_THROTTLE_POS] = -9;
|
||||
masterConfig.osdProfile.item_pos[OSD_CPU_LOAD] = 26;
|
||||
masterConfig.osdProfile.item_pos[OSD_VTX_CHANNEL] = 1;
|
||||
masterConfig.osdProfile.item_pos[OSD_VOLTAGE_WARNING] = -80;
|
||||
masterConfig.osdProfile.item_pos[OSD_ARMED] = -107;
|
||||
masterConfig.osdProfile.item_pos[OSD_DISARMED] = -109;
|
||||
masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON] = -1;
|
||||
masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS] = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,3 +62,4 @@ typedef struct {
|
|||
|
||||
void updateOsd(void);
|
||||
void osdInit(void);
|
||||
void resetOsdConfig(void);
|
||||
|
|
|
@ -204,7 +204,7 @@ static const char * const featureNames[] = {
|
|||
"SONAR", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
|
||||
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DISPLAY", "ONESHOT125",
|
||||
"BLACKBOX", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE", "SUPEREXPO_RATES",
|
||||
NULL
|
||||
"OSD", NULL
|
||||
};
|
||||
|
||||
// sync this with rxFailsafeChannelMode_e
|
||||
|
@ -819,6 +819,8 @@ const clivalue_t valueTable[] = {
|
|||
{ "osd_voltage_warning_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_VOLTAGE_WARNING], .config.minmax = { -480, 480 } },
|
||||
{ "osd_armed_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_ARMED], .config.minmax = { -480, 480 } },
|
||||
{ "osd_disarmed_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_DISARMED], .config.minmax = { -480, 480 } },
|
||||
{ "osd_artificial_horizon", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON], .config.minmax = { -1, 0 } },
|
||||
{ "osd_horizon_sidebars", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS], .config.minmax = { -1, 0 } },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1214,6 +1214,21 @@ static bool processOutCommand(uint8_t cmdMSP)
|
|||
#endif
|
||||
break;
|
||||
|
||||
case MSP_OSD_CONFIG:
|
||||
#ifdef OSD
|
||||
headSerialReply(2 + (OSD_MAX_ITEMS * 2));
|
||||
serialize8(1); // OSD supported
|
||||
// send video system (AUTO/PAL/NTSC)
|
||||
serialize8(masterConfig.osdProfile.video_system);
|
||||
for (i = 0; i < OSD_MAX_ITEMS; i++) {
|
||||
serialize16(masterConfig.osdProfile.item_pos[i]);
|
||||
}
|
||||
#else
|
||||
headSerialReply(1);
|
||||
serialize8(0); // OSD not supported
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MSP_BF_BUILD_INFO:
|
||||
headSerialReply(11 + 4 + 4);
|
||||
for (i = 0; i < 11; i++)
|
||||
|
@ -1524,9 +1539,15 @@ static bool processInCommand(void)
|
|||
#endif
|
||||
#ifdef OSD
|
||||
case MSP_SET_OSD_CONFIG:
|
||||
addr = read8();
|
||||
// set all the other settings
|
||||
if ((int8_t)addr == -1) {
|
||||
masterConfig.osdProfile.video_system = read8();
|
||||
for (i = 0; i < OSD_MAX_ITEMS; i++)
|
||||
masterConfig.osdProfile.item_pos[i] = read16();
|
||||
}
|
||||
// set a position setting
|
||||
else {
|
||||
masterConfig.osdProfile.item_pos[addr] = read16();
|
||||
}
|
||||
break;
|
||||
case MSP_OSD_CHAR_WRITE:
|
||||
addr = read8();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue