Preparation for conversion to parameter groups 14
This commit is contained in:
parent
743b3e37e3
commit
c67d6eb4f1
|
@ -83,6 +83,7 @@ static const char * const cmsx_BlackboxDeviceNames[] = {
|
|||
static bool featureRead = false;
|
||||
|
||||
static uint8_t cmsx_FeatureBlackbox;
|
||||
static uint8_t blackboxConfig_rate_denom;
|
||||
|
||||
static uint8_t cmsx_BlackboxDevice;
|
||||
static OSD_TAB_t cmsx_BlackboxDeviceTable = { &cmsx_BlackboxDevice, 2, cmsx_BlackboxDeviceNames };
|
||||
|
@ -171,7 +172,7 @@ static long cmsx_Blackbox_onEnter(void)
|
|||
cmsx_FeatureBlackbox = feature(FEATURE_BLACKBOX) ? 1 : 0;
|
||||
featureRead = true;
|
||||
}
|
||||
|
||||
blackboxConfig_rate_denom = blackboxConfig()->rate_denom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -183,7 +184,7 @@ static long cmsx_Blackbox_onExit(const OSD_Entry *self)
|
|||
blackboxConfigMutable()->device = cmsx_BlackboxDevice;
|
||||
validateBlackboxConfig();
|
||||
}
|
||||
|
||||
blackboxConfigMutable()->rate_denom = blackboxConfig_rate_denom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -207,7 +208,7 @@ static OSD_Entry cmsx_menuBlackboxEntries[] =
|
|||
{ "(STATUS)", OME_String, NULL, &cmsx_BlackboxStatus, 0 },
|
||||
{ "(USED)", OME_String, NULL, &cmsx_BlackboxDeviceStorageUsed, 0 },
|
||||
{ "(FREE)", OME_String, NULL, &cmsx_BlackboxDeviceStorageFree, 0 },
|
||||
{ "RATE DENOM", OME_UINT8, NULL, &(OSD_UINT8_t){ &blackboxConfig()->rate_denom, 1, 32, 1 }, 0 },
|
||||
{ "RATE DENOM", OME_UINT8, NULL, &(OSD_UINT8_t){ &blackboxConfig_rate_denom, 1, 32, 1 }, 0 },
|
||||
|
||||
#ifdef USE_FLASHFS
|
||||
{ "ERASE FLASH", OME_Funcall, cmsx_EraseFlash, NULL, 0 },
|
||||
|
|
|
@ -286,15 +286,45 @@ static CMS_Menu cmsx_menuProfileOther = {
|
|||
.entries = cmsx_menuProfileOtherEntries,
|
||||
};
|
||||
|
||||
static uint8_t gyroConfig_gyro_soft_lpf_hz;
|
||||
static uint16_t gyroConfig_gyro_soft_notch_hz_1;
|
||||
static uint16_t gyroConfig_gyro_soft_notch_cutoff_1;
|
||||
static uint16_t gyroConfig_gyro_soft_notch_hz_2;
|
||||
static uint16_t gyroConfig_gyro_soft_notch_cutoff_2;
|
||||
|
||||
static long cmsx_menuGyro_onEnter(void)
|
||||
{
|
||||
gyroConfig_gyro_soft_lpf_hz = gyroConfig()->gyro_soft_lpf_hz;
|
||||
gyroConfig_gyro_soft_notch_hz_1 = gyroConfig()->gyro_soft_notch_hz_1;
|
||||
gyroConfig_gyro_soft_notch_cutoff_1 = gyroConfig()->gyro_soft_notch_cutoff_1;
|
||||
gyroConfig_gyro_soft_notch_hz_2 = gyroConfig()->gyro_soft_notch_hz_2;
|
||||
gyroConfig_gyro_soft_notch_cutoff_2 = gyroConfig()->gyro_soft_notch_cutoff_2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cmsx_menuGyro_onExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
gyroConfigMutable()->gyro_soft_lpf_hz = gyroConfig_gyro_soft_lpf_hz;
|
||||
gyroConfigMutable()->gyro_soft_notch_hz_1 = gyroConfig_gyro_soft_notch_hz_1;
|
||||
gyroConfigMutable()->gyro_soft_notch_cutoff_1 = gyroConfig_gyro_soft_notch_cutoff_1;
|
||||
gyroConfigMutable()->gyro_soft_notch_hz_2 = gyroConfig_gyro_soft_notch_hz_2;
|
||||
gyroConfigMutable()->gyro_soft_notch_cutoff_2 = gyroConfig_gyro_soft_notch_cutoff_2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OSD_Entry cmsx_menuFilterGlobalEntries[] =
|
||||
{
|
||||
{ "-- FILTER GLB --", OME_Label, NULL, NULL, 0 },
|
||||
|
||||
{ "GYRO LPF", OME_UINT8, NULL, &(OSD_UINT8_t) { &gyroConfig()->gyro_soft_lpf_hz, 0, 255, 1 }, 0 },
|
||||
{ "GYRO NF1", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig()->gyro_soft_notch_hz_1, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF1C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig()->gyro_soft_notch_cutoff_1, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF2", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig()->gyro_soft_notch_hz_2, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF2C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig()->gyro_soft_notch_cutoff_2, 0, 500, 1 }, 0 },
|
||||
{ "GYRO LPF", OME_UINT8, NULL, &(OSD_UINT8_t) { &gyroConfig_gyro_soft_lpf_hz, 0, 255, 1 }, 0 },
|
||||
{ "GYRO NF1", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_hz_1, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF1C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_cutoff_1, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF2", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_hz_2, 0, 500, 1 }, 0 },
|
||||
{ "GYRO NF2C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_cutoff_2, 0, 500, 1 }, 0 },
|
||||
|
||||
{ "BACK", OME_Back, NULL, NULL, 0 },
|
||||
{ NULL, OME_END, NULL, NULL, 0 }
|
||||
|
@ -303,8 +333,8 @@ static OSD_Entry cmsx_menuFilterGlobalEntries[] =
|
|||
static CMS_Menu cmsx_menuFilterGlobal = {
|
||||
.GUARD_text = "XFLTGLB",
|
||||
.GUARD_type = OME_MENU,
|
||||
.onEnter = NULL,
|
||||
.onExit = NULL,
|
||||
.onEnter = cmsx_menuGyro_onEnter,
|
||||
.onExit = cmsx_menuGyro_onExit,
|
||||
.onGlobalExit = NULL,
|
||||
.entries = cmsx_menuFilterGlobalEntries,
|
||||
};
|
||||
|
|
|
@ -22,16 +22,18 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#include "build/version.h"
|
||||
|
||||
#ifdef CMS
|
||||
|
||||
#include "build/version.h"
|
||||
|
||||
#include "drivers/system.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
#include "cms/cms_types.h"
|
||||
#include "cms/cms_menu_ledstrip.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/feature.h"
|
||||
#include "config/parameter_group.h"
|
||||
|
@ -43,7 +45,6 @@
|
|||
|
||||
#include "sensors/battery.h"
|
||||
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
@ -86,14 +87,35 @@ CMS_Menu cmsx_menuRcPreview = {
|
|||
.entries = cmsx_menuRcEntries
|
||||
};
|
||||
|
||||
static uint16_t motorConfig_minthrottle;
|
||||
static uint8_t batteryConfig_vbatscale;
|
||||
static uint8_t batteryConfig_vbatmaxcellvoltage;
|
||||
|
||||
static long cmsx_menuMiscOnEnter(void)
|
||||
{
|
||||
motorConfig_minthrottle = motorConfig()->minthrottle;
|
||||
batteryConfig_vbatscale = batteryConfig()->vbatscale;
|
||||
batteryConfig_vbatmaxcellvoltage = batteryConfig()->vbatmaxcellvoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cmsx_menuMiscOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
motorConfigMutable()->minthrottle = motorConfig_minthrottle;
|
||||
batteryConfigMutable()->vbatscale = batteryConfig_vbatscale;
|
||||
batteryConfigMutable()->vbatmaxcellvoltage = batteryConfig_vbatmaxcellvoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OSD_Entry menuMiscEntries[]=
|
||||
{
|
||||
{ "-- MISC --", OME_Label, NULL, NULL, 0 },
|
||||
|
||||
{ "MIN THR", OME_UINT16, NULL, &(OSD_UINT16_t){ &motorConfig()->minthrottle, 1000, 2000, 1 }, 0 },
|
||||
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig()->vbatscale, 1, 250, 1 }, 0 },
|
||||
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig()->vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
||||
{ "MIN THR", OME_UINT16, NULL, &(OSD_UINT16_t){ &motorConfig_minthrottle, 1000, 2000, 1 }, 0 },
|
||||
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatscale, 1, 250, 1 }, 0 },
|
||||
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
||||
{ "RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
|
||||
|
||||
{ "BACK", OME_Back, NULL, NULL, 0},
|
||||
|
@ -103,8 +125,8 @@ static OSD_Entry menuMiscEntries[]=
|
|||
CMS_Menu cmsx_menuMisc = {
|
||||
.GUARD_text = "XMISC",
|
||||
.GUARD_type = OME_MENU,
|
||||
.onEnter = NULL,
|
||||
.onExit = NULL,
|
||||
.onEnter = cmsx_menuMiscOnEnter,
|
||||
.onExit = cmsx_menuMiscOnExit,
|
||||
.onGlobalExit = NULL,
|
||||
.entries = menuMiscEntries
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
@ -29,6 +30,8 @@
|
|||
#include "cms/cms_types.h"
|
||||
#include "cms/cms_menu_osd.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/feature.h"
|
||||
#include "config/parameter_group.h"
|
||||
|
@ -36,18 +39,38 @@
|
|||
|
||||
#include "io/osd.h"
|
||||
|
||||
OSD_UINT8_t entryAlarmRssi = {&osdConfig()->rssi_alarm, 5, 90, 5};
|
||||
OSD_UINT16_t entryAlarmCapacity = {&osdConfig()->cap_alarm, 50, 30000, 50};
|
||||
OSD_UINT16_t enryAlarmFlyTime = {&osdConfig()->time_alarm, 1, 200, 1};
|
||||
OSD_UINT16_t entryAlarmAltitude = {&osdConfig()->alt_alarm, 1, 200, 1};
|
||||
static uint8_t osdConfig_rssi_alarm;
|
||||
static uint16_t osdConfig_cap_alarm;
|
||||
static uint16_t osdConfig_time_alarm;
|
||||
static uint16_t osdConfig_alt_alarm;
|
||||
|
||||
static long cmsx_menuAlarmsOnEnter(void)
|
||||
{
|
||||
osdConfig_rssi_alarm = osdConfig()->rssi_alarm;
|
||||
osdConfig_cap_alarm = osdConfig()->cap_alarm;
|
||||
osdConfig_time_alarm = osdConfig()->time_alarm;
|
||||
osdConfig_alt_alarm = osdConfig()->alt_alarm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cmsx_menuAlarmsOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
osdConfigMutable()->rssi_alarm = osdConfig_rssi_alarm;
|
||||
osdConfigMutable()->cap_alarm = osdConfig_cap_alarm;
|
||||
osdConfigMutable()->time_alarm = osdConfig_time_alarm;
|
||||
osdConfigMutable()->alt_alarm = osdConfig_alt_alarm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
OSD_Entry cmsx_menuAlarmsEntries[] =
|
||||
{
|
||||
{"--- ALARMS ---", OME_Label, NULL, NULL, 0},
|
||||
{"RSSI", OME_UINT8, NULL, &entryAlarmRssi, 0},
|
||||
{"MAIN BAT", OME_UINT16, NULL, &entryAlarmCapacity, 0},
|
||||
{"FLY TIME", OME_UINT16, NULL, &enryAlarmFlyTime, 0},
|
||||
{"MAX ALT", OME_UINT16, NULL, &entryAlarmAltitude, 0},
|
||||
{"RSSI", OME_UINT8, NULL, &(OSD_UINT8_t){&osdConfig_rssi_alarm, 5, 90, 5}, 0},
|
||||
{"MAIN BAT", OME_UINT16, NULL, &(OSD_UINT16_t){&osdConfig_cap_alarm, 50, 30000, 50}, 0},
|
||||
{"FLY TIME", OME_UINT16, NULL, &(OSD_UINT16_t){&osdConfig_time_alarm, 1, 200, 1}, 0},
|
||||
{"MAX ALT", OME_UINT16, NULL, &(OSD_UINT16_t){&osdConfig_alt_alarm, 1, 200, 1}, 0},
|
||||
{"BACK", OME_Back, NULL, NULL, 0},
|
||||
{NULL, OME_END, NULL, NULL, 0}
|
||||
};
|
||||
|
@ -55,38 +78,54 @@ OSD_Entry cmsx_menuAlarmsEntries[] =
|
|||
CMS_Menu cmsx_menuAlarms = {
|
||||
.GUARD_text = "MENUALARMS",
|
||||
.GUARD_type = OME_MENU,
|
||||
.onEnter = NULL,
|
||||
.onExit = NULL,
|
||||
.onEnter = cmsx_menuAlarmsOnEnter,
|
||||
.onExit = cmsx_menuAlarmsOnExit,
|
||||
.onGlobalExit = NULL,
|
||||
.entries = cmsx_menuAlarmsEntries,
|
||||
};
|
||||
|
||||
static uint16_t osdConfig_item_pos[OSD_ITEM_COUNT];
|
||||
|
||||
static long menuOsdActiveElemsOnEnter(void)
|
||||
{
|
||||
memcpy(&osdConfig_item_pos[0], &osdConfig()->item_pos[0], sizeof(uint16_t) * OSD_ITEM_COUNT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long menuOsdActiveElemsOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
memcpy(&osdConfigMutable()->item_pos[0], &osdConfig_item_pos[0], sizeof(uint16_t) * OSD_ITEM_COUNT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
OSD_Entry menuOsdActiveElemsEntries[] =
|
||||
{
|
||||
{"--- ACTIV ELEM ---", OME_Label, NULL, NULL, 0},
|
||||
{"RSSI", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_RSSI_VALUE], 0},
|
||||
{"MAIN BATTERY", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_MAIN_BATT_VOLTAGE], 0},
|
||||
{"HORIZON", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_ARTIFICIAL_HORIZON], 0},
|
||||
{"HORIZON SIDEBARS", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_HORIZON_SIDEBARS], 0},
|
||||
{"UPTIME", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_ONTIME], 0},
|
||||
{"FLY TIME", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_FLYTIME], 0},
|
||||
{"FLY MODE", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_FLYMODE], 0},
|
||||
{"NAME", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_CRAFT_NAME], 0},
|
||||
{"THROTTLE", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_THROTTLE_POS], 0},
|
||||
{"RSSI", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_RSSI_VALUE], 0},
|
||||
{"MAIN BATTERY", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_MAIN_BATT_VOLTAGE], 0},
|
||||
{"HORIZON", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ARTIFICIAL_HORIZON], 0},
|
||||
{"HORIZON SIDEBARS", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_HORIZON_SIDEBARS], 0},
|
||||
{"UPTIME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ONTIME], 0},
|
||||
{"FLY TIME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_FLYTIME], 0},
|
||||
{"FLY MODE", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_FLYMODE], 0},
|
||||
{"NAME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_CRAFT_NAME], 0},
|
||||
{"THROTTLE", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_THROTTLE_POS], 0},
|
||||
#ifdef VTX
|
||||
{"VTX CHAN", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_VTX_CHANNEL], 0},
|
||||
{"VTX CHAN", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_VTX_CHANNEL], 0},
|
||||
#endif // VTX
|
||||
{"CURRENT (A)", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_CURRENT_DRAW], 0},
|
||||
{"USED MAH", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_MAH_DRAWN], 0},
|
||||
{"CURRENT (A)", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_CURRENT_DRAW], 0},
|
||||
{"USED MAH", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_MAH_DRAWN], 0},
|
||||
#ifdef GPS
|
||||
{"GPS SPEED", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_GPS_SPEED], 0},
|
||||
{"GPS SATS.", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_GPS_SATS], 0},
|
||||
{"GPS SPEED", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_GPS_SPEED], 0},
|
||||
{"GPS SATS.", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_GPS_SATS], 0},
|
||||
#endif // GPS
|
||||
{"ALTITUDE", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_ALTITUDE], 0},
|
||||
{"POWER", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_POWER], 0},
|
||||
{"ROLL PID", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_ROLL_PIDS], 0},
|
||||
{"PITCH PID", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_PITCH_PIDS], 0},
|
||||
{"YAW PID", OME_VISIBLE, NULL, &osdConfig()->item_pos[OSD_YAW_PIDS], 0},
|
||||
{"ALTITUDE", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ALTITUDE], 0},
|
||||
{"POWER", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_POWER], 0},
|
||||
{"ROLL PID", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_ROLL_PIDS], 0},
|
||||
{"PITCH PID", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PITCH_PIDS], 0},
|
||||
{"YAW PID", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_YAW_PIDS], 0},
|
||||
{"BACK", OME_Back, NULL, NULL, 0},
|
||||
{NULL, OME_END, NULL, NULL, 0}
|
||||
};
|
||||
|
@ -94,8 +133,8 @@ OSD_Entry menuOsdActiveElemsEntries[] =
|
|||
CMS_Menu menuOsdActiveElems = {
|
||||
.GUARD_text = "MENUOSDACT",
|
||||
.GUARD_type = OME_MENU,
|
||||
.onEnter = NULL,
|
||||
.onExit = NULL,
|
||||
.onEnter = menuOsdActiveElemsOnEnter,
|
||||
.onExit = menuOsdActiveElemsOnExit,
|
||||
.onGlobalExit = NULL,
|
||||
.entries = menuOsdActiveElemsEntries
|
||||
};
|
||||
|
|
|
@ -3674,6 +3674,9 @@ typedef struct {
|
|||
} cliResourceValue_t;
|
||||
|
||||
const cliResourceValue_t resourceTable[] = {
|
||||
#ifdef USE_PARAMETER_GROUPS
|
||||
{ OWNER_MOTOR, NULL, MAX_SUPPORTED_MOTORS },
|
||||
#else
|
||||
#ifdef BEEPER
|
||||
{ OWNER_BEEPER, &beeperDevConfig()->ioTag, 0 },
|
||||
#endif
|
||||
|
@ -3692,6 +3695,7 @@ const cliResourceValue_t resourceTable[] = {
|
|||
#ifdef LED_STRIP
|
||||
{ OWNER_LED_STRIP, &ledStripConfig()->ioTag, 0 },
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
static void printResource(uint8_t dumpMask, const master_t *defaultConfig)
|
||||
|
|
|
@ -396,7 +396,7 @@ void init(void)
|
|||
if (feature(FEATURE_OSD)) {
|
||||
#ifdef USE_MAX7456
|
||||
// if there is a max7456 chip for the OSD then use it, otherwise use MSP
|
||||
displayPort_t *osdDisplayPort = max7456DisplayPortInit(vcdProfile(), displayPortProfileMax7456());
|
||||
displayPort_t *osdDisplayPort = max7456DisplayPortInit(vcdProfile());
|
||||
#else
|
||||
displayPort_t *osdDisplayPort = displayPortMspInit(displayPortProfileMax7456());
|
||||
#endif
|
||||
|
@ -437,7 +437,7 @@ void init(void)
|
|||
mspSerialInit();
|
||||
|
||||
#if defined(USE_MSP_DISPLAYPORT) && defined(CMS)
|
||||
cmsDisplayPortRegister(displayPortMspInit(displayPortProfileMsp()));
|
||||
cmsDisplayPortRegister(displayPortMspInit());
|
||||
#endif
|
||||
|
||||
#ifdef USE_CLI
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
#include "drivers/max7456.h"
|
||||
#include "drivers/vcd.h"
|
||||
|
||||
#include "io/displayport_max7456.h"
|
||||
#include "io/osd.h"
|
||||
|
||||
displayPort_t max7456DisplayPort; // Referenced from osd.c
|
||||
displayPortProfile_t *max7456DisplayPortProfile;
|
||||
|
||||
extern uint16_t refreshTimeout;
|
||||
|
||||
|
@ -106,8 +106,8 @@ static void resync(displayPort_t *displayPort)
|
|||
{
|
||||
UNUSED(displayPort);
|
||||
max7456RefreshAll();
|
||||
displayPort->rows = max7456GetRowsCount() + max7456DisplayPortProfile->rowAdjust;
|
||||
displayPort->cols = 30 + max7456DisplayPortProfile->colAdjust;
|
||||
displayPort->rows = max7456GetRowsCount() + displayPortProfileMax7456()->rowAdjust;
|
||||
displayPort->cols = 30 + displayPortProfileMax7456()->colAdjust;
|
||||
}
|
||||
|
||||
static int heartbeat(displayPort_t *displayPort)
|
||||
|
@ -136,9 +136,8 @@ static const displayPortVTable_t max7456VTable = {
|
|||
.txBytesFree = txBytesFree,
|
||||
};
|
||||
|
||||
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile, displayPortProfile_t *displayPortProfileToUse)
|
||||
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile)
|
||||
{
|
||||
max7456DisplayPortProfile = displayPortProfileToUse;
|
||||
displayInit(&max7456DisplayPort, &max7456VTable);
|
||||
max7456Init(vcdProfile);
|
||||
resync(&max7456DisplayPort);
|
||||
|
|
|
@ -17,5 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "config/parameter_group.h"
|
||||
#include "drivers/display.h"
|
||||
|
||||
PG_DECLARE(displayPortProfile_t, displayPortProfileMax7456);
|
||||
|
||||
struct vcdProfile_s;
|
||||
displayPort_t *max7456DisplayPortInit(const struct vcdProfile_s *vcdProfile, displayPortProfile_t *displayPortProfileToUse);
|
||||
displayPort_t *max7456DisplayPortInit(const struct vcdProfile_s *vcdProfile);
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config_master.h"
|
||||
|
||||
#include "drivers/display.h"
|
||||
#include "drivers/system.h"
|
||||
|
||||
|
@ -34,9 +36,9 @@
|
|||
#include "msp/msp_protocol.h"
|
||||
#include "msp/msp_serial.h"
|
||||
|
||||
static displayPort_t mspDisplayPort;
|
||||
#include "io/displayport_msp.h"
|
||||
|
||||
static displayPortProfile_t *mspDisplayPortProfile;
|
||||
static displayPort_t mspDisplayPort;
|
||||
|
||||
static int output(displayPort_t *displayPort, uint8_t cmd, const uint8_t *buf, int len)
|
||||
{
|
||||
|
@ -118,8 +120,8 @@ static bool isTransferInProgress(const displayPort_t *displayPort)
|
|||
|
||||
static void resync(displayPort_t *displayPort)
|
||||
{
|
||||
displayPort->rows = 13 + mspDisplayPortProfile->rowAdjust; // XXX Will reflect NTSC/PAL in the future
|
||||
displayPort->cols = 30 + mspDisplayPortProfile->colAdjust;
|
||||
displayPort->rows = 13 + displayPortProfileMsp()->rowAdjust; // XXX Will reflect NTSC/PAL in the future
|
||||
displayPort->cols = 30 + displayPortProfileMsp()->colAdjust;
|
||||
}
|
||||
|
||||
static uint32_t txBytesFree(const displayPort_t *displayPort)
|
||||
|
@ -142,9 +144,8 @@ static const displayPortVTable_t mspDisplayPortVTable = {
|
|||
.txBytesFree = txBytesFree
|
||||
};
|
||||
|
||||
displayPort_t *displayPortMspInit(displayPortProfile_t *displayPortProfileToUse)
|
||||
displayPort_t *displayPortMspInit(void)
|
||||
{
|
||||
mspDisplayPortProfile = displayPortProfileToUse;
|
||||
displayInit(&mspDisplayPort, &mspDisplayPortVTable);
|
||||
resync(&mspDisplayPort);
|
||||
return &mspDisplayPort;
|
||||
|
|
|
@ -17,5 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "config/parameter_group.h"
|
||||
#include "drivers/display.h"
|
||||
|
||||
PG_DECLARE(displayPortProfile_t, displayPortProfileMsp);
|
||||
|
||||
struct displayPort_s;
|
||||
struct displayPort_s *displayPortMspInit(displayPortProfile_t *displayPortProfileToUse);
|
||||
struct displayPort_s *displayPortMspInit(void);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -43,6 +44,7 @@
|
|||
#include "common/typeconversion.h"
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config_master.h"
|
||||
#include "config/config_profile.h"
|
||||
#include "config/feature.h"
|
||||
#include "config/parameter_group.h"
|
||||
|
@ -391,8 +393,8 @@ static void osdDrawSingleElement(uint8_t item)
|
|||
|
||||
case OSD_PIDRATE_PROFILE:
|
||||
{
|
||||
uint8_t profileIndex = masterConfig.current_profile_index;
|
||||
uint8_t rateProfileIndex = masterConfig.profile[profileIndex].activeRateProfile;
|
||||
const uint8_t profileIndex = masterConfig.current_profile_index;
|
||||
const uint8_t rateProfileIndex = masterConfig.profile[profileIndex].activeRateProfile;
|
||||
sprintf(buff, "%d-%d", profileIndex + 1, rateProfileIndex + 1);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue