mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
Issue #1608 start - What do you think?
This commit is contained in:
parent
2a0445e41e
commit
f67f0ffb1d
31 changed files with 320 additions and 143 deletions
|
@ -39,7 +39,6 @@
|
|||
#define AUTOSWITCH
|
||||
#define GRAPHICS
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
#define BOLD_FONT
|
||||
#define VOICE
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#define AUTOSWITCH
|
||||
#define GRAPHICS
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
#define BOLD_FONT
|
||||
#define VOICE
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#define AUTOSWITCH
|
||||
#define GRAPHICS
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
#define BOLD_FONT
|
||||
#define VOICE
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#define GRAPHICS
|
||||
#define SDCARD
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
#define BOLD_FONT
|
||||
#define PPM_CENTER_ADJUSTABLE
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define SIMU_EXCEPTIONS
|
||||
#define PCBTARANIS
|
||||
#define CPUARM
|
||||
#define CPUSTM32
|
||||
#define GUI
|
||||
#define HELI
|
||||
#define SPLASH
|
||||
|
@ -43,6 +44,7 @@
|
|||
#define GRAPHICS
|
||||
#define SDCARD
|
||||
#define RTCLOCK
|
||||
#define VIRTUALINPUTS
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define SIMU_EXCEPTIONS
|
||||
#define PCBTARANIS
|
||||
#define CPUARM
|
||||
#define CPUSTM32
|
||||
#define GUI
|
||||
#define HELI
|
||||
#define SPLASH
|
||||
|
@ -43,6 +44,7 @@
|
|||
#define GRAPHICS
|
||||
#define SDCARD
|
||||
#define RTCLOCK
|
||||
#define VIRTUALINPUTS
|
||||
#define CURVES
|
||||
#define XCURVES
|
||||
#define GVARS
|
||||
|
|
|
@ -811,7 +811,7 @@ ifeq ($(PCB), TARANIS)
|
|||
MCU = cortex-m3
|
||||
OPT = s
|
||||
CPPDEFS += -DHSE_VALUE=12000000
|
||||
BITMAPS += $(patsubst %.png,%.lbm,$(wildcard bitmaps/Taranis/*.png) $(wildcard bitmaps/Taranis/std/*.png))
|
||||
BITMAPS += $(patsubst %.png,%.lbm,$(wildcard bitmaps/Taranis/*.png)) bitmaps/Taranis/mainmenu.lbm
|
||||
SDCARD = YES
|
||||
THR_TRACE = YES
|
||||
EXT = FRSKY_SPORT
|
||||
|
@ -821,7 +821,7 @@ ifeq ($(PCB), TARANIS)
|
|||
PPM_LIMITS_SYMETRICAL = YES
|
||||
PPM_CENTER_ADJUSTABLE = YES
|
||||
DSM2 = PPM
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DPXX
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DXCURVES -DEEPROM_VARIANT=0 -DAUDIO -DPXX
|
||||
INCDIRS += targets/taranis CoOS/kernel CoOS/portable
|
||||
EXTRAINCDIRS += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/include
|
||||
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc
|
||||
|
@ -1437,6 +1437,10 @@ fonts: $(FONTS)
|
|||
fonts/%.lbm: fonts/%.png
|
||||
$(IMG2LBM) $^ $@ $(LCDSIZE)
|
||||
|
||||
fonts/font_tinsize.lbm:
|
||||
$(FONT2PNG) $(FONTNAME) 5 fonts/font_tinsize.png
|
||||
$(IMG2LBM) fonts/font_tinsize.png $@ $(LCDSIZE) 4bits
|
||||
|
||||
fonts/font_stdsize.lbm:
|
||||
$(FONT2PNG) $(FONTNAME) 8 fonts/font_stdsize.png
|
||||
$(IMG2LBM) fonts/font_stdsize.png $@ $(LCDSIZE) 4bits
|
||||
|
@ -1461,6 +1465,9 @@ bitmaps/9X/%.lbm: bitmaps/9X/%.png
|
|||
bitmaps/Taranis/%.lbm: bitmaps/Taranis/%.png
|
||||
$(IMG2LBM) $^ $@ $(LCDSIZE) 4bits
|
||||
|
||||
bitmaps/Taranis/mainmenu.png: ../util/taranisicons.py $(wildcard bitmaps/Taranis/std/*.png)
|
||||
@$(PYTHON) ../util/taranisicons.py
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
PARSER = avr-cpp
|
||||
else
|
||||
|
|
1
radio/src/bitmaps/Taranis/.gitignore
vendored
Executable file
1
radio/src/bitmaps/Taranis/.gitignore
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
/mainmenu.png
|
|
@ -77,11 +77,19 @@ void pushMenu(MenuFuncP newMenu)
|
|||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuModelNotes(uint8_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
strcpy(s_text_file, MODELS_PATH "/");
|
||||
char *buf = strcat_modelname(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
}
|
||||
|
||||
menuTextView(event);
|
||||
}
|
||||
|
||||
void pushModelNotes()
|
||||
{
|
||||
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
||||
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
pushMenuTextView(filename);
|
||||
pushMenu(menuModelNotes);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -437,6 +437,9 @@ void displayWarning(uint8_t event);
|
|||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(uint8_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
bool modelHasNotes();
|
||||
void pushModelNotes();
|
||||
|
|
|
@ -42,9 +42,16 @@
|
|||
#define MENU_TITLE_HEIGHT FH
|
||||
#define MENU_NAVIG_HEIGHT 0
|
||||
|
||||
struct MenuItem {
|
||||
const char *name;
|
||||
const MenuFuncP action;
|
||||
};
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
void displaySplash();
|
||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void displayMenuBar(const MenuItem *menu, int index);
|
||||
|
||||
extern coord_t scrollbar_X;
|
||||
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);
|
||||
|
|
|
@ -48,6 +48,20 @@ uint8_t switchToMix(uint8_t source)
|
|||
return MIXSRC_SH;
|
||||
}
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
|
||||
{
|
||||
do {
|
||||
current += inc;
|
||||
if (current < min)
|
||||
current = max;
|
||||
else if (current > max)
|
||||
current = min;
|
||||
if (!isValueAvailable || isValueAvailable(current))
|
||||
return current;
|
||||
} while(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool isInputAvailable(int input)
|
||||
{
|
||||
for (int i=0; i<MAX_EXPOS; i++) {
|
||||
|
|
|
@ -525,11 +525,11 @@ void lcd_vline(coord_t x, scoord_t y, scoord_t h)
|
|||
|
||||
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, pat);
|
||||
lcd_vlineStip(x+w-1, y, h, pat);
|
||||
lcd_vlineStip(x, y, h, pat, att);
|
||||
lcd_vlineStip(x+w-1, y, h, pat, att);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcd_hlineStip(x, y+h-1, w, pat);
|
||||
lcd_hlineStip(x, y, w, pat);
|
||||
lcd_hlineStip(x, y+h-1, w, pat, att);
|
||||
lcd_hlineStip(x, y, w, pat, att);
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
@ -936,10 +936,17 @@ void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t value, Lc
|
|||
else if (channel == MIXSRC_TX_VOLTAGE) {
|
||||
lcd_outdezAtt(x, y, value, att|PREC1);
|
||||
}
|
||||
else {
|
||||
if (channel <= MIXSRC_LAST_CH) {
|
||||
value = calcRESXto100(value);
|
||||
else if (channel < MIXSRC_FIRST_CH) {
|
||||
lcd_outdezAtt(x, y, calcRESXto100(value), att);
|
||||
}
|
||||
else if (channel <= MIXSRC_LAST_CH) {
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x, y, calcRESXto1000(value), att|PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(x, y, calcRESXto100(value), att);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(x, y, value, att);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,13 +188,12 @@ void menuCommonCalib(uint8_t event)
|
|||
|
||||
void menuGeneralCalib(uint8_t event)
|
||||
{
|
||||
check_simple(event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0);
|
||||
check_simple(STR_MENUCALIBRATION, event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0);
|
||||
|
||||
if (menuEvent) {
|
||||
calibrationState = 0;
|
||||
}
|
||||
|
||||
TITLE(STR_MENUCALIBRATION);
|
||||
menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
|||
menuHandler = onLogicalSwitchesMenu;
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
k = i+s_pgOfs;
|
||||
LcdFlags attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
|
@ -135,7 +135,9 @@ void menuModelLogicalSwitches(uint8_t event)
|
|||
|
||||
// CSW params
|
||||
unsigned int cstate = lswFamily(cs->func);
|
||||
int v1_val=cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM, v3_min=-1, v3_max=100;
|
||||
int v1_val=cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM;
|
||||
int v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
int v3_min=-1, v3_max=100;
|
||||
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
|
@ -186,9 +188,14 @@ void menuModelLogicalSwitches(uint8_t event)
|
|||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
putsChannelValue(CSW_3RD_COLUMN, y, v1_val, v1_val <= MIXSRC_LAST_CH ? calc100toRESX(cs->v2) : cs->v2, LEFT|attr2);
|
||||
v2_min = -30000;
|
||||
v2_max = 30000;
|
||||
v2_max = getMaximumValue(v1_val);
|
||||
v2_min = - v2_min;
|
||||
if (v1_val <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(CSW_3RD_COLUMN, y, v1_val, calc100toRESX(cs->v2), LEFT|attr2);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(CSW_3RD_COLUMN, y, v1_val, cs->v2, LEFT|attr2);
|
||||
}
|
||||
}
|
||||
|
||||
// CSW AND switch
|
||||
|
@ -245,7 +252,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
|||
if (cstate==LS_FAMILY_OFS && cs->v1!=0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
getvalue_t x = getValue(v1_val);
|
||||
if (v1_val < MIXSRC_GVAR1)
|
||||
if (v1_val <= MIXSRC_LAST_CH)
|
||||
cs->v2 = calcRESXto100(x);
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ void menuModelSelect(uint8_t event)
|
|||
|
||||
int8_t oldSub = m_posVert;
|
||||
|
||||
check_submenu_simple(_event_, MAX_MODELS);
|
||||
check_submenu_simple(NULL, _event_, MAX_MODELS);
|
||||
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ void menuModelSetup(uint8_t event)
|
|||
bool CURSOR_ON_CELL = (m_posHorz >= 0);
|
||||
MENU_TAB({ 0, 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsAllowed()), ONE_2x2POS_DEFINED() ? TITLE_ROW : HIDDEN_ROW, POT_WARN_ITEMS(), NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0, LABEL(InternalModule), 0, IF_INTERNAL_MODULE_ON(1), IF_INTERNAL_MODULE_ON(IS_D8_RX(0) ? (uint8_t)1 : (uint8_t)2), IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), LABEL(ExternalModule), (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0, EXTERNAL_MODULE_CHANNELS_ROWS(), (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW, IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)), LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
|
||||
|
||||
MENU_CHECK(menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX);
|
||||
MENU_CHECK(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX);
|
||||
|
||||
#if (defined(DSM2) || defined(PXX))
|
||||
if (menuEvent) {
|
||||
|
@ -149,8 +149,6 @@ void menuModelSetup(uint8_t event)
|
|||
}
|
||||
#endif
|
||||
|
||||
TITLE(STR_MENUSETUP);
|
||||
|
||||
uint8_t sub = m_posVert;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
|
|
|
@ -115,7 +115,6 @@ enum menuModelTelemetryItems {
|
|||
#define IF_FAS_OFFSET(x) x,
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#define CHANNELS_ROWS
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0,
|
||||
#define USRDATA_ROWS
|
||||
|
@ -436,20 +435,20 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
|||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
|
||||
|
||||
int sub = m_posVert;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
int k = i + s_pgOfs;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+TELEM_VALUES_MAX) {
|
||||
int index = k-ITEM_TELEMETRY_SENSOR1;
|
||||
|
@ -662,10 +661,18 @@ void menuModelTelemetry(uint8_t event)
|
|||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
|
||||
int barMax = getMaximumValue(barSource);
|
||||
int barMin = -barMax;
|
||||
if (barSource) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
else if (attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
|
@ -674,15 +681,21 @@ void menuModelTelemetry(uint8_t event)
|
|||
case 0:
|
||||
bar.source = CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, barSource, MIXSRC_LAST_TELEM, isSourceAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
bar.barMin = -100;
|
||||
bar.barMax = 100;
|
||||
}
|
||||
else {
|
||||
bar.barMin = 0;
|
||||
bar.barMax = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bar.barMin = checkIncDec(event, bar.barMin, -30000, bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
bar.barMin = checkIncDec(event, bar.barMin, barMin, bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
case 2:
|
||||
bar.barMax = checkIncDec(event, bar.barMax, bar.barMin, 30000, EE_MODEL|NO_INCDEC_MARKS);
|
||||
bar.barMax = checkIncDec(event, bar.barMax, bar.barMin, barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -690,10 +703,10 @@ void menuModelTelemetry(uint8_t event)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
for (uint8_t c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
uint8_t cellAttr = (m_posHorz==c ? attr : 0);
|
||||
for (int c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
LcdFlags cellAttr = (m_posHorz==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
uint8_t pos[] = {TELEM_COL1, TELEM_COL2, TELEM_COL3};
|
||||
const coord_t pos[] = {TELEM_COL1, TELEM_COL2, TELEM_COL3};
|
||||
putsMixerSource(pos[c], y, value, cellAttr);
|
||||
if (cellAttr && s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, MIXSRC_LAST_TELEM, isSourceAvailable);
|
||||
|
|
|
@ -76,10 +76,18 @@ void pushMenu(MenuFuncP newMenu)
|
|||
menuEvent = EVT_ENTRY;
|
||||
}
|
||||
|
||||
void menuModelNotes(uint8_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
strcpy(s_text_file, MODELS_PATH "/");
|
||||
char *buf = strcat_modelname(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
}
|
||||
|
||||
menuTextView(event);
|
||||
}
|
||||
|
||||
void pushModelNotes()
|
||||
{
|
||||
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
||||
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
pushMenuTextView(filename);
|
||||
pushMenu(menuModelNotes);
|
||||
}
|
||||
|
|
|
@ -100,8 +100,12 @@ void menuGeneralDiagAna(uint8_t event);
|
|||
#if defined(FRSKY)
|
||||
void menuTelemetryFrsky(uint8_t event);
|
||||
#endif
|
||||
void menuModelSetup(uint8_t event);
|
||||
void menuModelNotes(uint8_t event);
|
||||
void menuGeneralSetup(uint8_t event);
|
||||
void menuGeneralSdManager(uint8_t event);
|
||||
void menuGeneralCalib(uint8_t event);
|
||||
void menuGeneralVersion(uint8_t event);
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
|
||||
void menuModelSelect(uint8_t event);
|
||||
|
@ -219,54 +223,49 @@ bool isInputSourceAvailable(int source);
|
|||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
|
||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||
void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
void check(const char *title, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
void check_simple(const char *title, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
void check_submenu_simple(const char *title, check_event_t event, uint8_t maxrow);
|
||||
|
||||
void title(const pm_char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
#define MENU_CHECK(tab, menu, lines_count) \
|
||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
|
||||
#define MENU_CHECK(title, tab, menu, lines_count) \
|
||||
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
|
||||
|
||||
#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \
|
||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, flags)
|
||||
#define MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count) \
|
||||
check(title, event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, flags)
|
||||
|
||||
#define MENU(title, tab, menu, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
MENU_CHECK(tab, menu, lines_count); \
|
||||
TITLE(title)
|
||||
MENU_CHECK(title, tab, menu, lines_count)
|
||||
|
||||
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
MENU_CHECK_FLAGS(tab, menu, flags, lines_count); \
|
||||
TITLE(title)
|
||||
MENU_CHECK_FLAGS(title, tab, menu, flags, lines_count)
|
||||
|
||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||
check_simple(event, menu, tab, DIM(tab), lines_count);
|
||||
check_simple(NULL, event, menu, tab, DIM(tab), lines_count);
|
||||
|
||||
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
||||
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
||||
TITLE(title)
|
||||
check_simple(title, event, menu, tab, DIM(tab), lines_count)
|
||||
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||
check(NULL, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||
}
|
||||
|
||||
#define SUBMENU(title, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||
TITLE(title)
|
||||
check(title, event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)
|
||||
|
||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||
check_submenu_simple(event, lines_count);
|
||||
check_submenu_simple(NULL, event, lines_count);
|
||||
|
||||
#define SIMPLE_SUBMENU(title, lines_count) \
|
||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||
TITLE(title)
|
||||
check_submenu_simple(title, event, lines_count)
|
||||
|
||||
typedef int select_menu_value_t;
|
||||
|
||||
|
@ -343,6 +342,9 @@ extern char statusLineMsg[STATUS_LINE_LENGTH];
|
|||
void showStatusLine();
|
||||
void drawStatusLine();
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(uint8_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
bool modelHasNotes();
|
||||
void pushModelNotes();
|
||||
|
|
|
@ -231,7 +231,7 @@ void onLongMenuPress(const char *result)
|
|||
|
||||
tmr10ms_t menuEntryTime;
|
||||
|
||||
void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
|
@ -466,19 +466,23 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
|||
displayScrollbar(scrollbar_X, MENU_TITLE_HEIGHT, LCD_H-MENU_TITLE_HEIGHT-MENU_NAVIG_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
title(name);
|
||||
}
|
||||
|
||||
m_posVert = l_posVert;
|
||||
m_posHorz = l_posHorz;
|
||||
}
|
||||
|
||||
|
||||
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
void check_simple(const char *name, check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount)
|
||||
{
|
||||
check(event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
||||
check(name, event, curr, menuTab, menuTabSize, 0, 0, rowcount);
|
||||
}
|
||||
|
||||
void check_submenu_simple(check_event_t event, uint8_t rowcount)
|
||||
void check_submenu_simple(const char *name, check_event_t event, uint8_t rowcount)
|
||||
{
|
||||
check_simple(event, 0, 0, 0, rowcount);
|
||||
check_simple(name, event, 0, 0, 0, rowcount);
|
||||
}
|
||||
|
||||
void repeatLastCursorMove(uint8_t event)
|
||||
|
|
|
@ -350,11 +350,6 @@ void displayTimers()
|
|||
}
|
||||
}
|
||||
|
||||
#define EVT_KEY_MODEL_MENU EVT_KEY_BREAK(KEY_MENU)
|
||||
#define EVT_KEY_GENERAL_MENU EVT_KEY_LONG(KEY_MENU)
|
||||
#define EVT_KEY_TELEMETRY EVT_KEY_LONG(KEY_PAGE)
|
||||
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
|
||||
|
||||
void menuMainViewChannelsMonitor(uint8_t event)
|
||||
{
|
||||
switch(event) {
|
||||
|
@ -431,13 +426,49 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
|
|||
}
|
||||
}
|
||||
|
||||
const MenuItem MAIN_MENU[] = {
|
||||
{ "RADIO SETTINGS", menuGeneralSetup },
|
||||
{ "MODEL SELECT", menuModelSelect },
|
||||
{ "MODEL SETTINGS", menuModelSetup },
|
||||
{ "CHECKLIST", menuModelNotes },
|
||||
{ "SD MANAGER", menuGeneralSdManager },
|
||||
{ "VERSION", menuGeneralVersion }
|
||||
};
|
||||
|
||||
bool isMenuAvailable(int index)
|
||||
{
|
||||
if (index == 4) {
|
||||
return modelHasNotes();
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#define GRAPHICAL_MENUS 1
|
||||
|
||||
#if GRAPHICAL_MENUS == 1
|
||||
#define DECLARE_MAIN_MENU() static int currentMenuIndex = -1
|
||||
#define INIT_MAIN_MENU() currentMenuIndex = -1
|
||||
#define IS_MAIN_MENU_DISPLAYED() currentMenuIndex > 0
|
||||
#define TOGGLE_MAIN_MENU() currentMenuIndex = -currentMenuIndex
|
||||
#else
|
||||
#define DECLARE_MAIN_MENU()
|
||||
#define INIT_MAIN_MENU()
|
||||
#define IS_MAIN_MENU_DISPLAYED() 0
|
||||
#define TOGGLE_MAIN_MENU()
|
||||
#endif
|
||||
|
||||
void menuMainView(uint8_t event)
|
||||
{
|
||||
DECLARE_MAIN_MENU();
|
||||
|
||||
STICK_SCROLL_DISABLE();
|
||||
|
||||
switch(event) {
|
||||
|
||||
case EVT_ENTRY:
|
||||
INIT_MAIN_MENU();
|
||||
killEvents(KEY_EXIT);
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
|
@ -447,13 +478,11 @@ void menuMainView(uint8_t event)
|
|||
LOAD_MODEL_BITMAP();
|
||||
break;
|
||||
|
||||
case EVT_KEY_CONTEXT_MENU:
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
|
||||
if (modelHasNotes()) {
|
||||
MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
}
|
||||
|
||||
MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
MENU_ADD_ITEM(STR_STATISTICS);
|
||||
MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
|
@ -461,16 +490,21 @@ void menuMainView(uint8_t event)
|
|||
break;
|
||||
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_MODEL_MENU:
|
||||
case EVT_KEY_BREAK(KEY_MENU):
|
||||
#if GRAPHICAL_MENUS == 1
|
||||
TOGGLE_MAIN_MENU();
|
||||
#else
|
||||
pushMenu(menuModelSelect);
|
||||
killEvents(event);
|
||||
#endif
|
||||
break;
|
||||
|
||||
CASE_EVT_ROTARY_LONG
|
||||
case EVT_KEY_GENERAL_MENU:
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
#if GRAPHICAL_MENUS == 1
|
||||
pushMenu(lastPopMenu());
|
||||
#else
|
||||
pushMenu(menuGeneralSetup);
|
||||
killEvents(event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -483,15 +517,18 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_TELEMETRY:
|
||||
case EVT_KEY_LONG(KEY_PAGE):
|
||||
if (!IS_FAI_ENABLED())
|
||||
chainMenu(menuTelemetryFrsky);
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
if (IS_MAIN_MENU_DISPLAYED()) {
|
||||
TOGGLE_MAIN_MENU();
|
||||
}
|
||||
#if defined(GVARS)
|
||||
if (s_gvar_timer > 0) {
|
||||
else if (s_gvar_timer > 0) {
|
||||
s_gvar_timer = 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -499,17 +536,15 @@ void menuMainView(uint8_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
{
|
||||
// Flight Phase Name
|
||||
uint8_t phase = mixerCurrentFlightMode;
|
||||
lcd_putsnAtt(PHASE_X, PHASE_Y, g_model.flightModeData[phase].name, sizeof(g_model.flightModeData[phase].name), ZCHAR|PHASE_FLAGS);
|
||||
// Flight Mode Name
|
||||
int mode = mixerCurrentFlightMode;
|
||||
lcd_putsnAtt(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|PHASE_FLAGS);
|
||||
|
||||
// Model Name
|
||||
putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE);
|
||||
|
||||
// Trims sliders
|
||||
displayTrims(phase);
|
||||
}
|
||||
displayTrims(mode);
|
||||
|
||||
// Top bar
|
||||
displayTopBar();
|
||||
|
@ -521,7 +556,7 @@ void menuMainView(uint8_t event)
|
|||
|
||||
// Switches
|
||||
#if defined(REV9E)
|
||||
for (unsigned i=0; i<18; i++) {
|
||||
for (int i=0; i<18; ++i) {
|
||||
div_t qr = div(i, 9);
|
||||
if (g_eeGeneral.view == VIEW_INPUTS) {
|
||||
div_t qr2 = div(qr.rem, 5);
|
||||
|
@ -535,7 +570,7 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
}
|
||||
#else
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
for (int i=0; i<8; ++i) {
|
||||
getvalue_t sw;
|
||||
getvalue_t val;
|
||||
// TODO simplify this + reuse code in checkSwitches() + Menu MODELSETUP
|
||||
|
@ -571,7 +606,7 @@ void menuMainView(uint8_t event)
|
|||
else {
|
||||
// Logical Switches
|
||||
lcd_puts(TRIM_RH_X - TRIM_LEN/2 + 5, 6*FH-1, "LS 1-32");
|
||||
for (uint8_t sw=0; sw<NUM_LOGICAL_SWITCH; sw++) {
|
||||
for (int sw=0; sw<NUM_LOGICAL_SWITCH; ++sw) {
|
||||
div_t qr = div(sw, 10);
|
||||
uint8_t y = 13 + 11 * qr.quot;
|
||||
uint8_t x = TRIM_RH_X - TRIM_LEN + qr.rem*5 + (qr.rem >= 5 ? 3 : 0);
|
||||
|
@ -589,7 +624,6 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(GVARS)
|
||||
if (s_gvar_timer > 0) {
|
||||
s_gvar_timer--;
|
||||
|
@ -601,4 +635,25 @@ void menuMainView(uint8_t event)
|
|||
lcd_outdezAtt(BITMAP_X+5*FW+FW/2, BITMAP_Y+2*FH+3, GVAR_VALUE(s_gvar_last, getGVarFlightPhase(mixerCurrentFlightMode, s_gvar_last)), BOLD);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GRAPHICAL_MENUS > 0
|
||||
if (IS_MAIN_MENU_DISPLAYED()) {
|
||||
displayMenuBar(MAIN_MENU, currentMenuIndex-1);
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_MINUS):
|
||||
currentMenuIndex = circularIncDec(currentMenuIndex, +1, 1, DIM(MAIN_MENU), isMenuAvailable);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_PLUS):
|
||||
currentMenuIndex = circularIncDec(currentMenuIndex, -1, 1, DIM(MAIN_MENU), isMenuAvailable);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
killEvents(event);
|
||||
pushMenu(MAIN_MENU[currentMenuIndex-1].action);
|
||||
TOGGLE_MAIN_MENU();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ bar_threshold_t barsThresholds[THLD_MAX];
|
|||
uint8_t s_frsky_view = 0;
|
||||
|
||||
#define BAR_LEFT 26
|
||||
#define BAR_WIDTH 157
|
||||
#define BAR_WIDTH 156
|
||||
|
||||
void displayRssiLine()
|
||||
{
|
||||
|
@ -68,33 +68,37 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
|
|||
return (45 - 3*alarm + g_model.frsky.rssiAlarms[alarm].value);
|
||||
}
|
||||
|
||||
uint8_t barCoord(int16_t value, int16_t min, int16_t max)
|
||||
int barCoord(int value, int min, int max)
|
||||
{
|
||||
if (value <= min)
|
||||
return 0;
|
||||
else if (value >= max)
|
||||
return BAR_WIDTH-1;
|
||||
else
|
||||
return ((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min);
|
||||
return ((BAR_WIDTH-1) * (value - min)) / (max - min);
|
||||
}
|
||||
|
||||
bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with gauges
|
||||
uint8_t barHeight = 5;
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
int barHeight = 5;
|
||||
for (int i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
source_t source = bar.source;
|
||||
getvalue_t barMin = bar.barMin;
|
||||
getvalue_t barMax = bar.barMax;
|
||||
if (source <= MIXSRC_LAST_CH) {
|
||||
barMin = calc100toRESX(barMin);
|
||||
barMax = calc100toRESX(barMax);
|
||||
}
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
int y = barHeight+6+i*(barHeight+6);
|
||||
putsMixerSource(0, y+barHeight-5, source, 0);
|
||||
lcd_rect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
|
||||
getvalue_t value = getValue(source);
|
||||
putsChannel(BAR_LEFT+2+BAR_WIDTH, y+barHeight-5, source, LEFT);
|
||||
uint8_t thresholdX = 0;
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
int width = barCoord(value, barMin, barMax);
|
||||
uint8_t barShade = SOLID;
|
||||
drawFilledRect(BAR_LEFT+1, y+1, width, barHeight, barShade);
|
||||
for (uint8_t j=24; j<99; j+=25) {
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
#define TEXT_FILE_MAXSIZE 2048
|
||||
|
||||
char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
|
|
|
@ -81,6 +81,20 @@ void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t
|
|||
lcd_vlineStip(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
|
||||
const pm_uchar MAINMENU_LBM[] PROGMEM = {
|
||||
#include "bitmaps/Taranis/mainmenu.lbm"
|
||||
};
|
||||
|
||||
void displayMenuBar(const MenuItem *menu, int index)
|
||||
{
|
||||
drawFilledRect(0, 0, LCD_W, 32, SOLID, ERASE);
|
||||
drawFilledRect(0, 24, LCD_W, 7, SOLID, GREY_DEFAULT);
|
||||
lcd_bmp(1, 0, MAINMENU_LBM);
|
||||
lcd_putsAtt(0, 24, menu[index].name, INVERS);
|
||||
lcd_rect(index*24, 0, 26, 24, SOLID, FORCE);
|
||||
lcd_hlineStip(0, 31, LCD_W, SOLID, FORCE);
|
||||
}
|
||||
|
||||
void title(const pm_char * s)
|
||||
{
|
||||
lcd_putsAtt(0, 0, s, INVERS);
|
||||
|
|
|
@ -937,9 +937,9 @@ extern uint16_t lastMixerDuration;
|
|||
#define RESET_THR_TRACE() s_timeCum16ThrP = s_timeCumThr = 0
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(CPUSTM32)
|
||||
static inline uint16_t getTmr2MHz() { return TIM7->CNT; }
|
||||
#elif defined(PCBSKY9X)
|
||||
#elif defined(CPUARM)
|
||||
static inline uint16_t getTmr2MHz() { return TC1->TC_CHANNEL[0].TC_CV; }
|
||||
#else
|
||||
uint16_t getTmr16KHz();
|
||||
|
@ -1150,7 +1150,7 @@ extern int16_t ex_chans[NUM_CHNOUT]; // Outputs (before LIMITS) of th
|
|||
extern int16_t channelOutputs[NUM_CHNOUT];
|
||||
extern uint16_t BandGap;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(VIRTUALINPUTS)
|
||||
#define NUM_INPUTS (MAX_INPUTS)
|
||||
#else
|
||||
#define NUM_INPUTS (NUM_STICKS)
|
||||
|
@ -1159,23 +1159,35 @@ extern uint16_t BandGap;
|
|||
int intpol(int x, uint8_t idx);
|
||||
int expo(int x, int k);
|
||||
|
||||
#if defined(CURVES)
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(CURVES) && defined(XCURVES)
|
||||
int applyCurve(int x, CurveRef & curve);
|
||||
#else
|
||||
#elif defined(CURVES)
|
||||
int applyCurve(int x, int8_t idx);
|
||||
#endif
|
||||
#else
|
||||
#define applyCurve(x, idx) (x)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(CPUARM)
|
||||
inline int getMaximumValue(int source)
|
||||
{
|
||||
if (source < MIXSRC_FIRST_CH)
|
||||
return 100;
|
||||
else if (source <= MIXSRC_LAST_CH)
|
||||
return g_model.extendedLimits ? 150 : 100;
|
||||
else if (source >= MIXSRC_FIRST_TIMER && source <= MIXSRC_LAST_TIMER)
|
||||
return (23*60)+59;
|
||||
else
|
||||
return 30000;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XCURVES)
|
||||
int applyCustomCurve(int x, uint8_t idx);
|
||||
#else
|
||||
#define applyCustomCurve(x, idx) intpol(x, idx)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(XCURVES)
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS_INC , uint8_t ovwrIdx=0, int16_t ovwrValue=0
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS , uint8_t ovwrIdx, int16_t ovwrValue
|
||||
#else
|
||||
|
@ -1183,7 +1195,7 @@ int expo(int x, int k);
|
|||
#define APPLY_EXPOS_EXTRA_PARAMS
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(VIRTUALINPUTS)
|
||||
void clearInputs();
|
||||
void defaultInputs();
|
||||
#endif
|
||||
|
@ -1209,7 +1221,7 @@ LimitData *limitAddress(uint8_t idx);
|
|||
int8_t *curveAddress(uint8_t idx);
|
||||
LogicalSwitchData *lswAddress(uint8_t idx);
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
#if !defined(XCURVES)
|
||||
struct CurveInfo {
|
||||
int8_t *crv;
|
||||
uint8_t points;
|
||||
|
@ -1220,7 +1232,7 @@ extern CurveInfo curveInfo(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.
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(VIRTUALINPUTS)
|
||||
extern int8_t virtualInputsTrims[NUM_INPUTS];
|
||||
#else
|
||||
extern int16_t rawAnas[NUM_INPUTS];
|
||||
|
|
|
@ -53,7 +53,7 @@ uint16_t dummyport16;
|
|||
const char *eepromFile = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(CPUSTM32)
|
||||
uint32_t Peri1_frequency, Peri2_frequency;
|
||||
GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog;
|
||||
TIM_TypeDef tim1, tim2, tim3, tim4, tim8, tim10;
|
||||
|
@ -61,7 +61,7 @@ RCC_TypeDef rcc;
|
|||
DMA_Stream_TypeDef dma2_stream2, dma2_stream6;
|
||||
DMA_TypeDef dma2;
|
||||
USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
||||
#elif defined(PCBSKY9X)
|
||||
#elif defined(CPUARM)
|
||||
Pio Pioa, Piob, Pioc;
|
||||
Pwm pwm;
|
||||
Twi Twio;
|
||||
|
|
|
@ -98,7 +98,7 @@ typedef const uint8_t pm_uint8_t;
|
|||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(CPUSTM32)
|
||||
extern GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog;
|
||||
extern TIM_TypeDef tim1, tim3, tim4, tim8, tim10;
|
||||
extern USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
||||
|
|
|
@ -565,7 +565,7 @@ void telemetryReset()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if defined(CPUARM) && defined(SIMU)
|
||||
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, RSSI_ID, 0, 75, UNIT_RAW, 0);
|
||||
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, T1_FIRST_ID, 0, 100, UNIT_CELSIUS, 0);
|
||||
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, T1_FIRST_ID, 1, 200, UNIT_CELSIUS, 0);
|
||||
|
|
|
@ -6,15 +6,9 @@ from PyQt4 import Qt, QtGui
|
|||
|
||||
chars = u""" !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz~ ≥→←↑↓ △Ⓘ"""
|
||||
|
||||
font = sys.argv[1]
|
||||
size = int(sys.argv[2])
|
||||
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
font = QtGui.QFont(font)
|
||||
font.setPointSize(size)
|
||||
metrics = QtGui.QFontMetrics(font)
|
||||
|
||||
def getCharWidth():
|
||||
def getCharWidth(metrics):
|
||||
width = 0
|
||||
for c in chars:
|
||||
rect = metrics.boundingRect(c)
|
||||
|
@ -22,10 +16,12 @@ def getCharWidth():
|
|||
width = rect.width()
|
||||
return width
|
||||
|
||||
width = getCharWidth()
|
||||
|
||||
def createFontBitmap(filename, foreground, background):
|
||||
image = QtGui.QImage(width*len(chars), size+4, QtGui.QImage.Format_RGB32)
|
||||
def createFontBitmap(filename, fontname, fontsize, foreground, background):
|
||||
font = QtGui.QFont(fontname)
|
||||
font.setPointSize(fontsize)
|
||||
metrics = QtGui.QFontMetrics(font)
|
||||
width = getCharWidth(metrics)
|
||||
image = QtGui.QImage(width*len(chars), fontsize+4, QtGui.QImage.Format_RGB32)
|
||||
image.fill(background)
|
||||
painter = QtGui.QPainter()
|
||||
painter.begin(image)
|
||||
|
@ -38,13 +34,13 @@ def createFontBitmap(filename, foreground, background):
|
|||
rect.setWidth(4)
|
||||
elif i == 14:
|
||||
rect.setWidth(1)
|
||||
painter.drawPoint(width*i, size);
|
||||
painter.drawPoint(width*i, fontsize);
|
||||
else:
|
||||
painter.drawText(width*i-rect.left(), size+1, c)
|
||||
painter.drawText(width*i-rect.left(), fontsize+1, c)
|
||||
for j in range(rect.width(), width):
|
||||
painter.drawLine(width*i+j, 0, width*i+j, size+4)
|
||||
painter.drawLine(width*i+j, 0, width*i+j, fontsize+4)
|
||||
painter.end()
|
||||
image.save(filename)
|
||||
|
||||
if len(sys.argv) == 4:
|
||||
createFontBitmap(sys.argv[3], QtGui.QColor(0x00, 0x00, 0x00), QtGui.QColor(0xFF, 0xFF, 0xFF))
|
||||
createFontBitmap(sys.argv[3], sys.argv[1], int(sys.argv[2]), QtGui.QColor(0x00, 0x00, 0x00), QtGui.QColor(0xFF, 0xFF, 0xFF))
|
||||
|
|
19
radio/util/taranisicons.py
Executable file
19
radio/util/taranisicons.py
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from PyQt4 import Qt, QtGui
|
||||
|
||||
menu = [ "radio_setup", "model_select", "model_settings", "model_checklist", "files", "version" ]
|
||||
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
|
||||
image = QtGui.QImage(24*8, 24, QtGui.QImage.Format_RGB32)
|
||||
image.fill(QtGui.QColor(255, 255, 255))
|
||||
painter = QtGui.QPainter()
|
||||
painter.begin(image)
|
||||
for i, str in enumerate(menu):
|
||||
icon = QtGui.QImage("../src/bitmaps/Taranis/std/%s.png" % str)
|
||||
painter.drawImage(Qt.QPoint(24*i, 0), icon)
|
||||
painter.end()
|
||||
image.save("../src/bitmaps/Taranis/mainmenu.png")
|
Loading…
Add table
Add a link
Reference in a new issue