Merge with latest 2.3
@@ -381,9 +381,12 @@ endif()
|
||||
|
||||
add_definitions(-DPOPUP_LEVEL=${POPUP_LEVEL})
|
||||
|
||||
if(BOOTLOADER)
|
||||
add_definitions(-DBOOTLOADER)
|
||||
endif(BOOTLOADER)
|
||||
if(INTERNAL_MODULE_MULTI)
|
||||
set(DEFAULT_TEMPLATE_SETUP 21 CACHE STRING "")
|
||||
else()
|
||||
set(DEFAULT_TEMPLATE_SETUP 0 CACHE STRING "")
|
||||
endif()
|
||||
add_definitions(-DDEFAULT_TEMPLATE_SETUP=${DEFAULT_TEMPLATE_SETUP})
|
||||
|
||||
set(SRC
|
||||
${SRC}
|
||||
@@ -444,7 +447,6 @@ endif()
|
||||
|
||||
set(SRC ${SRC} ${FIRMWARE_SRC})
|
||||
|
||||
|
||||
##### firmware target #####
|
||||
|
||||
option(FIRMWARE_TARGET "Configure Firmware target (can be turned of for compiling Companion only)" ON)
|
||||
|
||||
|
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 553 B |
@@ -315,7 +315,7 @@ void Bluetooth::wakeup(void)
|
||||
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
|
||||
if (len > 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
*cur++ = char2lower(zchar2char(g_eeGeneral.bluetoothName[i]));
|
||||
*cur++ = char2lower(g_eeGeneral.bluetoothName[i]);
|
||||
}
|
||||
*cur = '\0';
|
||||
}
|
||||
@@ -418,7 +418,7 @@ void Bluetooth::wakeup()
|
||||
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
|
||||
if (len > 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
*cur++ = char2lower(zchar2char(g_eeGeneral.bluetoothName[i]));
|
||||
*cur++ = char2lower(g_eeGeneral.bluetoothName[i]);
|
||||
}
|
||||
*cur = '\0';
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#define _BUZZER_H_
|
||||
|
||||
#if defined(BUZZER)
|
||||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t beepAgain;
|
||||
extern uint8_t beepAgainOrig;
|
||||
extern uint8_t beepOn;
|
||||
extern bool warble;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
uint8_t s_curveChan;
|
||||
int8_t * curveEnd[MAX_CURVES];
|
||||
|
||||
void loadCurves()
|
||||
@@ -120,7 +119,7 @@ bool isCurveUsed(uint8_t index)
|
||||
}
|
||||
|
||||
#define CUSTOM_POINT_X(points, count, idx) ((idx)==0 ? -100 : (((idx)==(count)-1) ? 100 : points[(count)+(idx)-1]))
|
||||
int32_t compute_tangent(CurveHeader * crv, int8_t * points, int i)
|
||||
int32_t compute_tangent(CurveHeader * crv, const int8_t * points, int i)
|
||||
{
|
||||
int32_t m=0;
|
||||
uint8_t num_points = crv->points + 5;
|
||||
@@ -240,7 +239,7 @@ int intpol(int x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 100
|
||||
int8_t * points = curveAddress(idx);
|
||||
uint8_t count = crv.points+5;
|
||||
bool custom = (crv.type == CURVE_TYPE_CUSTOM);
|
||||
int16_t erg = 0;
|
||||
int16_t erg;
|
||||
|
||||
x += RESXu;
|
||||
|
||||
@@ -339,11 +338,6 @@ int applyCustomCurve(int x, uint8_t idx)
|
||||
return intpol(x, idx);
|
||||
}
|
||||
|
||||
point_t getPoint(uint8_t index)
|
||||
{
|
||||
return getPoint(s_curveChan, index);
|
||||
}
|
||||
|
||||
point_t getPoint(uint8_t curveIndex, uint8_t index)
|
||||
{
|
||||
point_t result = {0, 0};
|
||||
@@ -363,7 +357,14 @@ point_t getPoint(uint8_t curveIndex, uint8_t index)
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
point_t getPoint(uint8_t index)
|
||||
{
|
||||
return getPoint(s_currIdxSubMenu, index);
|
||||
}
|
||||
|
||||
int applyCurrentCurve(int x)
|
||||
{
|
||||
return applyCustomCurve(x, s_curveChan);
|
||||
return applyCustomCurve(x, s_currIdxSubMenu);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -208,6 +208,16 @@ enum TrainerMode {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(RADIO_FAMILY_T16) || (defined(RADIO_T12) && defined(INTERNAL_MODULE_MULTI)) || defined(ALLOW_TRAINER_MULTI)
|
||||
#define TRAINER_MODE_MAX() TRAINER_MODE_MULTI
|
||||
#elif defined(BLUETOOTH)
|
||||
#define TRAINER_MODE_MAX() TRAINER_MODE_SLAVE_BLUETOOTH
|
||||
#elif defined(PCBX7) || defined(PCBXLITE)
|
||||
#define TRAINER_MODE_MAX() TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
|
||||
#else
|
||||
#define TRAINER_MODE_MAX() HAS_WIRELESS_TRAINER_HARDWARE() ? TRAINER_MODE_MASTER_BATTERY_COMPARTMENT : TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
#define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
#else
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "dataconstants.h"
|
||||
#include "definitions.h"
|
||||
#include "opentx_types.h"
|
||||
#include "globals.h"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define N_TARANIS_FIELD(x)
|
||||
@@ -331,10 +332,10 @@ PACK(struct TelemetrySensor {
|
||||
NOBACKUP(uint16_t persistentValue);
|
||||
} NAME(id1) FUNC(select_id1);
|
||||
union {
|
||||
PACK(struct {
|
||||
NOBACKUP(PACK(struct {
|
||||
uint8_t physID:5;
|
||||
uint8_t rxIndex:3; // 1 bit for module index, 2 bits for receiver index
|
||||
}) frskyInstance;
|
||||
}) frskyInstance);
|
||||
uint8_t instance;
|
||||
NOBACKUP(uint8_t formula);
|
||||
} NAME(id2) FUNC(select_id2);
|
||||
@@ -513,8 +514,6 @@ PACK(struct ModuleData {
|
||||
* Model structure
|
||||
*/
|
||||
|
||||
typedef uint16_t BeepANACenter;
|
||||
|
||||
#if LEN_BITMAP_NAME > 0
|
||||
#define MODEL_HEADER_BITMAP_FIELD NOBACKUP(char bitmap[LEN_BITMAP_NAME]);
|
||||
#else
|
||||
@@ -697,7 +696,8 @@ PACK(struct TrainerData {
|
||||
|
||||
#if defined(PCBHORUS) || defined(PCBNV14)
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
NOBACKUP(uint8_t auxSerialMode); \
|
||||
NOBACKUP(uint8_t auxSerialMode:4); \
|
||||
NOBACKUP(uint8_t aux2SerialMode:4); \
|
||||
swconfig_t switchConfig ARRAY(2,struct_switchConfig,nullptr); \
|
||||
uint16_t potsConfig ARRAY(2,struct_potConfig,nullptr); /* two bits per pot */ \
|
||||
uint8_t slidersConfig ARRAY(1,struct_sliderConfig,nullptr); /* 1 bit per slider */ \
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
extern volatile uint32_t g_tmr10ms;
|
||||
|
||||
uint8_t auxSerialTracesEnabled();
|
||||
uint8_t aux2SerialTracesEnabled();
|
||||
|
||||
#if defined(SIMU)
|
||||
typedef void (*traceCallbackFunc)(const char * text);
|
||||
|
||||
@@ -19,10 +19,10 @@ add_truetype_font_target(9 9 ${subset} none)
|
||||
add_truetype_font_target(13 13 ${subset} none)
|
||||
add_truetype_font_target(15 15 ${subset} none)
|
||||
add_truetype_font_target(16 16 ${subset} none)
|
||||
add_truetype_font_target(16en 16 en none)
|
||||
add_truetype_font_target(16en 16 en none)
|
||||
add_truetype_font_target(bold16 16 ${subset} bold)
|
||||
add_truetype_font_target(17 17 ${subset} none)
|
||||
add_truetype_font_target(17en 17 en none)
|
||||
add_truetype_font_target(17en 17 en none)
|
||||
add_truetype_font_target(bold17 17 ${subset} bold)
|
||||
add_truetype_font_target(24 24 ${subset} none)
|
||||
add_truetype_font_target(32 32 ${subset} bold)
|
||||
|
||||
|
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 355 B |
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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.
|
||||
*/
|
||||
|
||||
#ifndef _GLOBALS_H_
|
||||
#define _GLOBALS_H_
|
||||
|
||||
#include "definitions.h"
|
||||
#include "dataconstants.h"
|
||||
|
||||
PACK(struct GlobalData {
|
||||
uint8_t unexpectedShutdown:1;
|
||||
uint8_t externalAntennaEnabled:1;
|
||||
uint8_t authenticationCount:2;
|
||||
uint8_t upgradeModulePopup:1;
|
||||
uint8_t internalModuleVersionChecked:1;
|
||||
uint8_t spare:2;
|
||||
});
|
||||
|
||||
extern GlobalData globalData;
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
extern uint16_t s_timeCumThr;
|
||||
extern uint16_t s_timeCum16ThrP;
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
||||
#endif
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
extern uint8_t trimsDisplayTimer;
|
||||
extern uint8_t trimsDisplayMask;
|
||||
extern uint16_t maxMixerDuration;
|
||||
|
||||
extern uint8_t requiredSpeakerVolume;
|
||||
|
||||
enum MainRequest {
|
||||
REQUEST_SCREENSHOT,
|
||||
REQUEST_FLIGHT_RESET,
|
||||
};
|
||||
|
||||
extern uint8_t mainRequestFlags;
|
||||
|
||||
#define DELAY_POS_MARGIN 3
|
||||
typedef int16_t delayval_t;
|
||||
PACK(struct SwOn {
|
||||
uint16_t delay:14; // max = 2550
|
||||
uint8_t activeMix:1;
|
||||
uint8_t activeExpo:1;
|
||||
int16_t now; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
int16_t prev;
|
||||
});
|
||||
|
||||
extern SwOn swOn[MAX_MIXERS];
|
||||
extern int32_t act[MAX_MIXERS];
|
||||
|
||||
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
||||
// It's also easier to initialize them here.
|
||||
extern int8_t virtualInputsTrims[MAX_INPUTS];
|
||||
|
||||
extern int16_t anas [MAX_INPUTS];
|
||||
extern int16_t trims[NUM_TRIMS];
|
||||
extern int32_t chans[MAX_OUTPUT_CHANNELS];
|
||||
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
|
||||
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
||||
|
||||
typedef uint16_t BeepANACenter;
|
||||
extern BeepANACenter bpanaCenter;
|
||||
|
||||
extern uint8_t s_mixer_first_run_done;
|
||||
|
||||
extern int16_t calibratedAnalogs[NUM_CALIBRATED_ANALOGS];
|
||||
|
||||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t beepAgain;
|
||||
extern uint16_t lightOffCounter;
|
||||
extern uint8_t flashCounter;
|
||||
extern uint8_t mixWarning;
|
||||
|
||||
#endif
|
||||
@@ -40,6 +40,7 @@
|
||||
#define drawFieldLabel(x, y, str) lcdDrawTextAlignedLeft(y, str)
|
||||
|
||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||
#define TEXT_VIEWER_LINES NUM_BODY_LINES
|
||||
#define MENU_HEADER_HEIGHT FH
|
||||
|
||||
#define CURVE_SIDE_WIDTH (LCD_H/2)
|
||||
@@ -213,7 +214,7 @@ extern uint8_t s_copyMode;
|
||||
extern int8_t s_copySrcRow;
|
||||
extern int8_t s_copyTgtOfs;
|
||||
extern uint8_t s_currIdx;
|
||||
extern uint8_t s_curveChan;
|
||||
extern uint8_t s_currIdxSubMenu;
|
||||
extern uint8_t s_copySrcIdx;
|
||||
extern uint8_t s_copySrcCh;
|
||||
extern int8_t s_currCh;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include "opentx.h"
|
||||
#include "gui/common/stdlcd/fonts.h"
|
||||
|
||||
@@ -213,7 +214,7 @@ uint8_t getCharWidth(char c, LcdFlags flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
|
||||
{
|
||||
const unsigned char * q;
|
||||
|
||||
@@ -281,7 +282,7 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c)
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c)
|
||||
{
|
||||
lcdDrawChar(x, y, c, 0);
|
||||
}
|
||||
@@ -441,12 +442,12 @@ void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val)
|
||||
lcdDrawNumber(x, y, val);
|
||||
}
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags flags)
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags)
|
||||
{
|
||||
lcdDrawNumber(x, y, val, flags, 0);
|
||||
}
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags flags, uint8_t len)
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
char str[16+1];
|
||||
char *s = str+16;
|
||||
@@ -454,7 +455,19 @@ void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags flags, uint8_t len)
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
|
||||
if (val == INT_MAX) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MAX", flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val < 0) {
|
||||
if (val == INT_MIN) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MIN", flags);
|
||||
return;
|
||||
}
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ extern coord_t lcdNextPos;
|
||||
extern volatile uint32_t lcdInputs ;
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags);
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags);
|
||||
void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags flags = 0);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags flags);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s, uint8_t idx, LcdFlags flags);
|
||||
@@ -112,8 +112,8 @@ void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att);
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags=0);
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int val, LcdFlags mode=0);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode=0);
|
||||
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val);
|
||||
|
||||
void drawModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att);
|
||||
|
||||
@@ -45,3 +45,4 @@ void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8
|
||||
}
|
||||
|
||||
uint8_t s_currIdx;
|
||||
uint8_t s_currIdxSubMenu;
|
||||
|
||||
@@ -50,8 +50,8 @@ void runPopupCurvePreset(event_t event)
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
int k = 25 * reusableBuffer.curveEdit.preset;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
@@ -71,14 +71,14 @@ void onCurveOneMenu(const char * result)
|
||||
POPUP_INPUT(STR_PRESET, runPopupCurvePreset);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = -points[i];
|
||||
}
|
||||
else if (result == STR_CLEAR) {
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = 0;
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
@@ -89,10 +89,10 @@ void onCurveOneMenu(const char * result)
|
||||
|
||||
void menuModelCurveOne(event_t event)
|
||||
{
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
|
||||
drawStringWithIndex(PSIZE(TR_MENUCURVES)*FW+FW, 0, STR_CV, s_curveChan+1);
|
||||
drawStringWithIndex(PSIZE(TR_MENUCURVES)*FW+FW, 0, STR_CV, s_currIdxSubMenu+1);
|
||||
|
||||
SIMPLE_SUBMENU(STR_MENUCURVES, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0));
|
||||
|
||||
@@ -108,9 +108,9 @@ void menuModelCurveOne(event_t event)
|
||||
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
||||
if (newType != crv.type) {
|
||||
for (int i = 1; i < 4 + crv.points; i++) {
|
||||
points[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + crv.points, i)), s_curveChan));
|
||||
points[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + crv.points, i)), s_currIdxSubMenu));
|
||||
}
|
||||
if (moveCurve(s_curveChan, checkIncDec_Ret > 0 ? 3 + crv.points : -3 - crv.points)) {
|
||||
if (moveCurve(s_currIdxSubMenu, checkIncDec_Ret > 0 ? 3 + crv.points : -3 - crv.points)) {
|
||||
if (newType == CURVE_TYPE_CUSTOM) {
|
||||
resetCustomCurveX(points, 5 + crv.points);
|
||||
}
|
||||
@@ -131,8 +131,8 @@ void menuModelCurveOne(event_t event)
|
||||
newPoints[0] = points[0];
|
||||
newPoints[4 + count] = points[4 + crv.points];
|
||||
for (int i = 1; i < 4 + count; i++)
|
||||
newPoints[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + count, i)), s_curveChan));
|
||||
if (moveCurve(s_curveChan, checkIncDec_Ret * (crv.type == CURVE_TYPE_CUSTOM ? 2 : 1))) {
|
||||
newPoints[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + count, i)), s_currIdxSubMenu));
|
||||
if (moveCurve(s_currIdxSubMenu, checkIncDec_Ret * (crv.type == CURVE_TYPE_CUSTOM ? 2 : 1))) {
|
||||
for (int i = 0; i < 5 + count; i++) {
|
||||
points[i] = newPoints[i];
|
||||
if (crv.type == CURVE_TYPE_CUSTOM && i != 0 && i != 4 + count)
|
||||
|
||||
@@ -87,7 +87,8 @@ void menuModelFlightModeOne(event_t event)
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
#if defined(GVARS)
|
||||
if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH) sub += VERTICAL_SHIFT;
|
||||
if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH)
|
||||
sub += VERTICAL_SHIFT;
|
||||
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
@@ -147,7 +148,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
drawStringWithIndex(INDENT_WIDTH, y, STR_GV, idx+1, posHorz==0 ? attr : 0);
|
||||
lcdDrawSizedText(4*FW, y,g_model.gvars[idx].name, LEN_GVAR_NAME, ZCHAR);
|
||||
if (attr && editMode>0 && posHorz==0) {
|
||||
s_currIdx = sub - ITEM_MODEL_FLIGHT_MODE_GV1;
|
||||
s_currIdxSubMenu = sub - ITEM_MODEL_FLIGHT_MODE_GV1;
|
||||
editMode = 0;
|
||||
pushMenu(menuModelGVarOne);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ enum GVarFields {
|
||||
|
||||
void menuModelGVarOne(event_t event)
|
||||
{
|
||||
GVarData * gvar = &g_model.gvars[s_currIdx];
|
||||
GVarData * gvar = &g_model.gvars[s_currIdxSubMenu];
|
||||
|
||||
drawStringWithIndex(PSIZE(TR_GVARS)*FW+FW, 0, STR_GV, s_currIdx+1, 0);
|
||||
drawGVarValue(32*FW, 0, s_currIdx, getGVarValue(s_currIdx, getFlightMode()));
|
||||
drawStringWithIndex(PSIZE(TR_GVARS)*FW+FW, 0, STR_GV, s_currIdxSubMenu+1, 0);
|
||||
drawGVarValue(32*FW, 0, s_currIdxSubMenu, getGVarValue(s_currIdxSubMenu, getFlightMode()));
|
||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID);
|
||||
|
||||
SIMPLE_SUBMENU(STR_GVARS, GVAR_FIELD_LAST);
|
||||
@@ -92,13 +92,13 @@ void menuModelGVarOne(event_t event)
|
||||
|
||||
case GVAR_FIELD_MIN:
|
||||
lcdDrawText(0, y, STR_MIN);
|
||||
drawGVarValue(GVAR_2ND_COLUMN, y, s_currIdx, GVAR_MIN+gvar->min, LEFT|attr);
|
||||
drawGVarValue(GVAR_2ND_COLUMN, y, s_currIdxSubMenu, GVAR_MIN+gvar->min, LEFT|attr);
|
||||
if (attr) gvar->min = checkIncDec(event, GVAR_MIN+gvar->min, GVAR_MIN, GVAR_MAX-gvar->max, EE_MODEL) - GVAR_MIN;
|
||||
break;
|
||||
|
||||
case GVAR_FIELD_MAX:
|
||||
lcdDrawText(0, y, STR_MAX);
|
||||
drawGVarValue(GVAR_2ND_COLUMN, y, s_currIdx, GVAR_MAX-gvar->max, LEFT|attr);
|
||||
drawGVarValue(GVAR_2ND_COLUMN, y, s_currIdxSubMenu, GVAR_MAX-gvar->max, LEFT|attr);
|
||||
if (attr) gvar->max = GVAR_MAX - checkIncDec(event, GVAR_MAX-gvar->max, GVAR_MIN+gvar->min, GVAR_MAX, EE_MODEL);
|
||||
break;
|
||||
|
||||
@@ -108,7 +108,7 @@ void menuModelGVarOne(event_t event)
|
||||
|
||||
default:
|
||||
drawStringWithIndex(0, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdxSubMenu, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void menuModelExpoOne(event_t event)
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, ed->curveParam, CURVE_BASE+MAX_CURVES-1);
|
||||
if (ed->curveParam) ed->curveMode = MODE_CURVE;
|
||||
if (ed->curveParam>=CURVE_BASE && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
s_curveChan = ed->curveParam - CURVE_BASE;
|
||||
s_currIdxSubMenu = ed->curveParam - CURVE_BASE;
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,7 @@ void menuModelMixOne(event_t event)
|
||||
drawCurveName(COLUMN_X+MIXES_2ND_COLUMN, y, curveParam, attr);
|
||||
if (attr) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && (curveParam<0 || curveParam>=CURVE_BASE)){
|
||||
s_curveChan = (curveParam<0 ? -curveParam-1 : curveParam-CURVE_BASE);
|
||||
s_currIdxSubMenu = (curveParam<0 ? -curveParam-1 : curveParam-CURVE_BASE);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -150,7 +150,7 @@ void menuModelMixOne(event_t event)
|
||||
|
||||
case MIX_FIELD_CURVE:
|
||||
lcdDrawTextAlignedLeft(y, STR_CURVE);
|
||||
editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, event, attr);
|
||||
editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, s_editMode > 0 ? event : 0, attr);
|
||||
break;
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
|
||||
@@ -88,6 +88,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_LABEL,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_TYPE,
|
||||
#if defined(MULTIMODULE)
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_PROTOCOL,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_SUBTYPE,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_STATUS,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_SYNCSTATUS,
|
||||
@@ -116,6 +117,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_LABEL,
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_TYPE,
|
||||
#if defined(MULTIMODULE)
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_PROTOCOL,
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_SUBTYPE,
|
||||
#endif
|
||||
#if defined(MULTIMODULE)
|
||||
@@ -211,7 +213,7 @@ inline uint8_t MODULE_TYPE_ROWS(int moduleIdx)
|
||||
return 1;
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
@@ -309,19 +311,20 @@ void onBluetoothConnectMenu(const char * result)
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
#define INTERNAL_MODULE_ROWS \
|
||||
LABEL(InternalModule), \
|
||||
MODULE_TYPE_ROWS(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_TYPE*/ \
|
||||
MULTIMODULE_SUBTYPE_ROWS(INTERNAL_MODULE) /* ITEM_MODEL_SETUP_INTERNAL_MODULE_SUBTYPE*/ \
|
||||
MODULE_TYPE_ROWS(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_TYPE */ \
|
||||
MULTIMODULE_TYPE_ROWS(INTERNAL_MODULE) /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PROTOCOL */ \
|
||||
MULTIMODULE_SUBTYPE_ROWS(INTERNAL_MODULE) /* ITEM_MODEL_SETUP_INTERNAL_MODULE_SUBTYPE */ \
|
||||
MULTIMODULE_STATUS_ROWS(INTERNAL_MODULE) /* ITEM_MODEL_SETUP_INTERNAL_MODULE_STATUS, ITEM_MODEL_SETUP_INTERNAL_MODULE_SYNCSTATUS */ \
|
||||
MODULE_CHANNELS_ROWS(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_CHANNELS*/ \
|
||||
IF_NOT_ACCESS_MODULE_RF(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(IF_INTERNAL_MODULE_ON(isModuleRxNumAvailable(INTERNAL_MODULE) ? (uint8_t)2 : (uint8_t)1))), /* *ITEM_MODEL_SETUP_INTERNAL_MODULE_NOT_ACCESS_RXNUM_BIND_RANGE */\
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_MODEL_NUM*/ \
|
||||
MODULE_CHANNELS_ROWS(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_CHANNELS */ \
|
||||
IF_NOT_ACCESS_MODULE_RF(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(IF_INTERNAL_MODULE_ON(MODULE_BIND_ROWS(INTERNAL_MODULE)))), /* *ITEM_MODEL_SETUP_INTERNAL_MODULE_NOT_ACCESS_RXNUM_BIND_RANGE */\
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_MODEL_NUM */ \
|
||||
MODULE_OPTION_ROW(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_OPTIONS */ \
|
||||
MULTIMODULE_MODULE_ROWS(INTERNAL_MODULE) /* ITEM_MODEL_SETUP_INTERNAL_MODULE_AUTOBIND */ \
|
||||
EXTERNAL_ANTENNA_ROW /* ITEM_MODEL_SETUP_INTERNAL_MODULE_ANTENNA */ \
|
||||
MODULE_POWER_ROW(INTERNAL_MODULE), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_POWER */ \
|
||||
IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_FAILSAFE */ \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 1), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_REGISTER_RANGE */ \
|
||||
IF_PXX2_MODULE(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_OPTIONS*/ \
|
||||
IF_PXX2_MODULE(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_OPTIONS */ \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_1 */ \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_2 */ \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_3 */
|
||||
@@ -365,7 +368,8 @@ void menuModelSetup(event_t event)
|
||||
|
||||
LABEL(ExternalModule),
|
||||
MODULE_TYPE_ROWS(EXTERNAL_MODULE),
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
|
||||
MULTIMODULE_TYPE_ROWS(EXTERNAL_MODULE) // PROTOCOL
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE) // SUBTYPE
|
||||
MULTIMODULE_STATUS_ROWS(EXTERNAL_MODULE)
|
||||
MODULE_CHANNELS_ROWS(EXTERNAL_MODULE),
|
||||
IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, MODULE_BIND_ROWS(EXTERNAL_MODULE)), // line reused for PPM: PPM settings
|
||||
@@ -373,8 +377,8 @@ void menuModelSetup(event_t event)
|
||||
MODULE_POWER_ROW(EXTERNAL_MODULE),
|
||||
IF_NOT_PXX2_MODULE(EXTERNAL_MODULE, MODULE_OPTION_ROW(EXTERNAL_MODULE)),
|
||||
MULTIMODULE_MODULE_ROWS(EXTERNAL_MODULE)
|
||||
FAILSAFE_ROWS(EXTERNAL_MODULE),
|
||||
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 1), // Range check and Register buttons
|
||||
FAILSAFE_ROWS(EXTERNAL_MODULE), //ITEM_MODEL_SETUP_EXTERNAL_MODULE_FAILSAFE
|
||||
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 1), // Range check and Register buttons
|
||||
IF_PXX2_MODULE(EXTERNAL_MODULE, 0), // Module options
|
||||
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 1
|
||||
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 2
|
||||
@@ -908,12 +912,6 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_DSM_PROTOCOLS, g_model.moduleData[moduleIdx].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleR9MNonAccess(moduleIdx))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_R9M_REGION, g_model.moduleData[moduleIdx].subType, (menuHorizontalPosition==1 ? attr : 0));
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
int multi_rfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
lcdDrawMultiProtocolString(lcdNextPos + 3, y, moduleIdx, multi_rfProto, menuHorizontalPosition == 1 ? attr : 0);
|
||||
}
|
||||
#endif
|
||||
if (attr && menuHorizontalPosition == 0 && moduleIdx == EXTERNAL_MODULE) {
|
||||
if (s_editMode > 0) {
|
||||
g_model.moduleData[moduleIdx].type = MODULE_TYPE_NONE;
|
||||
@@ -962,18 +960,6 @@ void menuModelSetup(event_t event)
|
||||
g_model.moduleData[moduleIdx].channelsCount = defaultModuleChannels_M8(moduleIdx);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, multiRfProto, MODULE_SUBTYPE_MULTI_FIRST, MULTI_MAX_PROTOCOLS, isMultiProtocolSelectable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[moduleIdx].setMultiProtocol(multiRfProto);
|
||||
g_model.moduleData[moduleIdx].subType = 0;
|
||||
resetMultiProtocolsOptions(moduleIdx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].subType, 0, MODULE_SUBTYPE_PXX1_LAST);
|
||||
}
|
||||
@@ -1008,6 +994,45 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PROTOCOL:
|
||||
#endif
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PROTOCOL:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, TR_TYPE);
|
||||
int multi_rfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
lcdDrawMultiProtocolString(MODEL_SETUP_2ND_COLUMN, y, moduleIdx, multi_rfProto, attr);
|
||||
if (attr) {
|
||||
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
||||
if (status.isValid()) {
|
||||
int8_t direction = checkIncDec(event, 0, -1, 1);
|
||||
if (direction == -1) {
|
||||
if (multiRfProto == MODULE_SUBTYPE_MULTI_FRSKY)
|
||||
multiRfProto = MODULE_SUBTYPE_MULTI_FRSKYX_RX;
|
||||
else
|
||||
multiRfProto = convertMultiToOtx(status.protocolPrev);
|
||||
}
|
||||
if (direction == 1) {
|
||||
if (multiRfProto == MODULE_SUBTYPE_MULTI_FRSKY)
|
||||
multiRfProto = MODULE_SUBTYPE_MULTI_FRSKYX2;
|
||||
else
|
||||
multiRfProto = convertMultiToOtx(status.protocolNext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, multiRfProto, MODULE_SUBTYPE_MULTI_FIRST, MULTI_MAX_PROTOCOLS, isMultiProtocolSelectable);
|
||||
}
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[moduleIdx].setMultiProtocol(multiRfProto);
|
||||
g_model.moduleData[moduleIdx].subType = 0;
|
||||
resetMultiProtocolsOptions(moduleIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_SUBTYPE:
|
||||
#endif
|
||||
@@ -1324,7 +1349,8 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, l_posHorz==1 ? attr : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
|
||||
if (!IS_RX_MULTI(moduleIdx))
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
#if defined(MULTIMODULE)
|
||||
if (getMultiBindStatus(moduleIdx) == MULTI_BIND_FINISHED) {
|
||||
@@ -1584,7 +1610,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
module.multi.lowPowerMode = editCheckBox(module.multi.lowPowerMode, MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_LOWPOWER, attr, event);
|
||||
module.multi.lowPowerMode = editCheckBox(module.multi.lowPowerMode, MODEL_SETUP_2ND_COLUMN, y, IS_RX_MULTI(moduleIdx) ? STR_MULTI_LNA_DISABLE : STR_MULTI_LOWPOWER, attr, event);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -128,10 +128,6 @@ void menuChannelsView(event_t event)
|
||||
case EVT_KEY_PREVIOUS_PAGE:
|
||||
g_eeGeneral.view = (g_eeGeneral.view + (4 * ALTERNATE_VIEW) - ALTERNATE_VIEW) % (4 * ALTERNATE_VIEW);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
reusableBuffer.viewChannels.mixersView = !reusableBuffer.viewChannels.mixersView;
|
||||
break;
|
||||
}
|
||||
|
||||
menuChannelsViewCommon(event);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||
#define TEXT_VIEWER_LINES NUM_BODY_LINES
|
||||
#define MENU_HEADER_HEIGHT FH
|
||||
|
||||
#define MODEL_BITMAP_WIDTH 64
|
||||
@@ -226,7 +227,6 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
|
||||
|
||||
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event);
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
||||
|
||||
extern uint8_t editNameCursorPos;
|
||||
@@ -244,6 +244,7 @@ extern uint8_t s_copyMode;
|
||||
extern int8_t s_copySrcRow;
|
||||
extern int8_t s_copyTgtOfs;
|
||||
extern uint8_t s_currIdx;
|
||||
extern uint8_t s_currIdxSubMenu;
|
||||
extern uint8_t s_maxLines;
|
||||
extern uint8_t s_copySrcIdx;
|
||||
extern uint8_t s_copySrcCh;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include "opentx.h"
|
||||
#include "common/stdlcd/fonts.h"
|
||||
|
||||
@@ -87,11 +88,11 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<(int8_t)(width+2); i++) {
|
||||
if (x<LCD_W) {
|
||||
for (int8_t i = 0; i < int8_t(width + 2); i++) {
|
||||
if (x < LCD_W) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
if (i == 0) {
|
||||
if (x == 0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
@@ -100,11 +101,11 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
x--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
else if (i <= width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = *(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
if (b[j] != 0xFF) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
@@ -120,20 +121,24 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
}
|
||||
}
|
||||
|
||||
for (int8_t j=-1; j<=(int8_t)(height); j++) {
|
||||
for (int8_t j = -1; j <= int8_t(height); j++) {
|
||||
bool plot;
|
||||
if (j < 0 || ((j == height) && !(FONTSIZE(flags) == SMLSIZE))) {
|
||||
if (j < 0 || (j == height && FONTSIZE(flags) != SMLSIZE)) {
|
||||
plot = false;
|
||||
if (height >= 12) continue;
|
||||
if (j<0 && !inv) continue;
|
||||
if (y+j < 0) continue;
|
||||
if (height >= 12)
|
||||
continue;
|
||||
if (j < 0 && !inv)
|
||||
continue;
|
||||
if (y + j < 0)
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
uint8_t line = (j / 8);
|
||||
uint8_t pixel = (j % 8);
|
||||
plot = b[line] & (1 << pixel);
|
||||
}
|
||||
if (inv) plot = !plot;
|
||||
if (inv)
|
||||
plot = !plot;
|
||||
if (!blink) {
|
||||
if (flags & VERTICAL)
|
||||
lcdDrawPoint(y+j, LCD_H-x, plot ? FORCE : ERASE);
|
||||
@@ -154,10 +159,10 @@ void getCharPattern(PatternData * pattern, unsigned char c, LcdFlags flags)
|
||||
uint32_t fontsize = FONTSIZE(flags);
|
||||
unsigned char c_remapped = 0;
|
||||
|
||||
if (fontsize == DBLSIZE || (flags&BOLD)) {
|
||||
if (fontsize == DBLSIZE || (flags & BOLD)) {
|
||||
// To save space only some DBLSIZE and BOLD chars are available
|
||||
// c has to be remapped. All non existing chars mapped to 0 (space)
|
||||
if (c>=',' && c<=':')
|
||||
if (c >= ',' && c <= ':')
|
||||
c_remapped = c - ',' + 1;
|
||||
else if (c>='A' && c<='Z')
|
||||
c_remapped = c - 'A' + 16;
|
||||
@@ -221,7 +226,7 @@ uint8_t getCharWidth(char c, LcdFlags flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
|
||||
{
|
||||
lcdNextPos = x-1;
|
||||
#if defined(BOOT)
|
||||
@@ -234,7 +239,7 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c)
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c)
|
||||
{
|
||||
lcdDrawChar(x, y, c, 0);
|
||||
}
|
||||
@@ -285,7 +290,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
break;
|
||||
}
|
||||
else if (c >= 0x20) {
|
||||
if ( ( c == 46) && ((FONTSIZE(flags) == TINSIZE))) { // '.' handling
|
||||
if (c == 46 && FONTSIZE(flags) == TINSIZE) { // '.' handling
|
||||
if (((flags & BLINK) && BLINK_ON_PHASE) || ((!(flags & BLINK) && (flags & INVERS)))) {
|
||||
lcdDrawSolidVerticalLine(x, y-1, 5);
|
||||
lcdDrawPoint(x, y + 5);
|
||||
@@ -293,7 +298,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
else {
|
||||
lcdDrawPoint(x, y + 5 -1 , flags);
|
||||
}
|
||||
x+=2;
|
||||
x += 2;
|
||||
}
|
||||
else {
|
||||
lcdDrawChar(x, y, c, flags);
|
||||
@@ -320,7 +325,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
x += 1;
|
||||
}
|
||||
else {
|
||||
x += (c*FW/2); // EXTENDED SPACE
|
||||
x += (c * FW/2); // EXTENDED SPACE
|
||||
}
|
||||
s++;
|
||||
}
|
||||
@@ -398,7 +403,19 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
|
||||
if (val == INT_MAX) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MAX", flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val < 0) {
|
||||
if (val == INT_MIN) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MIN", flags);
|
||||
return;
|
||||
}
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ extern coord_t lcdNextPos;
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c);
|
||||
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags mode);
|
||||
void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags flags = 0);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags mode);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags mode);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s,unsigned char len, LcdFlags mode);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len, LcdFlags mode);
|
||||
void lcdDrawText(coord_t x, coord_t y, const char * s);
|
||||
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
|
||||
void lcdDrawTextAlignedLeft(coord_t y, const char * s);
|
||||
|
||||
@@ -63,7 +63,9 @@ uint8_t editNameCursorPos = 0;
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char *name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, label);
|
||||
TRACE("EDIT SINGLE NAME %s", name);
|
||||
editName(x, y, name, size, event, active);
|
||||
}
|
||||
|
||||
uint8_t s_currIdx;
|
||||
uint8_t s_currIdxSubMenu;
|
||||
|
||||
@@ -52,8 +52,8 @@ void runPopupCurvePreset(event_t event)
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
int k = 25 * reusableBuffer.curveEdit.preset;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
@@ -73,14 +73,14 @@ void onCurveOneMenu(const char * result)
|
||||
POPUP_INPUT(STR_PRESET, runPopupCurvePreset);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = -points[i];
|
||||
}
|
||||
else if (result == STR_CLEAR) {
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = 0;
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
@@ -92,10 +92,10 @@ void onCurveOneMenu(const char * result)
|
||||
void menuModelCurveOne(event_t event)
|
||||
{
|
||||
static uint8_t pointsOfs = 0;
|
||||
CurveHeader & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveHeader & crv = g_model.curves[s_currIdxSubMenu];
|
||||
int8_t * points = curveAddress(s_currIdxSubMenu);
|
||||
|
||||
drawStringWithIndex(PSIZE(TR_MENUCURVES)*FW+FW, 0, "CV", s_curveChan+1);
|
||||
drawStringWithIndex(PSIZE(TR_MENUCURVES)*FW+FW, 0, "CV", s_currIdxSubMenu+1);
|
||||
|
||||
lcdDrawText(11*FW+FW/2, 0, TR_PT "\002X\006Y");
|
||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||
@@ -114,9 +114,9 @@ void menuModelCurveOne(event_t event)
|
||||
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
||||
if (newType != crv.type) {
|
||||
for (int i = 1; i < 4 + crv.points; i++) {
|
||||
points[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + crv.points, i)), s_curveChan));
|
||||
points[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + crv.points, i)), s_currIdxSubMenu));
|
||||
}
|
||||
if (moveCurve(s_curveChan, checkIncDec_Ret > 0 ? 3 + crv.points : -3 - crv.points)) {
|
||||
if (moveCurve(s_currIdxSubMenu, checkIncDec_Ret > 0 ? 3 + crv.points : -3 - crv.points)) {
|
||||
if (newType == CURVE_TYPE_CUSTOM) {
|
||||
resetCustomCurveX(points, 5 + crv.points);
|
||||
}
|
||||
@@ -137,8 +137,8 @@ void menuModelCurveOne(event_t event)
|
||||
newPoints[0] = points[0];
|
||||
newPoints[4 + count] = points[4 + crv.points];
|
||||
for (int i = 1; i < 4 + count; i++)
|
||||
newPoints[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + count, i)), s_curveChan));
|
||||
if (moveCurve(s_curveChan, checkIncDec_Ret * (crv.type == CURVE_TYPE_CUSTOM ? 2 : 1))) {
|
||||
newPoints[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + count, i)), s_currIdxSubMenu));
|
||||
if (moveCurve(s_currIdxSubMenu, checkIncDec_Ret * (crv.type == CURVE_TYPE_CUSTOM ? 2 : 1))) {
|
||||
for (int i = 0; i < 5 + count; i++) {
|
||||
points[i] = newPoints[i];
|
||||
if (crv.type == CURVE_TYPE_CUSTOM && i != 0 && i != 4 + count)
|
||||
|
||||
@@ -212,7 +212,7 @@ void menuModelLimits(event_t event)
|
||||
case ITEM_LIMITS_CURVE:
|
||||
drawCurveName(LIMITS_CURVE_POS, y, ld->curve, attr);
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER) && ld->curve>0) {
|
||||
s_curveChan = (ld->curve<0 ? -ld->curve-1 : ld->curve-1);
|
||||
s_currIdxSubMenu = (ld->curve<0 ? -ld->curve-1 : ld->curve-1);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
if (active) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define MODELSIZE_POS_X 170
|
||||
#define MODELSEL_W 133
|
||||
|
||||
void onModelSelectMenu(const char * result)
|
||||
|
||||
@@ -98,6 +98,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_LABEL,
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_TYPE,
|
||||
#if defined (MULTIMODULE)
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_PROTOCOL,
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_STATUS,
|
||||
ITEM_MODEL_SETUP_EXTERNAL_MODULE_SYNCSTATUS,
|
||||
#endif
|
||||
@@ -248,11 +249,6 @@ inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
{
|
||||
if (isModuleXJT(EXTERNAL_MODULE) || isModuleR9MNonAccess(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE))
|
||||
return 1;
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
return 1 + MULTIMODULE_RFPROTO_COLUMNS(EXTERNAL_MODULE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -362,6 +358,7 @@ void menuModelSetup(event_t event)
|
||||
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_TYPE_ROW(),
|
||||
MULTIMODULE_TYPE_ROW(EXTERNAL_MODULE)
|
||||
MULTIMODULE_STATUS_ROWS(EXTERNAL_MODULE)
|
||||
MODULE_CHANNELS_ROWS(EXTERNAL_MODULE),
|
||||
IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, MODULE_BIND_ROWS(EXTERNAL_MODULE)),
|
||||
@@ -813,15 +810,6 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleR9MNonAccess(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].subType, (menuHorizontalPosition==1 ? attr : 0));
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
uint8_t multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol();
|
||||
// Do not use MODEL_SETUP_3RD_COLUMN here since some the protocol string are so long that we cannot afford the 2 spaces (+6) here
|
||||
lcdDrawMultiProtocolString(lcdNextPos + 3, y, EXTERNAL_MODULE, multi_rfProto, menuHorizontalPosition == 1 ? attr : 0);
|
||||
if (MULTIMODULE_HAS_SUBTYPE(EXTERNAL_MODULE))
|
||||
lcdDrawMultiSubProtocolString(lcdNextPos + 3, y, EXTERNAL_MODULE, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
|
||||
}
|
||||
#endif
|
||||
if (attr && menuHorizontalPosition == 0) {
|
||||
if (s_editMode > 0) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = MODULE_TYPE_NONE;
|
||||
@@ -906,6 +894,59 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PROTOCOL:
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, TR_TYPE);
|
||||
uint8_t multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol();
|
||||
lcdDrawMultiProtocolString(MODEL_SETUP_2ND_COLUMN, y, EXTERNAL_MODULE, multi_rfProto, menuHorizontalPosition == 0 ? attr : 0);
|
||||
if (MULTIMODULE_HAS_SUBTYPE(EXTERNAL_MODULE))
|
||||
lcdDrawMultiSubProtocolString(MODEL_SETUP_3RD_COLUMN + 15, y, EXTERNAL_MODULE, g_model.moduleData[EXTERNAL_MODULE].subType,
|
||||
menuHorizontalPosition == 1 ? attr : 0);
|
||||
if (attr) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0: {
|
||||
int multiRfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol();
|
||||
MultiModuleStatus &status = getMultiModuleStatus(EXTERNAL_MODULE);
|
||||
if (status.isValid()) {
|
||||
int8_t direction = checkIncDec(event, 0, -1, 1);
|
||||
if (direction == -1) {
|
||||
if (multiRfProto == MODULE_SUBTYPE_MULTI_FRSKY)
|
||||
multiRfProto = MODULE_SUBTYPE_MULTI_FRSKYX_RX;
|
||||
else
|
||||
multiRfProto = convertMultiToOtx(status.protocolPrev);
|
||||
}
|
||||
if (direction == 1) {
|
||||
if (multiRfProto == MODULE_SUBTYPE_MULTI_FRSKY)
|
||||
multiRfProto = MODULE_SUBTYPE_MULTI_FRSKYX2;
|
||||
else
|
||||
multiRfProto = convertMultiToOtx(status.protocolNext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, multiRfProto, MODULE_SUBTYPE_MULTI_FIRST, MULTI_MAX_PROTOCOLS, isMultiProtocolSelectable);
|
||||
}
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].setMultiProtocol(multiRfProto);
|
||||
g_model.moduleData[EXTERNAL_MODULE].subType = 0;
|
||||
resetMultiProtocolsOptions(EXTERNAL_MODULE);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, getMaxMultiSubtype(EXTERNAL_MODULE));
|
||||
if (checkIncDec_Ret) {
|
||||
resetMultiProtocolsOptions(EXTERNAL_MODULE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_SETUP_TRAINER_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_TRAINER);
|
||||
break;
|
||||
@@ -1100,8 +1141,13 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_RECEIVER_NUM);
|
||||
}
|
||||
if (isModuleBindRangeAvailable(moduleIdx)) {
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
bindButtonPos = lcdNextPos + FW;
|
||||
if (!IS_RX_MULTI(moduleIdx)) {
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz == 0 ? attr : 0) | LEADING0 | LEFT, 2);
|
||||
bindButtonPos = lcdNextPos + FW;
|
||||
}
|
||||
else {
|
||||
bindButtonPos = MODEL_SETUP_2ND_COLUMN;
|
||||
}
|
||||
if (attr && l_posHorz==0) {
|
||||
if (s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], getMaxRxNum(moduleIdx));
|
||||
@@ -1119,7 +1165,8 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
lcdDrawText(bindButtonPos, y, STR_MODULE_BIND, l_posHorz==1 ? attr : 0);
|
||||
lcdDrawText(lcdNextPos + FW, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
|
||||
if (!IS_RX_MULTI(moduleIdx))
|
||||
lcdDrawText(lcdNextPos + FW, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
#if defined(MULTIMODULE)
|
||||
if (getMultiBindStatus(moduleIdx) == MULTI_BIND_FINISHED) {
|
||||
@@ -1284,7 +1331,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
#if defined (MULTIMODULE)
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode, MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_LOWPOWER, attr, event);
|
||||
g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode = editCheckBox(g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode, MODEL_SETUP_2ND_COLUMN, y, IS_RX_MULTI(moduleIdx) ? STR_MULTI_LNA_DISABLE : STR_MULTI_LOWPOWER, attr, event);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -38,12 +38,4 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
lcdDrawNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256, RIGHT);
|
||||
#endif
|
||||
}
|
||||
|
||||
// RAS
|
||||
if ((isModuleXJT(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) || (isModulePXX1(EXTERNAL_MODULE) && !IS_INTERNAL_MODULE_ON())) {
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH, "RAS");
|
||||
lcdDrawNumber(10*FW-1, MENU_HEADER_HEIGHT+6*FH, telemetryData.swrInternal.value(), RIGHT);
|
||||
lcdDrawText(LCD_W/2, MENU_HEADER_HEIGHT+6*FH, "XJTVER");
|
||||
lcdDrawNumber(LCD_W/2 + 10*FW-1, MENU_HEADER_HEIGHT+6*FH, telemetryData.xjtVersion, RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ const uint8_t LBM_LAYOUT_1x1[] = {
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_1x1[] = {
|
||||
{ "Top bar", ZoneOption::Bool },
|
||||
{ "Sliders+Trims", ZoneOption::Bool },
|
||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
||||
{ STR_SLIDERS_TRIMS, ZoneOption::Bool },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const uint8_t LBM_LAYOUT_2x1[] = {
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_2x1[] = {
|
||||
{ "Top bar", ZoneOption::Bool },
|
||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ class Layout2x1: public Layout
|
||||
|
||||
unsigned int getZonesCount() const override
|
||||
{
|
||||
return 4;
|
||||
return 2;
|
||||
}
|
||||
|
||||
Zone getZone(unsigned int index) const override
|
||||
|
||||
@@ -25,7 +25,7 @@ const uint8_t LBM_LAYOUT_2x2[] = {
|
||||
};
|
||||
|
||||
const ZoneOption OPTIONS_LAYOUT_2x2[] = {
|
||||
{ "Top bar", ZoneOption::Bool },
|
||||
{ STR_TOP_BAR, ZoneOption::Bool },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -28,50 +28,12 @@ uint8_t getMappedChar(uint8_t c)
|
||||
{
|
||||
uint8_t result;
|
||||
|
||||
#if defined(TRANSLATIONS_FR)
|
||||
if (c >= 0x80 && c <= 0x84) {
|
||||
result = 115 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_DE)
|
||||
if (c >= 0x80 && c <= 0x86) {
|
||||
result = 120 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
if (c >= 0x80 && c <= 0x80+29) {
|
||||
result = 127 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_ES)
|
||||
if (c >= 0x80 && c <= 0x81) {
|
||||
result = 157 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_FI)
|
||||
if (c >= 0x80 && c <= 0x85) {
|
||||
result = 159 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_IT)
|
||||
if (c >= 0x80 && c <= 0x81) {
|
||||
result = 165 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_PL)
|
||||
if (c >= 0x80 && c <= 0x80+17) {
|
||||
result = 167 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_PT)
|
||||
if (c >= 0x80 && c <= 0x80+21) {
|
||||
result = 185 + c - 0x80;
|
||||
}
|
||||
#elif defined(TRANSLATIONS_SE)
|
||||
if (c >= 0x80 && c <= 0x85) {
|
||||
result = 207 + c - 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c < 0xC0)
|
||||
if (c < 0x80)
|
||||
result = c - 0x20;
|
||||
else
|
||||
result = c - 0xC0 + 96;
|
||||
result = c - 0x80 + 32 + 26 + 6 + 26 + 5; // 96;
|
||||
|
||||
// TRACE("getMappedChar '%c' (%x) = %d", c, c, result);
|
||||
// TRACE("getMappedChar '%c' (0x%x) = %d", c, c, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ extern int8_t s_editMode; // global editmode
|
||||
//#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
//#define CURSOR_ON_LINE() (menuHorizontalPosition<0)
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
extern uint8_t s_currIdxSubMenu;
|
||||
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
|
||||
@@ -62,7 +62,7 @@ void drawModel(coord_t x, coord_t y, ModelCell * model, bool current, bool selec
|
||||
if (selected) {
|
||||
lcdDrawSolidRect(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2, 1, TITLE_BGCOLOR);
|
||||
drawShadow(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2);
|
||||
if (selectMode == MODE_MOVE_MODEL) {
|
||||
if (selectMode == MODE_MOVE_MODEL && modelselModelMoveBackground) {
|
||||
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width(), y, modelselModelMoveBackground, TITLE_BGCOLOR);
|
||||
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width()+12, y+5, modelselModelMoveIcon, DEFAULT_BGCOLOR);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void onModelSelectMenu(const char * result)
|
||||
setCurrentModel(currentCategory->size() - 1);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING("Invalid File");
|
||||
POPUP_WARNING(STR_INVALID_FILE);
|
||||
}
|
||||
}
|
||||
else if (result == STR_MOVE_MODEL) {
|
||||
|
||||
@@ -121,7 +121,7 @@ bool editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue * valu
|
||||
}
|
||||
}
|
||||
else if (option->type == ZoneOption::TextSize) {
|
||||
lcdDrawTextAtIndex(SCREENS_SETUP_2ND_COLUMN, y, "\010StandardTiny\0 Small\0 Mid\0 Double", value->unsignedValue, attr);
|
||||
lcdDrawTextAtIndex(SCREENS_SETUP_2ND_COLUMN, y, STR_TEXT_SIZE, value->unsignedValue, attr);
|
||||
if (attr) {
|
||||
value->unsignedValue = checkIncDec(event, value->unsignedValue, 0, 4, i_flags);
|
||||
}
|
||||
@@ -346,7 +346,7 @@ bool menuWidgetsSetup(event_t event)
|
||||
|
||||
currentScreen->refresh();
|
||||
|
||||
for (int i=currentContainer->getZonesCount()-1; i>=0; i--) {
|
||||
for (int i = currentContainer->getZonesCount() - 1; i >= 0; i--) {
|
||||
Zone zone = currentContainer->getZone(i);
|
||||
LcdFlags color;
|
||||
int padding, thickness;
|
||||
@@ -558,7 +558,7 @@ bool menuScreenSetup(int index, event_t event)
|
||||
currentContainer = currentScreen;
|
||||
bool needsOffsetCheck = (menuVerticalPosition != 0 || menuHorizontalPosition < 0);
|
||||
|
||||
char title[] = "Main view X";
|
||||
char title[] = TR_MAIN_VIEW_X;
|
||||
title[sizeof(title)-2] = '1' + index;
|
||||
menuPageCount = updateMainviewsMenu();
|
||||
|
||||
|
||||
@@ -26,30 +26,31 @@
|
||||
#include "lcd.h"
|
||||
#include "strhelpers.h"
|
||||
#include "draw_functions.h"
|
||||
#include "opentx.h"
|
||||
|
||||
class SourceChoiceMenuToolbar : public MenuToolbar<SourceChoice> {
|
||||
public:
|
||||
SourceChoiceMenuToolbar(SourceChoice * choice, Menu * menu):
|
||||
MenuToolbar<SourceChoice>(choice, menu)
|
||||
{
|
||||
addButton(char('\314'), MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT);
|
||||
addButton(CHAR_INPUT, MIXSRC_FIRST_INPUT, MIXSRC_LAST_INPUT);
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
addButton(char('\322'), MIXSRC_LAST_LUA, MIXSRC_FIRST_LUA);
|
||||
addButton(CHAR_LUA, MIXSRC_LAST_LUA, MIXSRC_FIRST_LUA);
|
||||
#endif
|
||||
addButton(char('\307'), MIXSRC_FIRST_STICK, MIXSRC_LAST_STICK);
|
||||
addButton(char('\310'), MIXSRC_FIRST_POT, MIXSRC_LAST_POT);
|
||||
addButton(char('\315'), MIXSRC_MAX, MIXSRC_MAX);
|
||||
addButton(char(CHAR_STICK), MIXSRC_FIRST_STICK, MIXSRC_LAST_STICK);
|
||||
addButton(CHAR_POT, MIXSRC_FIRST_POT, MIXSRC_LAST_POT);
|
||||
addButton(CHAR_FUNCTION, MIXSRC_MAX, MIXSRC_MAX);
|
||||
#if defined(HELI)
|
||||
addButton(char('\316'), MIXSRC_FIRST_HELI, MIXSRC_LAST_HELI);
|
||||
addButton(CHAR_CYC, MIXSRC_FIRST_HELI, MIXSRC_LAST_HELI);
|
||||
#endif
|
||||
addButton(char('\313'), MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM);
|
||||
addButton(char('\312'), MIXSRC_FIRST_SWITCH, MIXSRC_LAST_SWITCH);
|
||||
addButton(char('\317'), MIXSRC_FIRST_TRAINER, MIXSRC_LAST_TRAINER);
|
||||
addButton(char('\320'), MIXSRC_FIRST_CH, MIXSRC_LAST_CH);
|
||||
addButton(CHAR_TRIM, MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM);
|
||||
addButton(CHAR_SWITCH, MIXSRC_FIRST_SWITCH, MIXSRC_LAST_SWITCH);
|
||||
addButton(CHAR_TRAINER, MIXSRC_FIRST_TRAINER, MIXSRC_LAST_TRAINER);
|
||||
addButton(CHAR_CHANNEL, MIXSRC_FIRST_CH, MIXSRC_LAST_CH);
|
||||
#if defined(GVARS)
|
||||
addButton(char('\311'), MIXSRC_LAST_GVAR, MIXSRC_FIRST_GVAR);
|
||||
addButton(CHAR_GVAR, MIXSRC_LAST_GVAR, MIXSRC_FIRST_GVAR);
|
||||
#endif
|
||||
addButton(char('\321'), MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM);
|
||||
addButton(CHAR_TELEMETRY, MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ bool TabsCarousel::onTouchEnd(coord_t x, coord_t y)
|
||||
TabsGroup::TabsGroup(uint8_t icon):
|
||||
Window(&mainWindow, { 0, 0, LCD_W, LCD_H }, OPAQUE),
|
||||
header(this, icon),
|
||||
body(this, { 0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT })
|
||||
body(this, { 0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT }, FORM_FORWARD_FOCUS)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -76,11 +76,19 @@ void drawTopBar()
|
||||
|
||||
/* Tx battery */
|
||||
uint8_t bars = GET_TXBATT_BARS(5);
|
||||
lcdDrawBitmapPattern(LCD_W-130, 24, LBM_TOPMENU_TXBATT, MENU_COLOR);
|
||||
#if defined(USB_CHARGER)
|
||||
if (usbChargerLed()) {
|
||||
lcdDrawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT_CHARGING, MENU_TITLE_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, MENU_TITLE_COLOR);
|
||||
}
|
||||
#else
|
||||
lcdDrawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, MENU_TITLE_COLOR);
|
||||
#endif
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
lcdDrawSolidFilledRect(LCD_W-122+4*i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_COLOR);
|
||||
lcdDrawSolidFilledRect(LCD_W - 128 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_COLOR);
|
||||
}
|
||||
|
||||
topbar->refresh();
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -42,7 +42,7 @@ bool menuTextView(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (menuVerticalOffset + NUM_BODY_LINES >= lines_count)
|
||||
if (menuVerticalOffset + TEXT_VIEWER_LINES >= lines_count)
|
||||
break;
|
||||
else
|
||||
++menuVerticalOffset;
|
||||
@@ -55,11 +55,11 @@ bool menuTextView(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
lcd->drawTextMaxWidth(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i * FH, reusableBuffer.viewText.lines[i], 0, LCD_W - 2 * MENUS_MARGIN_LEFT);
|
||||
for (int i = 0; i < TEXT_VIEWER_LINES; i++) {
|
||||
lcd->drawTextMaxWidth(MENUS_MARGIN_LEFT, MENU_HEADER_HEIGHT + i * FH, reusableBuffer.viewText.lines[i], 0, LCD_W - 2 * MENUS_MARGIN_LEFT);
|
||||
}
|
||||
|
||||
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES);
|
||||
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, TEXT_VIEWER_LINES);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ class GaugeWidget: public Widget
|
||||
};
|
||||
|
||||
const ZoneOption GaugeWidget::options[] = {
|
||||
{ "Source", ZoneOption::Source, OPTION_VALUE_UNSIGNED(1) },
|
||||
{ "Min", ZoneOption::Integer, OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
|
||||
{ "Max", ZoneOption::Integer, OPTION_VALUE_SIGNED(RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
|
||||
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
|
||||
{ STR_SOURCE, ZoneOption::Source, OPTION_VALUE_UNSIGNED(1) },
|
||||
{ STR_MIN, ZoneOption::Integer, OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
|
||||
{ STR_MAX, ZoneOption::Integer, OPTION_VALUE_SIGNED(RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
|
||||
{ STR_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ class OutputsWidget: public Widget
|
||||
};
|
||||
|
||||
const ZoneOption OutputsWidget::options[] = {
|
||||
{ "First channel", ZoneOption::Integer, OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(32) },
|
||||
{ "Fill Background?", ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ "BG Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(LIGHTGREY) },
|
||||
{ STR_FIRST_CHANNEL, ZoneOption::Integer, OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(32) },
|
||||
{ STR_FILL_BACKGROUND, ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ STR_BG_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(LIGHTGREY) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ class TextWidget: public Widget
|
||||
};
|
||||
|
||||
const ZoneOption TextWidget::options[] = {
|
||||
{ "Text", ZoneOption::String, OPTION_VALUE_STRING(TEXT_WIDGET_DEFAULT_LABEL) },
|
||||
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
|
||||
{ "Size", ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) },
|
||||
{ "Shadow", ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ STR_TEXT, ZoneOption::String, OPTION_VALUE_STRING(TEXT_WIDGET_DEFAULT_LABEL) },
|
||||
{ STR_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
|
||||
{ STR_SIZE, ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) },
|
||||
{ STR_SHADOW, ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class TimerWidget: public Widget
|
||||
};
|
||||
|
||||
const ZoneOption TimerWidget::options[] = {
|
||||
{ "Timer source", ZoneOption::Timer, OPTION_VALUE_UNSIGNED(0) },
|
||||
{ STR_TIMER_SOURCE, ZoneOption::Timer, OPTION_VALUE_UNSIGNED(0) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ class ValueWidget: public Widget
|
||||
};
|
||||
|
||||
const ZoneOption ValueWidget::options[] = {
|
||||
{ "Source", ZoneOption::Source, OPTION_VALUE_UNSIGNED(MIXSRC_Rud) },
|
||||
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(WHITE) },
|
||||
{ "Shadow", ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ STR_SOURCE, ZoneOption::Source, OPTION_VALUE_UNSIGNED(MIXSRC_Rud) },
|
||||
{ STR_COLOR, ZoneOption::Color, OPTION_VALUE_UNSIGNED(WHITE) },
|
||||
{ STR_SHADOW, ZoneOption::Bool, OPTION_VALUE_BOOL(false) },
|
||||
{ nullptr, ZoneOption::Bool }
|
||||
};
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t flightMode, uint8_t idx, LcdFlag
|
||||
}
|
||||
}
|
||||
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att)
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
lcdDrawNumber(x, y, val, att & (~NO_UNIT));
|
||||
@@ -121,6 +121,40 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
|
||||
return value;
|
||||
}
|
||||
|
||||
char getNextChar(char c, uint8_t position)
|
||||
{
|
||||
if (c == ' ')
|
||||
return (position == 0 ? 'A' : 'a');
|
||||
|
||||
if (c == 'Z' || c == 'z')
|
||||
return '0';
|
||||
|
||||
static const char * specialChars = "9_-., ";
|
||||
for (uint8_t i = 0; specialChars[i] != 0; i++) {
|
||||
if (c == specialChars[i])
|
||||
return specialChars[i + 1];
|
||||
}
|
||||
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
char getPreviousChar(char c, uint8_t position)
|
||||
{
|
||||
if (c == 'A' || c == 'a')
|
||||
return ' ';
|
||||
|
||||
if (c == '0')
|
||||
return (position == 0 ? 'Z' : 'z');
|
||||
|
||||
static const char * specialChars = "9_-., ";
|
||||
for (uint8_t i = 1; specialChars[i] != 0; i++) {
|
||||
if (c == specialChars[i])
|
||||
return specialChars[i - 1];
|
||||
}
|
||||
|
||||
return c - 1;
|
||||
}
|
||||
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr)
|
||||
{
|
||||
uint8_t mode = 0;
|
||||
@@ -131,23 +165,24 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
mode = FIXEDWIDTH;
|
||||
}
|
||||
|
||||
lcdDrawSizedText(x, y, name, size, attr | mode);
|
||||
lcdDrawSizedText(x, y, name[0] == '\0' ? "---" : name, size, attr | mode);
|
||||
coord_t backupNextPos = lcdNextPos;
|
||||
|
||||
if (active) {
|
||||
uint8_t cur = editNameCursorPos;
|
||||
if (s_editMode > 0) {
|
||||
int8_t c = name[cur];
|
||||
int8_t v = c;
|
||||
|
||||
if (IS_NEXT_EVENT(event) || IS_PREVIOUS_EVENT(event)) {
|
||||
if (attr == ZCHAR) {
|
||||
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
|
||||
if (c <= 0) v = -v;
|
||||
}
|
||||
else {
|
||||
v = checkIncDec(event, abs(v), '0', 'z', 0);
|
||||
}
|
||||
if (c == '\0')
|
||||
c = ' ';
|
||||
char v;
|
||||
if (IS_NEXT_EVENT(event)) {
|
||||
v = getNextChar(c, cur);
|
||||
}
|
||||
else if (IS_PREVIOUS_EVENT(event)) {
|
||||
v = getPreviousChar(c, cur);
|
||||
}
|
||||
else {
|
||||
v = c;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
@@ -164,11 +199,13 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
|
||||
#if defined(NAVIGATION_XLITE) || defined(NAVIGATION_9X)
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
if (cur>0) cur--;
|
||||
if (cur > 0)
|
||||
cur--;
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (cur<size-1) cur++;
|
||||
if (cur < size - 1)
|
||||
cur++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -181,33 +218,21 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#endif
|
||||
|
||||
if (attr & ZCHAR) {
|
||||
#if defined(PCBTARANIS) && !defined(PCBXLITE)
|
||||
if (v == 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
}
|
||||
#endif
|
||||
if (v >= -26 && v <= 26) {
|
||||
v = -v; // toggle case
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if !defined(NAVIGATION_XLITE)
|
||||
if (v == ' ') {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (v >= 'A' && v <= 'Z') {
|
||||
v = 'a' + v - 'A'; // toggle case
|
||||
}
|
||||
else if (v >= 'a' && v <= 'z') {
|
||||
v = 'A' + v - 'a'; // toggle case
|
||||
}
|
||||
if (v == ' ') {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (v >= 'A' && v <= 'Z') {
|
||||
v = 'a' + v - 'A'; // toggle case
|
||||
}
|
||||
else if (v >= 'a' && v <= 'z') {
|
||||
v = 'A' + v - 'a'; // toggle case
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_9X)
|
||||
if (event==EVT_KEY_LONG(KEY_LEFT))
|
||||
killEvents(KEY_LEFT);
|
||||
@@ -220,12 +245,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
storageDirty(isModelMenuDisplayed() ? EE_MODEL : EE_GENERAL);
|
||||
}
|
||||
|
||||
if (attr == ZCHAR) {
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, zchar2char(v), ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
cur = 0;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags = 0);
|
||||
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags = 0);
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0);
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att=0);
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att=0);
|
||||
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0);
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
|
||||
|
||||
@@ -61,7 +61,7 @@ void menuModelCurvesAll(event_t event)
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
if (CURVE_SELECTED() && !READ_ONLY()) {
|
||||
s_curveChan = sub;
|
||||
s_currIdxSubMenu = sub;
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
break;
|
||||
@@ -94,7 +94,7 @@ void menuModelCurvesAll(event_t event)
|
||||
}
|
||||
|
||||
if (CURVE_SELECTED()) {
|
||||
s_curveChan = sub;
|
||||
s_currIdxSubMenu = sub;
|
||||
#if LCD_W >= 212
|
||||
drawCurve(23);
|
||||
#else
|
||||
@@ -143,7 +143,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
||||
drawCurveName(x, y, curve.value, flags);
|
||||
if (active && menuHorizontalPosition==1) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
|
||||
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
s_currIdxSubMenu = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -227,7 +227,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
|
||||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
waitKeysReleased();
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ enum
|
||||
{
|
||||
warningText = message;
|
||||
warningInfoText = info;
|
||||
warningInfoLength = strlen(info);
|
||||
warningInfoLength = info ? strlen(info) : 0;
|
||||
warningInfoFlags = 0;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
popupFunc = runPopupWarning;
|
||||
|
||||
@@ -624,22 +624,23 @@ void menuRadioHardware(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_HARDWARE_RAS:
|
||||
#if defined(PCBX9LITE) && !defined(PCBX9LITES)
|
||||
lcdDrawTextAlignedLeft(y, "Ext. RAS");
|
||||
lcdNextPos = HW_SETTINGS_COLUMN2;
|
||||
#else
|
||||
#if defined(HARDWARE_INTERNAL_RAS)
|
||||
lcdDrawTextAlignedLeft(y, "RAS");
|
||||
if (telemetryData.swrInternal.isFresh())
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, telemetryData.swrInternal.value());
|
||||
else
|
||||
lcdDrawText(HW_SETTINGS_COLUMN2, y, "---");
|
||||
lcdDrawText(lcdNextPos, y, "/");
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(y, "Ext. RAS");
|
||||
lcdNextPos = HW_SETTINGS_COLUMN2;
|
||||
#endif
|
||||
if (telemetryData.swrExternal.isFresh())
|
||||
lcdDrawNumber(lcdNextPos, y, telemetryData.swrExternal.value());
|
||||
else
|
||||
lcdDrawText(lcdNextPos, y, "---");
|
||||
break;
|
||||
|
||||
#if defined(SPORT_UPDATE_PWR_GPIO)
|
||||
case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
|
||||
g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
|
||||
|
||||
@@ -291,12 +291,14 @@ void menuRadioSdManager(event_t _event)
|
||||
int lastPos = menuVerticalPosition;
|
||||
#endif
|
||||
|
||||
if (moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode == MODULE_MODE_BIND && EVT_KEY_MASK(_event) == KEY_EXIT) {
|
||||
#if defined(PXX2)
|
||||
if (EVT_KEY_MASK(_event) == KEY_EXIT && moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode == MODULE_MODE_BIND) {
|
||||
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
|
||||
CLEAR_POPUP();
|
||||
killEvents(KEY_EXIT);
|
||||
_event = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
event_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, HEADER_LINE + reusableBuffer.sdManager.count);
|
||||
@@ -304,13 +306,13 @@ void menuRadioSdManager(event_t _event)
|
||||
switch (_event) {
|
||||
case EVT_ENTRY:
|
||||
f_chdir(ROOT_PATH);
|
||||
REFRESH_FILES();
|
||||
#if LCD_DEPTH > 1
|
||||
lastPos = -1;
|
||||
#endif
|
||||
break;
|
||||
// no break
|
||||
|
||||
case EVT_ENTRY_UP:
|
||||
memclear(&reusableBuffer.sdManager, sizeof(reusableBuffer.sdManager));
|
||||
REFRESH_FILES();
|
||||
break;
|
||||
|
||||
@@ -579,7 +581,7 @@ void menuRadioSdManager(event_t _event)
|
||||
if (reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount > 0) {
|
||||
if (reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount != popupMenuItemsCount) {
|
||||
CLEAR_POPUP();
|
||||
popupMenuItemsCount = min<uint8_t>(reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount,PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
popupMenuItemsCount = min<uint8_t>(reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
for (auto rx = 0; rx < popupMenuItemsCount; rx++) {
|
||||
popupMenuItems[rx] = reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversNames[rx];
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void menuViewTelemetry(event_t event)
|
||||
}
|
||||
|
||||
drawTelemetryTopBar();
|
||||
lcdDrawText(LCD_W / 2, 3 * FH, "No Telemetry Screens", CENTERED);
|
||||
lcdDrawText(LCD_W / 2, 3 * FH, STR_NO_TELEMETRY_SCREENS, CENTERED);
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -752,16 +752,12 @@ bool isTrainerModeAvailable(int mode)
|
||||
return g_eeGeneral.auxSerialMode == UART_MODE_SBUS_TRAINER;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TRAINER_BLUETOOTH)
|
||||
case TRAINER_MODE_MASTER_BLUETOOTH:
|
||||
case TRAINER_MODE_SLAVE_BLUETOOTH:
|
||||
return g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TRAINER_JACK)
|
||||
case TRAINER_MODE_MASTER_TRAINER_JACK:
|
||||
case TRAINER_MODE_SLAVE:
|
||||
return true;
|
||||
#if defined(BLUETOOTH) && !defined(PCBX9E)
|
||||
if (g_eeGeneral.bluetoothMode != BLUETOOTH_TRAINER && (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_SLAVE_BLUETOOTH))
|
||||
return false;
|
||||
#elif !defined(PCBSKY9X)
|
||||
if (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_SLAVE_BLUETOOTH)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TRAINER_MULTI)
|
||||
@@ -813,7 +809,7 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable)
|
||||
#if defined(MULTIMODULE)
|
||||
|
||||
// This maps OpenTX multi type with Pascal's Multi type
|
||||
uint8_t convertMultiProtocol(uint8_t moduleIdx, uint8_t type)
|
||||
uint8_t multiConvertOtxToMulti(uint8_t moduleIdx, uint8_t type)
|
||||
{
|
||||
|
||||
// 15 for Multimodule is FrskyX or D16 which we map as a subprotocol of 3 (FrSky)
|
||||
@@ -827,7 +823,7 @@ uint8_t convertMultiProtocol(uint8_t moduleIdx, uint8_t type)
|
||||
|
||||
if (type == MODULE_SUBTYPE_MULTI_FRSKY) {
|
||||
int subtype = g_model.moduleData[moduleIdx].subType;
|
||||
if (subtype == MM_RF_FRSKY_SUBTYPE_D8) {
|
||||
if (subtype == MM_RF_FRSKY_SUBTYPE_D8 || subtype == MM_RF_FRSKY_SUBTYPE_D8_CLONED) {
|
||||
//D8
|
||||
type = 3;
|
||||
}
|
||||
@@ -842,6 +838,27 @@ uint8_t convertMultiProtocol(uint8_t moduleIdx, uint8_t type)
|
||||
return type;
|
||||
}
|
||||
|
||||
// This maps multi type to OpenTX number, type ONLY (no subtype)
|
||||
int convertMultiToOtx(int type)
|
||||
{
|
||||
if (type == 3) //FrSkyD
|
||||
return MODULE_SUBTYPE_MULTI_FRSKY;
|
||||
|
||||
if (type == 15) //FrSkyX
|
||||
return MODULE_SUBTYPE_MULTI_FRSKY;
|
||||
|
||||
if (type == 25) //FrSkyV
|
||||
return MODULE_SUBTYPE_MULTI_FRSKY;
|
||||
|
||||
if (type > 25)
|
||||
type = type - 1;
|
||||
|
||||
if (type > 15)
|
||||
type = type - 1;
|
||||
|
||||
return type - 1; //Multi list starts at 1
|
||||
}
|
||||
|
||||
// Third row is number of subtypes -1 (max valid subtype)
|
||||
#define NO_SUBTYPE nullptr
|
||||
|
||||
@@ -855,7 +872,7 @@ uint8_t convertMultiProtocol(uint8_t moduleIdx, uint8_t type)
|
||||
|
||||
const char STR_SUBTYPE_FLYSKY[] = "\004""Std\0""V9x9""V6x6""V912""CX20";
|
||||
const char STR_SUBTYPE_HUBSAN[] = "\004""H107""H301""H501";
|
||||
const char STR_SUBTYPE_FRSKY[] = "\007""D16\0 ""D8\0 ""D16 8ch""V8\0 ""LBT(EU)""LBT 8ch";
|
||||
const char STR_SUBTYPE_FRSKY[] = "\011""D16\0 ""D8\0 ""D16 8ch\0 ""V8\0 ""LBT(EU)\0 ""LBT 8ch\0 ""D8Cloned\0""D16Cloned";
|
||||
const char STR_SUBTYPE_HISKY[] = "\005""Std\0 ""HK310";
|
||||
const char STR_SUBTYPE_V2X2[] = "\006""Std\0 ""JXD506";
|
||||
const char STR_SUBTYPE_DSM[] = "\006""2 22ms""2 11ms""X 22ms""X 11ms";
|
||||
@@ -867,6 +884,7 @@ const char STR_SUBTYPE_SLT[] = "\006""V1_6ch""V2_8ch""Q100\0 ""Q200\0 ""M
|
||||
const char STR_SUBTYPE_CX10[] = "\007""Green\0 ""Blue\0 ""DM007\0 ""-\0 ""JC3015a""JC3015b""MK33041";
|
||||
const char STR_SUBTYPE_CG023[] = "\005""Std\0 ""YD829";
|
||||
const char STR_SUBTYPE_BAYANG[] = "\007""Std\0 ""H8S3D\0 ""X16 AH\0""IRDrone""DHD D4";
|
||||
const char STR_SUBTYPE_ESky[] = "\003""Std""ET4";
|
||||
const char STR_SUBTYPE_MT99[] = "\006""MT99\0 ""H7\0 ""YZ\0 ""LS\0 ""FY805";
|
||||
const char STR_SUBTYPE_MJXQ[] = "\007""WLH08\0 ""X600\0 ""X800\0 ""H26D\0 ""E010\0 ""H26WH\0 ""Phoenix";
|
||||
const char STR_SUBTYPE_FY326[] = "\005""Std\0 ""FY319";
|
||||
@@ -876,19 +894,29 @@ const char STR_SUBTYPE_Q2X2[] = "\004""Q222""Q242""Q282";
|
||||
const char STR_SUBTYPE_WK2x01[] = "\006""WK2801""WK2401""W6_5_1""W6_6_1""W6_HeL""W6_HeI";
|
||||
const char STR_SUBTYPE_Q303[] = "\006""Std\0 ""CX35\0 ""CX10D\0""CX10WD";
|
||||
const char STR_SUBTYPE_CABELL[] = "\007""V3\0 ""V3 Telm""-\0 ""-\0 ""-\0 ""-\0 ""F-Safe\0""Unbind\0";
|
||||
const char STR_SUBTYPE_ESKY150[] = "\003""4ch""7ch";
|
||||
const char STR_SUBTYPE_H83D[] = "\007""Std\0 ""H20H\0 ""H20Mini""H30Mini";
|
||||
const char STR_SUBTYPE_CORONA[] = "\005""V1\0 ""V2\0 ""FD V3";
|
||||
const char STR_SUBTYPE_HITEC[] = "\007""Optima\0""Opt Hub""Minima\0";
|
||||
const char STR_SUBTYPE_WFLY[] = "\006""WFR0xS";
|
||||
const char STR_SUBTYPE_BUGS_MINI[] = "\006""Std\0 ""Bugs3H";
|
||||
const char STR_SUBTYPE_TRAXXAS[] = "\004""6519";
|
||||
const char STR_SUBTYPE_E01X[] = "\005""E012\0""E015\0""E016H";
|
||||
const char STR_SUBTYPE_V911S[] = "\004""Std\0""E119";
|
||||
const char STR_SUBTYPE_GD00X[] = "\005""GD_V1""GD_V2";
|
||||
const char STR_SUBTYPE_REDPINE[] = "\004""Fast""Slow";
|
||||
const char STR_SUBTYPE_POTENSIC[] = "\003""A20";
|
||||
const char STR_SUBTYPE_ZSX[] = "\007""280JJRC";
|
||||
const char STR_SUBTYPE_FLYZONE[] = "\005""FZ410";
|
||||
const char STR_SUBTYPE_FRSKYX_RX[] = "\007""RX\0 ""CloneTX";
|
||||
const char STR_SUBTYPE_FX816[] = "\003""P38";
|
||||
const char STR_SUBTYPE_ESKY150[] = "\003""4CH""7CH";
|
||||
const char STR_SUBTYPE_XK[] = "\004""X450""X420";
|
||||
const char STR_SUBTYPE_XN297DUMP[] = "\004""250K""1M\0 ""2M\0 ""AUTO";
|
||||
const char STR_SUBTYPE_FRSKYX2[] = "\011""D16\0 ""D16 8ch\0 ""LBT(EU)\0 ""LBT 8ch\0 ""D16Cloned";
|
||||
const char STR_SUBTYPE_FRSKYR9[] = "\007""915MHz\0""868MHz\0""915 8ch""868 8ch";
|
||||
const char STR_SUBTYPE_PROPEL[] = "\004""74-Z";
|
||||
const char STR_SUBTYPE_FRSKYL[] = "\010""LR12\0 ""LR12 6ch";
|
||||
const char STR_SUBTYPE_ESKY150V2[] = "\006""150 V2";
|
||||
|
||||
const char* mm_options_strings::options[] = {
|
||||
nullptr,
|
||||
@@ -906,7 +934,7 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
// Protocol as defined in pulses\modules_constants.h, number of sub_protocols - 1, Failsafe supported, Disable channel mapping supported, Subtype string, Option type
|
||||
{MODULE_SUBTYPE_MULTI_FLYSKY, 4, false, true, STR_SUBTYPE_FLYSKY, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_HUBSAN, 2, false, false, STR_SUBTYPE_HUBSAN, STR_MULTI_VIDFREQ},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKY, 5, false, false, STR_SUBTYPE_FRSKY, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKY, 7, false, false, STR_SUBTYPE_FRSKY, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_HISKY, 1, false, true, STR_SUBTYPE_HISKY, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_V2X2, 1, false, false, STR_SUBTYPE_V2X2, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_DSM2, 3, false, true, STR_SUBTYPE_DSM, STR_MULTI_MAX_THROW},
|
||||
@@ -914,14 +942,16 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{MODULE_SUBTYPE_MULTI_YD717, 4, false, false, STR_SUBTYPE_YD717, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_KN, 1, false, false, STR_SUBTYPE_KN, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_SYMAX, 1, false, false, STR_SUBTYPE_SYMAX, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_SLT, 4, false, true, STR_SUBTYPE_SLT, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_SLT, 4, false, true, STR_SUBTYPE_SLT, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_CX10, 6, false, false, STR_SUBTYPE_CX10, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_CG023, 1, false, false, STR_SUBTYPE_CG023, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_BAYANG, 4, false, false, STR_SUBTYPE_BAYANG, STR_MULTI_TELEMETRY},
|
||||
{MODULE_SUBTYPE_MULTI_ESky, 1, false, true, STR_SUBTYPE_ESky, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_MT99XX, 4, false, false, STR_SUBTYPE_MT99, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_MJXQ, 6, false, false, STR_SUBTYPE_MJXQ, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_FY326, 1, false, false, STR_SUBTYPE_FY326, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_SFHSS, 0, true, true, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_J6PRO, 0, false, true, NO_SUBTYPE, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_HONTAI, 3, false, false, STR_SUBTYPE_HONTAI, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_OLRS, 0, false, false, NO_SUBTYPE, STR_RF_POWER},
|
||||
{MODULE_SUBTYPE_MULTI_FS_AFHDS2A, 3, true, true, STR_SUBTYPE_AFHDS2A, STR_MULTI_SERVOFREQ},
|
||||
@@ -929,24 +959,32 @@ const mm_protocol_definition multi_protocols[] = {
|
||||
{MODULE_SUBTYPE_MULTI_WK_2X01, 5, false, true, STR_SUBTYPE_WK2x01, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_Q303, 3, false, false, STR_SUBTYPE_Q303, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_CABELL, 7, false, false, STR_SUBTYPE_CABELL, STR_MULTI_OPTION},
|
||||
{MODULE_SUBTYPE_MULTI_ESKY150, 1, false, false, STR_SUBTYPE_ESKY150, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_H83D, 3, false, false, STR_SUBTYPE_H83D, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_CORONA, 2, false, false, STR_SUBTYPE_CORONA, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_HITEC, 2, false, false, STR_SUBTYPE_HITEC, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_WFLY, 0, false, false, STR_SUBTYPE_WFLY, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_BUGS_MINI, 1, false, false, STR_SUBTYPE_BUGS_MINI, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_TRAXXAS, 0, false, false, STR_SUBTYPE_TRAXXAS, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_E01X, 2, false, false, STR_SUBTYPE_E01X, STR_MULTI_OPTION},
|
||||
{MODULE_SUBTYPE_MULTI_V911S, 1, false, false, STR_SUBTYPE_V911S, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_GD00X, 1, false, false, STR_SUBTYPE_GD00X, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_KF606, 0, false, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_REDPINE, 1, false, false, STR_SUBTYPE_REDPINE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_POTENSIC, 0, false, false, STR_SUBTYPE_POTENSIC, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_ZSX, 0, false, false, STR_SUBTYPE_ZSX, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FLYZONE, 0, false, false, STR_SUBTYPE_FLYZONE, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYX_RX, 0, false, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_ESky, 0, false, true, NO_SUBTYPE, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_J6PRO, 0, false, true, NO_SUBTYPE, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_ESKY150, 1, false, false, STR_SUBTYPE_ESKY150, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FX816, 0, false, false, STR_SUBTYPE_FX816, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYX_RX, 1, false, false, STR_SUBTYPE_FRSKYX_RX, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_HOTT, 0, true, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_FX816, 0, false, false, STR_SUBTYPE_FX816, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_XK, 1, false, false, STR_SUBTYPE_XK, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_XN297DUMP, 3, false, false, STR_SUBTYPE_XN297DUMP, STR_MULTI_RFCHAN},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYX2, 4, true, false, STR_SUBTYPE_FRSKYX2, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKY_R9, 3, true, false, STR_SUBTYPE_FRSKYR9, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_PROPEL, 0, false, false, STR_SUBTYPE_PROPEL, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYL, 1, false, false, STR_SUBTYPE_FRSKYL, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_SKYARTEC, 0, false, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_ESKY150V2, 0, false, true, STR_SUBTYPE_ESKY150V2, STR_MULTI_RFTUNE},
|
||||
{MM_RF_CUSTOM_SELECTED, 7, true, true, NO_SUBTYPE, STR_MULTI_OPTION},
|
||||
|
||||
// Sentinel and default for protocols not listed above (MM_RF_CUSTOM is 0xff)
|
||||
|
||||
@@ -137,6 +137,8 @@ void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value,
|
||||
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags flags=0);
|
||||
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
|
||||
|
||||
int convertMultiToOtx(int type);
|
||||
|
||||
void drawCurve(coord_t offset=0);
|
||||
|
||||
// model_setup Defines that are used in all uis in the same way
|
||||
@@ -145,7 +147,7 @@ void drawCurve(coord_t offset=0);
|
||||
|
||||
inline uint8_t MODULE_BIND_ROWS(int moduleIdx)
|
||||
{
|
||||
if (isModuleXJTD8(moduleIdx) || isModuleSBUS(moduleIdx))
|
||||
if (isModuleXJTD8(moduleIdx) || isModuleSBUS(moduleIdx) || IS_RX_MULTI(moduleIdx))
|
||||
return 1;
|
||||
|
||||
if (isModulePPM(moduleIdx) || isModulePXX1(moduleIdx) || isModulePXX2(moduleIdx) || isModuleDSM2(moduleIdx) || isModuleMultimodule(moduleIdx))
|
||||
@@ -156,7 +158,7 @@ inline uint8_t MODULE_BIND_ROWS(int moduleIdx)
|
||||
|
||||
inline uint8_t MODULE_CHANNELS_ROWS(int moduleIdx)
|
||||
{
|
||||
if (!IS_MODULE_ENABLED(moduleIdx))
|
||||
if (!IS_MODULE_ENABLED(moduleIdx) || IS_RX_MULTI(moduleIdx))
|
||||
return HIDDEN_ROW;
|
||||
|
||||
if (isModuleDSM2(moduleIdx) || isModuleCrossfire(moduleIdx) || isModuleSBUS(moduleIdx) || (isModuleMultimodule(moduleIdx) && g_model.moduleData[moduleIdx].getMultiProtocol() != MODULE_SUBTYPE_MULTI_DSM2))
|
||||
@@ -256,12 +258,14 @@ inline uint8_t MULTIMODULE_HASOPTIONS(uint8_t moduleIdx)
|
||||
return false;
|
||||
}
|
||||
|
||||
#define MULTIMODULE_MODULE_ROWS(moduleIdx) MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) ? (uint8_t) 0 : HIDDEN_ROW, MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) ? (uint8_t) 0 : HIDDEN_ROW, MULTI_DISABLE_CHAN_MAP_ROW(moduleIdx), // AUTOBIND, DISABLE TELEM, DISABLE CN.MAP
|
||||
#define MULTIMODULE_MODULE_ROWS(moduleIdx) (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) && !IS_RX_MULTI(moduleIdx)) ? (uint8_t) 0 : HIDDEN_ROW, (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) && !IS_RX_MULTI(moduleIdx)) ? (uint8_t) 0 : HIDDEN_ROW, MULTI_DISABLE_CHAN_MAP_ROW(moduleIdx), // AUTOBIND, DISABLE TELEM, DISABLE CN.MAP
|
||||
#define MULTIMODULE_TYPE_ROW(moduleIdx) isModuleMultimodule(moduleIdx) ? MULTIMODULE_RFPROTO_COLUMNS(moduleIdx) : HIDDEN_ROW,
|
||||
#define MULTIMODULE_STATUS_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? TITLE_ROW : HIDDEN_ROW, (isModuleMultimodule(moduleIdx) && getMultiSyncStatus(moduleIdx).isValid()) ? TITLE_ROW : HIDDEN_ROW,
|
||||
#define MULTIMODULE_MODE_ROWS(moduleIdx) (g_model.moduleData[moduleIdx].multi.customProto) ? (uint8_t) 3 : MULTIMODULE_HAS_SUBTYPE(moduleIdx) ? (uint8_t)2 : (uint8_t)1
|
||||
#define MULTIMODULE_TYPE_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? (uint8_t) 0 : HIDDEN_ROW,
|
||||
#define MULTIMODULE_SUBTYPE_ROWS(moduleIdx) isModuleMultimodule(moduleIdx) ? MULTIMODULE_RFPROTO_COLUMNS(moduleIdx) : HIDDEN_ROW,
|
||||
#define MULTIMODULE_OPTIONS_ROW(moduleIdx) (isModuleMultimodule(moduleIdx) && MULTIMODULE_HASOPTIONS(moduleIdx)) ? (uint8_t) 0: HIDDEN_ROW
|
||||
#define MODULE_POWER_ROW(moduleIdx) (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) || isModuleR9MNonAccess(moduleIdx)) ? (isModuleR9MLiteNonPro(moduleIdx) ? (isModuleR9M_FCC_VARIANT(moduleIdx) ? READONLY_ROW : (uint8_t)0) : (uint8_t)0) : HIDDEN_ROW
|
||||
#define MODULE_POWER_ROW(moduleIdx) (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx) || isModuleR9MNonAccess(moduleIdx)) ? (isModuleR9MLiteNonPro(moduleIdx) ? (isModuleR9M_FCC_VARIANT(moduleIdx) ? READONLY_ROW : (uint8_t)0) : (uint8_t)0) : HIDDEN_ROW
|
||||
|
||||
#else
|
||||
#define MULTIMODULE_STATUS_ROWS(moduleIdx)
|
||||
|
||||
@@ -316,9 +316,9 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||
if (menuTab && !menuCalibrationState) {
|
||||
int cc = curr;
|
||||
switch (event) {
|
||||
#if defined(PCBX12S)
|
||||
#if defined(KEYS_GPIO_REG_PGUP)
|
||||
case EVT_KEY_FIRST(KEY_PGDN):
|
||||
#elif defined(PCBX10)
|
||||
#else
|
||||
case EVT_KEY_BREAK(KEY_PGDN):
|
||||
#endif
|
||||
if (s_editMode>0)
|
||||
@@ -328,8 +328,9 @@ bool check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||
cc = 0;
|
||||
break;
|
||||
|
||||
#if defined(KEYS_GPIO_REG_PGUP)
|
||||
case EVT_KEY_FIRST(KEY_PGUP):
|
||||
#if defined(PCBX10)
|
||||
#else
|
||||
case EVT_KEY_LONG(KEY_PGDN):
|
||||
#endif
|
||||
if (s_editMode>0)
|
||||
|
||||
@@ -45,30 +45,52 @@ enum FrskyFirmwareModuleProductId {
|
||||
|
||||
enum FrskyFirmwareReceiverProductId {
|
||||
FIRMWARE_ID_RECEIVER_NONE,
|
||||
FIRMWARE_ID_RECEIVER_ARCHER = 0xC0, // TODO use the right constant
|
||||
FIRMWARE_ID_RECEIVER_R9MX = 0xF0, // TODO use the right constant
|
||||
// TODO fill the table
|
||||
|
||||
FIRMWARE_ID_RECEIVER_X8R = 0x01,
|
||||
FIRMWARE_ID_RECEIVER_RX8R = 0x02,
|
||||
FIRMWARE_ID_RECEIVER_RX8R_PRO = 0x03,
|
||||
FIRMWARE_ID_RECEIVER_RX6R = 0x04,
|
||||
FIRMWARE_ID_RECEIVER_RX4R = 0x05,
|
||||
FIRMWARE_ID_RECEIVER_G_RX8 = 0x06,
|
||||
FIRMWARE_ID_RECEIVER_G_RX6 = 0x07,
|
||||
FIRMWARE_ID_RECEIVER_X6R = 0x08,
|
||||
FIRMWARE_ID_RECEIVER_X4R = 0x09,
|
||||
FIRMWARE_ID_RECEIVER_X4R_SB = 0x0A,
|
||||
FIRMWARE_ID_RECEIVER_XSR = 0x0B,
|
||||
FIRMWARE_ID_RECEIVER_XSR_M = 0x0C,
|
||||
FIRMWARE_ID_RECEIVER_RXSR = 0x0D,
|
||||
FIRMWARE_ID_RECEIVER_S6R = 0x0E,
|
||||
FIRMWARE_ID_RECEIVER_S8R = 0x0F,
|
||||
FIRMWARE_ID_RECEIVER_XM = 0x10,
|
||||
FIRMWARE_ID_RECEIVER_XMP = 0x11,
|
||||
FIRMWARE_ID_RECEIVER_XMR = 0x12,
|
||||
FIRMWARE_ID_RECEIVER_R9 = 0x13,
|
||||
FIRMWARE_ID_RECEIVER_R9_SLIM = 0x14,
|
||||
FIRMWARE_ID_RECEIVER_R9_SLIMP = 0x15,
|
||||
FIRMWARE_ID_RECEIVER_R9_MINI = 0x16,
|
||||
FIRMWARE_ID_RECEIVER_R9_MM = 0x17,
|
||||
FIRMWARE_ID_RECEIVER_R9_STAB = 0x18, // R9_STAB has OTA
|
||||
FIRMWARE_ID_RECEIVER_R9_MINI_OTA = 0x19, // this one has OTA (different bootloader)
|
||||
FIRMWARE_ID_RECEIVER_R9_MM_OTA = 0x1A, // this one has OTA (different bootloader)
|
||||
FIRMWARE_ID_RECEIVER_R9_SLIMP_OTA = 0x1B, // this one has OTA (different bootloader)
|
||||
FIRMWARE_ID_RECEIVER_ARCHER_X = 0x1C, // this one has OTA (internal module)
|
||||
FIRMWARE_ID_RECEIVER_R9MX = 0x1D, // this one has OTA
|
||||
FIRMWARE_ID_RECEIVER_R9SX = 0x1E, // this one has OTA
|
||||
};
|
||||
|
||||
inline bool isReceiverOTAEnabledFromModule(uint8_t moduleIdx, uint8_t productId)
|
||||
{
|
||||
switch (productId) {
|
||||
case FIRMWARE_ID_RECEIVER_ARCHER:
|
||||
case FIRMWARE_ID_RECEIVER_ARCHER_X:
|
||||
return isModuleISRM(moduleIdx);
|
||||
|
||||
case FIRMWARE_ID_RECEIVER_R9_STAB:
|
||||
case FIRMWARE_ID_RECEIVER_R9_MINI_OTA:
|
||||
case FIRMWARE_ID_RECEIVER_R9_MM_OTA:
|
||||
case FIRMWARE_ID_RECEIVER_R9_SLIMP_OTA:
|
||||
case FIRMWARE_ID_RECEIVER_R9MX:
|
||||
case FIRMWARE_ID_RECEIVER_R9SX:
|
||||
return isModuleR9M(moduleIdx);
|
||||
|
||||
// TODO add all those OTA receivers here
|
||||
|
||||
/*
|
||||
"R9-MINI-OTA", // this one has OTA (different bootloader)
|
||||
"R9-MM-OTA", // this one has OTA (different bootloader)
|
||||
"R9-SLIM+-OTA", // this one has OTA (different bootloader)
|
||||
"R9SX", // this one has OTA
|
||||
*/
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class MultiFirmwareInformation {
|
||||
|
||||
bool isMultiInternalFirmware() const
|
||||
{
|
||||
return (boardType == FIRMWARE_MULTI_STM && telemetryInversion == false && optibootSupport == true && bootloaderCheck == true && telemetryType == FIRMWARE_MULTI_TELEM_MULTI_TELEMETRY);
|
||||
return (boardType == FIRMWARE_MULTI_STM && optibootSupport == true && bootloaderCheck == true && telemetryType == FIRMWARE_MULTI_TELEM_MULTI_TELEMETRY);
|
||||
}
|
||||
|
||||
bool isMultiExternalFirmware() const
|
||||
|
||||
@@ -71,9 +71,7 @@ const char * logsOpen()
|
||||
if (!len && filename[i])
|
||||
len = i+1;
|
||||
if (len) {
|
||||
if (filename[i])
|
||||
filename[i] = zchar2char(filename[i]);
|
||||
else
|
||||
if (!filename[i])
|
||||
filename[i] = '_';
|
||||
}
|
||||
i--;
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
{ "EVT_"#xxx"_LONG", EVT_KEY_LONG(yyy) }, \
|
||||
{ "EVT_"#xxx"_REPT", EVT_KEY_REPT(yyy) }
|
||||
|
||||
#if defined(LUA) && !defined(CLI)
|
||||
Fifo<uint8_t, LUA_FIFO_SIZE> * luaRxFifo = nullptr;
|
||||
#endif
|
||||
|
||||
/*luadoc
|
||||
@function getVersion()
|
||||
|
||||
@@ -694,7 +698,8 @@ The list of valid sources is available:
|
||||
|----------------|-------|
|
||||
| 2.0 | [all](http://downloads-20.open-tx.org/firmware/lua_fields.txt) |
|
||||
| 2.1 | [X9D and X9D+](http://downloads-21.open-tx.org/firmware/lua_fields_taranis.txt), [X9E](http://downloads-21.open-tx.org/firmware/lua_fields_taranis_x9e.txt) |
|
||||
| 2.2 | [X9D and X9D+](http://downloads.open-tx.org/2.2/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.2/firmware/lua_fields_x9e.txt), [Horus](http://downloads.open-tx.org/2.2/firmware/lua_fields_x12s.txt) |
|
||||
| 2.2 | [X9D and X9D+](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x9e.txt), [Horus](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x12s.txt) |
|
||||
| 2.3 | [X9D and X9D+](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x9e.txt), [X7](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x7.txt), [Horus](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x12s.txt) |
|
||||
|
||||
@param name (string) name of the field
|
||||
|
||||
@@ -741,8 +746,8 @@ The list of fixed sources:
|
||||
|----------------|-------|
|
||||
| 2.0 | [all](http://downloads-20.open-tx.org/firmware/lua_fields.txt) |
|
||||
| 2.1 | [X9D and X9D+](http://downloads-21.open-tx.org/firmware/lua_fields_taranis.txt), [X9E](http://downloads-21.open-tx.org/firmware/lua_fields_taranis_x9e.txt) |
|
||||
| 2.2 | [X9D and X9D+](http://downloads.open-tx.org/2.2/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.2/firmware/lua_fields_x9e.txt), [Horus](http://downloads.open-tx.org/2.2/firmware/lua_fields_x12s.txt) |
|
||||
|
||||
| 2.2 | [X9D and X9D+](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x9e.txt), [Horus](http://downloads.open-tx.org/2.2/release/firmware/lua_fields_x12s.txt) |
|
||||
| 2.3 | [X9D and X9D+](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x9d.txt), [X9E](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x9e.txt), [X7](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x7.txt), [Horus](http://downloads.open-tx.org/2.3/release/firmware/lua_fields_x12s.txt) |
|
||||
|
||||
In OpenTX 2.1.x the telemetry sources no longer have a predefined name.
|
||||
To get a telemetry value simply use it's sensor name. For example:
|
||||
@@ -1206,11 +1211,14 @@ static int luaPopupWarning(lua_State * L)
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function popupConfirmation(title, event)
|
||||
@function popupConfirmation(title, event) deprecated, please replace by
|
||||
@function popupConfirmation(title, message, event)
|
||||
|
||||
Raises a pop-up on screen that asks for confirmation
|
||||
|
||||
@param title (string) text to display
|
||||
@param title (string) title to display
|
||||
|
||||
@param message (string) text to display
|
||||
|
||||
@param event (number) the event variable that is passed in from the
|
||||
Run function (key pressed)
|
||||
@@ -1219,13 +1227,24 @@ Run function (key pressed)
|
||||
|
||||
@notice Use only from stand-alone and telemetry scripts.
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
@status current Introduced in 2.2.0, changed to (title, message, event) in 2.3.8
|
||||
*/
|
||||
static int luaPopupConfirmation(lua_State * L)
|
||||
{
|
||||
event_t event = luaL_checkinteger(L, 2);
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
warningType = WARNING_TYPE_CONFIRM;
|
||||
event_t event;
|
||||
|
||||
if (lua_isnone(L, 3)) {
|
||||
// only two args: deprecated mode
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
event = luaL_checkinteger(L, 2);
|
||||
}
|
||||
else {
|
||||
warningText = luaL_checkstring(L, 1);
|
||||
warningInfoText = luaL_checkstring(L, 2);
|
||||
event = luaL_optinteger(L, 3, 0);
|
||||
}
|
||||
|
||||
runPopupWarning(event);
|
||||
if (!warningText) {
|
||||
lua_pushstring(L, warningResult ? "OK" : "CANCEL");
|
||||
@@ -1586,6 +1605,13 @@ static int luaSerialWrite(lua_State * L)
|
||||
while(wr_len--) auxSerialPutc(*p++);
|
||||
}
|
||||
#endif
|
||||
#if defined(AUX2_SERIAL)
|
||||
if (aux2SerialMode == UART_MODE_LUA) {
|
||||
size_t wr_len = len;
|
||||
const char* p = str;
|
||||
while(wr_len--) aux2SerialPutc(*p++);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
debugPrintf("luaSerialWrite: %.*s",len,str);
|
||||
#endif
|
||||
@@ -1593,6 +1619,58 @@ static int luaSerialWrite(lua_State * L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function serialRead([num])
|
||||
@param num (optional): maximum number of bytes to read.
|
||||
If non-zero, serialRead will read up to num characters from the buffer.
|
||||
If 0 or left out, serialRead will read up to and including the first newline character or the end of the buffer.
|
||||
Note that the returned string may not end in a newline if this character is not present in the buffer.
|
||||
|
||||
@retval str string. Empty if no new characters were available.
|
||||
|
||||
Reads characters from the serial port. The string is allowed to contain any character, including 0.
|
||||
|
||||
@status current Introduced in 2.3.8
|
||||
*/
|
||||
static int luaSerialRead(lua_State * L)
|
||||
{
|
||||
#if defined(LUA) && !defined(CLI)
|
||||
int num = luaL_optunsigned(L, 1, 0);
|
||||
|
||||
if (!luaRxFifo) {
|
||||
luaRxFifo = new Fifo<uint8_t, LUA_FIFO_SIZE>();
|
||||
if (!luaRxFifo) {
|
||||
lua_pushlstring(L, "", 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
uint8_t str[LUA_FIFO_SIZE];
|
||||
uint8_t *p = str;
|
||||
while (luaRxFifo->pop(*p)) {
|
||||
p++; // increment only when pop was successful
|
||||
if (p - str >= LUA_FIFO_SIZE) {
|
||||
// buffer full
|
||||
break;
|
||||
}
|
||||
if (num == 0) {
|
||||
if (*(p - 1) == '\n' || *(p - 1) == '\r') {
|
||||
// found newline
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (p - str >= num) {
|
||||
// requested number of characters reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
lua_pushlstring(L, (const char*)str, p - str);
|
||||
#else
|
||||
lua_pushlstring(L, "", 0);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg opentxLib[] = {
|
||||
{ "getTime", luaGetTime },
|
||||
{ "getDateTime", luaGetDateTime },
|
||||
@@ -1640,6 +1718,7 @@ const luaL_Reg opentxLib[] = {
|
||||
{ "multiBuffer", luaMultiBuffer },
|
||||
#endif
|
||||
{ "serialWrite", luaSerialWrite },
|
||||
{ "serialRead", luaSerialRead },
|
||||
{ nullptr, nullptr } /* sentinel */
|
||||
};
|
||||
|
||||
@@ -1649,6 +1728,9 @@ const luaR_value_entry opentxConstants[] = {
|
||||
{ "DBLSIZE", DBLSIZE },
|
||||
{ "MIDSIZE", MIDSIZE },
|
||||
{ "SMLSIZE", SMLSIZE },
|
||||
#if defined(COLORLCD)
|
||||
{ "TINSIZE", TINSIZE },
|
||||
#endif
|
||||
{ "INVERS", INVERS },
|
||||
{ "BOLD", BOLD },
|
||||
{ "BLINK", BLINK },
|
||||
@@ -1790,9 +1872,7 @@ const luaR_value_entry opentxConstants[] = {
|
||||
{ "EVT_VIRTUAL_EXIT", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_EXIT)
|
||||
{ "EVT_EXIT_BREAK", EVT_KEY_BREAK(KEY_EXIT) },
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIO_REG_ENTER)
|
||||
KEY_EVENTS(ENTER, KEY_ENTER),
|
||||
@@ -1875,8 +1955,6 @@ const luaR_value_entry opentxConstants[] = {
|
||||
{ "PLAY_BACKGROUND", PLAY_BACKGROUND },
|
||||
{ "TIMEHOUR", TIMEHOUR },
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
// Adding the unit consts for the set Telemetry function adds about 1k of flash usage
|
||||
{"UNIT_RAW", UNIT_RAW },
|
||||
{"UNIT_VOLTS", UNIT_VOLTS },
|
||||
{"UNIT_AMPS", UNIT_AMPS },
|
||||
@@ -1910,6 +1988,6 @@ const luaR_value_entry opentxConstants[] = {
|
||||
{"UNIT_GPS", UNIT_GPS},
|
||||
{"UNIT_BITFIELD", UNIT_BITFIELD},
|
||||
{"UNIT_TEXT", UNIT_TEXT},
|
||||
#endif
|
||||
|
||||
{ nullptr, 0 } /* sentinel */
|
||||
};
|
||||
|
||||
@@ -62,6 +62,20 @@ static int luaLcdClear(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.resetBacklightTimeout()
|
||||
|
||||
Reset the backlight timeout
|
||||
|
||||
@status current Introduced in 2.3.6
|
||||
*/
|
||||
static int luaLcdResetBacklightTimeout(lua_State * L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
resetBacklightTimeout();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*luadoc
|
||||
@function lcd.drawPoint(x, y)
|
||||
|
||||
@@ -861,6 +875,7 @@ static int luaRGB(lua_State *L)
|
||||
const luaL_Reg lcdLib[] = {
|
||||
{ "refresh", luaLcdRefresh },
|
||||
{ "clear", luaLcdClear },
|
||||
{ "resetBacklightTimeout", luaLcdResetBacklightTimeout },
|
||||
{ "drawPoint", luaLcdDrawPoint },
|
||||
{ "drawLine", luaLcdDrawLine },
|
||||
{ "drawRectangle", luaLcdDrawRectangle },
|
||||
|
||||
@@ -86,7 +86,24 @@ static int luaModelSetInfo(lua_State *L)
|
||||
|
||||
Get RF module parameters
|
||||
|
||||
`subType` values:
|
||||
`Type` values:
|
||||
* 0 NONE
|
||||
* 1 PPM
|
||||
* 2 XJT_PXX1
|
||||
* 3 ISRM_PXX2
|
||||
* 4 DSM2
|
||||
* 5 CROSSFIRE
|
||||
* 6 MULTIMODULE
|
||||
* 7 R9M_PXX1
|
||||
* 8 R9M_PXX2
|
||||
* 9 R9M_LITE_PXX1
|
||||
* 10 R9M_LITE_PXX2
|
||||
* 11 R9M_LITE_PRO_PXX1
|
||||
* 12 R9M_LITE_PRO_PXX2
|
||||
* 13 SBUS
|
||||
* 14 XJT_LITE_PXX2
|
||||
|
||||
`subType` values for XJT_PXX1:
|
||||
* -1 OFF
|
||||
* 0 D16
|
||||
* 1 D8
|
||||
@@ -101,6 +118,11 @@ Get RF module parameters
|
||||
* `modelId` (number) receiver number
|
||||
* `firstChannel` (number) start channel (0 is CH1)
|
||||
* `channelsCount` (number) number of channels sent to module
|
||||
* `Type` (number) module type
|
||||
* if the module type is Multi additional information are available
|
||||
* `protocol` (number) protocol number
|
||||
* `subProtocol` (number) sub-protocol number
|
||||
* `channelsOrder` (number) first 4 channels expected order
|
||||
|
||||
@status current Introduced in TODO
|
||||
*/
|
||||
@@ -114,6 +136,25 @@ static int luaModelGetModule(lua_State *L)
|
||||
lua_pushtableinteger(L, "modelId", g_model.header.modelId[idx]);
|
||||
lua_pushtableinteger(L, "firstChannel", module.channelsStart);
|
||||
lua_pushtableinteger(L, "channelsCount", module.channelsCount + 8);
|
||||
lua_pushtableinteger(L, "Type", module.type);
|
||||
#if defined(MULTIMODULE)
|
||||
if (module.type == MODULE_TYPE_MULTIMODULE) {
|
||||
int protocol = g_model.moduleData[idx].getMultiProtocol() + 1;
|
||||
int subprotocol = g_model.moduleData[idx].subType;
|
||||
convertOtxProtocolToMulti(&protocol, &subprotocol); // Special treatment for the FrSky entry...
|
||||
lua_pushtableinteger(L, "protocol", protocol);
|
||||
lua_pushtableinteger(L, "subProtocol", subprotocol);
|
||||
if (getMultiModuleStatus(idx).isValid()) {
|
||||
if (getMultiModuleStatus(idx).ch_order == 0xFF)
|
||||
lua_pushtableinteger(L, "channelsOrder", -1);
|
||||
else
|
||||
lua_pushtableinteger(L, "channelsOrder", getMultiModuleStatus(idx).ch_order);
|
||||
}
|
||||
else {
|
||||
lua_pushtableinteger(L, "channelsOrder", -1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
|
||||
@@ -41,6 +41,11 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CLI) || defined(AUX2_SERIAL)
|
||||
#define LUA_FIFO_SIZE 256
|
||||
extern Fifo<uint8_t, LUA_FIFO_SIZE> * luaRxFifo;
|
||||
#endif
|
||||
|
||||
extern lua_State * lsScripts;
|
||||
extern lua_State * lsWidgets;
|
||||
extern bool luaLcdAllowed;
|
||||
|
||||
@@ -457,7 +457,7 @@ void evalInputs(uint8_t mode)
|
||||
if (mode == e_perout_mode_normal) {
|
||||
if (tmp==0 || (tmp==1 && (bpanaCenter & mask))) {
|
||||
anaCenter |= mask;
|
||||
if ((g_model.beepANACenter & mask) && !(bpanaCenter & mask) && !menuCalibrationState) {
|
||||
if ((g_model.beepANACenter & mask) && !(bpanaCenter & mask) && s_mixer_first_run_done && !menuCalibrationState) {
|
||||
if (!IS_POT(i) || IS_POT_SLIDER_AVAILABLE(i)) {
|
||||
AUDIO_POT_MIDDLE(i);
|
||||
}
|
||||
@@ -893,9 +893,7 @@ void evalMixes(uint8_t tick10ms)
|
||||
|
||||
static uint16_t fp_act[MAX_FLIGHT_MODES] = {0};
|
||||
static uint16_t delta = 0;
|
||||
static ACTIVE_PHASES_TYPE flightModesFade = 0;
|
||||
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
static uint16_t flightModesFade = 0;
|
||||
|
||||
uint8_t fm = getFlightMode();
|
||||
|
||||
@@ -907,7 +905,7 @@ void evalMixes(uint8_t tick10ms)
|
||||
}
|
||||
else {
|
||||
uint8_t fadeTime = max(g_model.flightModeData[lastFlightMode].fadeOut, g_model.flightModeData[fm].fadeIn);
|
||||
ACTIVE_PHASES_TYPE transitionMask = ((ACTIVE_PHASES_TYPE)1 << lastFlightMode) + ((ACTIVE_PHASES_TYPE)1 << fm);
|
||||
uint16_t transitionMask = (0x01u << lastFlightMode) + (0x01u << fm);
|
||||
if (fadeTime) {
|
||||
flightModesFade |= transitionMask;
|
||||
delta = (MAX_ACT / 10) / fadeTime;
|
||||
@@ -937,15 +935,13 @@ void evalMixes(uint8_t tick10ms)
|
||||
if (flightModesFade) {
|
||||
memclear(sum_chans512, sizeof(sum_chans512));
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
if (flightModesFade & ((ACTIVE_PHASES_TYPE)1 << p)) {
|
||||
if (flightModesFade & (0x01 << p)) {
|
||||
mixerCurrentFlightMode = p;
|
||||
evalFlightModeMixes(p==fm ? e_perout_mode_normal : e_perout_mode_inactive_flight_mode, p==fm ? tick10ms : 0);
|
||||
for (uint8_t i=0; i<MAX_OUTPUT_CHANNELS; i++)
|
||||
sum_chans512[i] += (chans[i] >> 4) * fp_act[p];
|
||||
weight += fp_act[p];
|
||||
}
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
}
|
||||
assert(weight);
|
||||
mixerCurrentFlightMode = fm;
|
||||
@@ -986,7 +982,7 @@ void evalMixes(uint8_t tick10ms)
|
||||
if (tick10ms && flightModesFade) {
|
||||
uint16_t tick_delta = delta * tick10ms;
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
ACTIVE_PHASES_TYPE flightModeMask = ((ACTIVE_PHASES_TYPE)1 << p);
|
||||
uint16_t flightModeMask = (0x01 << p);
|
||||
if (flightModesFade & flightModeMask) {
|
||||
if (p == fm) {
|
||||
if (MAX_ACT - fp_act[p] > tick_delta)
|
||||
|
||||
@@ -303,9 +303,7 @@ void generalDefault()
|
||||
g_eeGeneral.stickMode = DEFAULT_MODE - 1;
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_RELEASE)
|
||||
g_eeGeneral.templateSetup = 17; /* TAER */
|
||||
#endif
|
||||
g_eeGeneral.templateSetup = DEFAULT_TEMPLATE_SETUP;
|
||||
|
||||
g_eeGeneral.backlightMode = e_backlight_mode_all;
|
||||
g_eeGeneral.lightAutoOff = 2;
|
||||
@@ -510,11 +508,7 @@ void modelDefault(uint8_t id)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(EEPROM)
|
||||
strcpy(g_model.header.name, "Model");
|
||||
g_model.header.name[5] = '0' + id / 10;
|
||||
g_model.header.name[6] = '0' + id % 10;
|
||||
#endif
|
||||
strAppendUnsigned(strAppend(g_model.header.name, STR_MODEL), id + 1, 2);
|
||||
|
||||
#if defined(COLORLCD)
|
||||
extern const LayoutFactory * defaultLayout;
|
||||
@@ -696,7 +690,7 @@ void checkBacklight()
|
||||
if (inputsMoved()) {
|
||||
inactivity.counter = 0;
|
||||
if (g_eeGeneral.backlightMode & e_backlight_mode_sticks) {
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +703,7 @@ void checkBacklight()
|
||||
}
|
||||
}
|
||||
|
||||
void backlightOn()
|
||||
void resetBacklightTimeout()
|
||||
{
|
||||
lightOffCounter = ((uint16_t)g_eeGeneral.lightAutoOff*250) << 1;
|
||||
}
|
||||
@@ -736,7 +730,7 @@ void doSplash()
|
||||
#endif
|
||||
|
||||
if (SPLASH_NEEDED()) {
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
drawSplash();
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
@@ -1999,6 +1993,10 @@ void opentxInit()
|
||||
auxSerialInit(g_eeGeneral.auxSerialMode, modelTelemetryProtocol());
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
aux2SerialInit(g_eeGeneral.aux2SerialMode, modelTelemetryProtocol());
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
getMovedSwitch();
|
||||
if (TRIMS_PRESSED() && g_eeGeneral.switchUnlockStates==switches_states) {
|
||||
@@ -2034,7 +2032,7 @@ void opentxInit()
|
||||
|
||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) {
|
||||
// on Tx start turn the light on
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
}
|
||||
|
||||
if (!globalData.unexpectedShutdown) {
|
||||
@@ -2052,7 +2050,7 @@ void opentxInit()
|
||||
lcdSetContrast();
|
||||
#endif
|
||||
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
|
||||
startPulses();
|
||||
|
||||
|
||||
@@ -21,11 +21,7 @@
|
||||
#ifndef _OPENTX_H_
|
||||
#define _OPENTX_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "definitions.h"
|
||||
#include "opentx_types.h"
|
||||
#include "debounce.h"
|
||||
@@ -434,7 +430,6 @@ char char2lower(char c);
|
||||
int8_t char2zchar(char c);
|
||||
void str2zchar(char *dest, const char *src, int size);
|
||||
int zchar2str(char *dest, const char *src, int size);
|
||||
bool cmpStrWithZchar(const char * charString, const char * zcharString, int size);
|
||||
|
||||
#include "keys.h"
|
||||
#include "pwr.h"
|
||||
@@ -519,7 +514,6 @@ void logicalSwitchesReset();
|
||||
|
||||
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||
|
||||
#if defined(PCBFRSKY) || defined(PCBFLYSKY)
|
||||
void getSwitchesPosition(bool startup);
|
||||
@@ -564,34 +558,8 @@ bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||
|
||||
#include "gvars.h"
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
extern uint16_t s_timeCumThr;
|
||||
extern uint16_t s_timeCum16ThrP;
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
||||
#endif
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
extern uint8_t trimsDisplayTimer;
|
||||
extern uint8_t trimsDisplayMask;
|
||||
|
||||
void flightReset(uint8_t check=true);
|
||||
|
||||
PACK(struct GlobalData {
|
||||
uint8_t unexpectedShutdown:1;
|
||||
uint8_t externalAntennaEnabled:1;
|
||||
uint8_t authenticationCount:2;
|
||||
uint8_t upgradeModulePopup:1;
|
||||
uint8_t internalModuleVersionChecked:1;
|
||||
uint8_t spare:2;
|
||||
});
|
||||
|
||||
extern GlobalData globalData;
|
||||
|
||||
extern uint16_t maxMixerDuration;
|
||||
|
||||
#define DURATION_MS_PREC2(x) ((x)/20)
|
||||
|
||||
#if defined(THRTRACE)
|
||||
@@ -652,7 +620,7 @@ static inline void GET_ADC_IF_MIXER_NOT_RUNNING()
|
||||
|
||||
#include "sbus.h"
|
||||
|
||||
void backlightOn();
|
||||
void resetBacklightTimeout();
|
||||
void checkBacklight();
|
||||
|
||||
uint16_t isqrt32(uint32_t n);
|
||||
@@ -733,14 +701,9 @@ extern const char vers_stamp[];
|
||||
const char * getOtherVersion(char * buffer);
|
||||
|
||||
#define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms)
|
||||
extern uint8_t g_beepCnt;
|
||||
|
||||
#include "trainer.h"
|
||||
|
||||
extern int32_t chans[MAX_OUTPUT_CHANNELS];
|
||||
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
|
||||
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
||||
|
||||
int expo(int x, int k);
|
||||
|
||||
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
|
||||
@@ -813,33 +776,15 @@ int16_t applyLimits(uint8_t channel, int32_t value);
|
||||
void evalInputs(uint8_t mode);
|
||||
uint16_t anaIn(uint8_t chan);
|
||||
|
||||
extern int16_t calibratedAnalogs[NUM_CALIBRATED_ANALOGS];
|
||||
|
||||
#define FLASH_DURATION 20 /*200ms*/
|
||||
|
||||
extern uint8_t beepAgain;
|
||||
extern uint16_t lightOffCounter;
|
||||
extern uint8_t flashCounter;
|
||||
extern uint8_t mixWarning;
|
||||
|
||||
FlightModeData * flightModeAddress(uint8_t idx);
|
||||
ExpoData * expoAddress(uint8_t idx);
|
||||
MixData * mixAddress(uint8_t idx);
|
||||
LimitData * limitAddress(uint8_t idx);
|
||||
LogicalSwitchData * lswAddress(uint8_t idx);
|
||||
|
||||
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
||||
// It's also easier to initialize them here.
|
||||
extern int8_t virtualInputsTrims[MAX_INPUTS];
|
||||
|
||||
extern int16_t anas [MAX_INPUTS];
|
||||
extern int16_t trims[NUM_TRIMS];
|
||||
extern BeepANACenter bpanaCenter;
|
||||
|
||||
extern uint8_t s_mixer_first_run_done;
|
||||
|
||||
void applyDefaultTemplate();
|
||||
|
||||
void instantTrim();
|
||||
void evalTrims();
|
||||
void copyTrimsToOffset(uint8_t ch);
|
||||
@@ -847,20 +792,6 @@ void copySticksToOffset(uint8_t ch);
|
||||
void copyMinMaxToOutputs(uint8_t ch);
|
||||
void moveTrimsToOffsets();
|
||||
|
||||
typedef uint16_t ACTIVE_PHASES_TYPE;
|
||||
#define DELAY_POS_MARGIN 3
|
||||
typedef int16_t delayval_t;
|
||||
PACK(struct SwOn {
|
||||
uint16_t delay:14; // max = 2550
|
||||
uint8_t activeMix:1;
|
||||
uint8_t activeExpo:1;
|
||||
int16_t now; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
int16_t prev;
|
||||
});
|
||||
|
||||
extern SwOn swOn[MAX_MIXERS];
|
||||
extern int32_t act[MAX_MIXERS];
|
||||
|
||||
inline bool isExpoActive(uint8_t expo)
|
||||
{
|
||||
return swOn[expo].activeExpo;
|
||||
@@ -1028,15 +959,6 @@ void setMFP();
|
||||
void clearMFP();
|
||||
#endif
|
||||
|
||||
extern uint8_t requiredSpeakerVolume;
|
||||
|
||||
enum MainRequest {
|
||||
REQUEST_SCREENSHOT,
|
||||
REQUEST_FLIGHT_RESET,
|
||||
};
|
||||
|
||||
extern uint8_t mainRequestFlags;
|
||||
|
||||
void checkBattery();
|
||||
void opentxClose(uint8_t shutdown=true);
|
||||
void opentxInit();
|
||||
|
||||
@@ -53,6 +53,9 @@ static const char * options[] = {
|
||||
#if defined(HORUS_STICKS)
|
||||
"horussticks",
|
||||
#endif
|
||||
#if defined(INTERNAL_GPS)
|
||||
"internalgps",
|
||||
#endif
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
"internalppm",
|
||||
#endif
|
||||
|
||||
@@ -103,62 +103,75 @@ enum ModuleSubtypeR9M {
|
||||
enum ModuleSubtypeMulti {
|
||||
MODULE_SUBTYPE_MULTI_FIRST = 0,
|
||||
MODULE_SUBTYPE_MULTI_FLYSKY = MODULE_SUBTYPE_MULTI_FIRST,
|
||||
MODULE_SUBTYPE_MULTI_HUBSAN,
|
||||
MODULE_SUBTYPE_MULTI_FRSKY,
|
||||
MODULE_SUBTYPE_MULTI_HISKY,
|
||||
MODULE_SUBTYPE_MULTI_V2X2,
|
||||
MODULE_SUBTYPE_MULTI_DSM2,
|
||||
MODULE_SUBTYPE_MULTI_HUBSAN, //1
|
||||
MODULE_SUBTYPE_MULTI_FRSKY, //2
|
||||
MODULE_SUBTYPE_MULTI_HISKY, //3
|
||||
MODULE_SUBTYPE_MULTI_V2X2, //4
|
||||
MODULE_SUBTYPE_MULTI_DSM2, //5
|
||||
MODULE_SUBTYPE_MULTI_DEVO,
|
||||
MODULE_SUBTYPE_MULTI_YD717,
|
||||
MODULE_SUBTYPE_MULTI_KN,
|
||||
MODULE_SUBTYPE_MULTI_SYMAX,
|
||||
MODULE_SUBTYPE_MULTI_SLT,
|
||||
MODULE_SUBTYPE_MULTI_SLT, //10
|
||||
MODULE_SUBTYPE_MULTI_CX10,
|
||||
MODULE_SUBTYPE_MULTI_CG023,
|
||||
MODULE_SUBTYPE_MULTI_BAYANG,
|
||||
MODULE_SUBTYPE_MULTI_ESky,
|
||||
MODULE_SUBTYPE_MULTI_MT99XX,
|
||||
MODULE_SUBTYPE_MULTI_MT99XX, //15
|
||||
MODULE_SUBTYPE_MULTI_MJXQ,
|
||||
MODULE_SUBTYPE_MULTI_SHENQI,
|
||||
MODULE_SUBTYPE_MULTI_FY326,
|
||||
MODULE_SUBTYPE_MULTI_SFHSS,
|
||||
MODULE_SUBTYPE_MULTI_J6PRO,
|
||||
MODULE_SUBTYPE_MULTI_J6PRO, //20
|
||||
MODULE_SUBTYPE_MULTI_FQ777,
|
||||
MODULE_SUBTYPE_MULTI_ASSAN,
|
||||
MODULE_SUBTYPE_MULTI_HONTAI,
|
||||
MODULE_SUBTYPE_MULTI_OLRS,
|
||||
MODULE_SUBTYPE_MULTI_FS_AFHDS2A,
|
||||
MODULE_SUBTYPE_MULTI_FS_AFHDS2A, //25
|
||||
MODULE_SUBTYPE_MULTI_Q2X2,
|
||||
MODULE_SUBTYPE_MULTI_WK_2X01,
|
||||
MODULE_SUBTYPE_MULTI_Q303,
|
||||
MODULE_SUBTYPE_MULTI_GW008,
|
||||
MODULE_SUBTYPE_MULTI_DM002,
|
||||
MODULE_SUBTYPE_MULTI_DM002, //30
|
||||
MODULE_SUBTYPE_MULTI_CABELL,
|
||||
MODULE_SUBTYPE_MULTI_ESKY150,
|
||||
MODULE_SUBTYPE_MULTI_H83D,
|
||||
MODULE_SUBTYPE_MULTI_CORONA,
|
||||
MODULE_SUBTYPE_MULTI_CFLIE,
|
||||
MODULE_SUBTYPE_MULTI_CFLIE, //35
|
||||
MODULE_SUBTYPE_MULTI_HITEC,
|
||||
MODULE_SUBTYPE_MULTI_WFLY,
|
||||
MODULE_SUBTYPE_MULTI_BUGS,
|
||||
MODULE_SUBTYPE_MULTI_BUGS_MINI,
|
||||
MODULE_SUBTYPE_MULTI_TRAXXAS,
|
||||
MODULE_SUBTYPE_MULTI_TRAXXAS, //40
|
||||
MODULE_SUBTYPE_MULTI_NCC1701,
|
||||
MODULE_SUBTYPE_MULTI_E01X,
|
||||
MODULE_SUBTYPE_MULTI_V911S,
|
||||
MODULE_SUBTYPE_MULTI_GD00X,
|
||||
MODULE_SUBTYPE_MULTI_V761,
|
||||
MODULE_SUBTYPE_MULTI_V761, //45
|
||||
MODULE_SUBTYPE_MULTI_KF606,
|
||||
MODULE_SUBTYPE_MULTI_REDPINE,
|
||||
MODULE_SUBTYPE_MULTI_POTENSIC,
|
||||
MODULE_SUBTYPE_MULTI_ZSX,
|
||||
MODULE_SUBTYPE_MULTI_FLYZONE,
|
||||
MODULE_SUBTYPE_MULTI_FLYZONE, //50
|
||||
MODULE_SUBTYPE_MULTI_SCANNER,
|
||||
MODULE_SUBTYPE_MULTI_FRSKYX_RX,
|
||||
MODULE_SUBTYPE_MULTI_AFHDS2A_RX,
|
||||
MODULE_SUBTYPE_MULTI_HOTT,
|
||||
MODULE_SUBTYPE_MULTI_FX816,
|
||||
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_FX816
|
||||
MODULE_SUBTYPE_MULTI_FX816, //55
|
||||
MODULE_SUBTYPE_MULTI_BAYANG_RX,
|
||||
MODULE_SUBTYPE_MULTI_PELIKAN,
|
||||
MODULE_SUBTYPE_MULTI_TIGER,
|
||||
MODULE_SUBTYPE_MULTI_XK,
|
||||
MODULE_SUBTYPE_MULTI_XN297DUMP, //60
|
||||
MODULE_SUBTYPE_MULTI_FRSKYX2,
|
||||
MODULE_SUBTYPE_MULTI_FRSKY_R9,
|
||||
MODULE_SUBTYPE_MULTI_PROPEL,
|
||||
MODULE_SUBTYPE_MULTI_FRSKYL,
|
||||
MODULE_SUBTYPE_MULTI_SKYARTEC,
|
||||
MODULE_SUBTYPE_MULTI_ESKY150V2,
|
||||
MODULE_SUBTYPE_MULTI_DSM_RX,
|
||||
MODULE_SUBTYPE_MULTI_JJRC345,
|
||||
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_JJRC345
|
||||
};
|
||||
#define MODULE_SUBTYPE_MULTI_XN297DP 63-3
|
||||
|
||||
@@ -176,7 +189,9 @@ enum MMRFrskySubtypes {
|
||||
MM_RF_FRSKY_SUBTYPE_D16_8CH,
|
||||
MM_RF_FRSKY_SUBTYPE_V8,
|
||||
MM_RF_FRSKY_SUBTYPE_D16_LBT,
|
||||
MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH
|
||||
MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH,
|
||||
MM_RF_FRSKY_SUBTYPE_D8_CLONED,
|
||||
MM_RF_FRSKY_SUBTYPE_D16_CLONED
|
||||
};
|
||||
|
||||
enum ModuleSubtypeDSM2 {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "opentx_helpers.h"
|
||||
#include "telemetry/telemetry.h"
|
||||
#include "storage/storage.h"
|
||||
#include "globals.h"
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
#include "telemetry/multi.h"
|
||||
@@ -57,7 +58,7 @@ inline uint8_t getMaxMultiSubtype(uint8_t moduleIdx)
|
||||
const mm_protocol_definition *pdef = getMultiProtocolDefinition(g_model.moduleData[moduleIdx].getMultiProtocol());
|
||||
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKY) {
|
||||
return 5;
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() > MODULE_SUBTYPE_MULTI_LAST) {
|
||||
@@ -584,6 +585,14 @@ inline void setDefaultPpmFrameLength(uint8_t moduleIdx)
|
||||
g_model.moduleData[moduleIdx].ppm.frameLength = 4 * max<int>(0, g_model.moduleData[moduleIdx].channelsCount);
|
||||
}
|
||||
|
||||
inline void resetAccessAuthenticationCount()
|
||||
{
|
||||
#if defined(ACCESS_LIB)
|
||||
// the module will reset on mode switch, we need to reset the authentication counter
|
||||
globalData.authenticationCount = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||
{
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
@@ -594,6 +603,8 @@ inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||
moduleData.sbus.refreshRate = -31;
|
||||
else if (moduleData.type == MODULE_TYPE_PPM)
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
else
|
||||
resetAccessAuthenticationCount();
|
||||
}
|
||||
|
||||
extern bool isExternalAntennaEnabled();
|
||||
|
||||
@@ -244,6 +244,50 @@ void sendChannels(uint8_t moduleIdx)
|
||||
}
|
||||
}
|
||||
|
||||
void convertOtxProtocolToMulti(int *protocol, int *subprotocol)
|
||||
{
|
||||
// Special treatment for the FrSky entry...
|
||||
if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY +1) {
|
||||
if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D8) {
|
||||
//D8
|
||||
*protocol = 3;
|
||||
*subprotocol = 0;
|
||||
}
|
||||
else if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D8_CLONED) {
|
||||
//D8
|
||||
*protocol = 3;
|
||||
*subprotocol = 1;
|
||||
}
|
||||
else if (*subprotocol == MM_RF_FRSKY_SUBTYPE_V8) {
|
||||
//V8
|
||||
*protocol = 25;
|
||||
*subprotocol = 0;
|
||||
}
|
||||
else {
|
||||
*protocol = 15;
|
||||
if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D16_8CH)
|
||||
*subprotocol = 1;
|
||||
else if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D16)
|
||||
*subprotocol = 0; // D16
|
||||
else if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D16_LBT)
|
||||
*subprotocol = 2;
|
||||
else if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH)
|
||||
*subprotocol = 3;
|
||||
else
|
||||
*subprotocol = 4; // D16_CLONED
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 15 for Multimodule is FrskyX or D16 which we map as a protocol of 3 (FrSky)
|
||||
// all protos > frskyx are therefore also off by one
|
||||
if (*protocol >= 15)
|
||||
*protocol = *protocol + 1;
|
||||
// 25 is again a FrSky *protocol (FrskyV) so shift again
|
||||
if (*protocol >= 25)
|
||||
*protocol = *protocol + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
|
||||
{// byte 1+2, protocol information
|
||||
|
||||
@@ -268,8 +312,7 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
|
||||
protoByte |= MULTI_SEND_RANGECHECK;
|
||||
|
||||
// rfProtocol
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2) {
|
||||
|
||||
if (type == MODULE_SUBTYPE_MULTI_DSM2 +1 ) {
|
||||
// Autobinding should always be done in DSMX 11ms
|
||||
if (g_model.moduleData[moduleIdx].multi.autoBindMode && moduleState[moduleIdx].mode == MODULE_MODE_BIND)
|
||||
subtype = MM_RF_DSM2_SUBTYPE_AUTO;
|
||||
@@ -279,39 +322,11 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
|
||||
optionValue = 0x80 | sentModuleChannels(moduleIdx); // Max throw
|
||||
else
|
||||
optionValue = sentModuleChannels(moduleIdx);
|
||||
}
|
||||
|
||||
// 15 for Multimodule is FrskyX or D16 which we map as a subprotocol of 3 (FrSky)
|
||||
// all protos > frskyx are therefore also off by one
|
||||
if (type >= 15)
|
||||
type = type + 1;
|
||||
|
||||
// 25 is again a FrSky protocol (FrskyV) so shift again
|
||||
if (type >= 25)
|
||||
type = type + 1;
|
||||
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKY) {
|
||||
if (subtype == MM_RF_FRSKY_SUBTYPE_D8) {
|
||||
//D8
|
||||
type = 3;
|
||||
subtype = 0;
|
||||
} else if (subtype == MM_RF_FRSKY_SUBTYPE_V8) {
|
||||
//V8
|
||||
type = 25;
|
||||
subtype = 0;
|
||||
} else {
|
||||
type = 15;
|
||||
if (subtype == MM_RF_FRSKY_SUBTYPE_D16_8CH) // D16 8ch
|
||||
subtype = 1;
|
||||
else if (subtype == MM_RF_FRSKY_SUBTYPE_D16)
|
||||
subtype = 0; // D16
|
||||
else if (subtype == MM_RF_FRSKY_SUBTYPE_D16_LBT)
|
||||
subtype = 2;
|
||||
else
|
||||
subtype = 3; // MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH
|
||||
}
|
||||
}
|
||||
|
||||
// Special treatment for the FrSky entry...
|
||||
convertOtxProtocolToMulti(&type, &subtype);
|
||||
|
||||
// Set the highest bit of option byte in AFHDS2A protocol to instruct MULTI to passthrough telemetry bytes instead
|
||||
// of sending Frsky D telemetry
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "pulses_common.h"
|
||||
|
||||
void multiPatchCustom(uint8_t moduleIdx);
|
||||
void convertOtxProtocolToMulti(int *protocol, int *subprotocol);
|
||||
|
||||
class UartMultiPulses: public DataBuffer<uint8_t, 64>
|
||||
{
|
||||
|
||||
@@ -308,9 +308,7 @@ static void enablePulsesInternalModule(uint8_t protocol)
|
||||
#if defined(PXX2)
|
||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||
intmoduleSerialStart(PXX2_HIGHSPEED_BAUDRATE, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b);
|
||||
#if defined(HARDWARE_INTERNAL_MODULE) && defined(INTERNAL_MODULE_PXX2) && defined(ACCESS_LIB)
|
||||
globalData.authenticationCount = 0;
|
||||
#endif
|
||||
resetAccessAuthenticationCount();
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -172,10 +172,10 @@ void Pxx2Pulses::setupRegisterFrame(uint8_t module)
|
||||
if (reusableBuffer.moduleSetup.pxx2.registerStep == REGISTER_RX_NAME_SELECTED) {
|
||||
Pxx2Transport::addByte(0x01);
|
||||
for (uint8_t i=0; i<PXX2_LEN_RX_NAME; i++) {
|
||||
Pxx2Transport::addByte(zchar2char(reusableBuffer.moduleSetup.pxx2.registerRxName[i]));
|
||||
Pxx2Transport::addByte(reusableBuffer.moduleSetup.pxx2.registerRxName[i]);
|
||||
}
|
||||
for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) {
|
||||
Pxx2Transport::addByte(zchar2char(g_model.modelRegistrationID[i]));
|
||||
Pxx2Transport::addByte(g_model.modelRegistrationID[i]);
|
||||
}
|
||||
Pxx2Transport::addByte(reusableBuffer.moduleSetup.pxx2.registerLoopIndex);
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void Pxx2Pulses::setupAccessBindFrame(uint8_t module)
|
||||
else {
|
||||
Pxx2Transport::addByte(0x00); // DATA0
|
||||
for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) {
|
||||
Pxx2Transport::addByte(zchar2char(g_model.modelRegistrationID[i]));
|
||||
Pxx2Transport::addByte(g_model.modelRegistrationID[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
|
||||
|
||||
constexpr uint32_t TEXT_FILE_MAXSIZE = 2048;
|
||||
|
||||
void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS + 1], int & lines_count)
|
||||
void sdReadTextFile(const char * filename, char lines[TEXT_VIEWER_LINES][LCD_COLS + 1], int & lines_count)
|
||||
{
|
||||
FIL file;
|
||||
int result;
|
||||
@@ -368,17 +368,17 @@ void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS +
|
||||
char escape_chars[4] = {0};
|
||||
int current_line = 0;
|
||||
|
||||
memclear(lines, NUM_BODY_LINES * (LCD_COLS + 1));
|
||||
memclear(lines, TEXT_VIEWER_LINES * (LCD_COLS + 1));
|
||||
|
||||
result = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result == FR_OK) {
|
||||
for (uint32_t i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < int(NUM_BODY_LINES)); i++) {
|
||||
for (uint32_t i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < int(TEXT_VIEWER_LINES)); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c != '\r' && current_line >= menuVerticalOffset && current_line - menuVerticalOffset < int(NUM_BODY_LINES) && line_length < LCD_COLS) {
|
||||
else if (c != '\r' && current_line >= menuVerticalOffset && current_line - menuVerticalOffset < int(TEXT_VIEWER_LINES) && line_length < LCD_COLS) {
|
||||
if (c == '\\' && escape == 0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
@@ -386,15 +386,15 @@ void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS +
|
||||
else if (c != '\\' && escape > 0 && escape < sizeof(escape_chars)) {
|
||||
escape_chars[escape - 1] = c;
|
||||
if (escape == 2 && !strncmp(escape_chars, "up", 2)) {
|
||||
c = '\300';
|
||||
c = CHAR_UP;
|
||||
}
|
||||
else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) {
|
||||
c = '\301';
|
||||
c = CHAR_DOWN;
|
||||
}
|
||||
else if (escape == 3) {
|
||||
int val = atoi(escape_chars);
|
||||
if (val >= 200 && val < 225) {
|
||||
c = '\200' + val-200;
|
||||
c = '\200' + val - 200;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -34,6 +34,10 @@ void serialPutc(char c) {
|
||||
if (auxSerialTracesEnabled())
|
||||
auxSerialPutc(c);
|
||||
#endif
|
||||
#if defined(AUX2_SERIAL)
|
||||
if (aux2SerialTracesEnabled())
|
||||
aux2SerialPutc(c);
|
||||
#endif
|
||||
}
|
||||
|
||||
void serialPrintf(const char * format, ...)
|
||||
|
||||
@@ -401,7 +401,7 @@ void convertRadioData_218_to_219(RadioData & settings)
|
||||
#if defined(PCBHORUS)
|
||||
// 2 new pots from X10:
|
||||
// - copy btw. 'chkSum' and 'auxSerialMode' (excl.)
|
||||
memcpy(&settings.chkSum, &oldSettings.chkSum, offsetof(RadioData, auxSerialMode) - offsetof(RadioData, chkSum));
|
||||
memcpy(&settings.chkSum, &oldSettings.chkSum, offsetof(RadioData, switchConfig) - sizeof(uint8_t) - offsetof(RadioData, chkSum));
|
||||
// - move calibration data
|
||||
memcpy(&settings.calib[NUM_STICKS + 5], &oldSettings.calib[NUM_STICKS + 3], sizeof(CalibData) * (STORAGE_NUM_SLIDERS + STORAGE_NUM_MOUSE_ANALOGS));
|
||||
memclear(&settings.calib[NUM_STICKS + 3], sizeof(CalibData) * 2);
|
||||
|
||||
@@ -465,13 +465,11 @@ const char * eeBackupModel(uint8_t i_fileSrc)
|
||||
|
||||
uint8_t i = sizeof(MODELS_PATH)+sizeof(g_model.header.name)-1;
|
||||
uint8_t len = 0;
|
||||
while (i>sizeof(MODELS_PATH)-1) {
|
||||
while (i > sizeof(MODELS_PATH)-1) {
|
||||
if (!len && buf[i])
|
||||
len = i+1;
|
||||
if (len) {
|
||||
if (buf[i])
|
||||
buf[i] = zchar2char(buf[i]);
|
||||
else
|
||||
if (!buf[i])
|
||||
buf[i] = '_';
|
||||
}
|
||||
i--;
|
||||
|
||||
@@ -84,20 +84,10 @@ int zchar2str(char * dest, const char * src, int size)
|
||||
return size+1;
|
||||
}
|
||||
|
||||
bool cmpStrWithZchar(const char * charString, const char * zcharString, int size)
|
||||
{
|
||||
for (int i=0; i<size; i++) {
|
||||
if (charString[i] != zchar2char(zcharString[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int effectiveLen(const char * str, unsigned int size)
|
||||
{
|
||||
while (size > 0) {
|
||||
if (str[size-1] != ' ')
|
||||
if (str[size-1] != ' ' && str[size-1] != '\0')
|
||||
return size;
|
||||
size--;
|
||||
}
|
||||
@@ -137,9 +127,7 @@ char * strcat_zchar(char * dest, const char * name, uint8_t size, const char * d
|
||||
if (!len && dest[i])
|
||||
len = i+1;
|
||||
if (len) {
|
||||
if (dest[i])
|
||||
dest[i] = zchar2char(dest[i]);
|
||||
else
|
||||
if (!dest[i])
|
||||
dest[i] = '_';
|
||||
}
|
||||
i--;
|
||||
@@ -392,7 +380,7 @@ char * getSourceString(char * dest, mixsrc_t idx)
|
||||
}
|
||||
else if (idx <= MIXSRC_LAST_INPUT) {
|
||||
idx -= MIXSRC_FIRST_INPUT;
|
||||
*dest = '\314';
|
||||
*dest = CHAR_INPUT;
|
||||
if (strlen(g_model.inputNames[idx])) {
|
||||
memset(dest + 1, 0, LEN_INPUT_NAME);
|
||||
strncpy(dest + 1, g_model.inputNames[idx], LEN_INPUT_NAME);
|
||||
@@ -406,7 +394,7 @@ char * getSourceString(char * dest, mixsrc_t idx)
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
|
||||
*dest++ = '\322';
|
||||
*dest++ = CHAR_LUA;
|
||||
// *dest++ = '1'+qr.quot;
|
||||
strcpy(dest, scriptInputsOutputs[qr.quot].outputs[qr.rem].name);
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ void checkSwitches()
|
||||
}
|
||||
|
||||
LED_ERROR_BEGIN();
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
|
||||
// first - display warning
|
||||
#if defined(PCBSKY9X)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#elif defined(RADIO_T16)
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,1, -1,1, -1,1};
|
||||
#elif defined(RADIO_TX16S)
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1,1, -1,1, -1,1};
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,1, -1,1, -1,1};
|
||||
#elif defined(PCBX10)
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,1, 1, -1};
|
||||
#elif defined(PCBX9E)
|
||||
|
||||
@@ -122,26 +122,30 @@ void auxSerialInit(unsigned int mode, unsigned int protocol)
|
||||
#if defined(CROSSFIRE)
|
||||
if (protocol == PROTOCOL_TELEMETRY_CROSSFIRE) {
|
||||
auxSerialSetup(CROSSFIRE_TELEM_MIRROR_BAUDRATE, false);
|
||||
AUX_SERIAL_POWER_OFF();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
auxSerialSetup(FRSKY_SPORT_BAUDRATE, false);
|
||||
auxSerialSetup(FRSKY_TELEM_MIRROR_BAUDRATE, false);
|
||||
break;
|
||||
|
||||
#if defined(DEBUG) || defined(CLI)
|
||||
case UART_MODE_DEBUG:
|
||||
auxSerialSetup(DEBUG_BAUDRATE, false);
|
||||
AUX_SERIAL_POWER_OFF();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case UART_MODE_TELEMETRY:
|
||||
if (protocol == PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY) {
|
||||
auxSerialSetup(FRSKY_D_BAUDRATE, true);
|
||||
AUX_SERIAL_POWER_OFF();
|
||||
}
|
||||
break;
|
||||
|
||||
case UART_MODE_LUA:
|
||||
auxSerialSetup(DEBUG_BAUDRATE, false);
|
||||
AUX_SERIAL_POWER_ON();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,5 +218,214 @@ extern "C" void AUX_SERIAL_USART_IRQHandler(void)
|
||||
status = AUX_SERIAL_USART->SR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Receive
|
||||
uint32_t status = AUX_SERIAL_USART->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = AUX_SERIAL_USART->DR;
|
||||
if (!(status & USART_FLAG_ERRORS)) {
|
||||
#if defined(LUA) & !defined(CLI)
|
||||
if (luaRxFifo && auxSerialMode == UART_MODE_LUA)
|
||||
luaRxFifo->push(data);
|
||||
#endif
|
||||
}
|
||||
status = AUX_SERIAL_USART->SR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
uint8_t aux2SerialMode = 0;
|
||||
Fifo<uint8_t, 512> aux2SerialTxFifo;
|
||||
AuxSerialRxFifo aux2SerialRxFifo __DMA (AUX2_SERIAL_DMA_Stream_RX);
|
||||
|
||||
void aux2SerialSetup(unsigned int baudrate, bool dma)
|
||||
{
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_PinAFConfig(AUX2_SERIAL_GPIO, AUX2_SERIAL_GPIO_PinSource_RX, AUX2_SERIAL_GPIO_AF);
|
||||
GPIO_PinAFConfig(AUX2_SERIAL_GPIO, AUX2_SERIAL_GPIO_PinSource_TX, AUX2_SERIAL_GPIO_AF);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = AUX2_SERIAL_GPIO_PIN_TX | AUX2_SERIAL_GPIO_PIN_RX;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_Init(AUX2_SERIAL_GPIO, &GPIO_InitStructure);
|
||||
|
||||
#if defined(AUX2_SERIAL_PWR_GPIO)
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_InitStructure.GPIO_Pin = AUX2_SERIAL_PWR_GPIO_PIN;
|
||||
GPIO_Init(AUX2_SERIAL_PWR_GPIO, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
USART_InitStructure.USART_BaudRate = baudrate;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
|
||||
USART_Init(AUX2_SERIAL_USART, &USART_InitStructure);
|
||||
|
||||
if (dma) {
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
aux2SerialRxFifo.clear();
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_RXNE, DISABLE);
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_TXE, DISABLE);
|
||||
DMA_InitStructure.DMA_Channel = AUX2_SERIAL_DMA_Channel_RX;
|
||||
DMA_InitStructure.DMA_PeripheralBaseAddr = CONVERT_PTR_UINT(&AUX2_SERIAL_USART->DR);
|
||||
DMA_InitStructure.DMA_Memory0BaseAddr = CONVERT_PTR_UINT(aux2SerialRxFifo.buffer());
|
||||
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
|
||||
DMA_InitStructure.DMA_BufferSize = aux2SerialRxFifo.size();
|
||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
|
||||
DMA_InitStructure.DMA_Priority = DMA_Priority_Low;
|
||||
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
|
||||
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
|
||||
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
|
||||
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
|
||||
DMA_Init(AUX2_SERIAL_DMA_Stream_RX, &DMA_InitStructure);
|
||||
USART_DMACmd(AUX2_SERIAL_USART, USART_DMAReq_Rx, ENABLE);
|
||||
USART_Cmd(AUX2_SERIAL_USART, ENABLE);
|
||||
DMA_Cmd(AUX2_SERIAL_DMA_Stream_RX, ENABLE);
|
||||
}
|
||||
else {
|
||||
USART_Cmd(AUX2_SERIAL_USART, ENABLE);
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_RXNE, ENABLE);
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_TXE, DISABLE);
|
||||
NVIC_SetPriority(AUX2_SERIAL_USART_IRQn, 7);
|
||||
NVIC_EnableIRQ(AUX2_SERIAL_USART_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
void aux2SerialInit(unsigned int mode, unsigned int protocol)
|
||||
{
|
||||
aux2SerialStop();
|
||||
|
||||
aux2SerialMode = mode;
|
||||
|
||||
switch (mode) {
|
||||
case UART_MODE_TELEMETRY_MIRROR:
|
||||
#if defined(CROSSFIRE)
|
||||
if (protocol == PROTOCOL_TELEMETRY_CROSSFIRE) {
|
||||
aux2SerialSetup(CROSSFIRE_TELEM_MIRROR_BAUDRATE, false);
|
||||
AUX2_SERIAL_POWER_OFF();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
aux2SerialSetup(FRSKY_TELEM_MIRROR_BAUDRATE, false);
|
||||
AUX2_SERIAL_POWER_OFF();
|
||||
break;
|
||||
|
||||
#if defined(DEBUG) || defined(CLI)
|
||||
case UART_MODE_DEBUG:
|
||||
aux2SerialSetup(DEBUG_BAUDRATE, false);
|
||||
AUX2_SERIAL_POWER_OFF();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case UART_MODE_TELEMETRY:
|
||||
if (protocol == PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY) {
|
||||
aux2SerialSetup(FRSKY_D_BAUDRATE, true);
|
||||
AUX2_SERIAL_POWER_OFF();
|
||||
}
|
||||
break;
|
||||
|
||||
case UART_MODE_LUA:
|
||||
aux2SerialSetup(DEBUG_BAUDRATE, false);
|
||||
AUX2_SERIAL_POWER_ON();
|
||||
}
|
||||
}
|
||||
|
||||
void aux2SerialPutc(char c)
|
||||
{
|
||||
#if !defined(SIMU)
|
||||
int n = 0;
|
||||
while (aux2SerialTxFifo.isFull()) {
|
||||
delay_ms(1);
|
||||
if (++n > 100) return;
|
||||
}
|
||||
aux2SerialTxFifo.push(c);
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_TXE, ENABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void aux2SerialSbusInit()
|
||||
{
|
||||
aux2SerialSetup(SBUS_BAUDRATE, true);
|
||||
AUX2_SERIAL_USART->CR1 |= USART_CR1_M | USART_CR1_PCE ;
|
||||
AUX2_SERIAL_POWER_ON();
|
||||
}
|
||||
|
||||
void aux2SerialStop()
|
||||
{
|
||||
DMA_DeInit(AUX2_SERIAL_DMA_Stream_RX);
|
||||
USART_DeInit(AUX2_SERIAL_USART);
|
||||
}
|
||||
|
||||
uint8_t aux2SerialTracesEnabled()
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
return (aux2SerialMode == UART_MODE_DEBUG);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void AUX2_SERIAL_USART_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_SER2);
|
||||
// Send
|
||||
if (USART_GetITStatus(AUX2_SERIAL_USART, USART_IT_TXE) != RESET) {
|
||||
uint8_t txchar;
|
||||
if (aux2SerialTxFifo.pop(txchar)) {
|
||||
/* Write one byte to the transmit data register */
|
||||
USART_SendData(AUX2_SERIAL_USART, txchar);
|
||||
}
|
||||
else {
|
||||
USART_ITConfig(AUX2_SERIAL_USART, USART_IT_TXE, DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CLI)
|
||||
if (getSelectedUsbMode() != USB_SERIAL_MODE) {
|
||||
// Receive
|
||||
uint32_t status = AUX2_SERIAL_USART->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = AUX2_SERIAL_USART->DR;
|
||||
if (!(status & USART_FLAG_ERRORS)) {
|
||||
switch (aux2SerialMode) {
|
||||
case UART_MODE_DEBUG:
|
||||
cliRxFifo.push(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = AUX2_SERIAL_USART->SR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(AUX2_SERIAL)
|
||||
// Receive
|
||||
uint32_t status = AUX2_SERIAL_USART->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = AUX2_SERIAL_USART->DR;
|
||||
if (!(status & USART_FLAG_ERRORS)) {
|
||||
#if defined(LUA)
|
||||
if (luaRxFifo && aux2SerialMode == UART_MODE_LUA)
|
||||
luaRxFifo->push(data);
|
||||
#endif
|
||||
}
|
||||
status = AUX2_SERIAL_USART->SR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // AUX_SERIAL
|
||||
@@ -197,15 +197,15 @@ int main()
|
||||
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph |
|
||||
LCD_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph |
|
||||
AUX_SERIAL_RCC_AHB1Periph | I2C_RCC_AHB1Periph |
|
||||
AUX_SERIAL_RCC_AHB1Periph | AUX2_SERIAL_RCC_AHB1Periph | I2C_RCC_AHB1Periph |
|
||||
SD_RCC_AHB1Periph, ENABLE);
|
||||
|
||||
RCC_APB1PeriphClockCmd(ROTARY_ENCODER_RCC_APB1Periph | LCD_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph |
|
||||
INTERRUPT_xMS_RCC_APB1Periph | I2C_RCC_APB1Periph |
|
||||
AUX_SERIAL_RCC_APB1Periph |
|
||||
AUX_SERIAL_RCC_APB1Periph | AUX2_SERIAL_RCC_APB1Periph |
|
||||
SD_RCC_APB1Periph, ENABLE);
|
||||
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | BACKLIGHT_RCC_APB2Periph | RCC_APB2Periph_SYSCFG | AUX_SERIAL_RCC_APB2Periph, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | BACKLIGHT_RCC_APB2Periph | RCC_APB2Periph_SYSCFG | AUX_SERIAL_RCC_APB2Periph | AUX2_SERIAL_RCC_APB2Periph, ENABLE);
|
||||
|
||||
pwrInit();
|
||||
keysInit();
|
||||
@@ -249,6 +249,9 @@ int main()
|
||||
#if defined(DEBUG) && defined(AUX_SERIAL)
|
||||
auxSerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined)
|
||||
#endif
|
||||
#if defined(DEBUG) && defined(AUX2_SERIAL)
|
||||
aux2SerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined)
|
||||
#endif
|
||||
|
||||
__enable_irq();
|
||||
|
||||
|
||||
@@ -21,12 +21,18 @@
|
||||
#include "opentx.h"
|
||||
|
||||
ModuleFifo intmoduleFifo;
|
||||
#if !defined(INTMODULE_DMA_STREAM)
|
||||
uint8_t * intmoduleTxBufferData;
|
||||
uint8_t intmoduleTxBufferRemaining;
|
||||
#endif
|
||||
|
||||
void intmoduleStop()
|
||||
{
|
||||
GPIO_ResetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN);
|
||||
|
||||
#if defined(INTMODULE_DMA_STREAM)
|
||||
INTMODULE_DMA_STREAM->CR &= ~DMA_SxCR_EN; // Disable DMA
|
||||
#endif
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_TX_GPIO_PIN | INTMODULE_RX_GPIO_PIN;
|
||||
@@ -57,7 +63,11 @@ void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable, uint16_t parity,
|
||||
INTERNAL_MODULE_ON();
|
||||
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
#if defined(INTMODULE_DMA_STREAM)
|
||||
NVIC_InitStructure.NVIC_IRQChannel = INTMODULE_DMA_STREAM_IRQ;
|
||||
#else
|
||||
NVIC_InitStructure.NVIC_IRQChannel = INTMODULE_USART_IRQn;
|
||||
#endif
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; /* Not used as 4 bits are used for the pre-emption priority. */;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
@@ -118,8 +128,22 @@ void intmoduleTimerStart(uint32_t periodMs)
|
||||
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
||||
extern "C" void INTMODULE_USART_IRQHandler(void)
|
||||
{
|
||||
uint32_t status = INTMODULE_USART->SR;
|
||||
#if !defined(INTMODULE_DMA_STREAM)
|
||||
// Send
|
||||
if (USART_GetITStatus(INTMODULE_USART, USART_IT_TXE) != RESET) {
|
||||
if (intmoduleTxBufferRemaining) {
|
||||
USART_SendData(INTMODULE_USART, intmoduleTxBufferData[0]);
|
||||
intmoduleTxBufferData++;
|
||||
intmoduleTxBufferRemaining--;
|
||||
}
|
||||
else {
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_TXE, DISABLE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Receive
|
||||
uint32_t status = INTMODULE_USART->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = INTMODULE_USART->DR;
|
||||
if (status & USART_FLAG_ERRORS) {
|
||||
@@ -143,6 +167,7 @@ void intmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
#if defined(INTMODULE_DMA_STREAM)
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
DMA_DeInit(INTMODULE_DMA_STREAM);
|
||||
DMA_InitStructure.DMA_Channel = INTMODULE_DMA_CHANNEL;
|
||||
@@ -163,6 +188,11 @@ void intmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
DMA_Init(INTMODULE_DMA_STREAM, &DMA_InitStructure);
|
||||
DMA_Cmd(INTMODULE_DMA_STREAM, ENABLE);
|
||||
USART_DMACmd(INTMODULE_USART, USART_DMAReq_Tx, ENABLE);
|
||||
#else
|
||||
intmoduleTxBufferData = (uint8_t *)data;
|
||||
intmoduleTxBufferRemaining = size;
|
||||
USART_ITConfig(INTMODULE_USART, USART_IT_TXE, ENABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void intmoduleSendNextFrame()
|
||||
|
||||
@@ -104,7 +104,7 @@ void rotaryEncoderCheck()
|
||||
#endif
|
||||
#if !defined(BOOT)
|
||||
if (g_eeGeneral.backlightMode & e_backlight_mode_keys) {
|
||||
backlightOn();
|
||||
resetBacklightTimeout();
|
||||
}
|
||||
inactivity.counter = 0;
|
||||
#endif
|
||||
|
||||
@@ -218,11 +218,18 @@ static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len)
|
||||
|
||||
#if defined(CLI)
|
||||
//copy data to the application FIFO
|
||||
for (uint32_t i = 0; i < Len; i++)
|
||||
{
|
||||
for (uint32_t i = 0; i < Len; i++) {
|
||||
cliRxFifo.push(Buf[i]);
|
||||
}
|
||||
#endif
|
||||
#if defined(LUA) && !defined(CLI)
|
||||
// copy data to the LUA FIFO
|
||||
if (luaRxFifo) {
|
||||
for (uint32_t i = 0; i < Len; i++) {
|
||||
luaRxFifo->push(Buf[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
@@ -76,10 +76,15 @@ if (PCB STREQUAL X10)
|
||||
add_definitions(-DRADIO_FAMILY_T16)
|
||||
option(INTERNAL_MODULE_MULTI "Support for MULTI internal module" ON)
|
||||
option(BLUETOOTH "Support for bluetooth module" OFF)
|
||||
if (NOT BLUETOOTH)
|
||||
set(AUX_SERIAL ON)
|
||||
endif()
|
||||
option(INTERNAL_GPS "Support for internal ublox GPS" OFF)
|
||||
set(HARDWARE_TOUCH YES)
|
||||
set(USB_CHARGER YES)
|
||||
set(DEFAULT_THEME "DARKBLUE")
|
||||
set(AUX_SERIAL ON)
|
||||
if (NOT BLUETOOTH AND NOT INTERNAL_GPS)
|
||||
set(AUX2_SERIAL ON)
|
||||
endif()
|
||||
set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
|
||||
else()
|
||||
set(FLAVOUR x10)
|
||||
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" ON)
|
||||
@@ -106,7 +111,6 @@ elseif (PCB STREQUAL X12S)
|
||||
${TARGET_SRC}
|
||||
audio_spi_driver.cpp
|
||||
x12s_adc_driver.cpp
|
||||
gps_driver.cpp
|
||||
)
|
||||
set(BITMAPS_TARGET x12s_bitmaps)
|
||||
set(FONTS_TARGET x12s_fonts)
|
||||
@@ -131,6 +135,12 @@ add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
||||
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
|
||||
add_definitions(-DHARDWARE_TRAINER_JACK)
|
||||
|
||||
if(DEFAULT_THEME)
|
||||
add_definitions(-DDEFAULT_THEME_${DEFAULT_THEME})
|
||||
else()
|
||||
add_definitions(-DDEFAULT_THEME_DEFAULT)
|
||||
endif()
|
||||
|
||||
if(NOT UNEXPECTED_SHUTDOWN)
|
||||
add_definitions(-DNO_UNEXPECTED_SHUTDOWN)
|
||||
endif()
|
||||
@@ -162,6 +172,7 @@ endif()
|
||||
|
||||
if(INTERNAL_GPS)
|
||||
set(SRC ${SRC} gps.cpp)
|
||||
set(TARGET_SRC ${TARGET_SRC} gps_driver.cpp)
|
||||
add_definitions(-DINTERNAL_GPS)
|
||||
message("Horus: Internal GPS enabled")
|
||||
endif()
|
||||
@@ -178,6 +189,13 @@ set(TARGET_SRC
|
||||
../common/arm/stm32/rotary_encoder_driver.cpp
|
||||
)
|
||||
|
||||
if(HARDWARE_TOUCH)
|
||||
set(TARGET_SRC ${TARGET_SRC}
|
||||
tp_gt911.cpp
|
||||
)
|
||||
add_definitions(-DHARDWARE_TOUCH)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
set(TARGET_SRC ${TARGET_SRC} usb_charger_driver.cpp)
|
||||
add_definitions(-DUSB_CHARGER)
|
||||
@@ -195,6 +213,11 @@ if (AUX_SERIAL)
|
||||
set(AUX_SERIAL_DRIVER ../common/arm/stm32/aux_serial_driver.cpp)
|
||||
endif()
|
||||
|
||||
if (AUX2_SERIAL)
|
||||
add_definitions(-DAUX2_SERIAL)
|
||||
set(AUX_SERIAL_DRIVER ../common/arm/stm32/aux_serial_driver.cpp)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
${LCD_DRIVER}
|
||||
|
||||
@@ -52,6 +52,18 @@ void auxSerialPowerOff()
|
||||
GPIO_ResetBits(AUX_SERIAL_PWR_GPIO, AUX_SERIAL_PWR_GPIO_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(AUX2_SERIAL_PWR_GPIO)
|
||||
void aux2SerialPowerOn()
|
||||
{
|
||||
GPIO_SetBits(AUX2_SERIAL_PWR_GPIO, AUX2_SERIAL_PWR_GPIO_PIN);
|
||||
}
|
||||
|
||||
void aux2SerialPowerOff()
|
||||
{
|
||||
GPIO_ResetBits(AUX2_SERIAL_PWR_GPIO, AUX2_SERIAL_PWR_GPIO_PIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAS_SPORT_UPDATE_CONNECTOR()
|
||||
void sportUpdateInit()
|
||||
@@ -96,6 +108,7 @@ void boardInit()
|
||||
KEYS_RCC_AHB1Periph |
|
||||
ADC_RCC_AHB1Periph |
|
||||
AUX_SERIAL_RCC_AHB1Periph |
|
||||
AUX2_SERIAL_RCC_AHB1Periph |
|
||||
TELEMETRY_RCC_AHB1Periph |
|
||||
TRAINER_RCC_AHB1Periph |
|
||||
BT_RCC_AHB1Periph |
|
||||
@@ -103,9 +116,11 @@ void boardInit()
|
||||
HAPTIC_RCC_AHB1Periph |
|
||||
INTMODULE_RCC_AHB1Periph |
|
||||
EXTMODULE_RCC_AHB1Periph |
|
||||
I2C_TOUCH_RCC_AHB1Periph |
|
||||
I2C_RCC_AHB1Periph |
|
||||
GPS_RCC_AHB1Periph |
|
||||
SPORT_UPDATE_RCC_AHB1Periph,
|
||||
SPORT_UPDATE_RCC_AHB1Periph |
|
||||
TOUCH_INT_RCC_AHB1Periph |
|
||||
TOUCH_RST_RCC_AHB1Periph,
|
||||
ENABLE);
|
||||
|
||||
RCC_APB1PeriphClockCmd(ROTARY_ENCODER_RCC_APB1Periph |
|
||||
@@ -114,12 +129,13 @@ void boardInit()
|
||||
TIMER_2MHz_RCC_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
AUX_SERIAL_RCC_APB1Periph |
|
||||
AUX2_SERIAL_RCC_APB1Periph |
|
||||
TELEMETRY_RCC_APB1Periph |
|
||||
TRAINER_RCC_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
INTMODULE_RCC_APB1Periph |
|
||||
EXTMODULE_RCC_APB1Periph |
|
||||
I2C_TOUCH_RCC_APB1Periph |
|
||||
I2C_RCC_APB1Periph |
|
||||
GPS_RCC_APB1Periph |
|
||||
BACKLIGHT_RCC_APB1Periph,
|
||||
ENABLE);
|
||||
@@ -133,6 +149,8 @@ void boardInit()
|
||||
TELEMETRY_RCC_APB2Periph |
|
||||
BT_RCC_APB2Periph |
|
||||
AUX_SERIAL_RCC_APB2Periph |
|
||||
AUX2_SERIAL_RCC_APB2Periph |
|
||||
GPS_RCC_APB2Periph |
|
||||
BACKLIGHT_RCC_APB2Periph,
|
||||
ENABLE);
|
||||
|
||||
@@ -145,6 +163,9 @@ void boardInit()
|
||||
#if defined(DEBUG) && defined(AUX_SERIAL)
|
||||
auxSerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined)
|
||||
#endif
|
||||
#if defined(DEBUG) && defined(AUX2_SERIAL)
|
||||
aux2SerialInit(UART_MODE_DEBUG, 0); // default serial mode (None if DEBUG not defined)
|
||||
#endif
|
||||
|
||||
TRACE("\nHorus board started :)");
|
||||
TRACE("RCC->CSR = %08x", RCC->CSR);
|
||||
@@ -189,6 +210,10 @@ void boardInit()
|
||||
|
||||
ledInit();
|
||||
|
||||
#if defined(USB_CHARGER)
|
||||
usbChargerInit();
|
||||
#endif
|
||||
|
||||
#if HAS_SPORT_UPDATE_CONNECTOR()
|
||||
sportUpdateInit();
|
||||
#endif
|
||||
@@ -235,8 +260,14 @@ void boardOff()
|
||||
pwrOff();
|
||||
}
|
||||
|
||||
#if defined (RADIO_TX16S)
|
||||
#define BATTERY_DIVIDER 1495
|
||||
#else
|
||||
#define BATTERY_DIVIDER 1629
|
||||
#endif
|
||||
|
||||
uint16_t getBatteryVoltage()
|
||||
{
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose
|
||||
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / 1629);
|
||||
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / BATTERY_DIVIDER);
|
||||
}
|
||||
|
||||
@@ -137,6 +137,10 @@ void SDRAM_Init();
|
||||
// Pulses driver
|
||||
#define INTERNAL_MODULE_ON() GPIO_SetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN)
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2)
|
||||
#define HARDWARE_INTERNAL_RAS
|
||||
#endif
|
||||
|
||||
#if defined(INTMODULE_USART)
|
||||
#define INTERNAL_MODULE_OFF() intmoduleStop()
|
||||
#else
|
||||
@@ -604,7 +608,7 @@ void sportUpdatePowerInit();
|
||||
#define IS_SPORT_UPDATE_POWER_ON() (false)
|
||||
#endif
|
||||
|
||||
// Second serial port driver
|
||||
// Aux serial port driver
|
||||
#if defined(AUX_SERIAL_GPIO)
|
||||
#define DEBUG_BAUDRATE 115200
|
||||
extern uint8_t auxSerialMode;
|
||||
@@ -616,11 +620,30 @@ void auxSerialStop();
|
||||
void auxSerialPowerOn();
|
||||
void auxSerialPowerOff();
|
||||
#if defined(AUX_SERIAL_PWR_GPIO)
|
||||
#define AUX_SERIAL_POWER_ON() auxSerialPowerOn()
|
||||
#define AUX_SERIAL__POWER_OFF() auxSerialPowerOff()
|
||||
#define AUX_SERIAL_POWER_ON() auxSerialPowerOn()
|
||||
#define AUX_SERIAL_POWER_OFF() auxSerialPowerOff()
|
||||
#else
|
||||
#define AUX_SERIAL_POWER_ON()
|
||||
#define AUX_SERIAL__POWER_OFF()
|
||||
#define AUX_SERIAL_POWER_OFF()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Aux2 serial port driver
|
||||
#if defined(AUX2_SERIAL)
|
||||
extern uint8_t aux2SerialMode;
|
||||
void aux2SerialInit(unsigned int mode, unsigned int protocol);
|
||||
void aux2SerialPutc(char c);
|
||||
#define aux2SerialTelemetryInit(protocol) aux2SerialInit(UART_MODE_TELEMETRY, protocol)
|
||||
void aux2SerialSbusInit();
|
||||
void aux2SerialStop();
|
||||
void aux2SerialPowerOn();
|
||||
void aux2SerialPowerOff();
|
||||
#if defined(AUX2_SERIAL_PWR_GPIO)
|
||||
#define AUX2_SERIAL_POWER_ON() aux2SerialPowerOn()
|
||||
#define AUX2_SERIAL_POWER_OFF() aux2SerialPowerOff()
|
||||
#else
|
||||
#define AUX2_SERIAL_POWER_ON()
|
||||
#define AUX2_SERIAL_POWER_OFF()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ void gpsInit(uint32_t baudrate)
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
// RX and TX pins
|
||||
GPIO_PinAFConfig(GPIOA, GPS_TX_GPIO_PinSource, GPS_GPIO_AF);
|
||||
GPIO_PinAFConfig(GPIOA, GPS_RX_GPIO_PinSource, GPS_GPIO_AF);
|
||||
GPIO_PinAFConfig(GPS_UART_GPIO, GPS_TX_GPIO_PinSource, GPS_GPIO_AF);
|
||||
GPIO_PinAFConfig(GPS_UART_GPIO, GPS_RX_GPIO_PinSource, GPS_GPIO_AF);
|
||||
GPIO_InitStructure.GPIO_Pin = (GPS_TX_GPIO_PIN | GPS_RX_GPIO_PIN);
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
@@ -58,6 +58,14 @@ void gpsInit(uint32_t baudrate)
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
|
||||
#if defined(GPS_PWR_GPIO)
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_InitStructure.GPIO_Pin = GPS_PWR_GPIO_PIN;
|
||||
GPIO_Init(GPS_PWR_GPIO, &GPIO_InitStructure);
|
||||
GPIO_SetBits(GPS_PWR_GPIO, GPS_PWR_GPIO_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
@@ -184,10 +184,17 @@
|
||||
#define TRIMS_GPIO_REG_LSU GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13
|
||||
#elif defined(PCBX10)
|
||||
#define TRIMS_GPIO_REG_LHL GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_8 // PB.08
|
||||
#define TRIMS_GPIO_REG_LHR GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_9 // PB.09
|
||||
#if defined(RADIO_TX16S)
|
||||
#define TRIMS_GPIO_REG_LHL GPIOA->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_6 // PA.06
|
||||
#define TRIMS_GPIO_REG_LHR GPIOC->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_4 // PC.04
|
||||
#else
|
||||
#define TRIMS_GPIO_REG_LHL GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_8 // PB.08
|
||||
#define TRIMS_GPIO_REG_LHR GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_9 // PB.09
|
||||
#endif
|
||||
#define TRIMS_GPIO_REG_LVD GPIOG->IDR
|
||||
#define TRIMS_GPIO_PIN_LVD GPIO_Pin_12 // PG.12
|
||||
#define TRIMS_GPIO_REG_LVU GPIOJ->IDR
|
||||
@@ -228,14 +235,21 @@
|
||||
#define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | GPIO_Pin_4)
|
||||
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RSD)
|
||||
#elif defined(PCBX10)
|
||||
#define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9)
|
||||
#if defined(RADIO_TX16S)
|
||||
#define KEYS_GPIOC_PINS (GPIO_Pin_13)
|
||||
#endif
|
||||
#if defined(RADIO_TX16S)
|
||||
#define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13)
|
||||
#else
|
||||
#define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9)
|
||||
#endif
|
||||
#define KEYS_GPIOD_PINS (GPIO_Pin_11 | GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_13)
|
||||
#define KEYS_GPIOE_PINS (GPIO_Pin_3)
|
||||
#define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD)
|
||||
#if defined(RADIO_TX16S)
|
||||
#define KEYS_GPIOA_PINS (GPIO_Pin_6)
|
||||
#define KEYS_GPIOC_PINS (GPIO_Pin_4 | GPIO_Pin_13)
|
||||
#define KEYS_GPIOH_PINS (GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15)
|
||||
#else
|
||||
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15)
|
||||
#endif
|
||||
#define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15)
|
||||
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | GPIO_Pin_8)
|
||||
#endif
|
||||
@@ -308,7 +322,9 @@
|
||||
#define ADC_DMA_Stream DMA2_Stream0
|
||||
#define ADC_SET_DMA_FLAGS() ADC_DMA->LIFCR = (DMA_LIFCR_CTCIF0 | DMA_LIFCR_CHTIF0 | DMA_LIFCR_CTEIF0 | DMA_LIFCR_CDMEIF0 | DMA_LIFCR_CFEIF0)
|
||||
#define ADC_TRANSFER_COMPLETE() (ADC_DMA->LISR & DMA_LISR_TCIF0)
|
||||
#if defined(RADIO_FAMILY_T16)
|
||||
#if defined(RADIO_TX16S)
|
||||
#define ADC_VREF_PREC2 330
|
||||
#elif defined(RADIO_T16)
|
||||
#define ADC_VREF_PREC2 300
|
||||
#else
|
||||
#define ADC_VREF_PREC2 250
|
||||
@@ -327,6 +343,7 @@
|
||||
#define USB_CHARGER_RCC_AHB1Periph RCC_AHB1Periph_GPIOG
|
||||
#define USB_CHARGER_GPIO GPIOG
|
||||
#define USB_CHARGER_GPIO_PIN GPIO_Pin_11 // PG.11
|
||||
#define USB_USBDet_GPIO_PIN GPIO_Pin_13 // PG.13
|
||||
#else
|
||||
#define USB_CHARGER_RCC_AHB1Periph 0
|
||||
#endif
|
||||
@@ -377,8 +394,8 @@
|
||||
#endif
|
||||
|
||||
// Serial Port (DEBUG)
|
||||
#if defined(PCBX12S)
|
||||
#define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1)
|
||||
#if defined(PCBX12S) || defined(RADIO_TX16S)
|
||||
#define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1)
|
||||
#define AUX_SERIAL_RCC_APB1Periph RCC_APB1Periph_USART3
|
||||
#define AUX_SERIAL_RCC_APB2Periph 0
|
||||
#define AUX_SERIAL_GPIO GPIOB
|
||||
@@ -392,47 +409,58 @@
|
||||
#define AUX_SERIAL_USART_IRQn USART3_IRQn
|
||||
#define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1
|
||||
#define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4
|
||||
#elif defined(RADIO_TX16S) && !defined(BLUETOOTH)
|
||||
#define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_DMA2)
|
||||
#define AUX_SERIAL_RCC_APB1Periph 0
|
||||
#define AUX_SERIAL_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||
#define AUX_SERIAL_USART USART6
|
||||
#define AUX_SERIAL_GPIO_AF GPIO_AF_USART6
|
||||
#define AUX_SERIAL_USART_IRQn USART6_IRQn
|
||||
#define AUX_SERIAL_GPIO GPIOG
|
||||
#define AUX_SERIAL_GPIO_PIN_TX GPIO_Pin_14 // PG.14
|
||||
#define AUX_SERIAL_GPIO_PIN_RX GPIO_Pin_9 // PG.09
|
||||
#define AUX_SERIAL_GPIO_PinSource_TX GPIO_PinSource14
|
||||
#define AUX_SERIAL_GPIO_PinSource_RX GPIO_PinSource9
|
||||
#define AUX_SERIAL_USART_IRQHandler USART6_IRQHandler
|
||||
#define AUX_SERIAL_DMA_Stream_RX DMA2_Stream6
|
||||
#define AUX_SERIAL_DMA_Channel_RX DMA_Channel_5
|
||||
#define AUX_SERIAL_PWR_GPIO GPIOB
|
||||
#define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_0 // PB.00
|
||||
#define HARDWARE_TRAINER_AUX_SERIAL
|
||||
|
||||
#define AUX2_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1)
|
||||
#define AUX2_SERIAL_PWR_GPIO GPIOA
|
||||
#define AUX2_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PA.15
|
||||
#define AUX2_SERIAL_RCC_APB1Periph RCC_APB1Periph_USART3
|
||||
#define AUX2_SERIAL_RCC_APB2Periph 0
|
||||
#define AUX2_SERIAL_GPIO GPIOB
|
||||
#define AUX2_SERIAL_GPIO_PIN_TX GPIO_Pin_10 // PB.10
|
||||
#define AUX2_SERIAL_GPIO_PIN_RX GPIO_Pin_11 // PB.11
|
||||
#define AUX2_SERIAL_GPIO_PinSource_TX GPIO_PinSource10
|
||||
#define AUX2_SERIAL_GPIO_PinSource_RX GPIO_PinSource11
|
||||
#define AUX2_SERIAL_GPIO_AF GPIO_AF_USART3
|
||||
#define AUX2_SERIAL_USART USART3
|
||||
#define AUX2_SERIAL_USART_IRQHandler USART3_IRQHandler
|
||||
#define AUX2_SERIAL_USART_IRQn USART3_IRQn
|
||||
#define AUX2_SERIAL_DMA_Stream_RX DMA1_Stream1
|
||||
#define AUX2_SERIAL_DMA_Channel_RX DMA_Channel_4
|
||||
#define AUX_SERIAL_PWR_GPIO GPIOA
|
||||
#define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PB.00
|
||||
#if defined(RADIO_TX16S)
|
||||
#define TRAINER_BATTERY_COMPARTMENT // allows serial port TTL trainer
|
||||
#endif
|
||||
#else
|
||||
#define AUX_SERIAL_RCC_AHB1Periph 0
|
||||
#define AUX_SERIAL_RCC_APB1Periph 0
|
||||
#define AUX_SERIAL_RCC_APB2Periph 0
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
#define AUX2_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_DMA2)
|
||||
#define AUX2_SERIAL_RCC_APB1Periph 0
|
||||
#define AUX2_SERIAL_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||
#define AUX2_SERIAL_USART USART6
|
||||
#define AUX2_SERIAL_GPIO_AF GPIO_AF_USART6
|
||||
#define AUX2_SERIAL_USART_IRQn USART6_IRQn
|
||||
#define AUX2_SERIAL_GPIO GPIOG
|
||||
#define AUX2_SERIAL_GPIO_PIN_TX GPIO_Pin_14 // PG.14
|
||||
#define AUX2_SERIAL_GPIO_PIN_RX GPIO_Pin_9 // PG.09
|
||||
#define AUX2_SERIAL_GPIO_PinSource_TX GPIO_PinSource14
|
||||
#define AUX2_SERIAL_GPIO_PinSource_RX GPIO_PinSource9
|
||||
#define AUX2_SERIAL_USART_IRQHandler USART6_IRQHandler
|
||||
#define AUX2_SERIAL_DMA_Stream_RX DMA2_Stream6
|
||||
#define AUX2_SERIAL_DMA_Channel_RX DMA_Channel_5
|
||||
#define AUX2_SERIAL_PWR_GPIO GPIOB
|
||||
#define AUX2_SERIAL_PWR_GPIO_PIN GPIO_Pin_0 // PB.00
|
||||
#elif defined(RADIO_TX16S) && defined(INTERNAL_GPS)
|
||||
#define GPS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOG)
|
||||
#define GPS_RCC_APB1Periph 0
|
||||
#define GPS_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||
#define GPS_USART USART6
|
||||
#define GPS_GPIO_AF GPIO_AF_USART6
|
||||
#define GPS_USART_IRQn USART6_IRQn
|
||||
#define GPS_USART_IRQHandler USART6_IRQHandler
|
||||
#define GPS_UART_GPIO GPIOG
|
||||
#define GPS_TX_GPIO_PIN GPIO_Pin_14 // PG.14
|
||||
#define GPS_RX_GPIO_PIN GPIO_Pin_9 // PG.09
|
||||
#define GPS_TX_GPIO_PinSource GPIO_PinSource14
|
||||
#define GPS_RX_GPIO_PinSource GPIO_PinSource9
|
||||
#define GPS_PWR_GPIO GPIOB
|
||||
#define GPS_PWR_GPIO_PIN GPIO_Pin_0 // PB.00
|
||||
#define AUX2_SERIAL_RCC_AHB1Periph 0
|
||||
#define AUX2_SERIAL_RCC_APB1Periph 0
|
||||
#define AUX2_SERIAL_RCC_APB2Periph 0
|
||||
#else
|
||||
#define AUX2_SERIAL_RCC_AHB1Periph 0
|
||||
#define AUX2_SERIAL_RCC_APB1Periph 0
|
||||
#define AUX2_SERIAL_RCC_APB2Periph 0
|
||||
#endif
|
||||
|
||||
// Telemetry
|
||||
#define TELEMETRY_RCC_AHB1Periph (RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA1)
|
||||
#define TELEMETRY_RCC_APB1Periph RCC_APB1Periph_USART2
|
||||
@@ -625,11 +653,34 @@
|
||||
#define AUDIO_MUTE_DELAY 500 // ms
|
||||
#endif
|
||||
|
||||
// I2C Bus
|
||||
#if defined(RADIO_TX16S)
|
||||
#define I2C_RCC_AHB1Periph 0
|
||||
#define I2C_RCC_APB1Periph 0
|
||||
// Only slight noise with 868MHz > 1W, if complaints later remove and set AUDIO_UNMUTE_DELAY to 150
|
||||
#undef AUDIO_MUTE_GPIO_PIN
|
||||
#endif
|
||||
|
||||
// Touch
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#define TOUCH_INT_RCC_AHB1Periph RCC_AHB1Periph_GPIOH
|
||||
#define TOUCH_INT_GPIO GPIOH
|
||||
#define TOUCH_INT_GPIO_PIN GPIO_Pin_2 // PH.02
|
||||
|
||||
#define TOUCH_RST_RCC_AHB1Periph RCC_AHB1Periph_GPIOF
|
||||
#define TOUCH_RST_GPIO GPIOF
|
||||
#define TOUCH_RST_GPIO_PIN GPIO_Pin_10 // PF.10
|
||||
|
||||
#define TOUCH_INT_EXTI_LINE1 EXTI_Line2
|
||||
#define TOUCH_INT_EXTI_IRQn1 EXTI2_IRQn
|
||||
#define TOUCH_INT_EXTI_IRQHandler1 EXTI2_IRQHandler
|
||||
#define TOUCH_INT_EXTI_PortSource EXTI_PortSourceGPIOH
|
||||
#define TOUCH_INT_EXTI_PinSource1 EXTI_PinSource2
|
||||
|
||||
#define TOUCH_INT_STATUS() (GPIO_ReadInputDataBit(TOUCH_INT_GPIO, TOUCH_INT_GPIO_PIN))
|
||||
#else
|
||||
#define TOUCH_INT_RCC_AHB1Periph 0
|
||||
#define TOUCH_RST_RCC_AHB1Periph 0
|
||||
#endif
|
||||
|
||||
// I2C Bus
|
||||
#define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||
#define I2C_RCC_APB1Periph RCC_APB1Periph_I2C1
|
||||
#define I2C I2C1
|
||||
@@ -640,7 +691,6 @@
|
||||
#define I2C_SCL_GPIO_PinSource GPIO_PinSource8
|
||||
#define I2C_SDA_GPIO_PinSource GPIO_PinSource9
|
||||
#define I2C_SPEED 400000
|
||||
#endif
|
||||
|
||||
// Haptic
|
||||
#define HAPTIC_PWM
|
||||
@@ -834,24 +884,6 @@
|
||||
#define TIMER_2MHz_RCC_APB1Periph RCC_APB1Periph_TIM7
|
||||
#define TIMER_2MHz_TIMER TIM7
|
||||
|
||||
// Touch
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#define I2C_TOUCH_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||
#define I2C_TOUCH_RCC_APB1Periph RCC_APB1Periph_I2C1
|
||||
#define I2C_TOUCH I2C1
|
||||
#define I2C_TOUCH_GPIO GPIOB
|
||||
#define I2C_TOUCH_SCL_GPIO_PIN GPIO_Pin_8 // PB.08
|
||||
#define I2C_TOUCH_SDA_GPIO_PIN GPIO_Pin_7 // PB.07
|
||||
|
||||
#define I2C_TOUCH_RESET_GPIO GPIOF
|
||||
#define I2C_TOUCH_RESET_GPIO_PIN GPIO_Pin_10 // PF.10
|
||||
#define I2C_TOUCH_INT_GPIO GPIOH
|
||||
#define I2C_TOUCH_INT_GPIO_PIN GPIO_Pin_2 // PH.02
|
||||
#else
|
||||
#define I2C_TOUCH_RCC_AHB1Periph 0
|
||||
#define I2C_TOUCH_RCC_APB1Periph 0
|
||||
#endif
|
||||
|
||||
// Bluetooth
|
||||
#define STORAGE_BLUETOOTH
|
||||
#if defined(BLUETOOTH)
|
||||
@@ -892,6 +924,7 @@
|
||||
#if defined(PCBX12S)
|
||||
#define GPS_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||
#define GPS_RCC_APB1Periph RCC_APB1Periph_UART4
|
||||
#define GPS_RCC_APB2Periph 0
|
||||
#define GPS_USART UART4
|
||||
#define GPS_GPIO_AF GPIO_AF_UART4
|
||||
#define GPS_USART_IRQn UART4_IRQn
|
||||
@@ -901,9 +934,10 @@
|
||||
#define GPS_RX_GPIO_PIN GPIO_Pin_1 // PA.01
|
||||
#define GPS_TX_GPIO_PinSource GPIO_PinSource0
|
||||
#define GPS_RX_GPIO_PinSource GPIO_PinSource1
|
||||
#else
|
||||
#elif !defined(INTERNAL_GPS)
|
||||
#define GPS_RCC_AHB1Periph 0
|
||||
#define GPS_RCC_APB1Periph 0
|
||||
#define GPS_RCC_APB2Periph 0
|
||||
#endif
|
||||
|
||||
#endif // _HAL_H_
|
||||
|
||||