Merge pull request #3538 from DanNixon/osd_debug_mode
Allow setting debug mode from CMS
This commit is contained in:
commit
d32b7b415a
|
@ -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];
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "cms/cms_menu_builtin.h"
|
#include "cms/cms_menu_builtin.h"
|
||||||
#include "cms/cms_types.h"
|
#include "cms/cms_types.h"
|
||||||
|
|
||||||
|
#include "common/maths.h"
|
||||||
#include "common/typeconversion.h"
|
#include "common/typeconversion.h"
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "drivers/system.h"
|
||||||
|
@ -260,7 +261,8 @@ static void cmsPadToSize(char *buf, int size)
|
||||||
|
|
||||||
static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
|
static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
|
||||||
{
|
{
|
||||||
char buff[10];
|
#define CMS_DRAW_BUFFER_LEN 10
|
||||||
|
char buff[CMS_DRAW_BUFFER_LEN];
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
switch (p->type) {
|
switch (p->type) {
|
||||||
|
@ -306,8 +308,10 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
|
||||||
case OME_TAB:
|
case OME_TAB:
|
||||||
if (IS_PRINTVALUE(p)) {
|
if (IS_PRINTVALUE(p)) {
|
||||||
OSD_TAB_t *ptr = p->data;
|
OSD_TAB_t *ptr = p->data;
|
||||||
//cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay) - 5, row, (char *)ptr->names[*ptr->val]);
|
char * str = (char *)ptr->names[*ptr->val];
|
||||||
cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay), row, (char *)ptr->names[*ptr->val]);
|
memcpy(buff, str, MAX(CMS_DRAW_BUFFER_LEN, strlen(str)));
|
||||||
|
cmsPadToSize(buff, CMS_DRAW_BUFFER_LEN);
|
||||||
|
cnt = displayWrite(pDisplay, RIGHT_MENU_COLUMN(pDisplay), row, buff);
|
||||||
CLR_PRINTVALUE(p);
|
CLR_PRINTVALUE(p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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…
Reference in New Issue