mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 01:35:35 +03:00
Merge branch 'iNavFlight:master' into strobeblink-refactor
This commit is contained in:
commit
55af624de9
6 changed files with 30 additions and 12 deletions
|
@ -169,3 +169,5 @@ wp 12 0 0 0 0 0 0 0 0
|
||||||
...
|
...
|
||||||
wp 59 0 0 0 0 0 0 0 0
|
wp 59 0 0 0 0 0 0 0 0
|
||||||
```
|
```
|
||||||
|
### Changing Mission-Index in flight
|
||||||
|
The MISSION CHANGE mode allows to switch between multiple stored missions in flight. With mode active the required mission index can be selected by cycling through missions using the WP mode switch. Selected mission is loaded when mission change mode is switched off. Mission index can also be changed through addition of a new Mission Index adjustment function which should be useful for DJI users unable to use the normal OSD mission related fields.
|
||||||
|
|
|
@ -1550,6 +1550,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
|
static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
|
||||||
{
|
{
|
||||||
const uint8_t safe_home_no = sbufReadU8(src); // get the home number
|
const uint8_t safe_home_no = sbufReadU8(src); // get the home number
|
||||||
|
@ -1563,6 +1564,8 @@ static mspResult_e mspFcSafeHomeOutCommand(sbuf_t *dst, sbuf_t *src)
|
||||||
return MSP_RESULT_ERROR;
|
return MSP_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static mspResult_e mspFcLogicConditionCommand(sbuf_t *dst, sbuf_t *src) {
|
static mspResult_e mspFcLogicConditionCommand(sbuf_t *dst, sbuf_t *src) {
|
||||||
const uint8_t idx = sbufReadU8(src);
|
const uint8_t idx = sbufReadU8(src);
|
||||||
|
@ -2962,6 +2965,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
||||||
return MSP_RESULT_ERROR; // will only be reached if the rollback is not ready
|
return MSP_RESULT_ERROR; // will only be reached if the rollback is not ready
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
case MSP2_INAV_SET_SAFEHOME:
|
case MSP2_INAV_SET_SAFEHOME:
|
||||||
if (dataSize == 10) {
|
if (dataSize == 10) {
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
@ -2975,6 +2979,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
||||||
return MSP_RESULT_ERROR;
|
return MSP_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MSP_RESULT_ERROR;
|
return MSP_RESULT_ERROR;
|
||||||
|
@ -3420,9 +3425,11 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu
|
||||||
*ret = mspFcLogicConditionCommand(dst, src);
|
*ret = mspFcLogicConditionCommand(dst, src);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
case MSP2_INAV_SAFEHOME:
|
case MSP2_INAV_SAFEHOME:
|
||||||
*ret = mspFcSafeHomeOutCommand(dst, src);
|
*ret = mspFcSafeHomeOutCommand(dst, src);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SIMULATOR
|
#ifdef USE_SIMULATOR
|
||||||
case MSP_SIMULATOR:
|
case MSP_SIMULATOR:
|
||||||
|
|
|
@ -36,7 +36,7 @@ const char *armingDisableFlagNames[]= {
|
||||||
"FS", "ANGLE", "CAL", "OVRLD", "NAV", "COMPASS",
|
"FS", "ANGLE", "CAL", "OVRLD", "NAV", "COMPASS",
|
||||||
"ACC", "ARMSW", "HWFAIL", "BOXFS", "KILLSW", "RX",
|
"ACC", "ARMSW", "HWFAIL", "BOXFS", "KILLSW", "RX",
|
||||||
"THR", "CLI", "CMS", "OSD", "ROLL/PITCH", "AUTOTRIM", "OOM",
|
"THR", "CLI", "CMS", "OSD", "ROLL/PITCH", "AUTOTRIM", "OOM",
|
||||||
"SETTINGFAIL", "PWMOUT", "NOPREARM", "DSHOTBEEPER"
|
"SETTINGFAIL", "PWMOUT", "NOPREARM", "DSHOTBEEPER", "LANDED"
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@ flightModeForTelemetry_e getFlightModeForTelemetry(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_SIMULATOR
|
#ifdef USE_SIMULATOR
|
||||||
simulatorData_t simulatorData = {
|
simulatorData_t simulatorData = {
|
||||||
flags: 0,
|
flags: 0,
|
||||||
debugIndex: 0
|
debugIndex: 0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,9 +25,12 @@
|
||||||
#ifdef USE_MSP_DISPLAYPORT
|
#ifdef USE_MSP_DISPLAYPORT
|
||||||
|
|
||||||
#ifndef DISABLE_MSP_BF_COMPAT
|
#ifndef DISABLE_MSP_BF_COMPAT
|
||||||
|
#include "osd.h"
|
||||||
uint8_t getBfCharacter(uint8_t ch, uint8_t page);
|
uint8_t getBfCharacter(uint8_t ch, uint8_t page);
|
||||||
|
#define isBfCompatibleVideoSystem(osdConfigPtr) (osdConfigPtr->video_system == VIDEO_SYSTEM_BFCOMPAT)
|
||||||
#else
|
#else
|
||||||
#define getBfCharacter(x, page) (x)
|
#define getBfCharacter(x, page) (x)
|
||||||
|
#define isBfCompatibleVideoSystem(osdConfigPtr) (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -69,6 +69,7 @@ FILE_COMPILE_FOR_SPEED
|
||||||
#include "io/osd.h"
|
#include "io/osd.h"
|
||||||
#include "io/osd_common.h"
|
#include "io/osd_common.h"
|
||||||
#include "io/osd_hud.h"
|
#include "io/osd_hud.h"
|
||||||
|
#include "io/displayport_msp_bf_compat.h"
|
||||||
#include "io/vtx.h"
|
#include "io/vtx.h"
|
||||||
#include "io/vtx_string.h"
|
#include "io/vtx_string.h"
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ bool osdFormatCentiNumber(char *buff, int32_t centivalue, uint32_t scale, int ma
|
||||||
int decimals = maxDecimals;
|
int decimals = maxDecimals;
|
||||||
bool negative = false;
|
bool negative = false;
|
||||||
bool scaled = false;
|
bool scaled = false;
|
||||||
bool explicitDecimal = osdConfig()->video_system == VIDEO_SYSTEM_BFCOMPAT;
|
bool explicitDecimal = isBfCompatibleVideoSystem(osdConfig());
|
||||||
|
|
||||||
buff[length] = '\0';
|
buff[length] = '\0';
|
||||||
|
|
||||||
|
@ -731,7 +732,7 @@ static void osdFormatCoordinate(char *buff, char sym, int32_t val)
|
||||||
int32_t decimalPart = abs(val % GPS_DEGREES_DIVIDER);
|
int32_t decimalPart = abs(val % GPS_DEGREES_DIVIDER);
|
||||||
STATIC_ASSERT(GPS_DEGREES_DIVIDER == 1e7, adjust_max_decimal_digits);
|
STATIC_ASSERT(GPS_DEGREES_DIVIDER == 1e7, adjust_max_decimal_digits);
|
||||||
int decimalDigits;
|
int decimalDigits;
|
||||||
if (osdConfig()->video_system != VIDEO_SYSTEM_BFCOMPAT) {
|
if (!isBfCompatibleVideoSystem(osdConfig())) {
|
||||||
decimalDigits = tfp_sprintf(buff + 1 + integerDigits, "%07d", (int)decimalPart);
|
decimalDigits = tfp_sprintf(buff + 1 + integerDigits, "%07d", (int)decimalPart);
|
||||||
// Embbed the decimal separator
|
// Embbed the decimal separator
|
||||||
buff[1 + integerDigits - 1] += SYM_ZERO_HALF_TRAILING_DOT - '0';
|
buff[1 + integerDigits - 1] += SYM_ZERO_HALF_TRAILING_DOT - '0';
|
||||||
|
@ -1409,7 +1410,7 @@ static void osdFormatPidControllerOutput(char *buff, const char *label, const pi
|
||||||
|
|
||||||
static void osdDisplayBatteryVoltage(uint8_t elemPosX, uint8_t elemPosY, uint16_t voltage, uint8_t digits, uint8_t decimals)
|
static void osdDisplayBatteryVoltage(uint8_t elemPosX, uint8_t elemPosY, uint16_t voltage, uint8_t digits, uint8_t decimals)
|
||||||
{
|
{
|
||||||
char buff[6];
|
char buff[7];
|
||||||
textAttributes_t elemAttr = TEXT_ATTRIBUTES_NONE;
|
textAttributes_t elemAttr = TEXT_ATTRIBUTES_NONE;
|
||||||
|
|
||||||
osdFormatBatteryChargeSymbol(buff);
|
osdFormatBatteryChargeSymbol(buff);
|
||||||
|
@ -1418,7 +1419,7 @@ static void osdDisplayBatteryVoltage(uint8_t elemPosX, uint8_t elemPosY, uint16_
|
||||||
displayWriteWithAttr(osdDisplayPort, elemPosX, elemPosY, buff, elemAttr);
|
displayWriteWithAttr(osdDisplayPort, elemPosX, elemPosY, buff, elemAttr);
|
||||||
|
|
||||||
elemAttr = TEXT_ATTRIBUTES_NONE;
|
elemAttr = TEXT_ATTRIBUTES_NONE;
|
||||||
digits = MIN(digits, 4);
|
digits = MIN(digits, 5);
|
||||||
osdFormatCentiNumber(buff, voltage, 0, decimals, 0, digits);
|
osdFormatCentiNumber(buff, voltage, 0, decimals, 0, digits);
|
||||||
buff[digits] = SYM_VOLT;
|
buff[digits] = SYM_VOLT;
|
||||||
buff[digits+1] = '\0';
|
buff[digits+1] = '\0';
|
||||||
|
@ -1594,11 +1595,11 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
}
|
}
|
||||||
|
|
||||||
case OSD_MAIN_BATT_VOLTAGE:
|
case OSD_MAIN_BATT_VOLTAGE:
|
||||||
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatteryRawVoltage(), 2 + osdConfig()->main_voltage_decimals, osdConfig()->main_voltage_decimals);
|
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatteryRawVoltage(), (isBfCompatibleVideoSystem(osdConfig()) ? 3 : 2) + osdConfig()->main_voltage_decimals, osdConfig()->main_voltage_decimals);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_SAG_COMPENSATED_MAIN_BATT_VOLTAGE:
|
case OSD_SAG_COMPENSATED_MAIN_BATT_VOLTAGE:
|
||||||
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatterySagCompensatedVoltage(), 2 + osdConfig()->main_voltage_decimals, osdConfig()->main_voltage_decimals);
|
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatterySagCompensatedVoltage(), (isBfCompatibleVideoSystem(osdConfig()) ? 3 : 2) + osdConfig()->main_voltage_decimals, osdConfig()->main_voltage_decimals);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OSD_CURRENT_DRAW:
|
case OSD_CURRENT_DRAW:
|
||||||
|
@ -2705,13 +2706,13 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
|
|
||||||
case OSD_MAIN_BATT_CELL_VOLTAGE:
|
case OSD_MAIN_BATT_CELL_VOLTAGE:
|
||||||
{
|
{
|
||||||
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatteryRawAverageCellVoltage(), 3, 2);
|
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatteryRawAverageCellVoltage(), (isBfCompatibleVideoSystem(osdConfig()) ? 4 : 3), 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE:
|
case OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE:
|
||||||
{
|
{
|
||||||
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatterySagCompensatedAverageCellVoltage(), 3, 2);
|
osdDisplayBatteryVoltage(elemPosX, elemPosY, getBatterySagCompensatedAverageCellVoltage(), (isBfCompatibleVideoSystem(osdConfig()) ? 4 : 3), 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3629,8 +3629,9 @@ static navigationFSMEvent_t selectNavEventFromBoxModeInput(void)
|
||||||
const bool canActivatePosHold = canActivatePosHoldMode();
|
const bool canActivatePosHold = canActivatePosHoldMode();
|
||||||
const bool canActivateNavigation = canActivateNavigationModes();
|
const bool canActivateNavigation = canActivateNavigationModes();
|
||||||
const bool isExecutingRTH = navGetStateFlags(posControl.navState) & NAV_AUTO_RTH;
|
const bool isExecutingRTH = navGetStateFlags(posControl.navState) & NAV_AUTO_RTH;
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
checkSafeHomeState(isExecutingRTH || posControl.flags.forcedRTHActivated);
|
checkSafeHomeState(isExecutingRTH || posControl.flags.forcedRTHActivated);
|
||||||
|
#endif
|
||||||
// deactivate rth trackback if RTH not active
|
// deactivate rth trackback if RTH not active
|
||||||
if (posControl.flags.rthTrackbackActive) {
|
if (posControl.flags.rthTrackbackActive) {
|
||||||
posControl.flags.rthTrackbackActive = isExecutingRTH;
|
posControl.flags.rthTrackbackActive = isExecutingRTH;
|
||||||
|
@ -4218,7 +4219,9 @@ void activateForcedRTH(void)
|
||||||
{
|
{
|
||||||
abortFixedWingLaunch();
|
abortFixedWingLaunch();
|
||||||
posControl.flags.forcedRTHActivated = true;
|
posControl.flags.forcedRTHActivated = true;
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
checkSafeHomeState(true);
|
checkSafeHomeState(true);
|
||||||
|
#endif
|
||||||
navProcessFSMEvents(selectNavEventFromBoxModeInput());
|
navProcessFSMEvents(selectNavEventFromBoxModeInput());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4227,7 +4230,9 @@ void abortForcedRTH(void)
|
||||||
// Disable failsafe RTH and make sure we back out of navigation mode to IDLE
|
// Disable failsafe RTH and make sure we back out of navigation mode to IDLE
|
||||||
// If any navigation mode was active prior to RTH it will be re-enabled with next RX update
|
// If any navigation mode was active prior to RTH it will be re-enabled with next RX update
|
||||||
posControl.flags.forcedRTHActivated = false;
|
posControl.flags.forcedRTHActivated = false;
|
||||||
|
#ifdef USE_SAFE_HOME
|
||||||
checkSafeHomeState(false);
|
checkSafeHomeState(false);
|
||||||
|
#endif
|
||||||
navProcessFSMEvents(NAV_FSM_EVENT_SWITCH_TO_IDLE);
|
navProcessFSMEvents(NAV_FSM_EVENT_SWITCH_TO_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue