Add "hardware_defs" target to dump hardware defines from hal.h per target Fixed hal.h definitions for switches & ADC inputs Tools to generate hardware definitions from current hal.h generator: add support for EXTx and analog switches WiP Add generated header to hardware_defs target Add support for ADC input direction and index per GPIO port Incredible: it compiles Removed StdPeriph ADC driver Works on QX7 Works on TX16S (VBat missing) Switch driver using generated switches for stm32 targets Switch driver with generated switches for simu Use switch names from switch driver Fixed single conversion handling Fixed horus VBat reading Added switch name Fix warnings about bitfield offsets and GCC 4.4 This is caused by bitfields that cross type boundaries. In this particular case, it happens as the bitfield is not defined the same in `rtc_backup.cpp`. Switches has already been moved to generic driver Jitter measurement for each sample, not just for oversampled values Moved periph clock init to the ADC driver ADC & GPIOs. Add switchInit() to init pins Fix NV14 CMake Fix taranis target Fix NV14 (again) Model audio files: use new interface for switch index Fix X9-lite Fix simu headers Fix getSwitchName() Add support for ADC switches Fix switch warning YAML Test only switches which are defined Conversions tests for QX7 only on QX7 Fix X12S Fix function switch names Enable ADC periph clock before initialising channels NV14: offset inputs for the sticks & fix switches WiP: get rid of VSRCRAW and some more Simu shall use normal ADC driver fix x7 fix nv14 Fix 9x nav fix 212x64 fix xlite fix x9e fix simu lib fix unit tests fix x7 tests PWM stick values should be written directly into adcValues ... just like FlySky sticks. fix x12s fix nv14 Add some support for SPI ADC (only unit tests) Remove `jq` usage fix generate_yaml.py for newer libclang fix pot config fix stick names Some YAML generator improvements Max 16 Pots on COLORLCD Fix some source names Use 10 bits for switches to prevent overflow Removed horus constants for switches & ADC inputs Fix unit tests Fix curve edit Fix libsimulator Fix function switches (tpro) Refine ADC & analog API Moved hardware definitions scripts and templates into own dir cleanup API refine Fix unit tests Mixer: apply calibration only on required inputs Place ADC switches after all other ADC inputs Fix X12S Remove useless TR_POTS_VSRCRAW, TR_SW_VSRCRAW, and TR_VSRCRAW Cleanup redundant generated YAML parsers Fixes Boxer rebase Add boxer to generate-hw-defs.sh Obsolete LUA exports Add boxer ADC_DIRECTION Split generate_hw_defs.py into multiple files Some cleanup (+ LUA switches) Fix AXIS definitions Fixed translation strings declarations Some rebase fixes Remove some useless StdPeriph drivers fix: set pin mode to reset state on usart deinit fix: use canonical names for calibration data fix: ADC driver does not care about unconfigured inputs fix X12S ADC Add support for ADC conversion chaining Better X12S ADC implem Moved X12S ADC driver to HAL/LL Improve ADC driver separation Fixed taranis & nv14 Moved PWM gimbals to HAL/LL Removed useless TR_EXTRA_VSRCRAW Fixed include guards Small fixes Renamed control inputs Moved internal and external module pulse driver def to boards Move more things to the generic_stm32 board Remove STR_VMIXTRIMS Added analog labels Generate main control names Misuse labels / short labels for main controls Backward compatibility: sliders and legacy names New keys driver Let's get rid of StdPeriph headers in simu Add jinja2 to CI workflows Use `grep` instead of `sed` chore: add python jinja2 oto msys setup script Removed more static definitions and use dynamic ones instead Fixes X9E Fix x7 nav too 212 switch display Fix default sliders Removed NUM_STICKS 212 switch display working nicely Surface radio 'stick' replacements fix: switch, trim & rotary pin init Remove old key drivers Removed VKEYS Removed ETX_FOURCC Fixed SURFACE_NAME Removed TR_VSWITCHES & TR_TRIMS_SWITCHES Fix xpot switches Store calibrated analogs in physical order Use getSourceString in drawSource Implement missing YAML read/write Fix isSourceAvailableInInputs() Fix isSourceAvailable() Some surface fixes Fix CLI debug Ported colour UI of analog diagnostics to new ADC API Small fixes Better input mapping Minor tpro fixes Fix trims available Remove TX mode choice on surface radio Rename surface controls Channel order alignement Fix throttle warning Fix checkTrims() Fix pot config casting issue Fix IS_SWITCH_FS() Fixed input mapping Fix fswitch auto-switch Fixed storing / reading function switches in YAML Fix enableVBatBridge() / disableVBatBridge() Fix interesting mode conversion Fix sources issues Fix special funnction list Proper function switch handling 128 GUI improvements Fix compilation Boxer cosmetics 128 hardware screen cosmetic Fix TX12 switches More switches fixes Simplify CPU type handling Fix flash size Fixed page-up / page-down in libopenui
208 lines
6.7 KiB
C
208 lines
6.7 KiB
C
/*
|
|
* Copyright (C) EdgeTX
|
|
*
|
|
* Based on code named
|
|
* opentx - https://github.com/opentx/opentx
|
|
* 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 _GUI_H_
|
|
#define _GUI_H_
|
|
|
|
#include "gui_common.h"
|
|
#include "menus.h"
|
|
#include "popups.h"
|
|
|
|
#include "navigation/navigation.h"
|
|
#include "common/stdlcd/draw_functions.h"
|
|
|
|
#define MENUS_SCROLLBAR_WIDTH 0
|
|
|
|
#if defined(NAVIGATION_X7)
|
|
#define HEADER_LINE 0
|
|
#define HEADER_LINE_COLUMNS
|
|
#else
|
|
#define HEADER_LINE 1
|
|
#define HEADER_LINE_COLUMNS 0,
|
|
#endif
|
|
|
|
#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-2)
|
|
#define CURVE_CENTER_X (LCD_W-CURVE_SIDE_WIDTH-3)
|
|
#define CURVE_CENTER_Y (LCD_H/2)
|
|
|
|
#define MIXES_2ND_COLUMN (12*FW)
|
|
|
|
// Temporary no highlight
|
|
extern uint8_t noHighlightCounter;
|
|
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
|
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
|
|
|
void drawSlider(coord_t x, coord_t y, uint8_t width, uint8_t value, uint8_t max, uint8_t attr);
|
|
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
|
|
|
void title(const char * s);
|
|
|
|
typedef int choice_t;
|
|
|
|
choice_t editChoice(coord_t x, coord_t y, const char *label,
|
|
const char *const *values, choice_t value, choice_t min,
|
|
choice_t max, LcdFlags attr, event_t event,
|
|
IsValueAvailable isValueAvailable = nullptr);
|
|
|
|
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label,
|
|
LcdFlags attr, event_t event);
|
|
|
|
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr,
|
|
event_t event);
|
|
|
|
#if defined(GVARS)
|
|
|
|
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) \
|
|
editGVarFieldValue(x, y, v, min, max, attr, editflags, event)
|
|
|
|
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min,
|
|
int16_t max, LcdFlags attr, uint8_t editflags,
|
|
event_t event);
|
|
|
|
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value,
|
|
LcdFlags flags = 0);
|
|
|
|
void editGVarValue(coord_t x, coord_t y, event_t event, uint8_t gvar,
|
|
uint8_t flightMode, LcdFlags flags);
|
|
|
|
#define displayGVar(x, y, v, min, max) \
|
|
GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
|
|
|
|
#else // GVARS
|
|
|
|
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min,
|
|
int16_t max, LcdFlags attr, event_t event);
|
|
|
|
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) \
|
|
editGVarFieldValue(x, y, v, min, max, attr, event)
|
|
|
|
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
|
|
|
|
#endif
|
|
|
|
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event);
|
|
|
|
void editName(coord_t x, coord_t y, char *name, uint8_t size, event_t event,
|
|
uint8_t active, LcdFlags attr, uint8_t old_editMode);
|
|
|
|
void editSingleName(coord_t x, coord_t y, const char *label, char *name,
|
|
uint8_t size, event_t event, uint8_t active,
|
|
uint8_t old_editMode);
|
|
|
|
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay);
|
|
|
|
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
|
|
|
#define COPY_MODE 1
|
|
#define MOVE_MODE 2
|
|
|
|
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 uint16_t s_currSrcRaw;
|
|
extern uint16_t s_currScale;
|
|
extern uint8_t s_copySrcIdx;
|
|
extern uint8_t s_copySrcCh;
|
|
extern int8_t s_currCh;
|
|
extern uint8_t s_maxLines;
|
|
|
|
#if defined(SDCARD)
|
|
#define STATUS_LINE_LENGTH 32
|
|
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
|
void showStatusLine();
|
|
void drawStatusLine();
|
|
#else
|
|
#define drawStatusLine()
|
|
#endif
|
|
|
|
void menuTextView(event_t event);
|
|
void pushMenuTextView(const char *filename);
|
|
void pushModelNotes();
|
|
void readModelNotes();
|
|
|
|
void menuChannelsView(event_t event);
|
|
void menuChannelsViewCommon(event_t event);
|
|
|
|
void repeatLastCursorMove(event_t event);
|
|
|
|
#define EDIT_MODE_INIT 0
|
|
|
|
extern uint8_t editNameCursorPos;
|
|
|
|
uint8_t getExposCount();
|
|
void insertExpo(uint8_t idx);
|
|
void deleteExpo(uint8_t idx);
|
|
uint8_t getMixesCount();
|
|
void insertMix(uint8_t idx);
|
|
void deleteMix(uint8_t idx);
|
|
|
|
void onSwitchLongEnterPress(const char *result);
|
|
void onSourceLongEnterPress(const char *result);
|
|
|
|
uint8_t switchToMix(uint8_t source);
|
|
|
|
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
|
|
|
extern const unsigned char sticks[] ;
|
|
|
|
void drawSplash();
|
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
|
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
|
void drawWheel(coord_t centrex, int16_t wval);
|
|
void drawThrottle(coord_t centrex, int16_t tval);
|
|
void drawPotsBars();
|
|
void doMainScreenGraphics();
|
|
|
|
void drawProgressScreen(const char * title, const char * message, int num, int den);
|
|
void drawSleepBitmap();
|
|
|
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
|
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max);
|
|
|
|
void drawAlertBox(const char * title, const char * text, const char * action);
|
|
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound);
|
|
|
|
#define SET_SCROLLBAR_X(x)
|
|
#define LOAD_MODEL_BITMAP()
|
|
|
|
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
|
|
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry
|
|
#define IS_OTHER_VIEW_DISPLAYED() menuHandlers[0] == menuChannelsView
|
|
|
|
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
|
|
|
#if defined(FLIGHT_MODES)
|
|
void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
|
|
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr);
|
|
#else
|
|
#define displayFlightModes(...)
|
|
#endif
|
|
|
|
#endif // _GUI_H_
|