mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-22 07:45:29 +03:00
Add reboot required arming disabled flag, support for setting in MSP
This commit is contained in:
parent
3cee0c99cc
commit
25435ea49c
5 changed files with 38 additions and 7 deletions
|
@ -41,6 +41,7 @@
|
|||
#include "fc/rc.h"
|
||||
#include "fc/rc_adjustments.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
#include "flight/imu.h"
|
||||
|
@ -72,6 +73,8 @@
|
|||
|
||||
static bool configIsDirty; /* someone indicated that the config is modified and it is not yet saved */
|
||||
|
||||
static bool rebootRequired = false; // set if a config change requires a reboot to take effect
|
||||
|
||||
pidProfile_t *currentPidProfile;
|
||||
|
||||
#ifndef RX_SPI_DEFAULT_PROTOCOL
|
||||
|
@ -742,3 +745,14 @@ bool isSystemConfigured(void)
|
|||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void setRebootRequired(void)
|
||||
{
|
||||
rebootRequired = true;
|
||||
setArmingDisabled(ARMING_DISABLED_REBOOT_REQUIRED);
|
||||
}
|
||||
|
||||
bool getRebootRequired(void)
|
||||
{
|
||||
return rebootRequired;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ PG_DECLARE(systemConfig_t, systemConfig);
|
|||
struct pidProfile_s;
|
||||
extern struct pidProfile_s *currentPidProfile;
|
||||
|
||||
|
||||
void initEEPROM(void);
|
||||
void resetEEPROM(void);
|
||||
bool readEEPROM(void);
|
||||
|
@ -86,3 +87,5 @@ void targetConfiguration(void);
|
|||
void targetValidateConfiguration(void);
|
||||
|
||||
bool isSystemConfigured(void);
|
||||
void setRebootRequired(void);
|
||||
bool getRebootRequired(void);
|
||||
|
|
|
@ -53,8 +53,9 @@ const char *armingDisableFlagNames[]= {
|
|||
"MSP",
|
||||
"PARALYZE",
|
||||
"GPS",
|
||||
"RESCUE SW",
|
||||
"RESCUE_SW",
|
||||
"RPMFILTER",
|
||||
"REBOOT_REQD",
|
||||
"ARMSWITCH",
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ typedef enum {
|
|||
ARMING_DISABLED_GPS = (1 << 18),
|
||||
ARMING_DISABLED_RESC = (1 << 19),
|
||||
ARMING_DISABLED_RPMFILTER = (1 << 20),
|
||||
ARMING_DISABLED_ARM_SWITCH = (1 << 21), // Needs to be the last element, since it's always activated if one of the others is active when arming
|
||||
ARMING_DISABLED_REBOOT_REQUIRED = (1 << 21),
|
||||
ARMING_DISABLED_ARM_SWITCH = (1 << 22), // Needs to be the last element, since it's always activated if one of the others is active when arming
|
||||
} armingDisableFlags_e;
|
||||
|
||||
#define ARMING_DISABLE_FLAGS_COUNT (LOG2(ARMING_DISABLED_ARM_SWITCH) + 1)
|
||||
|
|
|
@ -241,6 +241,14 @@ static void mspFc4waySerialCommand(sbuf_t *dst, sbuf_t *src, mspPostProcessFnPtr
|
|||
}
|
||||
#endif //USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
static void configRebootUpdateCheckU8(uint8_t *parm, uint8_t value)
|
||||
{
|
||||
if (*parm != value) {
|
||||
setRebootRequired();
|
||||
}
|
||||
*parm = value;
|
||||
}
|
||||
|
||||
static void mspRebootFn(serialPort_t *serialPort)
|
||||
{
|
||||
UNUSED(serialPort);
|
||||
|
@ -860,6 +868,10 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
|
|||
// 4 bytes, flags
|
||||
const uint32_t armingDisableFlags = getArmingDisableFlags();
|
||||
sbufWriteU32(dst, armingDisableFlags);
|
||||
|
||||
// config state flags - bits to indicate the state of the configuration, reboot required, etc.
|
||||
// other flags can be added as needed
|
||||
sbufWriteU8(dst, (getRebootRequired() << 0));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2431,11 +2443,11 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
// Added in MSP API 1.40
|
||||
rxConfigMutable()->rcInterpolationChannels = sbufReadU8(src);
|
||||
#if defined(USE_RC_SMOOTHING_FILTER)
|
||||
rxConfigMutable()->rc_smoothing_type = sbufReadU8(src);
|
||||
rxConfigMutable()->rc_smoothing_input_cutoff = sbufReadU8(src);
|
||||
rxConfigMutable()->rc_smoothing_derivative_cutoff = sbufReadU8(src);
|
||||
rxConfigMutable()->rc_smoothing_input_type = sbufReadU8(src);
|
||||
rxConfigMutable()->rc_smoothing_derivative_type = sbufReadU8(src);
|
||||
configRebootUpdateCheckU8(&rxConfigMutable()->rc_smoothing_type, sbufReadU8(src));
|
||||
configRebootUpdateCheckU8(&rxConfigMutable()->rc_smoothing_input_cutoff, sbufReadU8(src));
|
||||
configRebootUpdateCheckU8(&rxConfigMutable()->rc_smoothing_derivative_cutoff, sbufReadU8(src));
|
||||
configRebootUpdateCheckU8(&rxConfigMutable()->rc_smoothing_input_type, sbufReadU8(src));
|
||||
configRebootUpdateCheckU8(&rxConfigMutable()->rc_smoothing_derivative_type, sbufReadU8(src));
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue