mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +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
|
#endif
|
||||||
|
|
||||||
#ifdef OSD
|
#ifdef OSD
|
||||||
featureSet(FEATURE_OSD);
|
resetOsdConfig();
|
||||||
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
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RTC6705
|
#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
|
#endif
|
||||||
|
|
|
@ -62,3 +62,4 @@ typedef struct {
|
||||||
|
|
||||||
void updateOsd(void);
|
void updateOsd(void);
|
||||||
void osdInit(void);
|
void osdInit(void);
|
||||||
|
void resetOsdConfig(void);
|
||||||
|
|
|
@ -204,7 +204,7 @@ static const char * const featureNames[] = {
|
||||||
"SONAR", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
|
"SONAR", "TELEMETRY", "CURRENT_METER", "3D", "RX_PARALLEL_PWM",
|
||||||
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DISPLAY", "ONESHOT125",
|
"RX_MSP", "RSSI_ADC", "LED_STRIP", "DISPLAY", "ONESHOT125",
|
||||||
"BLACKBOX", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE", "SUPEREXPO_RATES",
|
"BLACKBOX", "CHANNEL_FORWARDING", "TRANSPONDER", "AIRMODE", "SUPEREXPO_RATES",
|
||||||
NULL
|
"OSD", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// sync this with rxFailsafeChannelMode_e
|
// 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_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_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_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
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1214,6 +1214,21 @@ static bool processOutCommand(uint8_t cmdMSP)
|
||||||
#endif
|
#endif
|
||||||
break;
|
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:
|
case MSP_BF_BUILD_INFO:
|
||||||
headSerialReply(11 + 4 + 4);
|
headSerialReply(11 + 4 + 4);
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 11; i++)
|
||||||
|
@ -1524,9 +1539,15 @@ static bool processInCommand(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef OSD
|
#ifdef OSD
|
||||||
case MSP_SET_OSD_CONFIG:
|
case MSP_SET_OSD_CONFIG:
|
||||||
masterConfig.osdProfile.video_system = read8();
|
addr = read8();
|
||||||
for (i = 0; i < OSD_MAX_ITEMS; i++)
|
// set all the other settings
|
||||||
masterConfig.osdProfile.item_pos[i] = read16();
|
if ((int8_t)addr == -1) {
|
||||||
|
masterConfig.osdProfile.video_system = read8();
|
||||||
|
}
|
||||||
|
// set a position setting
|
||||||
|
else {
|
||||||
|
masterConfig.osdProfile.item_pos[addr] = read16();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSP_OSD_CHAR_WRITE:
|
case MSP_OSD_CHAR_WRITE:
|
||||||
addr = read8();
|
addr = read8();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue