mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +03:00
[Horus] Fixes. ADC + Switches + Trims + RTC OK
This commit is contained in:
parent
685dece185
commit
82a4ad4103
43 changed files with 402 additions and 398 deletions
BIN
radio/src/bitmaps/horus/shutdown.png
Normal file
BIN
radio/src/bitmaps/horus/shutdown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
radio/src/bitmaps/horus/sleep.png
Normal file
BIN
radio/src/bitmaps/horus/sleep.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -38,8 +38,8 @@ extern const pm_uchar sticks[] PROGMEM;
|
||||||
#define MIXES_2ND_COLUMN (12*FW)
|
#define MIXES_2ND_COLUMN (12*FW)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void displaySplash();
|
void drawSplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
||||||
|
|
||||||
#if !defined(CPUM64)
|
#if !defined(CPUM64)
|
||||||
|
|
|
@ -309,9 +309,9 @@ void menuModelSelect(uint8_t event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
displayScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0);
|
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_RE_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0);
|
||||||
#else
|
#else
|
||||||
displayScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
|
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TITLE(STR_MENUMODELSEL);
|
TITLE(STR_MENUMODELSEL);
|
||||||
|
|
|
@ -435,7 +435,7 @@ void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, ui
|
||||||
}
|
}
|
||||||
|
|
||||||
calibrationState = 0;
|
calibrationState = 0;
|
||||||
displayScreenIndex(curr, menuTabSize, attr);
|
drawScreenIndex(curr, menuTabSize, attr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ const pm_uchar splashdata[] PROGMEM = {
|
||||||
'S','P','E',0 };
|
'S','P','E',0 };
|
||||||
const pm_uchar * const splash_lbm = splashdata+4;
|
const pm_uchar * const splash_lbm = splashdata+4;
|
||||||
|
|
||||||
void displaySplash()
|
void drawSplash()
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_img(0, 0, splash_lbm, 0, 0);
|
lcd_img(0, 0, splash_lbm, 0, 0);
|
||||||
|
|
|
@ -182,7 +182,7 @@ void mav_title(const pm_char * s, uint8_t index)
|
||||||
{
|
{
|
||||||
lcdDrawText(0, 0, PSTR("MAVLINK"), INVERS);
|
lcdDrawText(0, 0, PSTR("MAVLINK"), INVERS);
|
||||||
lcdDrawText(10 * FW, 0, s);
|
lcdDrawText(10 * FW, 0, s);
|
||||||
displayScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
|
drawScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
|
||||||
lcdDrawChar(7 * FW, 0, (mav_heartbeat > 0) ? '*' : ' ');
|
lcdDrawChar(7 * FW, 0, (mav_heartbeat > 0) ? '*' : ' ');
|
||||||
if (telemetry_data.active)
|
if (telemetry_data.active)
|
||||||
lcdDrawChar(8 * FW, 0, 'A', BLINK);
|
lcdDrawChar(8 * FW, 0, 'A', BLINK);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#define APSIZE (BSS | DBLSIZE)
|
#define APSIZE (BSS | DBLSIZE)
|
||||||
|
|
||||||
void menuTelemetryMavlink(uint8_t event);
|
void menuTelemetryMavlink(uint8_t event);
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||||
void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0);
|
void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mode = 0);
|
||||||
void mav_title(const pm_char * s, uint8_t index);
|
void mav_title(const pm_char * s, uint8_t index);
|
||||||
void menuTelemetryMavlinkInfos(void);
|
void menuTelemetryMavlinkInfos(void);
|
||||||
|
|
|
@ -47,7 +47,7 @@ void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||||
{
|
{
|
||||||
lcdDrawNumber(LCD_W, 0, count, attr);
|
lcdDrawNumber(LCD_W, 0, count, attr);
|
||||||
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
|
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
|
||||||
|
|
|
@ -251,3 +251,11 @@ const uint8_t LBM_CURVE_POINT_CENTER[] = {
|
||||||
const uint8_t LBM_CURVE_COORD_SHADOW[] = {
|
const uint8_t LBM_CURVE_COORD_SHADOW[] = {
|
||||||
#include "mask_coord_shadow.lbm"
|
#include "mask_coord_shadow.lbm"
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
|
const uint8_t LBM_SHUTDOWN[] = {
|
||||||
|
#include "shutdown.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_SLEEP[] = {
|
||||||
|
#include "sleep.lbm"
|
||||||
|
}; */
|
|
@ -63,8 +63,8 @@ extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
|
||||||
bool loadModelBitmap(char * name, uint8_t * bitmap);
|
bool loadModelBitmap(char * name, uint8_t * bitmap);
|
||||||
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
|
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
|
||||||
|
|
||||||
void displaySplash();
|
void drawSplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count);
|
void drawScreenIndex(uint8_t index, uint8_t count);
|
||||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible);
|
||||||
void drawHeader(int index);
|
void drawHeader(int index);
|
||||||
|
@ -124,3 +124,5 @@ extern const uint8_t LBM_POINT[];
|
||||||
extern const uint8_t LBM_CURVE_POINT[];
|
extern const uint8_t LBM_CURVE_POINT[];
|
||||||
extern const uint8_t LBM_CURVE_POINT_CENTER[];
|
extern const uint8_t LBM_CURVE_POINT_CENTER[];
|
||||||
extern const uint8_t LBM_CURVE_COORD_SHADOW[];
|
extern const uint8_t LBM_CURVE_COORD_SHADOW[];
|
||||||
|
extern const uint8_t LBM_SHUTDOWN[];
|
||||||
|
extern const uint8_t LBM_SLEEP[];
|
||||||
|
|
|
@ -450,6 +450,12 @@ void putsStrIdx(coord_t x, coord_t y, const pm_char *str, int idx, LcdFlags att,
|
||||||
lcdDrawText(x, y, s, att);
|
lcdDrawText(x, y, s, att);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||||
|
{
|
||||||
|
uint8_t length = STR_VSRCRAW[0];
|
||||||
|
lcdDrawSizedText(x, y, STR_VSRCRAW+2+length*(idx+1), length-1, att);
|
||||||
|
}
|
||||||
|
|
||||||
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||||
{
|
{
|
||||||
if (idx == MIXSRC_NONE) {
|
if (idx == MIXSRC_NONE) {
|
||||||
|
|
|
@ -181,6 +181,7 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t
|
||||||
|
|
||||||
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, int idx, LcdFlags att=0, const char *prefix="");
|
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, int idx, LcdFlags att=0, const char *prefix="");
|
||||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||||
|
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||||
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
|
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
|
||||||
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||||
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||||
|
@ -211,7 +212,6 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
|
||||||
|
|
||||||
#define PIXEL_PTR(x, y) &displayBuf[(y)*LCD_W + (x)]
|
#define PIXEL_PTR(x, y) &displayBuf[(y)*LCD_W + (x)]
|
||||||
|
|
||||||
|
|
||||||
inline void lcdDrawPixel(display_t * p, display_t value)
|
inline void lcdDrawPixel(display_t * p, display_t value)
|
||||||
{
|
{
|
||||||
*p = value;
|
*p = value;
|
||||||
|
@ -313,6 +313,8 @@ void lcdSetContrast();
|
||||||
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||||
const char * imgLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
const char * imgLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||||
|
|
||||||
|
void drawSleepBitmap();
|
||||||
|
void drawShutdownBitmap(uint8_t index);
|
||||||
|
|
||||||
#if defined(BOOT)
|
#if defined(BOOT)
|
||||||
#define BLINK_ON_PHASE (0)
|
#define BLINK_ON_PHASE (0)
|
||||||
|
|
|
@ -20,22 +20,25 @@
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
#define XPOT_DELTA 10
|
#define XPOT_DELTA 10
|
||||||
#define XPOT_DELAY 10 /* cycles */
|
#define XPOT_DELAY 10 /* cycles */
|
||||||
|
#define BAR_WIDTH 7
|
||||||
#define BAR_HEIGHT (BOX_WIDTH-9)
|
#define BAR_HEIGHT (BOX_WIDTH-9)
|
||||||
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
|
#define BAR_INTERVAL 20
|
||||||
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
#define BAR_BOTTOM 200
|
||||||
|
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
|
||||||
|
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
||||||
|
|
||||||
void drawPotsBars()
|
void drawPotsBars()
|
||||||
{
|
{
|
||||||
// Optimization by Mike Blandford
|
// Optimization by Mike Blandford
|
||||||
unsigned int x, i, len ; // declare temporary variables
|
unsigned int x, i, len ; // declare temporary variables
|
||||||
for (x=LCD_W/2-9, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=9, i++) {
|
for (x=LCD_W/2-(BAR_INTERVAL*NUM_POTS/2), i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=BAR_INTERVAL, i++) {
|
||||||
if (IS_POT_AVAILABLE(i)) {
|
if (IS_POT_AVAILABLE(i)) {
|
||||||
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||||
// TODO 220 constant
|
// TODO 220 constant
|
||||||
lcdDrawSolidFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
|
lcdDrawSolidFilledRect(x, BAR_BOTTOM-len, BAR_WIDTH, len, TEXT_COLOR);
|
||||||
|
putsStickName(x-2, BAR_BOTTOM+5, i, TEXT_COLOR|TINSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +66,6 @@ bool menuCommonCalib(evt_t event)
|
||||||
if (IS_POT_WITHOUT_DETENT(i)) {
|
if (IS_POT_WITHOUT_DETENT(i)) {
|
||||||
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
uint8_t idx = i - POT1;
|
uint8_t idx = i - POT1;
|
||||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||||
if (IS_POT_MULTIPOS(i) && count <= XPOTS_MULTIPOS_COUNT) {
|
if (IS_POT_MULTIPOS(i) && count <= XPOTS_MULTIPOS_COUNT) {
|
||||||
|
@ -92,35 +94,32 @@ bool menuCommonCalib(evt_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
|
switch (event) {
|
||||||
|
|
||||||
switch (event)
|
|
||||||
{
|
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
reusableBuffer.calib.state = 0;
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
|
calibrationState = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
case EVT_KEY_BREAK(KEY_ENTER):
|
||||||
reusableBuffer.calib.state++;
|
calibrationState++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (reusableBuffer.calib.state) {
|
switch (calibrationState) {
|
||||||
case 0:
|
case 0:
|
||||||
// START CALIBRATION
|
// START CALIBRATION
|
||||||
if (!READ_ONLY()) {
|
if (!READ_ONLY()) {
|
||||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUTOSTART);
|
lcd_putsCenter(MENU_CONTENT_TOP, STR_MENUTOSTART);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// SET MIDPOINT
|
// SET MIDPOINT
|
||||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_SETMIDPOINT, INVERS);
|
lcd_putsCenter(MENU_CONTENT_TOP, STR_SETMIDPOINT, INVERS);
|
||||||
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
|
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
|
||||||
|
|
||||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||||
reusableBuffer.calib.loVals[i] = 15000;
|
reusableBuffer.calib.loVals[i] = 15000;
|
||||||
|
@ -136,8 +135,8 @@ bool menuCommonCalib(evt_t event)
|
||||||
case 2:
|
case 2:
|
||||||
// MOVE STICKS/POTS
|
// MOVE STICKS/POTS
|
||||||
STICK_SCROLL_DISABLE();
|
STICK_SCROLL_DISABLE();
|
||||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MOVESTICKSPOTS, INVERS);
|
lcd_putsCenter(MENU_CONTENT_TOP, STR_MOVESTICKSPOTS, INVERS);
|
||||||
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
|
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
|
||||||
|
|
||||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
||||||
|
@ -151,7 +150,6 @@ bool menuCommonCalib(evt_t event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
#if 0
|
|
||||||
for (int i=POT1; i<=POT_LAST; i++) {
|
for (int i=POT1; i<=POT_LAST; i++) {
|
||||||
int idx = i - POT1;
|
int idx = i - POT1;
|
||||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||||
|
@ -171,28 +169,26 @@ bool menuCommonCalib(evt_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_eeGeneral.potsType &= ~(0x03<<(2*idx));
|
g_eeGeneral.potsConfig &= ~(0x03<<(2*idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
g_eeGeneral.chkSum = evalChkSum();
|
g_eeGeneral.chkSum = evalChkSum();
|
||||||
storageDirty(EE_GENERAL);
|
storageDirty(EE_GENERAL);
|
||||||
reusableBuffer.calib.state = 4;
|
calibrationState = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reusableBuffer.calib.state = 0;
|
calibrationState = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawSticksPositions();
|
drawSticksPositions();
|
||||||
drawPotsBars();
|
drawPotsBars();
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (int i=POT1; i<=POT_LAST; i++) {
|
for (int i=POT1; i<=POT_LAST; i++) {
|
||||||
uint8_t steps = 0;
|
uint8_t steps = 0;
|
||||||
if (reusableBuffer.calib.state == 2) {
|
if (calibrationState == 2) {
|
||||||
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
|
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
|
||||||
}
|
}
|
||||||
else if (IS_POT_MULTIPOS(i)) {
|
else if (IS_POT_MULTIPOS(i)) {
|
||||||
|
@ -200,10 +196,9 @@ bool menuCommonCalib(evt_t event)
|
||||||
steps = calib->count + 1;
|
steps = calib->count + 1;
|
||||||
}
|
}
|
||||||
if (steps > 0 && steps <= XPOTS_MULTIPOS_COUNT) {
|
if (steps > 0 && steps <= XPOTS_MULTIPOS_COUNT) {
|
||||||
lcdDrawNumber(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
|
lcdDrawNumber(LCD_W/2-(BAR_INTERVAL*NUM_POTS/2)+(BAR_INTERVAL*(i-POT1)), BAR_BOTTOM+15, steps, TEXT_COLOR|TINSIZE, 0, "[", "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -211,19 +206,14 @@ bool menuCommonCalib(evt_t event)
|
||||||
bool menuGeneralCalib(evt_t event)
|
bool menuGeneralCalib(evt_t event)
|
||||||
{
|
{
|
||||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
||||||
|
|
||||||
menuVerticalPosition = -1;
|
menuVerticalPosition = -1;
|
||||||
|
|
||||||
if (menuEvent) {
|
|
||||||
calibrationState = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return menuCommonCalib(READ_ONLY() ? 0 : event);
|
return menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menuFirstCalib(evt_t event)
|
bool menuFirstCalib(evt_t event)
|
||||||
{
|
{
|
||||||
if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == 4) {
|
if (event == EVT_KEY_BREAK(KEY_EXIT) || calibrationState == 4) {
|
||||||
calibrationState = 0;
|
calibrationState = 0;
|
||||||
chainMenu(menuMainView);
|
chainMenu(menuMainView);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -368,7 +368,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else if (!calibrationState) {
|
||||||
popMenu();
|
popMenu();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@ const uint8_t LBM_SPLASH[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(SPLASH)
|
#if defined(SPLASH)
|
||||||
void displaySplash()
|
void drawSplash()
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
|
|
||||||
|
|
|
@ -323,3 +323,17 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void drawSleepBitmap()
|
||||||
|
{
|
||||||
|
/* lcdClear();
|
||||||
|
lcdDrawBitmap(POPUP_X-80, POPUP_Y-30, LBM_SLEEP);
|
||||||
|
lcdRefresh(); */
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawShutdownBitmap(uint8_t index)
|
||||||
|
{
|
||||||
|
/*lcdClear();
|
||||||
|
lcdDrawBitmap(76, 2, LBM_SHUTDOWN, index * 60, 60);
|
||||||
|
lcdRefresh();*/
|
||||||
|
}
|
||||||
|
|
|
@ -55,8 +55,8 @@ struct MenuItem {
|
||||||
};
|
};
|
||||||
|
|
||||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||||
void displaySplash();
|
void drawSplash();
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
void drawVerticalScrollbar(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);
|
void displayMenuBar(const MenuItem *menu, int index);
|
||||||
void drawProgressBar(const char *label);
|
void drawProgressBar(const char *label);
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_bmp(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t width)
|
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t width)
|
||||||
{
|
{
|
||||||
const uint8_t *q = img;
|
const uint8_t *q = img;
|
||||||
uint8_t w = *q++;
|
uint8_t w = *q++;
|
||||||
|
|
|
@ -188,13 +188,16 @@ inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h,
|
||||||
lcdDrawFilledRect(x, y, w, h, SOLID, att);
|
lcdDrawFilledRect(x, y, w, h, SOLID, att);
|
||||||
}
|
}
|
||||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||||
|
inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
|
||||||
|
{
|
||||||
|
lcdDrawRect(x, y, w, w, SOLID, att);
|
||||||
|
}
|
||||||
|
|
||||||
void lcdInvertLine(int8_t line);
|
void lcdInvertLine(int8_t line);
|
||||||
#define lcdInvertLastLine() lcdInvertLine(LCD_LINES-1)
|
#define lcdInvertLastLine() lcdInvertLine(LCD_LINES-1)
|
||||||
inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcdDrawRect(x, y, w, w, SOLID, att); }
|
|
||||||
|
|
||||||
void displaySleepBitmap();
|
|
||||||
|
|
||||||
|
void drawShutdownBitmap(uint8_t index);
|
||||||
|
void drawSleepBitmap();
|
||||||
void lcdDrawTelemetryTopBar();
|
void lcdDrawTelemetryTopBar();
|
||||||
|
|
||||||
#define V_BAR(xx, yy, ll) \
|
#define V_BAR(xx, yy, ll) \
|
||||||
|
@ -204,8 +207,8 @@ void lcdDrawTelemetryTopBar();
|
||||||
|
|
||||||
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||||
|
|
||||||
void lcd_bmp(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0);
|
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0);
|
||||||
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
|
#define LCD_ICON(x, y, icon) lcdDrawBitmap(x, y, icons, icon)
|
||||||
|
|
||||||
void lcdSetRefVolt(unsigned char val);
|
void lcdSetRefVolt(unsigned char val);
|
||||||
void lcdClear();
|
void lcdClear();
|
||||||
|
|
|
@ -81,8 +81,7 @@ void menuCommonCalib(uint8_t event)
|
||||||
|
|
||||||
calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
|
calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
|
||||||
|
|
||||||
switch (event)
|
switch (event) {
|
||||||
{
|
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
case EVT_KEY_BREAK(KEY_EXIT):
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
reusableBuffer.calib.state = 0;
|
reusableBuffer.calib.state = 0;
|
||||||
|
|
|
@ -462,6 +462,6 @@ void menuGeneralSdManager(evt_t _event)
|
||||||
memcpy(modelBitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
memcpy(modelBitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lcd_bmp(22*FW+2, 2*FH+FH/2, modelBitmap);
|
lcdDrawBitmap(22*FW+2, 2*FH+FH/2, modelBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ void menuModelSelect(uint8_t event)
|
||||||
lcdDrawNumber(20*FW, 0, EeFsGetFree(), 0);
|
lcdDrawNumber(20*FW, 0, EeFsGetFree(), 0);
|
||||||
lcdDrawText(21*FW, 0, STR_BYTES);
|
lcdDrawText(21*FW, 0, STR_BYTES);
|
||||||
|
|
||||||
displayScreenIndex(e_ModelSelect, DIM(menuTabModel), 0);
|
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), 0);
|
||||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||||
|
|
||||||
TITLE(STR_MENUMODELSEL);
|
TITLE(STR_MENUMODELSEL);
|
||||||
|
@ -270,5 +270,5 @@ void menuModelSelect(uint8_t event)
|
||||||
loadModelBitmap(modelHeaders[sub].bitmap, modelBitmap);
|
loadModelBitmap(modelHeaders[sub].bitmap, modelBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd_bmp(22*FW+2, 2*FH+FH/2, modelBitmap);
|
lcdDrawBitmap(22*FW+2, 2*FH+FH/2, modelBitmap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
|
||||||
displayScreenIndex(curr, menuTabSize, 0);
|
drawScreenIndex(curr, menuTabSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, SOLID, FILL_WHITE|GREY_DEFAULT);
|
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||||
|
|
|
@ -58,7 +58,7 @@ const pm_uchar asterisk_lbm[] PROGMEM = {
|
||||||
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SOUND_ARG)
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_bmp(0, 0, asterisk_lbm);
|
lcdDrawBitmap(0, 0, asterisk_lbm);
|
||||||
|
|
||||||
#define MESSAGE_LCD_OFFSET 60
|
#define MESSAGE_LCD_OFFSET 60
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ const pm_uchar splashdata[] PROGMEM = {
|
||||||
'S','P','E',0 };
|
'S','P','E',0 };
|
||||||
const pm_uchar * const splash_lbm = splashdata+4;
|
const pm_uchar * const splash_lbm = splashdata+4;
|
||||||
|
|
||||||
void displaySplash()
|
void drawSplash()
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_bmp(0, 0, splash_lbm);
|
lcdDrawBitmap(0, 0, splash_lbm);
|
||||||
|
|
||||||
#if MENUS_LOCK == 1
|
#if MENUS_LOCK == 1
|
||||||
if (readonly == false) {
|
if (readonly == false) {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
const pm_uchar about_bmp[] PROGMEM = {
|
const pm_uchar about_bmp[] PROGMEM = {
|
||||||
|
@ -66,7 +66,7 @@ void menuAboutView(uint8_t event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd_bmp(0, 0, about_bmp);
|
lcdDrawBitmap(0, 0, about_bmp);
|
||||||
lcdDrawText(64, 0, STR_ABOUTUS, DBLSIZE);
|
lcdDrawText(64, 0, STR_ABOUTUS, DBLSIZE);
|
||||||
lcdDrawSolidHorizontalLine(ABOUT_X, 18, 120);
|
lcdDrawSolidHorizontalLine(ABOUT_X, 18, 120);
|
||||||
lcdDrawSolidHorizontalLine(ABOUT_X, 19, 130, GREY_DEFAULT);
|
lcdDrawSolidHorizontalLine(ABOUT_X, 19, 130, GREY_DEFAULT);
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
#include "../../timers.h"
|
#include "../../timers.h"
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ void displayTopBarGauge(coord_t x, int count, bool blinking=false)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LCD_NOTIF_ICON(x, icon) \
|
#define LCD_NOTIF_ICON(x, icon) \
|
||||||
lcd_bmp(x, BAR_Y, icons, icon); \
|
lcdDrawBitmap(x, BAR_Y, icons, icon); \
|
||||||
lcdDrawSolidHorizontalLine(x, BAR_Y+8, 11)
|
lcdDrawSolidHorizontalLine(x, BAR_Y+8, 11)
|
||||||
|
|
||||||
void displayTopBar()
|
void displayTopBar()
|
||||||
|
@ -513,7 +513,7 @@ void menuMainView(uint8_t event)
|
||||||
// Sliders (Pots / Sliders)
|
// Sliders (Pots / Sliders)
|
||||||
drawSliders();
|
drawSliders();
|
||||||
|
|
||||||
lcd_bmp(BITMAP_X, BITMAP_Y, modelBitmap);
|
lcdDrawBitmap(BITMAP_X, BITMAP_Y, modelBitmap);
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
if (getSwitchCount() > 8) {
|
if (getSwitchCount() > 8) {
|
||||||
|
|
|
@ -24,10 +24,21 @@ const pm_uchar bmp_sleep[] PROGMEM = {
|
||||||
#include "../../bitmaps/taranis/sleep.lbm"
|
#include "../../bitmaps/taranis/sleep.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
void displaySleepBitmap()
|
void drawSleepBitmap()
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_sleep, 0, 60);
|
lcdDrawBitmap(76, 2, bmp_sleep, 0, 60);
|
||||||
|
lcdRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
const pm_uchar bmp_shutdown[] PROGMEM = {
|
||||||
|
#include "../../bitmaps/taranis/shutdown.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
void drawShutdownBitmap(uint8_t index)
|
||||||
|
{
|
||||||
|
lcdClear();
|
||||||
|
lcdDrawBitmap(76, 2, bmp_shutdown, index * 60, 60);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +69,7 @@ void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||||
lcdDrawSquare(x, y, 7);
|
lcdDrawSquare(x, y, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||||
{
|
{
|
||||||
lcdDrawNumber(LCD_W, 0, count, attr);
|
lcdDrawNumber(LCD_W, 0, count, attr);
|
||||||
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
|
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
|
||||||
|
|
|
@ -343,7 +343,7 @@ static int luaLcdDrawPixmap(lua_State *L)
|
||||||
uint8_t bitmap[BITMAP_BUFFER_SIZE(LCD_W/2, LCD_H)]; // width max is LCD_W/2 pixels for saving stack and avoid a malloc here
|
uint8_t bitmap[BITMAP_BUFFER_SIZE(LCD_W/2, LCD_H)]; // width max is LCD_W/2 pixels for saving stack and avoid a malloc here
|
||||||
const pm_char * error = bmpLoad(bitmap, filename, LCD_W/2, LCD_H);
|
const pm_char * error = bmpLoad(bitmap, filename, LCD_W/2, LCD_H);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
lcd_bmp(x, y, bitmap);
|
lcdDrawBitmap(x, y, bitmap);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ static int luaLcdDrawScreenTitle(lua_State *L)
|
||||||
int idx = luaL_checkinteger(L, 2);
|
int idx = luaL_checkinteger(L, 2);
|
||||||
int cnt = luaL_checkinteger(L, 3);
|
int cnt = luaL_checkinteger(L, 3);
|
||||||
|
|
||||||
if (cnt) displayScreenIndex(idx-1, cnt, 0);
|
if (cnt) drawScreenIndex(idx-1, cnt, 0);
|
||||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||||
title(str);
|
title(str);
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ enum BeeperMode {
|
||||||
int8_t backgroundVolume;
|
int8_t backgroundVolume;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
#define swconfig_t uint64_t
|
#define swconfig_t uint64_t
|
||||||
#define swarnstate_t uint64_t
|
#define swarnstate_t uint64_t
|
||||||
|
@ -427,10 +427,10 @@ enum UartModes {
|
||||||
#define EXTRA_GENERAL_FIELDS \
|
#define EXTRA_GENERAL_FIELDS \
|
||||||
EXTRA_GENERAL_FIELDS_ARM \
|
EXTRA_GENERAL_FIELDS_ARM \
|
||||||
uint8_t serial2Mode:6; \
|
uint8_t serial2Mode:6; \
|
||||||
uint8_t spare:2; \
|
uint8_t slidersConfig:2; \
|
||||||
CustomFunctionData customFn[NUM_CFN]; \
|
CustomFunctionData customFn[NUM_CFN]; \
|
||||||
uint32_t switchConfig; \
|
uint32_t switchConfig; \
|
||||||
uint8_t potsType; /*two bits for every pot*/\
|
uint8_t potsConfig; /* two bits per pot */ \
|
||||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||||
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
|
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
|
||||||
char currModelFilename[LEN_MODEL_FILENAME+1];
|
char currModelFilename[LEN_MODEL_FILENAME+1];
|
||||||
|
@ -463,7 +463,7 @@ enum UartModes {
|
||||||
EXTRA_GENERAL_FIELDS_ARM \
|
EXTRA_GENERAL_FIELDS_ARM \
|
||||||
uint8_t serial2Mode:6; \
|
uint8_t serial2Mode:6; \
|
||||||
uint8_t slidersConfig:2; \
|
uint8_t slidersConfig:2; \
|
||||||
uint8_t potsConfig; /*two bits for every pot*/\
|
uint8_t potsConfig; /* two bits per pot */\
|
||||||
uint8_t backlightColor; \
|
uint8_t backlightColor; \
|
||||||
swarnstate_t switchUnlockStates; \
|
swarnstate_t switchUnlockStates; \
|
||||||
CustomFunctionData customFn[NUM_CFN]; \
|
CustomFunctionData customFn[NUM_CFN]; \
|
||||||
|
@ -1926,15 +1926,15 @@ enum MixSources {
|
||||||
|
|
||||||
MIXSRC_FIRST_POT,
|
MIXSRC_FIRST_POT,
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
MIXSRC_S1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer S1")
|
||||||
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
MIXSRC_6POS, LUA_EXPORT("6pos", "Multipos Switch")
|
||||||
MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
|
MIXSRC_S2, LUA_EXPORT("s2", "Potentiometer S2")
|
||||||
MIXSRC_FIRST_SLIDER,
|
MIXSRC_FIRST_SLIDER,
|
||||||
MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
|
MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
|
||||||
MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
|
MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
|
||||||
MIXSRC_SLIDER3, LUA_EXPORT("lcs", "Left center slider")
|
MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
|
||||||
MIXSRC_SLIDER4, LUA_EXPORT("rcs", "Right center slider")
|
MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
|
||||||
MIXSRC_LAST_POT = MIXSRC_SLIDER4,
|
MIXSRC_LAST_POT = MIXSRC_RS,
|
||||||
#elif defined(PCBFLAMENCO)
|
#elif defined(PCBFLAMENCO)
|
||||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("sd", "Potentiometer D")
|
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("sd", "Potentiometer D")
|
||||||
MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")
|
MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
|
||||||
|
@ -244,12 +244,15 @@ void generalDefault()
|
||||||
g_eeGeneral.vBatWarn = 33;
|
g_eeGeneral.vBatWarn = 33;
|
||||||
g_eeGeneral.vBatMin = -60; // 0 is 9.0V
|
g_eeGeneral.vBatMin = -60; // 0 is 9.0V
|
||||||
g_eeGeneral.vBatMax = -78; // 0 is 12.0V
|
g_eeGeneral.vBatMax = -78; // 0 is 12.0V
|
||||||
|
#elif defined(PCBHORUS)
|
||||||
|
g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent
|
||||||
|
g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent
|
g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent
|
||||||
g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent
|
g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
|
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -368,7 +371,7 @@ void applyDefaultTemplate()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<NUM_STICKS; i++) {
|
for (int i=0; i<NUM_STICKS; i++) {
|
||||||
MixData *mix = mixAddress(i);
|
MixData * mix = mixAddress(i);
|
||||||
mix->destCh = i;
|
mix->destCh = i;
|
||||||
mix->weight = 100;
|
mix->weight = 100;
|
||||||
#if defined(VIRTUALINPUTS)
|
#if defined(VIRTUALINPUTS)
|
||||||
|
@ -989,12 +992,12 @@ bool readonlyUnlocked()
|
||||||
#if defined(SPLASH)
|
#if defined(SPLASH)
|
||||||
void doSplash()
|
void doSplash()
|
||||||
{
|
{
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SPLASH_NEEDED()) {
|
if (SPLASH_NEEDED()) {
|
||||||
displaySplash();
|
drawSplash();
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
AUDIO_TADA();
|
AUDIO_TADA();
|
||||||
|
@ -1038,7 +1041,7 @@ void doSplash()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
uint32_t pwr_check = pwrCheck();
|
uint32_t pwr_check = pwrCheck();
|
||||||
if (pwr_check == e_power_off) {
|
if (pwr_check == e_power_off) {
|
||||||
break;
|
break;
|
||||||
|
@ -1047,7 +1050,7 @@ void doSplash()
|
||||||
refresh = true;
|
refresh = true;
|
||||||
}
|
}
|
||||||
else if (pwr_check == e_power_on && refresh) {
|
else if (pwr_check == e_power_on && refresh) {
|
||||||
displaySplash();
|
drawSplash();
|
||||||
refresh = false;
|
refresh = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -1197,7 +1200,7 @@ void checkTHR()
|
||||||
// first - display warning; also deletes inputs if any have been before
|
// first - display warning; also deletes inputs if any have been before
|
||||||
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1211,7 +1214,7 @@ void checkTHR()
|
||||||
|
|
||||||
v = calibratedStick[thrchn];
|
v = calibratedStick[thrchn];
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
uint32_t pwr_check = pwrCheck();
|
uint32_t pwr_check = pwrCheck();
|
||||||
if (pwr_check == e_power_off) {
|
if (pwr_check == e_power_off) {
|
||||||
break;
|
break;
|
||||||
|
@ -1255,7 +1258,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||||
{
|
{
|
||||||
MESSAGE(t, s, STR_PRESSANYKEY, sound);
|
MESSAGE(t, s, STR_PRESSANYKEY, sound);
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1269,7 +1272,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||||
|
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
uint32_t pwr_check = pwrCheck();
|
uint32_t pwr_check = pwrCheck();
|
||||||
if (pwr_check == e_power_off) {
|
if (pwr_check == e_power_off) {
|
||||||
boardOff();
|
boardOff();
|
||||||
|
@ -2515,7 +2518,7 @@ int main(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
displaySplash();
|
drawSplash();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sei(); // interrupts needed now
|
sei(); // interrupts needed now
|
||||||
|
@ -2592,13 +2595,9 @@ int main(void)
|
||||||
}
|
}
|
||||||
#endif // !SIMU
|
#endif // !SIMU
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
#define PWR_PRESS_SHUTDOWN 300 // 3s
|
#define PWR_PRESS_SHUTDOWN 300 // 3s
|
||||||
|
|
||||||
const pm_uchar bmp_shutdown[] PROGMEM = {
|
|
||||||
#include "../../bitmaps/taranis/shutdown.lbm"
|
|
||||||
};
|
|
||||||
|
|
||||||
uint32_t pwr_press_time = 0;
|
uint32_t pwr_press_time = 0;
|
||||||
|
|
||||||
uint32_t pwrPressedDuration()
|
uint32_t pwrPressedDuration()
|
||||||
|
@ -2660,9 +2659,7 @@ uint32_t pwrCheck()
|
||||||
else {
|
else {
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
|
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
|
||||||
lcdClear();
|
drawShutdownBitmap(index);
|
||||||
lcd_bmp(76, 2, bmp_shutdown, index*60, 60);
|
|
||||||
lcdRefresh();
|
|
||||||
return e_power_press;
|
return e_power_press;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,12 +352,12 @@
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
#define IS_POT_AVAILABLE(x) (true)
|
#define IS_POT_AVAILABLE(x) (true)
|
||||||
#define IS_POT_MULTIPOS(x) (x==0)
|
#define IS_POT_MULTIPOS(x) ((x)==POT2)
|
||||||
#define IS_POT_WITHOUT_DETENT(x) (x==0)
|
#define IS_POT_WITHOUT_DETENT(x) (true)
|
||||||
#elif defined(PCBFLAMENCO)
|
#elif defined(PCBFLAMENCO)
|
||||||
#define IS_POT_AVAILABLE(x) (true)
|
#define IS_POT_AVAILABLE(x) (true)
|
||||||
#define IS_POT_MULTIPOS(x) (x==0)
|
#define IS_POT_MULTIPOS(x) (false)
|
||||||
#define IS_POT_WITHOUT_DETENT(x) (x==0)
|
#define IS_POT_WITHOUT_DETENT(x) (false)
|
||||||
#elif defined(PCBTARANIS) && defined(REV9E)
|
#elif defined(PCBTARANIS) && defined(REV9E)
|
||||||
#define IS_SLIDER_AVAILABLE(x) ((x)==SLIDER1 || (x)==SLIDER2 || (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))
|
#define IS_SLIDER_AVAILABLE(x) ((x)==SLIDER1 || (x)==SLIDER2 || (g_eeGeneral.slidersConfig & (0x01 << ((x)-SLIDER3))))
|
||||||
#define IS_POT_AVAILABLE(x) ((x)<POT1 || ((x)<=POT_LAST && ((g_eeGeneral.potsConfig & (0x03 << (2*((x)-POT1))))!=0)) || ((x)>=SLIDER1 && IS_SLIDER_AVAILABLE(x)))
|
#define IS_POT_AVAILABLE(x) ((x)<POT1 || ((x)<=POT_LAST && ((g_eeGeneral.potsConfig & (0x03 << (2*((x)-POT1))))!=0)) || ((x)>=SLIDER1 && IS_SLIDER_AVAILABLE(x)))
|
||||||
|
@ -377,10 +377,14 @@
|
||||||
#define IS_POT_WITHOUT_DETENT(x) (true)
|
#define IS_POT_WITHOUT_DETENT(x) (true)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_POT(x) ((x)>=POT1 && (x)<=POT_LAST)
|
#define IS_POT(x) ((x)>=POT1 && (x)<=POT_LAST)
|
||||||
|
|
||||||
#define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4)
|
#if defined(PCBFLAMENCO) || defined(PCBHORUS) || (defined(PCBTARANIS) && defined(REV9E))
|
||||||
#define SAVE_POT_POSITION(i) g_model.potsWarnPosition[i] = GET_LOWRES_POT_POSITION(i)
|
#define PWR_BUTTON_DELAY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4)
|
||||||
|
#define SAVE_POT_POSITION(i) g_model.potsWarnPosition[i] = GET_LOWRES_POT_POSITION(i)
|
||||||
|
|
||||||
#if ROTARY_ENCODERS > 0
|
#if ROTARY_ENCODERS > 0
|
||||||
#define IF_ROTARY_ENCODERS(x) x,
|
#define IF_ROTARY_ENCODERS(x) x,
|
||||||
|
|
|
@ -130,14 +130,14 @@ void adcInit()
|
||||||
#define SPI_STICK2 1
|
#define SPI_STICK2 1
|
||||||
#define SPI_STICK3 2
|
#define SPI_STICK3 2
|
||||||
#define SPI_STICK4 3
|
#define SPI_STICK4 3
|
||||||
#define SPI_POT1 4
|
#define SPI_S1 4
|
||||||
#define SPI_POT2 5
|
#define SPI_6POS 5
|
||||||
#define SPI_POT3 6
|
#define SPI_S2 6
|
||||||
#define SPI_SLIDER1 7
|
#define SPI_S3 7
|
||||||
#define SPI_SLIDER2 8
|
#define SPI_S4 8
|
||||||
#define SPI_TX_VOLTAGE 9
|
#define SPI_TX_VOLTAGE 9
|
||||||
#define SPI_SLIDER3 10
|
#define SPI_RS 10
|
||||||
#define SPI_SLIDER4 11
|
#define SPI_LS 11
|
||||||
|
|
||||||
const uint16_t adcCommands[MOUSE1+2] =
|
const uint16_t adcCommands[MOUSE1+2] =
|
||||||
{
|
{
|
||||||
|
@ -145,13 +145,13 @@ const uint16_t adcCommands[MOUSE1+2] =
|
||||||
MANUAL_MODE | ( SPI_STICK2 << 7 ),
|
MANUAL_MODE | ( SPI_STICK2 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_STICK3 << 7 ),
|
MANUAL_MODE | ( SPI_STICK3 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_STICK4 << 7 ),
|
MANUAL_MODE | ( SPI_STICK4 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_POT1 << 7 ),
|
MANUAL_MODE | ( SPI_S1 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_POT2 << 7 ),
|
MANUAL_MODE | ( SPI_6POS << 7 ),
|
||||||
MANUAL_MODE | ( SPI_POT3 << 7 ),
|
MANUAL_MODE | ( SPI_S2 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_SLIDER1 << 7 ),
|
MANUAL_MODE | ( SPI_LS << 7 ),
|
||||||
MANUAL_MODE | ( SPI_SLIDER2 << 7 ),
|
MANUAL_MODE | ( SPI_RS << 7 ),
|
||||||
MANUAL_MODE | ( SPI_SLIDER4 << 7 ),
|
MANUAL_MODE | ( SPI_S3 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_SLIDER3 << 7 ),
|
MANUAL_MODE | ( SPI_S4 << 7 ),
|
||||||
MANUAL_MODE | ( SPI_TX_VOLTAGE << 7 ),
|
MANUAL_MODE | ( SPI_TX_VOLTAGE << 7 ),
|
||||||
MANUAL_MODE | ( 0 << 7 ),
|
MANUAL_MODE | ( 0 << 7 ),
|
||||||
MANUAL_MODE | ( 0 << 7 )
|
MANUAL_MODE | ( 0 << 7 )
|
||||||
|
@ -199,7 +199,7 @@ void adcRead()
|
||||||
// On chip ADC read should have finished
|
// On chip ADC read should have finished
|
||||||
}
|
}
|
||||||
|
|
||||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, 1,1, -1,-1, 0,0,0};
|
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, -1,-1, 1,1, 0,0,0};
|
||||||
|
|
||||||
uint16_t getAnalogValue(uint32_t index)
|
uint16_t getAnalogValue(uint32_t index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(SIMU)
|
#if defined(__cplusplus) && !defined(SIMU)
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _HAL_H_
|
#ifndef _HAL_H_
|
||||||
#define _HAL_H_
|
#define _HAL_H_
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
#define KEYS_RCC_AHB1Periph_GPIO (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOH | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOJ)
|
#define KEYS_RCC_AHB1Periph_GPIO (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOH | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOJ)
|
||||||
|
@ -44,18 +44,18 @@
|
||||||
#define ENC_GPIO_PIN_B GPIO_Pin_10 // PH.10
|
#define ENC_GPIO_PIN_B GPIO_Pin_10 // PH.10
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
#define SWITCHES_GPIO_REG_A_H GPIOI->IDR
|
#define SWITCHES_GPIO_REG_A_H GPIOH->IDR
|
||||||
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_15 // PI.15
|
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_9 // PH.09
|
||||||
#define SWITCHES_GPIO_REG_A_L GPIOH->IDR
|
#define SWITCHES_GPIO_REG_A_L GPIOI->IDR
|
||||||
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_9 // PH.09
|
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_15 // PI.15
|
||||||
#define SWITCHES_GPIO_REG_B_H GPIOH->IDR
|
#define SWITCHES_GPIO_REG_B_H GPIOH->IDR
|
||||||
#define SWITCHES_GPIO_PIN_B_H GPIO_Pin_12 // PH.12
|
#define SWITCHES_GPIO_PIN_B_H GPIO_Pin_12 // PH.12
|
||||||
#define SWITCHES_GPIO_REG_B_L GPIOB->IDR
|
#define SWITCHES_GPIO_REG_B_L GPIOB->IDR
|
||||||
#define SWITCHES_GPIO_PIN_B_L GPIO_Pin_12 // PB.12
|
#define SWITCHES_GPIO_PIN_B_L GPIO_Pin_12 // PB.12
|
||||||
#define SWITCHES_GPIO_REG_C_H GPIOB->IDR
|
#define SWITCHES_GPIO_REG_C_H GPIOD->IDR
|
||||||
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_15 // PB.15
|
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_11 // PD.11
|
||||||
#define SWITCHES_GPIO_REG_C_L GPIOD->IDR
|
#define SWITCHES_GPIO_REG_C_L GPIOB->IDR
|
||||||
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_11 // PD.11
|
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_15 // PB.15
|
||||||
#define SWITCHES_GPIO_REG_D_H GPIOJ->IDR
|
#define SWITCHES_GPIO_REG_D_H GPIOJ->IDR
|
||||||
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PJ.07
|
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PJ.07
|
||||||
#define SWITCHES_GPIO_REG_D_L GPIOG->IDR
|
#define SWITCHES_GPIO_REG_D_L GPIOG->IDR
|
||||||
|
@ -67,9 +67,9 @@
|
||||||
#define SWITCHES_GPIO_REG_F GPIOH->IDR
|
#define SWITCHES_GPIO_REG_F GPIOH->IDR
|
||||||
#define SWITCHES_GPIO_PIN_F GPIO_Pin_3 // PH.03
|
#define SWITCHES_GPIO_PIN_F GPIO_Pin_3 // PH.03
|
||||||
#define SWITCHES_GPIO_REG_G_H GPIOG->IDR
|
#define SWITCHES_GPIO_REG_G_H GPIOG->IDR
|
||||||
#define SWITCHES_GPIO_PIN_G_H GPIO_Pin_3 // PG.03
|
#define SWITCHES_GPIO_PIN_G_H GPIO_Pin_6 // PG.06
|
||||||
#define SWITCHES_GPIO_REG_G_L GPIOG->IDR
|
#define SWITCHES_GPIO_REG_G_L GPIOG->IDR
|
||||||
#define SWITCHES_GPIO_PIN_G_L GPIO_Pin_6 // PG.06
|
#define SWITCHES_GPIO_PIN_G_L GPIO_Pin_3 // PG.03
|
||||||
#define SWITCHES_GPIO_REG_H GPIOG->IDR
|
#define SWITCHES_GPIO_REG_H GPIOG->IDR
|
||||||
#define SWITCHES_GPIO_PIN_H GPIO_Pin_7 // PG.07
|
#define SWITCHES_GPIO_PIN_H GPIO_Pin_7 // PG.07
|
||||||
|
|
||||||
|
@ -100,13 +100,13 @@
|
||||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13
|
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13
|
||||||
|
|
||||||
// Index of all keys
|
// Index of all keys
|
||||||
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_LSD | TRIMS_GPIO_PIN_LSU)
|
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_LSD | TRIMS_GPIO_PIN_LSU)
|
||||||
#define KEYS_GPIOC_PINS (KEYS_GPIO_PIN_MENU | KEYS_GPIO_PIN_ENTER | KEYS_GPIO_PIN_RIGHT | TRIMS_GPIO_PIN_RHL)
|
#define KEYS_GPIOC_PINS (KEYS_GPIO_PIN_MENU | KEYS_GPIO_PIN_ENTER | KEYS_GPIO_PIN_RIGHT | TRIMS_GPIO_PIN_RHL)
|
||||||
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RSU)
|
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RSU)
|
||||||
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
|
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
|
||||||
#define KEYS_GPIOG_PINS (KEYS_GPIO_PIN_UP | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_RVD)
|
#define KEYS_GPIOG_PINS (KEYS_GPIO_PIN_UP | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_RVD)
|
||||||
#define KEYS_GPIOH_PINS (SWITCHES_GPIO_PIN_A_L | SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ENC_GPIO_PIN_A | ENC_GPIO_PIN_B)
|
#define KEYS_GPIOH_PINS (SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ENC_GPIO_PIN_A | ENC_GPIO_PIN_B)
|
||||||
#define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_EXIT | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_H | TRIMS_GPIO_PIN_RHR)
|
#define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_EXIT | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | TRIMS_GPIO_PIN_RHR)
|
||||||
#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)
|
#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)
|
||||||
|
|
||||||
// ADC
|
// ADC
|
||||||
|
@ -130,8 +130,8 @@
|
||||||
// Power
|
// Power
|
||||||
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
||||||
#define PWR_GPIO GPIOJ
|
#define PWR_GPIO GPIOJ
|
||||||
#define PWR_GPIO_PIN_ON GPIO_Pin_0 // PJ.00
|
#define PWR_GPIO_PIN_ON GPIO_Pin_1 // PJ.01
|
||||||
#define PWR_GPIO_PIN_SWITCH GPIO_Pin_1 // PJ.01
|
#define PWR_GPIO_PIN_SWITCH GPIO_Pin_0 // PJ.00
|
||||||
|
|
||||||
// Led
|
// Led
|
||||||
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
||||||
|
@ -269,4 +269,4 @@
|
||||||
#define TIMER_2MHz_APB1Periph RCC_APB1Periph_TIM7
|
#define TIMER_2MHz_APB1Periph RCC_APB1Periph_TIM7
|
||||||
#define TIMER_2MHz_TIMER TIM7
|
#define TIMER_2MHz_TIMER TIM7
|
||||||
|
|
||||||
#endif // _HAL_H_
|
#endif // _HAL_H_
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
uint32_t readKeys()
|
uint32_t readKeys()
|
||||||
|
@ -147,6 +147,13 @@ void readKeysAndTrims()
|
||||||
case SW_S ## x ## 2: \
|
case SW_S ## x ## 2: \
|
||||||
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
||||||
break
|
break
|
||||||
|
#define ADD_NEG_2POS_CASE(x) \
|
||||||
|
case SW_S ## x ## 2: \
|
||||||
|
xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
||||||
|
break; \
|
||||||
|
case SW_S ## x ## 0: \
|
||||||
|
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
|
||||||
|
break
|
||||||
#define ADD_3POS_CASE(x, i) \
|
#define ADD_3POS_CASE(x, i) \
|
||||||
case SW_S ## x ## 0: \
|
case SW_S ## x ## 0: \
|
||||||
xxx = (SWITCHES_GPIO_REG_ ## x ## _H & SWITCHES_GPIO_PIN_ ## x ## _H); \
|
xxx = (SWITCHES_GPIO_REG_ ## x ## _H & SWITCHES_GPIO_PIN_ ## x ## _H); \
|
||||||
|
@ -177,7 +184,7 @@ bool switchState(EnumKeys enuk)
|
||||||
ADD_3POS_CASE(C, 2);
|
ADD_3POS_CASE(C, 2);
|
||||||
ADD_3POS_CASE(D, 3);
|
ADD_3POS_CASE(D, 3);
|
||||||
ADD_3POS_CASE(E, 4);
|
ADD_3POS_CASE(E, 4);
|
||||||
ADD_2POS_CASE(F);
|
ADD_NEG_2POS_CASE(F);
|
||||||
ADD_3POS_CASE(G, 6);
|
ADD_3POS_CASE(G, 6);
|
||||||
ADD_2POS_CASE(H);
|
ADD_2POS_CASE(H);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,34 +1,29 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../pwr.h"
|
#include "../../pwr.h"
|
||||||
#include "../horus/board_horus.h"
|
#include "../horus/board_horus.h"
|
||||||
|
|
||||||
extern volatile uint32_t g_tmr10ms;
|
|
||||||
#define get_tmr10ms() g_tmr10ms
|
|
||||||
|
|
||||||
void pwrInit()
|
void pwrInit()
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
/* GPIO Configuration*/
|
|
||||||
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
|
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||||
|
@ -38,25 +33,20 @@ void pwrInit()
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_SWITCH;
|
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_SWITCH;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
|
||||||
GPIO_Init(PWR_GPIO, &GPIO_InitStructure);
|
GPIO_Init(PWR_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
// Soft power ON
|
|
||||||
GPIO_SetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
|
|
||||||
|
|
||||||
// Init Module PWR
|
// Init Module PWR
|
||||||
GPIO_ResetBits(EXTMODULE_GPIO_PWR, EXTMODULE_GPIO_PIN_PWR);
|
GPIO_ResetBits(EXTMODULE_GPIO_PWR, EXTMODULE_GPIO_PIN_PWR);
|
||||||
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN_PWR;
|
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN_PWR;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
|
||||||
GPIO_Init(EXTMODULE_GPIO_PWR, &GPIO_InitStructure);
|
GPIO_Init(EXTMODULE_GPIO_PWR, &GPIO_InitStructure);
|
||||||
|
|
||||||
// TODO while (pwrPressed()) ;
|
pwrOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pwrOn()
|
||||||
|
{
|
||||||
|
GPIO_SetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pwrOff()
|
void pwrOff()
|
||||||
|
@ -68,33 +58,3 @@ uint32_t pwrPressed()
|
||||||
{
|
{
|
||||||
return GPIO_ReadInputDataBit(PWR_GPIO, PWR_GPIO_PIN_SWITCH) == Bit_RESET;
|
return GPIO_ReadInputDataBit(PWR_GPIO, PWR_GPIO_PIN_SWITCH) == Bit_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(BOOT)
|
|
||||||
uint32_t pwrPressTime = 0;
|
|
||||||
uint32_t pwrPressedDuration()
|
|
||||||
{
|
|
||||||
if (pwrPressTime == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return get_tmr10ms() - pwrPressTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uint32_t pwrCheck()
|
|
||||||
{
|
|
||||||
if (pwrPressed()) {
|
|
||||||
if (pwrPressTime == 0) {
|
|
||||||
pwrPressTime = get_tmr10ms();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (get_tmr10ms() - pwrPressTime > 250) {
|
|
||||||
return e_power_off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pwrPressTime = 0;
|
|
||||||
}
|
|
||||||
return e_power_on;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1279,14 +1279,15 @@ int lcdRestoreBackupBuffer()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
void pwrInit() { }
|
|
||||||
void pwrOff() { }
|
|
||||||
#if defined(REV9E)
|
|
||||||
uint32_t pwrPressed() { return false; }
|
uint32_t pwrPressed() { return false; }
|
||||||
#else
|
#else
|
||||||
uint32_t pwrCheck() { return true; }
|
uint32_t pwrCheck() { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||||
|
void pwrInit() { }
|
||||||
|
void pwrOff() { }
|
||||||
int usbPlugged() { return false; }
|
int usbPlugged() { return false; }
|
||||||
void USART_DeInit(USART_TypeDef* ) { }
|
void USART_DeInit(USART_TypeDef* ) { }
|
||||||
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { return SUCCESS; }
|
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { return SUCCESS; }
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "../../opentx.h"
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(SIMU)
|
#if defined(__cplusplus) && !defined(SIMU)
|
||||||
|
@ -146,7 +146,7 @@ void boardInit()
|
||||||
#if defined(REV9E)
|
#if defined(REV9E)
|
||||||
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_lock, 0, 60);
|
lcdDrawBitmap(76, 2, bmp_lock, 0, 60);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
lcdRefreshWait();
|
lcdRefreshWait();
|
||||||
|
|
||||||
|
@ -158,10 +158,10 @@ void boardInit()
|
||||||
if (duration < PWR_PRESS_DURATION_MIN) {
|
if (duration < PWR_PRESS_DURATION_MIN) {
|
||||||
unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4);
|
unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4);
|
||||||
lcdClear();
|
lcdClear();
|
||||||
lcd_bmp(76, 2, bmp_startup, index*60, 60);
|
lcdDrawBitmap(76, 2, bmp_startup, index*60, 60);
|
||||||
}
|
}
|
||||||
else if (duration >= PWR_PRESS_DURATION_MAX) {
|
else if (duration >= PWR_PRESS_DURATION_MAX) {
|
||||||
displaySleepBitmap();
|
drawSleepBitmap();
|
||||||
turnBacklightOff();
|
turnBacklightOff();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) OpenTX
|
* Copyright (C) OpenTX
|
||||||
*
|
*
|
||||||
* Based on code named
|
* Based on code named
|
||||||
* th9x - http://code.google.com/p/th9x
|
* th9x - http://code.google.com/p/th9x
|
||||||
* er9x - http://code.google.com/p/er9x
|
* er9x - http://code.google.com/p/er9x
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
*
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
OS_TID menusTaskId;
|
OS_TID menusTaskId;
|
||||||
|
@ -129,7 +129,7 @@ void menusTask(void * pdata)
|
||||||
{
|
{
|
||||||
opentxInit();
|
opentxInit();
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PWR_BUTTON_DELAY)
|
||||||
while (1) {
|
while (1) {
|
||||||
uint32_t pwr_check = pwrCheck();
|
uint32_t pwr_check = pwrCheck();
|
||||||
if (pwr_check == e_power_off) {
|
if (pwr_check == e_power_off) {
|
||||||
|
@ -158,9 +158,8 @@ void menusTask(void * pdata)
|
||||||
|
|
||||||
BACKLIGHT_OFF();
|
BACKLIGHT_OFF();
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD) || defined(PCBTARANIS)
|
||||||
#elif defined(PCBTARANIS)
|
drawSleepBitmap();
|
||||||
displaySleepBitmap();
|
|
||||||
#else
|
#else
|
||||||
lcdClear();
|
lcdClear();
|
||||||
displayPopup(STR_SHUTDOWN);
|
displayPopup(STR_SHUTDOWN);
|
||||||
|
|
|
@ -297,10 +297,10 @@ TEST(Lcd, BMPWrapping)
|
||||||
lcdClear();
|
lcdClear();
|
||||||
uint8_t bitmap[2+40*40/2];
|
uint8_t bitmap[2+40*40/2];
|
||||||
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
|
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
|
||||||
lcd_bmp(200, 0, bitmap);
|
lcdDrawBitmap(200, 0, bitmap);
|
||||||
lcd_bmp(200, 60, bitmap);
|
lcdDrawBitmap(200, 60, bitmap);
|
||||||
lcd_bmp(240, 60, bitmap); // x too big
|
lcdDrawBitmap(240, 60, bitmap); // x too big
|
||||||
lcd_bmp(20, 200, bitmap); // y too big
|
lcdDrawBitmap(20, 200, bitmap); // y too big
|
||||||
EXPECT_TRUE(checkScreenshot("bmpwrapping"));
|
EXPECT_TRUE(checkScreenshot("bmpwrapping"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -359,7 +359,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TEST(Lcd, lcd_bmpLoadAndDisplay)
|
TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
|
||||||
{
|
{
|
||||||
lcdClear();
|
lcdClear();
|
||||||
// Test proper BMP files, they should display correctly
|
// Test proper BMP files, they should display correctly
|
||||||
|
@ -367,33 +367,33 @@ TEST(Lcd, lcd_bmpLoadAndDisplay)
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
|
||||||
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_7x32.bmp", 7, 32), (char *)0);
|
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_7x32.bmp", 7, 32), (char *)0);
|
||||||
bitmap.leakCheck();
|
bitmap.leakCheck();
|
||||||
lcd_bmp(10, 2, bitmap.buffer());
|
lcdDrawBitmap(10, 2, bitmap.buffer());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(6, 32));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(6, 32));
|
||||||
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_6x32.bmp", 6, 32), (char *)0);
|
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_6x32.bmp", 6, 32), (char *)0);
|
||||||
bitmap.leakCheck();
|
bitmap.leakCheck();
|
||||||
lcd_bmp(20, 2, bitmap.buffer());
|
lcdDrawBitmap(20, 2, bitmap.buffer());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(31, 31));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(31, 31));
|
||||||
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_31x31.bmp", 31, 31), (char *)0);
|
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_31x31.bmp", 31, 31), (char *)0);
|
||||||
bitmap.leakCheck();
|
bitmap.leakCheck();
|
||||||
lcd_bmp(30, 2, bitmap.buffer());
|
lcdDrawBitmap(30, 2, bitmap.buffer());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(39, 32));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(39, 32));
|
||||||
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_39x32.bmp", 39, 32), (char *)0);
|
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_39x32.bmp", 39, 32), (char *)0);
|
||||||
bitmap.leakCheck();
|
bitmap.leakCheck();
|
||||||
lcd_bmp(70, 2, bitmap.buffer());
|
lcdDrawBitmap(70, 2, bitmap.buffer());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(20, 20));
|
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(20, 20));
|
||||||
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_20x20.bmp", 20, 20), (char *)0);
|
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_20x20.bmp", 20, 20), (char *)0);
|
||||||
bitmap.leakCheck();
|
bitmap.leakCheck();
|
||||||
lcd_bmp(120, 2, bitmap.buffer());
|
lcdDrawBitmap(120, 2, bitmap.buffer());
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(checkScreenshot("lcd_bmpLoadAndDisplay"));
|
EXPECT_TRUE(checkScreenshot("lcdDrawBitmapLoadAndDisplay"));
|
||||||
|
|
||||||
// Test various bad BMP files, they should not display
|
// Test various bad BMP files, they should not display
|
||||||
{
|
{
|
||||||
|
|
|
@ -469,7 +469,7 @@
|
||||||
#define TR_TRIMS_VSRCRAW TR("TrmR""TrmE""TrmT""TrmA", "\313Rud""\313Ele""\313Thr""\313Ail")
|
#define TR_TRIMS_VSRCRAW TR("TrmR""TrmE""TrmT""TrmA", "\313Rud""\313Ele""\313Thr""\313Ail")
|
||||||
|
|
||||||
#if defined(PCBHORUS)
|
#if defined(PCBHORUS)
|
||||||
#define TR_POTS_VSRCRAW "\310F1\0""\310F2\0""\310F3\0""\311S1\0""\311S2\0""\311LS\0""\311RS\0"
|
#define TR_POTS_VSRCRAW "\310S1\0""\3106P\0""\310S2\0""\311S3\0""\311S4\0""\311LS\0""\311RS\0"
|
||||||
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0"
|
#define TR_SW_VSRCRAW "\312SA\0""\312SB\0""\312SC\0""\312SD\0""\312SE\0""\312SF\0""\312SG\0""\312SH\0"
|
||||||
#elif defined(PCBFLAMENCO)
|
#elif defined(PCBFLAMENCO)
|
||||||
#define TR_POTS_VSRCRAW "SD\0 ""LS\0 ""RS\0 "
|
#define TR_POTS_VSRCRAW "SD\0 ""LS\0 ""RS\0 "
|
||||||
|
@ -597,7 +597,6 @@
|
||||||
#define OFS_EXIT sizeof(TR_ENTER)
|
#define OFS_EXIT sizeof(TR_ENTER)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TR_MENUWHENDONE CENTER "\006" TR_ENTER " WHEN DONE"
|
|
||||||
#define TR_FREE "free"
|
#define TR_FREE "free"
|
||||||
#define TR_DELETEMODEL "DELETE" BREAKSPACE "MODEL"
|
#define TR_DELETEMODEL "DELETE" BREAKSPACE "MODEL"
|
||||||
#define TR_COPYINGMODEL "Copying model..."
|
#define TR_COPYINGMODEL "Copying model..."
|
||||||
|
@ -729,10 +728,12 @@
|
||||||
#define TR_MENUTOSTART TR_ENTER " TO START"
|
#define TR_MENUTOSTART TR_ENTER " TO START"
|
||||||
#define TR_SETMIDPOINT "CENTER STICKS/SLIDERS"
|
#define TR_SETMIDPOINT "CENTER STICKS/SLIDERS"
|
||||||
#define TR_MOVESTICKSPOTS "MOVE STICKS/POTS"
|
#define TR_MOVESTICKSPOTS "MOVE STICKS/POTS"
|
||||||
|
#define TR_MENUWHENDONE TR_ENTER " WHEN DONE"
|
||||||
#else
|
#else
|
||||||
#define TR_MENUTOSTART CENTER "\010" TR_ENTER " TO START"
|
#define TR_MENUTOSTART CENTER "\010" TR_ENTER " TO START"
|
||||||
#define TR_SETMIDPOINT TR(CENTER "\004SET STICKS MIDPOINT", CENTER "\004CENTER STICKS/SLIDERS")
|
#define TR_SETMIDPOINT TR(CENTER "\004SET STICKS MIDPOINT", CENTER "\004CENTER STICKS/SLIDERS")
|
||||||
#define TR_MOVESTICKSPOTS CENTER "\006MOVE STICKS/POTS"
|
#define TR_MOVESTICKSPOTS CENTER "\006MOVE STICKS/POTS"
|
||||||
|
#define TR_MENUWHENDONE CENTER "\006" TR_ENTER " WHEN DONE"
|
||||||
#endif
|
#endif
|
||||||
#define TR_RXBATT "Rx Batt:"
|
#define TR_RXBATT "Rx Batt:"
|
||||||
#define TR_TXnRX "Tx:\0Rx:"
|
#define TR_TXnRX "Tx:\0Rx:"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue