mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Merge efef89735a
into 57c3471dc6
This commit is contained in:
commit
a405c12757
26 changed files with 846 additions and 37 deletions
|
@ -137,6 +137,7 @@ COMMON_SRC = \
|
||||||
blackbox/blackbox_io.c \
|
blackbox/blackbox_io.c \
|
||||||
cms/cms.c \
|
cms/cms.c \
|
||||||
cms/cms_menu_blackbox.c \
|
cms/cms_menu_blackbox.c \
|
||||||
|
cms/cms_menu_extra_led.c \
|
||||||
cms/cms_menu_failsafe.c \
|
cms/cms_menu_failsafe.c \
|
||||||
cms/cms_menu_firmware.c \
|
cms/cms_menu_firmware.c \
|
||||||
cms/cms_menu_gps_rescue.c \
|
cms/cms_menu_gps_rescue.c \
|
||||||
|
@ -154,6 +155,7 @@ COMMON_SRC = \
|
||||||
cms/cms_menu_vtx_tramp.c \
|
cms/cms_menu_vtx_tramp.c \
|
||||||
cms/cms_menu_persistent_stats.c \
|
cms/cms_menu_persistent_stats.c \
|
||||||
cms/cms_menu_rpm_limit.c \
|
cms/cms_menu_rpm_limit.c \
|
||||||
|
cms/cms_menu_spec.c \
|
||||||
cms/cms_menu_quick.c \
|
cms/cms_menu_quick.c \
|
||||||
drivers/display_ug2864hsweg01.c \
|
drivers/display_ug2864hsweg01.c \
|
||||||
drivers/light_ws2811strip.c \
|
drivers/light_ws2811strip.c \
|
||||||
|
@ -401,6 +403,7 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
|
||||||
msp/msp_serial.c \
|
msp/msp_serial.c \
|
||||||
cms/cms.c \
|
cms/cms.c \
|
||||||
cms/cms_menu_blackbox.c \
|
cms/cms_menu_blackbox.c \
|
||||||
|
cms/cms_menu_extra_led.c \
|
||||||
cms/cms_menu_failsafe.c \
|
cms/cms_menu_failsafe.c \
|
||||||
cms/cms_menu_firmware.c \
|
cms/cms_menu_firmware.c \
|
||||||
cms/cms_menu_gps_rescue.c \
|
cms/cms_menu_gps_rescue.c \
|
||||||
|
@ -418,6 +421,7 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
|
||||||
cms/cms_menu_vtx_tramp.c \
|
cms/cms_menu_vtx_tramp.c \
|
||||||
cms/cms_menu_persistent_stats.c \
|
cms/cms_menu_persistent_stats.c \
|
||||||
cms/cms_menu_rpm_limit.c \
|
cms/cms_menu_rpm_limit.c \
|
||||||
|
cms/cms_menu_spec.c \
|
||||||
cms/cms_menu_quick.c \
|
cms/cms_menu_quick.c \
|
||||||
io/vtx.c \
|
io/vtx.c \
|
||||||
io/vtx_rtc6705.c \
|
io/vtx_rtc6705.c \
|
||||||
|
|
|
@ -22,6 +22,13 @@
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#ifndef FC_VERSION_STRING_PRINTED
|
||||||
|
#define FC_VERSION_STRING_PRINTED
|
||||||
|
|
||||||
|
#pragma message "FC_VERSION_STRING: " FC_VERSION_STRING
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
const char * const targetName = __TARGET__;
|
const char * const targetName = __TARGET__;
|
||||||
const char * const shortGitRevision = __REVISION__;
|
const char * const shortGitRevision = __REVISION__;
|
||||||
#if defined(__CONFIG_REVISION__)
|
#if defined(__CONFIG_REVISION__)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define FC_VERSION_MINOR 5 // increment when a minor release is made (small new feature, change etc)
|
#define FC_VERSION_MINOR 5 // increment when a minor release is made (small new feature, change etc)
|
||||||
#define FC_VERSION_PATCH_LEVEL 3 // increment when a bug is fixed
|
#define FC_VERSION_PATCH_LEVEL 3 // increment when a bug is fixed
|
||||||
|
|
||||||
#define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL)
|
#define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL) ".KAACK_V17"
|
||||||
|
|
||||||
extern const char* const targetName;
|
extern const char* const targetName;
|
||||||
|
|
||||||
|
|
|
@ -1329,6 +1329,10 @@ const clivalue_t valueTable[] = {
|
||||||
{ "ledstrip_brightness", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 5, 100 }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_brightness) },
|
{ "ledstrip_brightness", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 5, 100 }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_brightness) },
|
||||||
{ "ledstrip_rainbow_delta", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, HSV_HUE_MAX }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_rainbow_delta) },
|
{ "ledstrip_rainbow_delta", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, HSV_HUE_MAX }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_rainbow_delta) },
|
||||||
{ "ledstrip_rainbow_freq", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 1, 2000 }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_rainbow_freq) },
|
{ "ledstrip_rainbow_freq", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 1, 2000 }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, ledstrip_rainbow_freq) },
|
||||||
|
{ "extra_ledstrip_blinkmask", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 1, UINT16_MAX }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, extra_ledstrip_blinkmask) },
|
||||||
|
{ "extra_ledstrip_color", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_LEDSTRIP_COLOR }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, extra_ledstrip_color) },
|
||||||
|
{ "extra_ledstrip_color2", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_LEDSTRIP_COLOR }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, extra_ledstrip_color2) },
|
||||||
|
{ "extra_ledstrip_color2_brightness", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 255 }, PG_LED_STRIP_CONFIG, offsetof(ledStripConfig_t, extra_ledstrip_color2_brightness) },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PG_SDCARD_CONFIG
|
// PG_SDCARD_CONFIG
|
||||||
|
@ -1486,6 +1490,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_efficiency_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_EFFICIENCY]) },
|
{ "osd_efficiency_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_EFFICIENCY]) },
|
||||||
{ "osd_total_flights_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_TOTAL_FLIGHTS]) },
|
{ "osd_total_flights_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_TOTAL_FLIGHTS]) },
|
||||||
{ "osd_aux_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_AUX_VALUE]) },
|
{ "osd_aux_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_AUX_VALUE]) },
|
||||||
|
{ "osd_spec_logo_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SPEC_LOGO]) },
|
||||||
|
|
||||||
#ifdef USE_MSP_DISPLAYPORT
|
#ifdef USE_MSP_DISPLAYPORT
|
||||||
{ "osd_sys_goggle_voltage_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_GOGGLE_VOLTAGE]) },
|
{ "osd_sys_goggle_voltage_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_ELEMENT_CONFIG, offsetof(osdElementConfig_t, item_pos[OSD_SYS_GOGGLE_VOLTAGE]) },
|
||||||
|
@ -1763,6 +1768,17 @@ const clivalue_t valueTable[] = {
|
||||||
{ "craft_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, craftName) },
|
{ "craft_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, craftName) },
|
||||||
#ifdef USE_OSD
|
#ifdef USE_OSD
|
||||||
{ "pilot_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, pilotName) },
|
{ "pilot_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, pilotName) },
|
||||||
|
{ "extra_100_throttle", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extra100Throttle) },
|
||||||
|
{ "extra_fc_hot_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraFcHotWarning) },
|
||||||
|
{ "extra_turtle_mode_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraTurtleModeWarning) },
|
||||||
|
{ "extra_low_battery_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraLowBatteryWarning) },
|
||||||
|
{ "extra_armed_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraArmedWarning) },
|
||||||
|
{ "extra_land_now_warning", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraLandNowWarning) },
|
||||||
|
|
||||||
|
|
||||||
|
{ "extra_prearm_1", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm1) },
|
||||||
|
{ "extra_prearm_2", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm2) },
|
||||||
|
{ "extra_prearm_3", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, MAX_NAME_LENGTH, STRING_FLAGS_NONE }, PG_PILOT_CONFIG, offsetof(pilotConfig_t, extraPrearm3) },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PG_POSITION
|
// PG_POSITION
|
||||||
|
|
101
src/main/cms/cms_menu_extra_led.c
Normal file
101
src/main/cms/cms_menu_extra_led.c
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_CMS
|
||||||
|
|
||||||
|
#include "io/ledstrip.h"
|
||||||
|
#include "cms/cms.h"
|
||||||
|
#include "cms/cms_types.h"
|
||||||
|
#include "config/config.h"
|
||||||
|
#include "pg/stats.h"
|
||||||
|
#include "flight/mixer.h"
|
||||||
|
|
||||||
|
#include "cli/settings.h"
|
||||||
|
|
||||||
|
static uint8_t cmsx_extraLedstripColor;
|
||||||
|
static uint8_t cmsx_extraLedstripColor2;
|
||||||
|
static uint8_t cmsx_extraLedstripColor2_brightness;
|
||||||
|
|
||||||
|
|
||||||
|
static const void *cmsx_ExtraLed_onEnter(displayPort_t *pDisp)
|
||||||
|
{
|
||||||
|
UNUSED(pDisp);
|
||||||
|
|
||||||
|
cmsx_extraLedstripColor = ledStripConfig()->extra_ledstrip_color;
|
||||||
|
cmsx_extraLedstripColor2 = ledStripConfig()->extra_ledstrip_color2;
|
||||||
|
cmsx_extraLedstripColor2_brightness = ledStripConfig()->extra_ledstrip_color2_brightness;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_ExtraLed_onExit(displayPort_t *pDisp, const OSD_Entry *self)
|
||||||
|
{
|
||||||
|
UNUSED(pDisp);
|
||||||
|
UNUSED(self);
|
||||||
|
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color = cmsx_extraLedstripColor;
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color2 = cmsx_extraLedstripColor2;
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color2_brightness = cmsx_extraLedstripColor2_brightness;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *writeLedColor(displayPort_t *pDisp, const OSD_Entry *self) {
|
||||||
|
UNUSED(pDisp);
|
||||||
|
UNUSED(self);
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color = cmsx_extraLedstripColor;
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color2 = cmsx_extraLedstripColor2;
|
||||||
|
ledStripConfigMutable()->extra_ledstrip_color2_brightness = cmsx_extraLedstripColor2_brightness;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const OSD_Entry cmsx_menuExtraLedEntries[] =
|
||||||
|
{
|
||||||
|
{ "-- LEDS EXTRA --", OME_Label, NULL, NULL },
|
||||||
|
|
||||||
|
{ "FORCE LED", OME_TAB, NULL, &(OSD_TAB_t) { &cmsx_extraLedstripColor, COLOR_COUNT - 1, lookupTableLedstripColors} },
|
||||||
|
{ "FORCE LED2", OME_TAB, NULL, &(OSD_TAB_t) { &cmsx_extraLedstripColor2, COLOR_COUNT - 1, lookupTableLedstripColors} },
|
||||||
|
{ "LED2 BRIGHT", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_extraLedstripColor2_brightness, 0, 255, 1} },
|
||||||
|
|
||||||
|
{ "SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT },
|
||||||
|
{ "BACK", OME_Back, NULL, NULL },
|
||||||
|
{ NULL, OME_END, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
CMS_Menu cmsx_menuExtraLed = {
|
||||||
|
#ifdef CMS_MENU_DEBUG
|
||||||
|
.GUARD_text = "RPMLIMIT",
|
||||||
|
.GUARD_type = OME_MENU,
|
||||||
|
#endif
|
||||||
|
.onEnter = cmsx_ExtraLed_onEnter,
|
||||||
|
.onExit = cmsx_ExtraLed_onExit,
|
||||||
|
.onDisplayUpdate = writeLedColor,
|
||||||
|
.entries = cmsx_menuExtraLedEntries
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
24
src/main/cms/cms_menu_extra_led.h
Normal file
24
src/main/cms/cms_menu_extra_led.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
extern CMS_Menu cmsx_menuExtraLed;
|
|
@ -29,9 +29,11 @@
|
||||||
|
|
||||||
#include "cms/cms.h"
|
#include "cms/cms.h"
|
||||||
#include "cms/cms_types.h"
|
#include "cms/cms_types.h"
|
||||||
|
#include "cms/cms_menu_extra_led.h"
|
||||||
#include "cms/cms_menu_main.h"
|
#include "cms/cms_menu_main.h"
|
||||||
#include "cms/cms_menu_vtx_common.h"
|
#include "cms/cms_menu_vtx_common.h"
|
||||||
#include "cms/cms_menu_rpm_limit.h"
|
#include "cms/cms_menu_rpm_limit.h"
|
||||||
|
|
||||||
#include "common/printf.h"
|
#include "common/printf.h"
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
|
|
||||||
|
@ -49,6 +51,8 @@
|
||||||
|
|
||||||
#include "cms_menu_quick.h"
|
#include "cms_menu_quick.h"
|
||||||
|
|
||||||
|
#include "cms/cms_menu_spec.h"
|
||||||
|
|
||||||
static controlRateConfig_t rateProfile;
|
static controlRateConfig_t rateProfile;
|
||||||
static uint8_t rateProfileIndex;
|
static uint8_t rateProfileIndex;
|
||||||
static batteryConfig_t batteryProfile;
|
static batteryConfig_t batteryProfile;
|
||||||
|
@ -87,23 +91,29 @@ static const void *cmsx_RateProfileWriteback(displayPort_t *pDisp, const OSD_Ent
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char * const osdTableThrottleLimitType[] = {
|
||||||
|
"OFF", "SCALE", "CLIP"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const OSD_Entry menuMainEntries[] =
|
static const OSD_Entry menuMainEntries[] =
|
||||||
{
|
{
|
||||||
{ "-- QUICK --", OME_Label, NULL, NULL },
|
|
||||||
|
|
||||||
#if defined(USE_RPM_LIMIT)
|
#if defined(USE_RPM_LIMIT)
|
||||||
{ "RPM LIM", OME_Submenu, cmsMenuChange, &cmsx_menuRpmLimit },
|
{ "RPM LIM", OME_Submenu, cmsMenuChange, &cmsx_menuRpmLimit },
|
||||||
#endif
|
#endif
|
||||||
{ "THR LIM TYPE", OME_TAB, NULL, &(OSD_TAB_t) { &rateProfile.throttle_limit_type, THROTTLE_LIMIT_TYPE_COUNT - 1, lookupTableThrottleLimitType } },
|
{ "LEDS EXTRA", OME_Submenu, cmsMenuChange, &cmsx_menuExtraLed },
|
||||||
{ "THR LIM %", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.throttle_limit_percent, 25, 100, 1 } },
|
{ "THR LIM TYPE",OME_TAB, NULL, &(OSD_TAB_t) { &rateProfile.throttle_limit_type, THROTTLE_LIMIT_TYPE_COUNT - 1, osdTableThrottleLimitType} },
|
||||||
{ "MTR OUT LIM %", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_motorOutputLimit, MOTOR_OUTPUT_LIMIT_PERCENT_MIN, MOTOR_OUTPUT_LIMIT_PERCENT_MAX, 1 } },
|
{ "THR LIM %", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.throttle_limit_percent, 25, 100, 1} },
|
||||||
{ "FORCE CELLS", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryProfile.forceBatteryCellCount, 0, 24, 1 } },
|
{ "MTR OUT LIM %",OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_motorOutputLimit, MOTOR_OUTPUT_LIMIT_PERCENT_MIN, MOTOR_OUTPUT_LIMIT_PERCENT_MAX, 1} },
|
||||||
|
{ "FORCE CELLS", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryProfile.forceBatteryCellCount, 0, 24, 1} },
|
||||||
#if defined(USE_VTX_CONTROL)
|
#if defined(USE_VTX_CONTROL)
|
||||||
#if defined(USE_VTX_RTC6705) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP)
|
#if defined(USE_VTX_RTC6705) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_TRAMP)
|
||||||
{"VTX", OME_Funcall, cmsSelectVtx, NULL},
|
{"VTX", OME_Funcall, cmsSelectVtx, NULL},
|
||||||
#endif
|
#endif
|
||||||
#endif // VTX_CONTROL
|
#endif // VTX_CONTROL
|
||||||
{ "MAIN", OME_Submenu, NULL, &cmsx_menuMain },
|
{ "SPECS", OME_Submenu, cmsMenuChange, &cmsx_menuSpec },
|
||||||
|
{ "MAIN", OME_Submenu, NULL, &cmsx_menuMain},
|
||||||
{ "EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT},
|
{ "EXIT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_EXIT},
|
||||||
{ "SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT},
|
{ "SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void *)CMS_POPUP_SAVEREBOOT},
|
||||||
{NULL, OME_END, NULL, NULL},
|
{NULL, OME_END, NULL, NULL},
|
||||||
|
|
134
src/main/cms/cms_menu_spec.c
Normal file
134
src/main/cms/cms_menu_spec.c
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_CMS
|
||||||
|
#ifdef USE_RPM_LIMIT
|
||||||
|
|
||||||
|
#include "cms/cms.h"
|
||||||
|
#include "cms/cms_types.h"
|
||||||
|
#include "config/config.h"
|
||||||
|
#include "pg/stats.h"
|
||||||
|
#include "flight/mixer.h"
|
||||||
|
|
||||||
|
#include "common/spec.h"
|
||||||
|
|
||||||
|
#include "cms/cms_menu_spec.h"
|
||||||
|
|
||||||
|
static const void *cmsx_spec_onEnter(displayPort_t *pDisp)
|
||||||
|
{
|
||||||
|
UNUSED(pDisp);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_spec_onExit(displayPort_t *pDisp, const OSD_Entry *self)
|
||||||
|
{
|
||||||
|
UNUSED(pDisp);
|
||||||
|
UNUSED(self);
|
||||||
|
|
||||||
|
// mixerConfigMutable()->rpm_limit_value = rpm_limit_value;
|
||||||
|
// motorConfigMutable()->kv = kv;
|
||||||
|
// mixerConfigMutable()->rpm_limit = rpm_limit;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_SetFreedom(displayPort_t *pDisplay, const void *ptr)
|
||||||
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
setSpec(SPEC_FREEDOM);
|
||||||
|
saveConfigAndNotify();
|
||||||
|
cmsMenuExit(pDisplay, (const void *)(intptr_t)CMS_POPUP_SAVEREBOOT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_Set7(displayPort_t *pDisplay, const void *ptr)
|
||||||
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
setSpec(SPEC_7IN);
|
||||||
|
saveConfigAndNotify();
|
||||||
|
cmsMenuExit(pDisplay, (const void *)(intptr_t)CMS_POPUP_SAVEREBOOT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_SetMayhem(displayPort_t *pDisplay, const void *ptr)
|
||||||
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
setSpec(SPEC_MAYHEM);
|
||||||
|
saveConfigAndNotify();
|
||||||
|
cmsMenuExit(pDisplay, (const void *)(intptr_t)CMS_POPUP_SAVEREBOOT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const void *cmsx_SetTt(displayPort_t *pDisplay, const void *ptr)
|
||||||
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
setSpec(SPEC_TT);
|
||||||
|
saveConfigAndNotify();
|
||||||
|
cmsMenuExit(pDisplay, (const void *)(intptr_t)CMS_POPUP_SAVEREBOOT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const void *cmsx_SetLl(displayPort_t *pDisplay, const void *ptr)
|
||||||
|
{
|
||||||
|
UNUSED(ptr);
|
||||||
|
setSpec(SPEC_LLIGUETA);
|
||||||
|
saveConfigAndNotify();
|
||||||
|
cmsMenuExit(pDisplay, (const void *)(intptr_t)CMS_POPUP_SAVEREBOOT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const OSD_Entry cmsx_menuSpecEntries[] =
|
||||||
|
{
|
||||||
|
{ "-- SELECT SPEC --", OME_Label, NULL, NULL },
|
||||||
|
|
||||||
|
{specArray[SPEC_FREEDOM].name, OME_Funcall, cmsx_SetFreedom, NULL},
|
||||||
|
{specArray[SPEC_7IN].name, OME_Funcall, cmsx_Set7, NULL},
|
||||||
|
{specArray[SPEC_MAYHEM].name, OME_Funcall, cmsx_SetMayhem, NULL},
|
||||||
|
{specArray[SPEC_TT].name, OME_Funcall, cmsx_SetTt, NULL},
|
||||||
|
{specArray[SPEC_LLIGUETA].name, OME_Funcall, cmsx_SetLl, NULL},
|
||||||
|
|
||||||
|
{ "BACK", OME_Back, NULL, NULL },
|
||||||
|
{ NULL, OME_END, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
CMS_Menu cmsx_menuSpec = {
|
||||||
|
#ifdef CMS_MENU_DEBUG
|
||||||
|
.GUARD_text = "SPECS",
|
||||||
|
.GUARD_type = OME_MENU,
|
||||||
|
#endif
|
||||||
|
.onEnter = cmsx_spec_onEnter,
|
||||||
|
.onExit = cmsx_spec_onExit,
|
||||||
|
.onDisplayUpdate = NULL,
|
||||||
|
.entries = cmsx_menuSpecEntries
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif // USE_RPM_LIMIT
|
24
src/main/cms/cms_menu_spec.h
Normal file
24
src/main/cms/cms_menu_spec.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
extern CMS_Menu cmsx_menuSpec;
|
221
src/main/common/spec.c
Normal file
221
src/main/common/spec.c
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "flight/mixer.h"
|
||||||
|
#include "pg/motor.h"
|
||||||
|
#include "drivers/motor.h"
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/spec.h"
|
||||||
|
|
||||||
|
SpecType getCurrentSpec(void)
|
||||||
|
{
|
||||||
|
SpecType result = SPEC_COUNT;
|
||||||
|
|
||||||
|
for (int spec = 0; spec < SPEC_COUNT; spec++) {
|
||||||
|
if (checkSpec(spec)) {
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkSpec(SpecType specType)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
isMotorProtocolBidirDshot() &&
|
||||||
|
mixerConfig()->rpm_limit == specArray[specType].rpm_limit &&
|
||||||
|
mixerConfig()->rpm_limit_value == specArray[specType].rpm_limit_value &&
|
||||||
|
motorConfig()->motorPoleCount == specArray[specType].motorPoleCount &&
|
||||||
|
mixerConfig()->rpm_limit_p == specArray[specType].rpm_limit_p &&
|
||||||
|
mixerConfig()->rpm_limit_i == specArray[specType].rpm_limit_i &&
|
||||||
|
mixerConfig()->rpm_limit_d == specArray[specType].rpm_limit_d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSpec(SpecType specType)
|
||||||
|
{
|
||||||
|
mixerConfigMutable()->rpm_limit = specArray[specType].rpm_limit;
|
||||||
|
mixerConfigMutable()->rpm_limit_value = specArray[specType].rpm_limit_value;
|
||||||
|
motorConfigMutable()->motorPoleCount = specArray[specType].motorPoleCount;
|
||||||
|
motorConfigMutable()->kv = specArray[specType].kv;
|
||||||
|
mixerConfigMutable()->rpm_limit_p = specArray[specType].rpm_limit_p;
|
||||||
|
mixerConfigMutable()->rpm_limit_i = specArray[specType].rpm_limit_i;
|
||||||
|
mixerConfigMutable()->rpm_limit_d = specArray[specType].rpm_limit_d;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definition of specArray, initialized with sample data
|
||||||
|
specSettings_t specArray[] = {
|
||||||
|
{
|
||||||
|
"FREEDOM 18K", // Name
|
||||||
|
true, // bool rpm_limit;
|
||||||
|
25, // uint16_t rpm_limit_p;
|
||||||
|
10, // uint16_t rpm_limit_i;
|
||||||
|
8, // uint16_t rpm_limit_d;
|
||||||
|
18000, // uint16_t rpm_limit_value;
|
||||||
|
14, // uint8_t motorPoleCount;
|
||||||
|
1960, // uint16_t kv;
|
||||||
|
|
||||||
|
{ // Logo groups
|
||||||
|
{ "FS ",
|
||||||
|
" ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " F ",
|
||||||
|
" S ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " ",
|
||||||
|
"FS ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "F ",
|
||||||
|
"S ",
|
||||||
|
" " },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"MGP PRO 13K", // Name
|
||||||
|
true, // bool rpm_limit;
|
||||||
|
25, // uint16_t rpm_limit_p;
|
||||||
|
10, // uint16_t rpm_limit_i;
|
||||||
|
8, // uint16_t rpm_limit_d;
|
||||||
|
13000, // uint16_t rpm_limit_value;
|
||||||
|
14, // uint8_t motorPoleCount;
|
||||||
|
1300, // uint16_t kv;
|
||||||
|
|
||||||
|
{ // Logo groups
|
||||||
|
{ "PRO",
|
||||||
|
" ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " RO",
|
||||||
|
"P ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "P O",
|
||||||
|
" R ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "PR ",
|
||||||
|
" O",
|
||||||
|
" " },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"MAYHEM 24K", // Name
|
||||||
|
true, // bool rpm_limit;
|
||||||
|
25, // uint16_t rpm_limit_p;
|
||||||
|
10, // uint16_t rpm_limit_i;
|
||||||
|
8, // uint16_t rpm_limit_d;
|
||||||
|
24000, // uint16_t rpm_limit_value;
|
||||||
|
14, // uint8_t motorPoleCount;
|
||||||
|
1960, // uint16_t kv;
|
||||||
|
|
||||||
|
{ // Logo groups
|
||||||
|
{ "M8 ",
|
||||||
|
" ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " M ",
|
||||||
|
" 8 ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " ",
|
||||||
|
"M8 ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "M ",
|
||||||
|
"8 ",
|
||||||
|
" " },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"TT 30K", // Name
|
||||||
|
true, // bool rpm_limit;
|
||||||
|
25, // uint16_t rpm_limit_p;
|
||||||
|
10, // uint16_t rpm_limit_i;
|
||||||
|
8, // uint16_t rpm_limit_d;
|
||||||
|
30000, // uint16_t rpm_limit_value;
|
||||||
|
12, // uint8_t motorPoleCount;
|
||||||
|
4533, // uint16_t kv;
|
||||||
|
|
||||||
|
{ // Logo groups
|
||||||
|
{ "TT ",
|
||||||
|
" ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " T ",
|
||||||
|
" T ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " ",
|
||||||
|
"TT ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "T ",
|
||||||
|
"T ",
|
||||||
|
" " },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"LA LLIGUETA 17K", // Name
|
||||||
|
true, // bool rpm_limit;
|
||||||
|
25, // uint16_t rpm_limit_p;
|
||||||
|
10, // uint16_t rpm_limit_i;
|
||||||
|
8, // uint16_t rpm_limit_d;
|
||||||
|
17000, // uint16_t rpm_limit_value;
|
||||||
|
14, // uint8_t motorPoleCount;
|
||||||
|
1980, // uint16_t kv;
|
||||||
|
|
||||||
|
{ // Logo groups
|
||||||
|
{ "LL ",
|
||||||
|
" ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " L ",
|
||||||
|
" L ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ " ",
|
||||||
|
"LL ",
|
||||||
|
" " },
|
||||||
|
|
||||||
|
{ "L ",
|
||||||
|
"L ",
|
||||||
|
" " },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
62
src/main/common/spec.h
Normal file
62
src/main/common/spec.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public
|
||||||
|
* License along with this software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define MAX_NAME_SIZE 16
|
||||||
|
#define LOGO_WIDTH 4 // 3 + \n
|
||||||
|
#define LOGO_HEIGHT 3
|
||||||
|
#define LOGO_GROUPS 4
|
||||||
|
|
||||||
|
// Enum representing different types of specs
|
||||||
|
typedef enum {
|
||||||
|
SPEC_FREEDOM,
|
||||||
|
SPEC_7IN,
|
||||||
|
SPEC_MAYHEM,
|
||||||
|
SPEC_TT,
|
||||||
|
SPEC_LLIGUETA,
|
||||||
|
SPEC_COUNT // must be last
|
||||||
|
} SpecType;
|
||||||
|
|
||||||
|
// Struct representing the settings for each spec type
|
||||||
|
typedef struct specSettings_s {
|
||||||
|
char name[MAX_NAME_SIZE]; // Null-terminated name string
|
||||||
|
bool rpm_limit;
|
||||||
|
uint16_t rpm_limit_p;
|
||||||
|
uint16_t rpm_limit_i;
|
||||||
|
uint16_t rpm_limit_d;
|
||||||
|
uint16_t rpm_limit_value;
|
||||||
|
uint8_t motorPoleCount;
|
||||||
|
uint16_t kv;
|
||||||
|
char logo[LOGO_GROUPS][LOGO_HEIGHT][LOGO_WIDTH]; // 4x3 array of strings
|
||||||
|
} specSettings_t;
|
||||||
|
|
||||||
|
// Declaration of specArray for external access
|
||||||
|
extern specSettings_t specArray[];
|
||||||
|
|
||||||
|
bool checkSpec(SpecType specType);
|
||||||
|
void setSpec(SpecType specType);
|
||||||
|
SpecType getCurrentSpec(void);
|
|
@ -22,6 +22,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
@ -94,6 +95,8 @@
|
||||||
|
|
||||||
#include "drivers/dshot.h"
|
#include "drivers/dshot.h"
|
||||||
|
|
||||||
|
#include "osd/osd_elements.h"
|
||||||
|
|
||||||
static bool configIsDirty; /* someone indicated that the config is modified and it is not yet saved */
|
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
|
static bool rebootRequired = false; // set if a config change requires a reboot to take effect
|
||||||
|
@ -111,6 +114,15 @@ PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 2);
|
||||||
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
|
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
|
||||||
.craftName = { 0 },
|
.craftName = { 0 },
|
||||||
.pilotName = { 0 },
|
.pilotName = { 0 },
|
||||||
|
.extra100Throttle = "KAACK",
|
||||||
|
.extraFcHotWarning = "THIS IS HOT",
|
||||||
|
.extraTurtleModeWarning = "SORRY",
|
||||||
|
.extraLowBatteryWarning = "AINT LEAVING",
|
||||||
|
.extraArmedWarning = "LETS GO",
|
||||||
|
.extraLandNowWarning = ">> LAND NOW <<",
|
||||||
|
.extraPrearm1 = "SCULLY",
|
||||||
|
.extraPrearm2 = "ONE",
|
||||||
|
.extraPrearm3 = "LOVE",
|
||||||
);
|
);
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 3);
|
PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 3);
|
||||||
|
@ -210,6 +222,19 @@ static void validateAndFixRatesSettings(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void makeStringsUpperCase(void)
|
||||||
|
{
|
||||||
|
toUpperCase(pilotConfigMutable()->extra100Throttle, pilotConfig()->extra100Throttle, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraFcHotWarning, pilotConfig()->extraFcHotWarning, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraTurtleModeWarning, pilotConfig()->extraTurtleModeWarning, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraLowBatteryWarning, pilotConfig()->extraLowBatteryWarning, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraArmedWarning, pilotConfig()->extraArmedWarning, MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
toUpperCase(pilotConfigMutable()->extraPrearm1, pilotConfig()->extraPrearm1, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraPrearm2, pilotConfig()->extraPrearm2, MAX_NAME_LENGTH);
|
||||||
|
toUpperCase(pilotConfigMutable()->extraPrearm3, pilotConfig()->extraPrearm3, MAX_NAME_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
static void validateAndFixConfig(void)
|
static void validateAndFixConfig(void)
|
||||||
{
|
{
|
||||||
#if !defined(USE_QUAD_MIXER_ONLY)
|
#if !defined(USE_QUAD_MIXER_ONLY)
|
||||||
|
@ -567,6 +592,21 @@ if (systemConfig()->configurationState == CONFIGURATION_STATE_UNCONFIGURED) {
|
||||||
osdConfigMutable()->timers[i] = osdTimerDefault[i];
|
osdConfigMutable()->timers[i] = osdTimerDefault[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
featureEnableImmediate(FEATURE_OSD);
|
||||||
|
|
||||||
|
if (!VISIBLE(osdElementConfig()->item_pos[OSD_SPEC_LOGO])) {
|
||||||
|
uint16_t profileFlags = 0;
|
||||||
|
for (unsigned i = 1; i <= OSD_PROFILE_COUNT; i++) {
|
||||||
|
profileFlags |= OSD_PROFILE_FLAG(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osdConfig()->canvas_cols < 40) {
|
||||||
|
osdElementConfigMutable()->item_pos[OSD_SPEC_LOGO] = OSD_POS(1, 2) | profileFlags;
|
||||||
|
} else {
|
||||||
|
osdElementConfigMutable()->item_pos[OSD_SPEC_LOGO] = OSD_POS(3, 2) | profileFlags;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_VTX_COMMON) && defined(USE_VTX_TABLE)
|
#if defined(USE_VTX_COMMON) && defined(USE_VTX_TABLE)
|
||||||
|
@ -602,6 +642,7 @@ if (systemConfig()->configurationState == CONFIGURATION_STATE_UNCONFIGURED) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
validateAndfixMotorOutputReordering(motorConfigMutable()->dev.motorOutputReordering, MAX_SUPPORTED_MOTORS);
|
validateAndfixMotorOutputReordering(motorConfigMutable()->dev.motorOutputReordering, MAX_SUPPORTED_MOTORS);
|
||||||
|
makeStringsUpperCase();
|
||||||
|
|
||||||
// validate that the minimum battery cell voltage is less than the maximum cell voltage
|
// validate that the minimum battery cell voltage is less than the maximum cell voltage
|
||||||
// reset to defaults if not
|
// reset to defaults if not
|
||||||
|
|
|
@ -35,6 +35,16 @@ typedef enum {
|
||||||
typedef struct pilotConfig_s {
|
typedef struct pilotConfig_s {
|
||||||
char craftName[MAX_NAME_LENGTH + 1];
|
char craftName[MAX_NAME_LENGTH + 1];
|
||||||
char pilotName[MAX_NAME_LENGTH + 1];
|
char pilotName[MAX_NAME_LENGTH + 1];
|
||||||
|
char extra100Throttle[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraFcHotWarning[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraTurtleModeWarning[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraLowBatteryWarning[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraArmedWarning[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraLandNowWarning[MAX_NAME_LENGTH + 1];
|
||||||
|
|
||||||
|
char extraPrearm1[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraPrearm2[MAX_NAME_LENGTH + 1];
|
||||||
|
char extraPrearm3[MAX_NAME_LENGTH + 1];
|
||||||
} pilotConfig_t;
|
} pilotConfig_t;
|
||||||
|
|
||||||
PG_DECLARE(pilotConfig_t, pilotConfig);
|
PG_DECLARE(pilotConfig_t, pilotConfig);
|
||||||
|
|
|
@ -270,20 +270,20 @@ void processRcStickPositions(void)
|
||||||
switch (rcSticks) {
|
switch (rcSticks) {
|
||||||
case THR_LO + YAW_LO + PIT_CE + ROL_LO:
|
case THR_LO + YAW_LO + PIT_CE + ROL_LO:
|
||||||
// ROLL left -> PID profile 1
|
// ROLL left -> PID profile 1
|
||||||
changePidProfile(0);
|
//changePidProfile(0);
|
||||||
return;
|
return;
|
||||||
case THR_LO + YAW_LO + PIT_HI + ROL_CE:
|
case THR_LO + YAW_LO + PIT_HI + ROL_CE:
|
||||||
// PITCH up -> PID profile 2
|
// PITCH up -> PID profile 2
|
||||||
changePidProfile(1);
|
//changePidProfile(1);
|
||||||
return;
|
return;
|
||||||
case THR_LO + YAW_LO + PIT_CE + ROL_HI:
|
case THR_LO + YAW_LO + PIT_CE + ROL_HI:
|
||||||
// ROLL right -> PID profile 3
|
// ROLL right -> PID profile 3
|
||||||
changePidProfile(2);
|
//changePidProfile(2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcSticks == THR_LO + YAW_LO + PIT_LO + ROL_HI) {
|
if (rcSticks == THR_LO + YAW_LO + PIT_LO + ROL_HI) {
|
||||||
saveConfigAndNotify();
|
//saveConfigAndNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ACC
|
#ifdef USE_ACC
|
||||||
|
@ -350,16 +350,16 @@ void processRcStickPositions(void)
|
||||||
// in ACRO mode, so use sticks to change RATE profile
|
// in ACRO mode, so use sticks to change RATE profile
|
||||||
switch (rcSticks) {
|
switch (rcSticks) {
|
||||||
case THR_HI + YAW_CE + PIT_HI + ROL_CE:
|
case THR_HI + YAW_CE + PIT_HI + ROL_CE:
|
||||||
changeControlRateProfile(0);
|
//changeControlRateProfile(0);
|
||||||
return;
|
return;
|
||||||
case THR_HI + YAW_CE + PIT_LO + ROL_CE:
|
case THR_HI + YAW_CE + PIT_LO + ROL_CE:
|
||||||
changeControlRateProfile(1);
|
//changeControlRateProfile(1);
|
||||||
return;
|
return;
|
||||||
case THR_HI + YAW_CE + PIT_CE + ROL_HI:
|
case THR_HI + YAW_CE + PIT_CE + ROL_HI:
|
||||||
changeControlRateProfile(2);
|
//changeControlRateProfile(2);
|
||||||
return;
|
return;
|
||||||
case THR_HI + YAW_CE + PIT_CE + ROL_LO:
|
case THR_HI + YAW_CE + PIT_CE + ROL_LO:
|
||||||
changeControlRateProfile(3);
|
//changeControlRateProfile(3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,16 +376,16 @@ void processRcStickPositions(void)
|
||||||
|
|
||||||
#ifdef USE_VTX_CONTROL
|
#ifdef USE_VTX_CONTROL
|
||||||
if (rcSticks == THR_HI + YAW_LO + PIT_CE + ROL_HI) {
|
if (rcSticks == THR_HI + YAW_LO + PIT_CE + ROL_HI) {
|
||||||
vtxIncrementBand();
|
//vtxIncrementBand();
|
||||||
}
|
}
|
||||||
if (rcSticks == THR_HI + YAW_LO + PIT_CE + ROL_LO) {
|
if (rcSticks == THR_HI + YAW_LO + PIT_CE + ROL_LO) {
|
||||||
vtxDecrementBand();
|
//vtxDecrementBand();
|
||||||
}
|
}
|
||||||
if (rcSticks == THR_HI + YAW_HI + PIT_CE + ROL_HI) {
|
if (rcSticks == THR_HI + YAW_HI + PIT_CE + ROL_HI) {
|
||||||
vtxIncrementChannel();
|
//vtxIncrementChannel();
|
||||||
}
|
}
|
||||||
if (rcSticks == THR_HI + YAW_HI + PIT_CE + ROL_LO) {
|
if (rcSticks == THR_HI + YAW_HI + PIT_CE + ROL_LO) {
|
||||||
vtxDecrementChannel();
|
//vtxDecrementChannel();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ typedef enum {
|
||||||
BOXBEEPERMUTE,
|
BOXBEEPERMUTE,
|
||||||
BOXREADY,
|
BOXREADY,
|
||||||
BOXLAPTIMERRESET,
|
BOXLAPTIMERRESET,
|
||||||
|
BOXLEDNOBLINK,
|
||||||
CHECKBOX_ITEM_COUNT
|
CHECKBOX_ITEM_COUNT
|
||||||
} boxId_e;
|
} boxId_e;
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,10 @@ void pgResetFn_ledStripConfig(ledStripConfig_t *ledStripConfig)
|
||||||
ledStripConfig->ledstrip_brightness = 100;
|
ledStripConfig->ledstrip_brightness = 100;
|
||||||
ledStripConfig->ledstrip_rainbow_delta = 0;
|
ledStripConfig->ledstrip_rainbow_delta = 0;
|
||||||
ledStripConfig->ledstrip_rainbow_freq = 120;
|
ledStripConfig->ledstrip_rainbow_freq = 120;
|
||||||
|
ledStripConfig->extra_ledstrip_blinkmask = 0x3333; // 0b1000000000000101;
|
||||||
|
ledStripConfig->extra_ledstrip_color = COLOR_BLACK;
|
||||||
|
ledStripConfig->extra_ledstrip_color2 = COLOR_BLACK;
|
||||||
|
ledStripConfig->extra_ledstrip_color2_brightness = 0;
|
||||||
#ifndef UNIT_TEST
|
#ifndef UNIT_TEST
|
||||||
#ifdef LED_STRIP_PIN
|
#ifdef LED_STRIP_PIN
|
||||||
ledStripConfig->ioTag = IO_TAG(LED_STRIP_PIN);
|
ledStripConfig->ioTag = IO_TAG(LED_STRIP_PIN);
|
||||||
|
@ -494,6 +498,17 @@ static const struct {
|
||||||
{0, LED_MODE_ORIENTATION},
|
{0, LED_MODE_ORIENTATION},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static hsvColor_t getCurrentLedColor(int ledIndex)
|
||||||
|
{
|
||||||
|
const ledConfig_t *ledConfig = &ledStripStatusModeConfig()->ledConfigs[ledIndex];
|
||||||
|
hsvColor_t color = ledStripStatusModeConfig()->colors[ledGetColor(ledConfig)];
|
||||||
|
if (COLOR_BLACK != ledStripConfig()->extra_ledstrip_color) {
|
||||||
|
color = hsv[ledStripConfig()->extra_ledstrip_color];
|
||||||
|
}
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
static void applyLedFixedLayers(void)
|
static void applyLedFixedLayers(void)
|
||||||
{
|
{
|
||||||
for (int ledIndex = 0; ledIndex < ledCounts.count; ledIndex++) {
|
for (int ledIndex = 0; ledIndex < ledCounts.count; ledIndex++) {
|
||||||
|
@ -505,7 +520,7 @@ static void applyLedFixedLayers(void)
|
||||||
|
|
||||||
switch (fn) {
|
switch (fn) {
|
||||||
case LED_FUNCTION_COLOR:
|
case LED_FUNCTION_COLOR:
|
||||||
color = ledStripStatusModeConfig()->colors[ledGetColor(ledConfig)];
|
color = getCurrentLedColor(ledIndex);
|
||||||
|
|
||||||
hsvColor_t nextColor = ledStripStatusModeConfig()->colors[(ledGetColor(ledConfig) + 1 + LED_CONFIGURABLE_COLOR_COUNT) % LED_CONFIGURABLE_COLOR_COUNT];
|
hsvColor_t nextColor = ledStripStatusModeConfig()->colors[(ledGetColor(ledConfig) + 1 + LED_CONFIGURABLE_COLOR_COUNT) % LED_CONFIGURABLE_COLOR_COUNT];
|
||||||
hsvColor_t previousColor = ledStripStatusModeConfig()->colors[(ledGetColor(ledConfig) - 1 + LED_CONFIGURABLE_COLOR_COUNT) % LED_CONFIGURABLE_COLOR_COUNT];
|
hsvColor_t previousColor = ledStripStatusModeConfig()->colors[(ledGetColor(ledConfig) - 1 + LED_CONFIGURABLE_COLOR_COUNT) % LED_CONFIGURABLE_COLOR_COUNT];
|
||||||
|
@ -1014,9 +1029,15 @@ static void applyLarsonScannerLayer(bool updateNow, timeUs_t *timer)
|
||||||
// blink twice, then wait ; either always or just when landing
|
// blink twice, then wait ; either always or just when landing
|
||||||
static void applyLedBlinkLayer(bool updateNow, timeUs_t *timer)
|
static void applyLedBlinkLayer(bool updateNow, timeUs_t *timer)
|
||||||
{
|
{
|
||||||
const uint16_t blinkPattern = 0x8005; // 0b1000000000000101;
|
uint16_t blinkPattern = ledStripConfig()->extra_ledstrip_blinkmask;
|
||||||
|
if (IS_RC_MODE_ACTIVE(BOXLEDNOBLINK)) {
|
||||||
|
|
||||||
|
blinkPattern = 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
static uint16_t blinkMask;
|
static uint16_t blinkMask;
|
||||||
|
|
||||||
|
|
||||||
if (updateNow) {
|
if (updateNow) {
|
||||||
blinkMask = blinkMask >> 1;
|
blinkMask = blinkMask >> 1;
|
||||||
if (blinkMask <= 1)
|
if (blinkMask <= 1)
|
||||||
|
@ -1031,7 +1052,12 @@ static void applyLedBlinkLayer(bool updateNow, timeUs_t *timer)
|
||||||
const ledConfig_t *ledConfig = &ledStripStatusModeConfig()->ledConfigs[i];
|
const ledConfig_t *ledConfig = &ledStripStatusModeConfig()->ledConfigs[i];
|
||||||
|
|
||||||
if (ledGetOverlayBit(ledConfig, LED_OVERLAY_BLINK)) {
|
if (ledGetOverlayBit(ledConfig, LED_OVERLAY_BLINK)) {
|
||||||
setLedHsv(i, getSC(LED_SCOLOR_BLINKBACKGROUND));
|
hsvColor_t currentColor = getCurrentLedColor(i);
|
||||||
|
if (COLOR_BLACK != ledStripConfig()->extra_ledstrip_color2) {
|
||||||
|
currentColor = hsv[ledStripConfig()->extra_ledstrip_color2];
|
||||||
|
}
|
||||||
|
currentColor.v = ledStripConfig()->extra_ledstrip_color2_brightness;
|
||||||
|
setLedHsv(i, ¤tColor); //getSC(LED_SCOLOR_BLINKBACKGROUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,10 @@ typedef struct ledStripConfig_s {
|
||||||
uint8_t ledstrip_brightness;
|
uint8_t ledstrip_brightness;
|
||||||
uint16_t ledstrip_rainbow_delta;
|
uint16_t ledstrip_rainbow_delta;
|
||||||
uint16_t ledstrip_rainbow_freq;
|
uint16_t ledstrip_rainbow_freq;
|
||||||
|
uint16_t extra_ledstrip_blinkmask;
|
||||||
|
uint8_t extra_ledstrip_color;
|
||||||
|
uint8_t extra_ledstrip_color2;
|
||||||
|
uint8_t extra_ledstrip_color2_brightness;
|
||||||
} ledStripConfig_t;
|
} ledStripConfig_t;
|
||||||
|
|
||||||
PG_DECLARE(ledStripConfig_t, ledStripConfig);
|
PG_DECLARE(ledStripConfig_t, ledStripConfig);
|
||||||
|
|
|
@ -102,6 +102,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT] = {
|
||||||
{ .boxId = BOXBEEPERMUTE, .boxName = "BEEPER MUTE", .permanentId = 52},
|
{ .boxId = BOXBEEPERMUTE, .boxName = "BEEPER MUTE", .permanentId = 52},
|
||||||
{ .boxId = BOXREADY, .boxName = "READY", .permanentId = 53},
|
{ .boxId = BOXREADY, .boxName = "READY", .permanentId = 53},
|
||||||
{ .boxId = BOXLAPTIMERRESET, .boxName = "LAP TIMER RESET", .permanentId = 54},
|
{ .boxId = BOXLAPTIMERRESET, .boxName = "LAP TIMER RESET", .permanentId = 54},
|
||||||
|
{ .boxId = BOXLEDNOBLINK, .boxName = "LED NO BLINK", .permanentId = 101},
|
||||||
};
|
};
|
||||||
|
|
||||||
// mask of enabled IDs, calculated on startup based on enabled features. boxId_e is used as bit index
|
// mask of enabled IDs, calculated on startup based on enabled features. boxId_e is used as bit index
|
||||||
|
@ -338,6 +339,7 @@ void initActiveBoxIds(void)
|
||||||
|
|
||||||
BME(BOXSTICKCOMMANDDISABLE);
|
BME(BOXSTICKCOMMANDDISABLE);
|
||||||
BME(BOXREADY);
|
BME(BOXREADY);
|
||||||
|
BME(BOXLEDNOBLINK);
|
||||||
|
|
||||||
#if defined(USE_GPS_LAP_TIMER)
|
#if defined(USE_GPS_LAP_TIMER)
|
||||||
BME(BOXLAPTIMERRESET);
|
BME(BOXLAPTIMERRESET);
|
||||||
|
|
|
@ -100,6 +100,8 @@
|
||||||
#include "sensors/battery.h"
|
#include "sensors/battery.h"
|
||||||
#include "sensors/sensors.h"
|
#include "sensors/sensors.h"
|
||||||
|
|
||||||
|
#include "common/spec.h"
|
||||||
|
|
||||||
#ifdef USE_HARDWARE_REVISION_DETECTION
|
#ifdef USE_HARDWARE_REVISION_DETECTION
|
||||||
#include "hardware_revision.h"
|
#include "hardware_revision.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -403,7 +405,7 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
||||||
|
|
||||||
osdConfig->stat_show_cell_value = false;
|
osdConfig->stat_show_cell_value = false;
|
||||||
osdConfig->framerate_hz = OSD_FRAMERATE_DEFAULT_HZ;
|
osdConfig->framerate_hz = OSD_FRAMERATE_DEFAULT_HZ;
|
||||||
osdConfig->cms_background_type = DISPLAY_BACKGROUND_TRANSPARENT;
|
osdConfig->cms_background_type = DISPLAY_BACKGROUND_BLACK;
|
||||||
#ifdef USE_CRAFTNAME_MSGS
|
#ifdef USE_CRAFTNAME_MSGS
|
||||||
osdConfig->osd_craftname_msgs = false; // Insert LQ/RSSI-dBm and warnings into CraftName
|
osdConfig->osd_craftname_msgs = false; // Insert LQ/RSSI-dBm and warnings into CraftName
|
||||||
#endif //USE_CRAFTNAME_MSGS
|
#endif //USE_CRAFTNAME_MSGS
|
||||||
|
@ -494,7 +496,11 @@ static void osdCompleteInitialization(void)
|
||||||
|
|
||||||
char string_buffer[30];
|
char string_buffer[30];
|
||||||
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
|
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
|
||||||
displayWrite(osdDisplayPort, midCol + 5, midRow, DISPLAYPORT_SEVERITY_NORMAL, string_buffer);
|
displayWrite(osdDisplayPort, midCol - 5, midRow, DISPLAYPORT_SEVERITY_NORMAL, string_buffer);
|
||||||
|
SpecType specType = getCurrentSpec();
|
||||||
|
if (specType != SPEC_COUNT) {
|
||||||
|
displayWrite(osdDisplayPort, midCol - 5, midRow + 1, DISPLAYPORT_SEVERITY_NORMAL, specArray[specType].name);
|
||||||
|
}
|
||||||
#ifdef USE_CMS
|
#ifdef USE_CMS
|
||||||
displayWrite(osdDisplayPort, midCol - 8, midRow + 2, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT1);
|
displayWrite(osdDisplayPort, midCol - 8, midRow + 2, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT1);
|
||||||
displayWrite(osdDisplayPort, midCol - 4, midRow + 3, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT2);
|
displayWrite(osdDisplayPort, midCol - 4, midRow + 3, DISPLAYPORT_SEVERITY_NORMAL, CMS_STARTUP_HELP_TEXT2);
|
||||||
|
@ -1198,7 +1204,7 @@ static timeDelta_t osdShowArmed(void)
|
||||||
} else {
|
} else {
|
||||||
ret = (REFRESH_1S / 2);
|
ret = (REFRESH_1S / 2);
|
||||||
}
|
}
|
||||||
displayWrite(osdDisplayPort, midCol - (strlen("ARMED") / 2), midRow, DISPLAYPORT_SEVERITY_NORMAL, "ARMED");
|
displayWrite(osdDisplayPort, midCol - (strlen(pilotConfig()->extraArmedWarning) / 2), midRow, DISPLAYPORT_SEVERITY_NORMAL, pilotConfig()->extraArmedWarning);
|
||||||
|
|
||||||
if (isFlipOverAfterCrashActive()) {
|
if (isFlipOverAfterCrashActive()) {
|
||||||
displayWrite(osdDisplayPort, midCol - (strlen(CRASH_FLIP_WARNING) / 2), midRow + 1, DISPLAYPORT_SEVERITY_NORMAL, CRASH_FLIP_WARNING);
|
displayWrite(osdDisplayPort, midCol - (strlen(CRASH_FLIP_WARNING) / 2), midRow + 1, DISPLAYPORT_SEVERITY_NORMAL, CRASH_FLIP_WARNING);
|
||||||
|
|
|
@ -189,6 +189,7 @@ typedef enum {
|
||||||
OSD_GPS_LAP_TIME_CURRENT,
|
OSD_GPS_LAP_TIME_CURRENT,
|
||||||
OSD_GPS_LAP_TIME_PREVIOUS,
|
OSD_GPS_LAP_TIME_PREVIOUS,
|
||||||
OSD_GPS_LAP_TIME_BEST3,
|
OSD_GPS_LAP_TIME_BEST3,
|
||||||
|
OSD_SPEC_LOGO,
|
||||||
OSD_ITEM_COUNT // MUST BE LAST
|
OSD_ITEM_COUNT // MUST BE LAST
|
||||||
} osd_items_e;
|
} osd_items_e;
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
#include "common/unit.h"
|
#include "common/unit.h"
|
||||||
#include "common/filter.h"
|
#include "common/filter.h"
|
||||||
|
#include "common/spec.h"
|
||||||
|
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
#include "config/feature.h"
|
#include "config/feature.h"
|
||||||
|
@ -853,7 +854,7 @@ static void osdBackgroundCameraFrame(osdElementParms_t *element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toUpperCase(char* dest, const char* src, unsigned int maxSrcLength)
|
void toUpperCase(char* dest, const char* src, unsigned int maxSrcLength)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < maxSrcLength && src[i]; i++) {
|
for (i = 0; i < maxSrcLength && src[i]; i++) {
|
||||||
|
@ -1642,7 +1643,15 @@ static void osdElementStickOverlay(osdElementParms_t *element)
|
||||||
|
|
||||||
static void osdElementThrottlePosition(osdElementParms_t *element)
|
static void osdElementThrottlePosition(osdElementParms_t *element)
|
||||||
{
|
{
|
||||||
tfp_sprintf(element->buff, "%c%3d", SYM_THR, calculateThrottlePercent());
|
const uint8_t throttleValue = calculateThrottlePercent();
|
||||||
|
if (strlen(pilotConfig()->extra100Throttle) == 0 || throttleValue < 100)
|
||||||
|
{
|
||||||
|
tfp_sprintf(element->buff, "%c%3d", SYM_THR, calculateThrottlePercent());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tfp_sprintf(element->buff, pilotConfig()->extra100Throttle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void osdElementTimer(osdElementParms_t *element)
|
static void osdElementTimer(osdElementParms_t *element)
|
||||||
|
@ -1712,6 +1721,41 @@ static void osdElementAuxValue(osdElementParms_t *element)
|
||||||
tfp_sprintf(element->buff, "%c%d", osdConfig()->aux_symbol, osdAuxValue);
|
tfp_sprintf(element->buff, "%c%d", osdConfig()->aux_symbol, osdAuxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void osdElementSpecLogo(osdElementParms_t *element)
|
||||||
|
{
|
||||||
|
static int state = -1; // for rendering logo line by line
|
||||||
|
static int animationState = 0; // for rendering different logo states
|
||||||
|
static timeMs_t lastLogoAnimationUpdateMs = 0;
|
||||||
|
static SpecType specType = SPEC_COUNT;
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case -1:
|
||||||
|
specType = getCurrentSpec();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (specType != SPEC_COUNT) {
|
||||||
|
osdDisplayWrite(element, element->elemPosX, element->elemPosY + state, DISPLAYPORT_SEVERITY_NORMAL, specArray[specType].logo[animationState][state]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
state ++;
|
||||||
|
|
||||||
|
if (state >= LOGO_HEIGHT) { // rendered the whole logo
|
||||||
|
if (millis() - lastLogoAnimationUpdateMs > 1000) // update logo animation ever second
|
||||||
|
{
|
||||||
|
lastLogoAnimationUpdateMs = millis();
|
||||||
|
animationState = (animationState + 1) % LOGO_GROUPS; // increment animation state and make sure its < LOGO_GROUPS
|
||||||
|
}
|
||||||
|
|
||||||
|
state = -1;
|
||||||
|
} else {
|
||||||
|
element->rendered = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
element->drawElement = false; // element already drawn
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void osdElementWarnings(osdElementParms_t *element)
|
static void osdElementWarnings(osdElementParms_t *element)
|
||||||
{
|
{
|
||||||
bool elementBlinking = false;
|
bool elementBlinking = false;
|
||||||
|
@ -1864,6 +1908,7 @@ static const uint8_t osdElementDisplayOrder[] = {
|
||||||
OSD_SYS_VTX_TEMP,
|
OSD_SYS_VTX_TEMP,
|
||||||
OSD_SYS_FAN_SPEED,
|
OSD_SYS_FAN_SPEED,
|
||||||
#endif
|
#endif
|
||||||
|
OSD_SPEC_LOGO,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define the mapping between the OSD element id and the function to draw it
|
// Define the mapping between the OSD element id and the function to draw it
|
||||||
|
@ -2003,6 +2048,7 @@ const osdElementDrawFn osdElementDrawFunction[OSD_ITEM_COUNT] = {
|
||||||
[OSD_SYS_VTX_TEMP] = osdElementSys,
|
[OSD_SYS_VTX_TEMP] = osdElementSys,
|
||||||
[OSD_SYS_FAN_SPEED] = osdElementSys,
|
[OSD_SYS_FAN_SPEED] = osdElementSys,
|
||||||
#endif
|
#endif
|
||||||
|
[OSD_SPEC_LOGO] = osdElementSpecLogo,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define the mapping between the OSD element id and the function to draw its background (static part)
|
// Define the mapping between the OSD element id and the function to draw its background (static part)
|
||||||
|
@ -2242,9 +2288,10 @@ bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_SPEC_PREARM_SCREEN
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
|
||||||
|
bool osdDrawSpecReal(displayPort_t *osdDisplayPort)
|
||||||
{
|
{
|
||||||
static enum {RPM, POLES, MIXER, THR, MOTOR, BAT, VER} specState = RPM;
|
static enum {RPM, POLES, MIXER, THR, MOTOR, BAT, VER, SPEC_NAME} specState = RPM;
|
||||||
static int currentRow;
|
static int currentRow;
|
||||||
|
|
||||||
const uint8_t midRow = osdDisplayPort->rows / 2;
|
const uint8_t midRow = osdDisplayPort->rows / 2;
|
||||||
|
@ -2322,13 +2369,72 @@ bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
len = strlen(FC_VERSION_STRING);
|
len = strlen(FC_VERSION_STRING);
|
||||||
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, FC_VERSION_STRING);
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, FC_VERSION_STRING);
|
||||||
|
|
||||||
|
specState = SPEC_NAME;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SPEC_NAME: {
|
||||||
|
SpecType specType = getCurrentSpec();
|
||||||
|
|
||||||
|
if (specType != SPEC_COUNT) {
|
||||||
|
len = strlen(specArray[specType].name);
|
||||||
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, specArray[specType].name);
|
||||||
|
}
|
||||||
|
|
||||||
specState = RPM;
|
specState = RPM;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool osdDrawPrearmStrings(displayPort_t *osdDisplayPort)
|
||||||
|
{
|
||||||
|
const uint8_t midRow = osdDisplayPort->rows / 2;
|
||||||
|
const uint8_t midCol = osdDisplayPort->cols / 2;
|
||||||
|
|
||||||
|
char buff[OSD_ELEMENT_BUFFER_LENGTH] = "";
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
|
static int currentRow;
|
||||||
|
static int state = 0;
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
default:
|
||||||
|
case 0:
|
||||||
|
state++;
|
||||||
|
currentRow = midRow - 2;
|
||||||
|
len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm1);
|
||||||
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
state++;
|
||||||
|
len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm2);
|
||||||
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
state = 0;
|
||||||
|
len = tfp_sprintf(buff, "%s", pilotConfig()->extraPrearm3);
|
||||||
|
displayWrite(osdDisplayPort, midCol - (len / 2), currentRow++, DISPLAYPORT_SEVERITY_NORMAL, buff);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool osdDrawSpec(displayPort_t *osdDisplayPort)
|
||||||
|
{
|
||||||
|
const uint8_t throttleValue = calculateThrottlePercent();
|
||||||
|
if (throttleValue > 80) {
|
||||||
|
return osdDrawPrearmStrings(osdDisplayPort);
|
||||||
|
} else {
|
||||||
|
return osdDrawSpecReal(osdDisplayPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_SPEC_PREARM_SCREEN
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
|
||||||
void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)
|
void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort)
|
||||||
|
|
|
@ -72,3 +72,4 @@ bool osdElementsNeedAccelerometer(void);
|
||||||
#ifdef USE_SPEC_PREARM_SCREEN
|
#ifdef USE_SPEC_PREARM_SCREEN
|
||||||
bool osdDrawSpec(displayPort_t *osdDisplayPort);
|
bool osdDrawSpec(displayPort_t *osdDisplayPort);
|
||||||
#endif // USE_SPEC_PREARM_SCREEN
|
#endif // USE_SPEC_PREARM_SCREEN
|
||||||
|
void toUpperCase(char* dest, const char* src, unsigned int maxSrcLength);
|
||||||
|
|
|
@ -137,7 +137,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
// Warn when in flip over after crash mode
|
// Warn when in flip over after crash mode
|
||||||
if (osdWarnGetState(OSD_WARNING_CRASH_FLIP) && IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) {
|
if (osdWarnGetState(OSD_WARNING_CRASH_FLIP) && IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) {
|
||||||
if (isFlipOverAfterCrashActive()) { // if was armed in crash flip mode
|
if (isFlipOverAfterCrashActive()) { // if was armed in crash flip mode
|
||||||
tfp_sprintf(warningText, CRASH_FLIP_WARNING);
|
tfp_sprintf(warningText, pilotConfig()->extraTurtleModeWarning);
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_INFO;
|
*displayAttr = DISPLAYPORT_SEVERITY_INFO;
|
||||||
return;
|
return;
|
||||||
} else if (!ARMING_FLAG(ARMED)) { // if disarmed, but crash flip mode is activated
|
} else if (!ARMING_FLAG(ARMED)) { // if disarmed, but crash flip mode is activated
|
||||||
|
@ -207,7 +207,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
#endif // USE_RX_LINK_QUALITY_INFO
|
#endif // USE_RX_LINK_QUALITY_INFO
|
||||||
|
|
||||||
if (osdWarnGetState(OSD_WARNING_BATTERY_CRITICAL) && batteryState == BATTERY_CRITICAL) {
|
if (osdWarnGetState(OSD_WARNING_BATTERY_CRITICAL) && batteryState == BATTERY_CRITICAL) {
|
||||||
tfp_sprintf(warningText, " LAND NOW");
|
tfp_sprintf(warningText, pilotConfig()->extraLandNowWarning);
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
*displayAttr = DISPLAYPORT_SEVERITY_CRITICAL;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
|
@ -259,7 +259,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
#ifdef USE_ADC_INTERNAL
|
#ifdef USE_ADC_INTERNAL
|
||||||
const int16_t coreTemperature = getCoreTemperatureCelsius();
|
const int16_t coreTemperature = getCoreTemperatureCelsius();
|
||||||
if (osdWarnGetState(OSD_WARNING_CORE_TEMPERATURE) && coreTemperature >= osdConfig()->core_temp_alarm) {
|
if (osdWarnGetState(OSD_WARNING_CORE_TEMPERATURE) && coreTemperature >= osdConfig()->core_temp_alarm) {
|
||||||
tfp_sprintf(warningText, "CORE %c: %3d%c", SYM_TEMPERATURE, osdConvertTemperatureToSelectedUnit(coreTemperature), osdGetTemperatureSymbolForSelectedUnit());
|
tfp_sprintf(warningText, "%s %c: %3d%c", pilotConfig()->extraFcHotWarning, SYM_TEMPERATURE, osdConvertTemperatureToSelectedUnit(coreTemperature), osdGetTemperatureSymbolForSelectedUnit());
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
|
@ -377,7 +377,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (osdWarnGetState(OSD_WARNING_BATTERY_WARNING) && batteryState == BATTERY_WARNING) {
|
if (osdWarnGetState(OSD_WARNING_BATTERY_WARNING) && batteryState == BATTERY_WARNING) {
|
||||||
tfp_sprintf(warningText, "LOW BATTERY");
|
tfp_sprintf(warningText, pilotConfig()->extraLowBatteryWarning);
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
*displayAttr = DISPLAYPORT_SEVERITY_WARNING;
|
||||||
*blinking = true;
|
*blinking = true;
|
||||||
return;
|
return;
|
||||||
|
@ -419,7 +419,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visual beeper
|
// Visual beeper
|
||||||
if (osdWarnGetState(OSD_WARNING_VISUAL_BEEPER) && osdGetVisualBeeperState()) {
|
if (osdWarnGetState(OSD_WARNING_VISUAL_BEEPER) && osdGetVisualBeeperState() && !ARMING_FLAG(ARMED)) {
|
||||||
tfp_sprintf(warningText, " * * * *");
|
tfp_sprintf(warningText, " * * * *");
|
||||||
*displayAttr = DISPLAYPORT_SEVERITY_INFO;
|
*displayAttr = DISPLAYPORT_SEVERITY_INFO;
|
||||||
osdSetVisualBeeperState(false);
|
osdSetVisualBeeperState(false);
|
||||||
|
|
|
@ -53,6 +53,14 @@
|
||||||
#define USE_DSHOT
|
#define USE_DSHOT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(USE_RACE_PRO)
|
||||||
|
#define USE_RACE_PRO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined USE_LED_STRIP
|
||||||
|
#define USE_LED_STRIP
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_DSHOT
|
#ifdef USE_DSHOT
|
||||||
#define USE_DSHOT_BITBANG
|
#define USE_DSHOT_BITBANG
|
||||||
#define USE_DSHOT_TELEMETRY
|
#define USE_DSHOT_TELEMETRY
|
||||||
|
|
|
@ -137,7 +137,7 @@ void doTestArm(bool testEmpty = true)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// arming alert displayed
|
// arming alert displayed
|
||||||
displayPortTestBufferSubstring(13, 8, "ARMED");
|
displayPortTestBufferSubstring(13, 8, "%s", pilotConfig()->extraArmedWarning);
|
||||||
|
|
||||||
// given
|
// given
|
||||||
// armed alert times out (0.5 seconds)
|
// armed alert times out (0.5 seconds)
|
||||||
|
|
|
@ -168,7 +168,7 @@ void doTestArm(bool testEmpty = true)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// arming alert displayed
|
// arming alert displayed
|
||||||
displayPortTestBufferSubstring(13, 8, "ARMED");
|
displayPortTestBufferSubstring(13, 8, "%s", pilotConfig()->extraArmedWarning);
|
||||||
|
|
||||||
// given
|
// given
|
||||||
// armed alert times out (0.5 seconds)
|
// armed alert times out (0.5 seconds)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue