mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Add debug mode to CMS menu
This commit is contained in:
parent
a46936d040
commit
cfb23ad0ac
4 changed files with 36 additions and 26 deletions
|
@ -26,3 +26,28 @@ uint8_t debugMode;
|
||||||
#ifdef DEBUG_SECTION_TIMES
|
#ifdef DEBUG_SECTION_TIMES
|
||||||
uint32_t sectionTimes[2][4];
|
uint32_t sectionTimes[2][4];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char * const debugModeNames[DEBUG_COUNT] = {
|
||||||
|
"NONE",
|
||||||
|
"CYCLETIME",
|
||||||
|
"BATTERY",
|
||||||
|
"GYRO",
|
||||||
|
"ACCELEROMETER",
|
||||||
|
"MIXER",
|
||||||
|
"AIRMODE",
|
||||||
|
"PIDLOOP",
|
||||||
|
"NOTCH",
|
||||||
|
"RC_INTERPOLATION",
|
||||||
|
"VELOCITY",
|
||||||
|
"DFILTER",
|
||||||
|
"ANGLERATE",
|
||||||
|
"ESC_SENSOR",
|
||||||
|
"SCHEDULER",
|
||||||
|
"STACK",
|
||||||
|
"ESC_SENSOR_RPM",
|
||||||
|
"ESC_SENSOR_TMP",
|
||||||
|
"ALTITUDE",
|
||||||
|
"FFT",
|
||||||
|
"FFT_TIME",
|
||||||
|
"FFT_FREQ"
|
||||||
|
};
|
||||||
|
|
|
@ -70,3 +70,5 @@ typedef enum {
|
||||||
DEBUG_FFT_FREQ,
|
DEBUG_FFT_FREQ,
|
||||||
DEBUG_COUNT
|
DEBUG_COUNT
|
||||||
} debugType_e;
|
} debugType_e;
|
||||||
|
|
||||||
|
extern const char * const debugModeNames[DEBUG_COUNT];
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifdef CMS
|
#ifdef CMS
|
||||||
|
|
||||||
|
#include "build/debug.h"
|
||||||
#include "build/version.h"
|
#include "build/version.h"
|
||||||
|
|
||||||
#include "drivers/time.h"
|
#include "drivers/time.h"
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
#include "config/parameter_group.h"
|
#include "config/parameter_group.h"
|
||||||
#include "config/parameter_group_ids.h"
|
#include "config/parameter_group_ids.h"
|
||||||
|
|
||||||
|
#include "fc/config.h"
|
||||||
#include "fc/rc_controls.h"
|
#include "fc/rc_controls.h"
|
||||||
|
|
||||||
#include "flight/mixer.h"
|
#include "flight/mixer.h"
|
||||||
|
@ -92,6 +94,7 @@ static uint16_t motorConfig_minthrottle;
|
||||||
static uint8_t motorConfig_digitalIdleOffsetValue;
|
static uint8_t motorConfig_digitalIdleOffsetValue;
|
||||||
static uint8_t voltageSensorADCConfig_vbatscale;
|
static uint8_t voltageSensorADCConfig_vbatscale;
|
||||||
static uint8_t batteryConfig_vbatmaxcellvoltage;
|
static uint8_t batteryConfig_vbatmaxcellvoltage;
|
||||||
|
static debugType_e systemConfig_debug_mode;
|
||||||
|
|
||||||
static long cmsx_menuMiscOnEnter(void)
|
static long cmsx_menuMiscOnEnter(void)
|
||||||
{
|
{
|
||||||
|
@ -99,6 +102,8 @@ static long cmsx_menuMiscOnEnter(void)
|
||||||
motorConfig_digitalIdleOffsetValue = motorConfig()->digitalIdleOffsetValue / 10;
|
motorConfig_digitalIdleOffsetValue = motorConfig()->digitalIdleOffsetValue / 10;
|
||||||
voltageSensorADCConfig_vbatscale = voltageSensorADCConfig(VOLTAGE_SENSOR_ADC_VBAT)->vbatscale;
|
voltageSensorADCConfig_vbatscale = voltageSensorADCConfig(VOLTAGE_SENSOR_ADC_VBAT)->vbatscale;
|
||||||
batteryConfig_vbatmaxcellvoltage = batteryConfig()->vbatmaxcellvoltage;
|
batteryConfig_vbatmaxcellvoltage = batteryConfig()->vbatmaxcellvoltage;
|
||||||
|
systemConfig_debug_mode = systemConfig()->debug_mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +115,8 @@ static long cmsx_menuMiscOnExit(const OSD_Entry *self)
|
||||||
motorConfigMutable()->digitalIdleOffsetValue = 10 * motorConfig_digitalIdleOffsetValue;
|
motorConfigMutable()->digitalIdleOffsetValue = 10 * motorConfig_digitalIdleOffsetValue;
|
||||||
voltageSensorADCConfigMutable(VOLTAGE_SENSOR_ADC_VBAT)->vbatscale = voltageSensorADCConfig_vbatscale;
|
voltageSensorADCConfigMutable(VOLTAGE_SENSOR_ADC_VBAT)->vbatscale = voltageSensorADCConfig_vbatscale;
|
||||||
batteryConfigMutable()->vbatmaxcellvoltage = batteryConfig_vbatmaxcellvoltage;
|
batteryConfigMutable()->vbatmaxcellvoltage = batteryConfig_vbatmaxcellvoltage;
|
||||||
|
systemConfigMutable()->debug_mode = systemConfig_debug_mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +128,7 @@ static OSD_Entry menuMiscEntries[]=
|
||||||
{ "DIGITAL IDLE", OME_UINT8, NULL, &(OSD_UINT8_t) { &motorConfig_digitalIdleOffsetValue, 0, 200, 1 }, 0 },
|
{ "DIGITAL IDLE", OME_UINT8, NULL, &(OSD_UINT8_t) { &motorConfig_digitalIdleOffsetValue, 0, 200, 1 }, 0 },
|
||||||
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &voltageSensorADCConfig_vbatscale, 1, 250, 1 }, 0 },
|
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &voltageSensorADCConfig_vbatscale, 1, 250, 1 }, 0 },
|
||||||
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
||||||
|
{ "DEBUG MODE", OME_TAB, NULL, &(OSD_TAB_t) { &systemConfig_debug_mode, DEBUG_COUNT - 1, debugModeNames }, 0 },
|
||||||
{ "RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
|
{ "RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
|
||||||
|
|
||||||
{ "BACK", OME_Back, NULL, NULL, 0},
|
{ "BACK", OME_Back, NULL, NULL, 0},
|
||||||
|
|
|
@ -195,31 +195,6 @@ static const char * const lookupTableGyroLpf[] = {
|
||||||
"EXPERIMENTAL"
|
"EXPERIMENTAL"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const lookupTableDebug[DEBUG_COUNT] = {
|
|
||||||
"NONE",
|
|
||||||
"CYCLETIME",
|
|
||||||
"BATTERY",
|
|
||||||
"GYRO",
|
|
||||||
"ACCELEROMETER",
|
|
||||||
"MIXER",
|
|
||||||
"AIRMODE",
|
|
||||||
"PIDLOOP",
|
|
||||||
"NOTCH",
|
|
||||||
"RC_INTERPOLATION",
|
|
||||||
"VELOCITY",
|
|
||||||
"DFILTER",
|
|
||||||
"ANGLERATE",
|
|
||||||
"ESC_SENSOR",
|
|
||||||
"SCHEDULER",
|
|
||||||
"STACK",
|
|
||||||
"ESC_SENSOR_RPM",
|
|
||||||
"ESC_SENSOR_TMP",
|
|
||||||
"ALTITUDE",
|
|
||||||
"FFT",
|
|
||||||
"FFT_TIME",
|
|
||||||
"FFT_FREQ"
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef OSD
|
#ifdef OSD
|
||||||
static const char * const lookupTableOsdType[] = {
|
static const char * const lookupTableOsdType[] = {
|
||||||
"AUTO",
|
"AUTO",
|
||||||
|
@ -286,7 +261,7 @@ const lookupTableEntry_t lookupTables[] = {
|
||||||
#ifdef MAG
|
#ifdef MAG
|
||||||
{ lookupTableMagHardware, sizeof(lookupTableMagHardware) / sizeof(char *) },
|
{ lookupTableMagHardware, sizeof(lookupTableMagHardware) / sizeof(char *) },
|
||||||
#endif
|
#endif
|
||||||
{ lookupTableDebug, sizeof(lookupTableDebug) / sizeof(char *) },
|
{ debugModeNames, sizeof(debugModeNames) / sizeof(char *) },
|
||||||
{ lookupTableSuperExpoYaw, sizeof(lookupTableSuperExpoYaw) / sizeof(char *) },
|
{ lookupTableSuperExpoYaw, sizeof(lookupTableSuperExpoYaw) / sizeof(char *) },
|
||||||
{ lookupTablePwmProtocol, sizeof(lookupTablePwmProtocol) / sizeof(char *) },
|
{ lookupTablePwmProtocol, sizeof(lookupTablePwmProtocol) / sizeof(char *) },
|
||||||
{ lookupTableRcInterpolation, sizeof(lookupTableRcInterpolation) / sizeof(char *) },
|
{ lookupTableRcInterpolation, sizeof(lookupTableRcInterpolation) / sizeof(char *) },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue