mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 14:25:16 +03:00
Added armingConfig parameter group
This commit is contained in:
parent
a65a71f086
commit
e3fdde2d09
6 changed files with 28 additions and 14 deletions
|
@ -56,8 +56,6 @@
|
||||||
#define gpsConfigMutable(x) (&masterConfig.gpsConfig)
|
#define gpsConfigMutable(x) (&masterConfig.gpsConfig)
|
||||||
#define navConfig(x) (&masterConfig.navConfig)
|
#define navConfig(x) (&masterConfig.navConfig)
|
||||||
#define navConfigMutable(x) (&masterConfig.navConfig)
|
#define navConfigMutable(x) (&masterConfig.navConfig)
|
||||||
#define armingConfig(x) (&masterConfig.armingConfig)
|
|
||||||
#define armingConfigMutable(x) (&masterConfig.armingConfig)
|
|
||||||
#define telemetryConfig(x) (&masterConfig.telemetryConfig)
|
#define telemetryConfig(x) (&masterConfig.telemetryConfig)
|
||||||
#define telemetryConfigMutable(x) (&masterConfig.telemetryConfig)
|
#define telemetryConfigMutable(x) (&masterConfig.telemetryConfig)
|
||||||
#define osdProfile(x) (&masterConfig.osdProfile)
|
#define osdProfile(x) (&masterConfig.osdProfile)
|
||||||
|
@ -121,8 +119,6 @@ typedef struct master_s {
|
||||||
|
|
||||||
pwmRxConfig_t pwmRxConfig;
|
pwmRxConfig_t pwmRxConfig;
|
||||||
|
|
||||||
armingConfig_t armingConfig;
|
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
telemetryConfig_t telemetryConfig;
|
telemetryConfig_t telemetryConfig;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define PG_SERIAL_CONFIG 13
|
#define PG_SERIAL_CONFIG 13
|
||||||
//#define PG_PID_PROFILE 14
|
//#define PG_PID_PROFILE 14
|
||||||
//#define PG_GTUNE_CONFIG 15
|
//#define PG_GTUNE_CONFIG 15
|
||||||
//#define PG_ARMING_CONFIG 16
|
#define PG_ARMING_CONFIG 16
|
||||||
//#define PG_TRANSPONDER_CONFIG 17
|
//#define PG_TRANSPONDER_CONFIG 17
|
||||||
//#define PG_SYSTEM_CONFIG 18
|
//#define PG_SYSTEM_CONFIG 18
|
||||||
//#define PG_FEATURE_CONFIG 19
|
//#define PG_FEATURE_CONFIG 19
|
||||||
|
|
|
@ -348,9 +348,6 @@ void createDefaultConfig(master_t *config)
|
||||||
|
|
||||||
config->pwmRxConfig.inputFilteringMode = INPUT_FILTERING_DISABLED;
|
config->pwmRxConfig.inputFilteringMode = INPUT_FILTERING_DISABLED;
|
||||||
|
|
||||||
config->armingConfig.disarm_kill_switch = 1;
|
|
||||||
config->armingConfig.auto_disarm_delay = 5;
|
|
||||||
|
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
resetServoMixerConfig(&config->servoMixerConfig);
|
resetServoMixerConfig(&config->servoMixerConfig);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
#include "config/feature.h"
|
#include "config/feature.h"
|
||||||
|
#include "config/parameter_group.h"
|
||||||
|
#include "config/parameter_group_ids.h"
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "drivers/system.h"
|
||||||
|
|
||||||
|
@ -71,6 +73,12 @@ int16_t rcCommand[4]; // interval [1000;2000] for THROTTLE and [-500;+
|
||||||
|
|
||||||
uint32_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
uint32_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
||||||
|
|
||||||
|
PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 0);
|
||||||
|
|
||||||
|
PG_RESET_TEMPLATE(armingConfig_t, armingConfig,
|
||||||
|
.disarm_kill_switch = 1,
|
||||||
|
.auto_disarm_delay = 5
|
||||||
|
);
|
||||||
|
|
||||||
void blackboxLogInflightAdjustmentEvent(adjustmentFunction_e adjustmentFunction, int32_t newValue) {
|
void blackboxLogInflightAdjustmentEvent(adjustmentFunction_e adjustmentFunction, int32_t newValue) {
|
||||||
#ifndef BLACKBOX
|
#ifndef BLACKBOX
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "config/parameter_group.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BOXARM = 0,
|
BOXARM = 0,
|
||||||
BOXANGLE,
|
BOXANGLE,
|
||||||
|
@ -141,6 +143,8 @@ typedef struct armingConfig_s {
|
||||||
uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0
|
uint8_t auto_disarm_delay; // allow automatically disarming multicopters after auto_disarm_delay seconds of zero throttle. Disabled when 0
|
||||||
} armingConfig_t;
|
} armingConfig_t;
|
||||||
|
|
||||||
|
PG_DECLARE(armingConfig_t, armingConfig);
|
||||||
|
|
||||||
bool areUsingSticksToArm(void);
|
bool areUsingSticksToArm(void);
|
||||||
|
|
||||||
bool areSticksInApModePosition(uint16_t ap_mode);
|
bool areSticksInApModePosition(uint16_t ap_mode);
|
||||||
|
|
|
@ -597,7 +597,6 @@ static const clivalue_t valueTable[] = {
|
||||||
{ "gimbal_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GIMBAL_MODE }, PG_GIMBAL_CONFIG, offsetof(gimbalConfig_t, mode) },
|
{ "gimbal_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GIMBAL_MODE }, PG_GIMBAL_CONFIG, offsetof(gimbalConfig_t, mode) },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// PG_BATTERY_CONFIG
|
// PG_BATTERY_CONFIG
|
||||||
{ "battery_capacity", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 20000 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, batteryCapacity) },
|
{ "battery_capacity", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 20000 }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, batteryCapacity) },
|
||||||
{ "vbat_scale", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VBAT_SCALE_MIN, VBAT_SCALE_MAX }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, vbatscale) },
|
{ "vbat_scale", VAR_UINT8 | MASTER_VALUE, .config.minmax = { VBAT_SCALE_MIN, VBAT_SCALE_MAX }, PG_BATTERY_CONFIG, offsetof(batteryConfig_t, vbatscale) },
|
||||||
|
@ -649,6 +648,13 @@ static const clivalue_t valueTable[] = {
|
||||||
{ "imu_dcm_ki_mag", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, UINT16_MAX }, PG_IMU_CONFIG, offsetof(imuConfig_t, dcm_ki_mag) },
|
{ "imu_dcm_ki_mag", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, UINT16_MAX }, PG_IMU_CONFIG, offsetof(imuConfig_t, dcm_ki_mag) },
|
||||||
{ "small_angle", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 180 }, PG_IMU_CONFIG, offsetof(imuConfig_t, small_angle) },
|
{ "small_angle", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 180 }, PG_IMU_CONFIG, offsetof(imuConfig_t, small_angle) },
|
||||||
|
|
||||||
|
// PG_ARMING_CONFIG
|
||||||
|
{ "fixed_wing_auto_arm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ARMING_CONFIG, offsetof(armingConfig_t, fixed_wing_auto_arm) },
|
||||||
|
{ "disarm_kill_switch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ARMING_CONFIG, offsetof(armingConfig_t, disarm_kill_switch) },
|
||||||
|
{ "auto_disarm_delay", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 60 }, PG_ARMING_CONFIG, offsetof(armingConfig_t, auto_disarm_delay) },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -671,11 +677,6 @@ const clivalue_t valueTable[] = {
|
||||||
|
|
||||||
{ "input_filtering_mode", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &pwmRxConfig()->inputFilteringMode, .config.lookup = { TABLE_OFF_ON } },
|
{ "input_filtering_mode", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &pwmRxConfig()->inputFilteringMode, .config.lookup = { TABLE_OFF_ON } },
|
||||||
|
|
||||||
{ "fixed_wing_auto_arm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &armingConfig()->fixed_wing_auto_arm, .config.lookup = { TABLE_OFF_ON } },
|
|
||||||
{ "disarm_kill_switch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &armingConfig()->disarm_kill_switch, .config.lookup = { TABLE_OFF_ON } },
|
|
||||||
{ "auto_disarm_delay", VAR_UINT8 | MASTER_VALUE, &armingConfig()->auto_disarm_delay, .config.minmax = { 0, 60 } },
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GPS
|
#ifdef GPS
|
||||||
{ "gps_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gpsConfig()->provider, .config.lookup = { TABLE_GPS_PROVIDER } },
|
{ "gps_provider", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gpsConfig()->provider, .config.lookup = { TABLE_GPS_PROVIDER } },
|
||||||
{ "gps_sbas_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gpsConfig()->sbasMode, .config.lookup = { TABLE_GPS_SBAS_MODE } },
|
{ "gps_sbas_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &gpsConfig()->sbasMode, .config.lookup = { TABLE_GPS_SBAS_MODE } },
|
||||||
|
@ -1112,6 +1113,7 @@ static mixerConfig_t mixerConfigCopy;
|
||||||
static flight3DConfig_t flight3DConfigCopy;
|
static flight3DConfig_t flight3DConfigCopy;
|
||||||
static serialConfig_t serialConfigCopy;
|
static serialConfig_t serialConfigCopy;
|
||||||
static imuConfig_t imuConfigCopy;
|
static imuConfig_t imuConfigCopy;
|
||||||
|
static armingConfig_t armingConfigCopy;
|
||||||
|
|
||||||
static void backupConfigs(void)
|
static void backupConfigs(void)
|
||||||
{
|
{
|
||||||
|
@ -1147,6 +1149,7 @@ static void backupConfigs(void)
|
||||||
flight3DConfigCopy = *flight3DConfig();
|
flight3DConfigCopy = *flight3DConfig();
|
||||||
serialConfigCopy = *serialConfig();
|
serialConfigCopy = *serialConfig();
|
||||||
imuConfigCopy = *imuConfig();
|
imuConfigCopy = *imuConfig();
|
||||||
|
armingConfigCopy = *armingConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restoreConfigs(void)
|
static void restoreConfigs(void)
|
||||||
|
@ -1182,6 +1185,7 @@ static void restoreConfigs(void)
|
||||||
*flight3DConfigMutable() = flight3DConfigCopy;
|
*flight3DConfigMutable() = flight3DConfigCopy;
|
||||||
*serialConfigMutable() = serialConfigCopy;
|
*serialConfigMutable() = serialConfigCopy;
|
||||||
*imuConfigMutable() = imuConfigCopy;
|
*imuConfigMutable() = imuConfigCopy;
|
||||||
|
*armingConfigMutable() = armingConfigCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *getDefaultPointer(const void *valuePointer, const master_t *defaultConfig)
|
static void *getDefaultPointer(const void *valuePointer, const master_t *defaultConfig)
|
||||||
|
@ -1231,6 +1235,11 @@ static void dumpValues(uint16_t valueSection, uint8_t dumpMask, const master_t *
|
||||||
dumpPgValues(MASTER_VALUE, dumpMask, PG_SERVO_CONFIG, &servoConfigCopy, servoConfig());
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_SERVO_CONFIG, &servoConfigCopy, servoConfig());
|
||||||
dumpPgValues(MASTER_VALUE, dumpMask, PG_GIMBAL_CONFIG, &gimbalConfigCopy, gimbalConfig());
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_GIMBAL_CONFIG, &gimbalConfigCopy, gimbalConfig());
|
||||||
#endif
|
#endif
|
||||||
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_ARMING_CONFIG, &mixerConfigCopy, mixerConfig());
|
||||||
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_ARMING_CONFIG, &flight3DConfigCopy, flight3DConfig());
|
||||||
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_ARMING_CONFIG, &serialConfigCopy, serialConfig());
|
||||||
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_ARMING_CONFIG, &imuConfigCopy, imuConfig());
|
||||||
|
dumpPgValues(MASTER_VALUE, dumpMask, PG_ARMING_CONFIG, &armingConfigCopy, armingConfig());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue