1
0
Fork 0
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:
Bertrand Songis 2016-01-08 22:21:26 +01:00
parent 685dece185
commit 82a4ad4103
43 changed files with 402 additions and 398 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -38,8 +38,8 @@ extern const pm_uchar sticks[] PROGMEM;
#define MIXES_2ND_COLUMN (12*FW)
#endif
void displaySplash();
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
void drawSplash();
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
#if !defined(CPUM64)

View file

@ -309,9 +309,9 @@ void menuModelSelect(uint8_t event)
#endif
#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
displayScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
drawScreenIndex(e_ModelSelect, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? INVERS : 0);
#endif
TITLE(STR_MENUMODELSEL);

View file

@ -435,7 +435,7 @@ void check(check_event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, ui
}
calibrationState = 0;
displayScreenIndex(curr, menuTabSize, attr);
drawScreenIndex(curr, menuTabSize, attr);
}

View file

@ -27,7 +27,7 @@ const pm_uchar splashdata[] PROGMEM = {
'S','P','E',0 };
const pm_uchar * const splash_lbm = splashdata+4;
void displaySplash()
void drawSplash()
{
lcdClear();
lcd_img(0, 0, splash_lbm, 0, 0);

View file

@ -182,7 +182,7 @@ void mav_title(const pm_char * s, uint8_t index)
{
lcdDrawText(0, 0, PSTR("MAVLINK"), INVERS);
lcdDrawText(10 * FW, 0, s);
displayScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
drawScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
lcdDrawChar(7 * FW, 0, (mav_heartbeat > 0) ? '*' : ' ');
if (telemetry_data.active)
lcdDrawChar(8 * FW, 0, 'A', BLINK);

View file

@ -33,7 +33,7 @@
#define APSIZE (BSS | DBLSIZE)
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 mav_title(const pm_char * s, uint8_t index);
void menuTelemetryMavlinkInfos(void);

View file

@ -47,7 +47,7 @@ void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
#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);
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);

View file

@ -251,3 +251,11 @@ const uint8_t LBM_CURVE_POINT_CENTER[] = {
const uint8_t LBM_CURVE_COORD_SHADOW[] = {
#include "mask_coord_shadow.lbm"
};
/*
const uint8_t LBM_SHUTDOWN[] = {
#include "shutdown.lbm"
};
const uint8_t LBM_SLEEP[] = {
#include "sleep.lbm"
}; */

View file

@ -63,8 +63,8 @@ extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
bool loadModelBitmap(char * name, uint8_t * bitmap);
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
void displaySplash();
void displayScreenIndex(uint8_t index, uint8_t count);
void drawSplash();
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 drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible);
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_CENTER[];
extern const uint8_t LBM_CURVE_COORD_SHADOW[];
extern const uint8_t LBM_SHUTDOWN[];
extern const uint8_t LBM_SLEEP[];

View file

@ -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);
}
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)
{
if (idx == MIXSRC_NONE) {

View file

@ -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 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 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);
@ -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)]
inline void lcdDrawPixel(display_t * p, display_t 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 * imgLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
void drawSleepBitmap();
void drawShutdownBitmap(uint8_t index);
#if defined(BOOT)
#define BLINK_ON_PHASE (0)

View file

@ -22,8 +22,10 @@
#define XPOT_DELTA 10
#define XPOT_DELAY 10 /* cycles */
#define BAR_WIDTH 7
#define BAR_HEIGHT (BOX_WIDTH-9)
#define BAR_INTERVAL 20
#define BAR_BOTTOM 200
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
@ -31,11 +33,12 @@ void drawPotsBars()
{
// Optimization by Mike Blandford
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)) {
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
// 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)) {
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
}
#if 0
uint8_t idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
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:
reusableBuffer.calib.state = 0;
case EVT_KEY_BREAK(KEY_EXIT):
calibrationState = 0;
break;
case EVT_KEY_BREAK(KEY_ENTER):
reusableBuffer.calib.state++;
calibrationState++;
break;
}
switch (reusableBuffer.calib.state) {
switch (calibrationState) {
case 0:
// START CALIBRATION
if (!READ_ONLY()) {
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUTOSTART);
lcd_putsCenter(MENU_CONTENT_TOP, STR_MENUTOSTART);
}
break;
case 1:
// SET MIDPOINT
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_SETMIDPOINT, INVERS);
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
lcd_putsCenter(MENU_CONTENT_TOP, STR_SETMIDPOINT, INVERS);
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
reusableBuffer.calib.loVals[i] = 15000;
@ -136,8 +135,8 @@ bool menuCommonCalib(evt_t event)
case 2:
// MOVE STICKS/POTS
STICK_SCROLL_DISABLE();
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
lcd_putsCenter(MENU_CONTENT_TOP, STR_MOVESTICKSPOTS, INVERS);
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
@ -151,7 +150,6 @@ bool menuCommonCalib(evt_t event)
break;
case 3:
#if 0
for (int i=POT1; i<=POT_LAST; i++) {
int idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
@ -171,28 +169,26 @@ bool menuCommonCalib(evt_t event)
}
}
else {
g_eeGeneral.potsType &= ~(0x03<<(2*idx));
g_eeGeneral.potsConfig &= ~(0x03<<(2*idx));
}
}
}
#endif
g_eeGeneral.chkSum = evalChkSum();
storageDirty(EE_GENERAL);
reusableBuffer.calib.state = 4;
calibrationState = 4;
break;
default:
reusableBuffer.calib.state = 0;
calibrationState = 0;
break;
}
drawSticksPositions();
drawPotsBars();
#if 0
for (int i=POT1; i<=POT_LAST; i++) {
uint8_t steps = 0;
if (reusableBuffer.calib.state == 2) {
if (calibrationState == 2) {
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
}
else if (IS_POT_MULTIPOS(i)) {
@ -200,10 +196,9 @@ bool menuCommonCalib(evt_t event)
steps = calib->count + 1;
}
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;
}
@ -211,19 +206,14 @@ bool menuCommonCalib(evt_t event)
bool menuGeneralCalib(evt_t event)
{
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
menuVerticalPosition = -1;
if (menuEvent) {
calibrationState = 0;
}
return menuCommonCalib(READ_ONLY() ? 0 : 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;
chainMenu(menuMainView);
return false;

View file

@ -368,7 +368,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
}
#endif
}
else {
else if (!calibrationState) {
popMenu();
}
break;

View file

@ -25,7 +25,7 @@ const uint8_t LBM_SPLASH[] = {
};
#if defined(SPLASH)
void displaySplash()
void drawSplash()
{
lcdClear();

View file

@ -323,3 +323,17 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
return value;
}
#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();*/
}

View file

@ -55,8 +55,8 @@ struct MenuItem {
};
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 drawSplash();
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 displayMenuBar(const MenuItem *menu, int index);
void drawProgressBar(const char *label);

View file

@ -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;
uint8_t w = *q++;

View file

@ -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);
}
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);
#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();
#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_bmp(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)
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) lcdDrawBitmap(x, y, icons, icon)
void lcdSetRefVolt(unsigned char val);
void lcdClear();

View file

@ -81,8 +81,7 @@ void menuCommonCalib(uint8_t event)
calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
switch (event)
{
switch (event) {
case EVT_ENTRY:
case EVT_KEY_BREAK(KEY_EXIT):
reusableBuffer.calib.state = 0;

View file

@ -462,6 +462,6 @@ void menuGeneralSdManager(evt_t _event)
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);
}
}

View file

@ -224,7 +224,7 @@ void menuModelSelect(uint8_t event)
lcdDrawNumber(20*FW, 0, EeFsGetFree(), 0);
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);
TITLE(STR_MENUMODELSEL);
@ -270,5 +270,5 @@ void menuModelSelect(uint8_t event)
loadModelBitmap(modelHeaders[sub].bitmap, modelBitmap);
}
lcd_bmp(22*FW+2, 2*FH+FH/2, modelBitmap);
lcdDrawBitmap(22*FW+2, 2*FH+FH/2, modelBitmap);
}

View file

@ -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)) {
displayScreenIndex(curr, menuTabSize, 0);
drawScreenIndex(curr, menuTabSize, 0);
}
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, SOLID, FILL_WHITE|GREY_DEFAULT);

View file

@ -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)
{
lcdClear();
lcd_bmp(0, 0, asterisk_lbm);
lcdDrawBitmap(0, 0, asterisk_lbm);
#define MESSAGE_LCD_OFFSET 60

View file

@ -27,10 +27,10 @@ const pm_uchar splashdata[] PROGMEM = {
'S','P','E',0 };
const pm_uchar * const splash_lbm = splashdata+4;
void displaySplash()
void drawSplash()
{
lcdClear();
lcd_bmp(0, 0, splash_lbm);
lcdDrawBitmap(0, 0, splash_lbm);
#if MENUS_LOCK == 1
if (readonly == false) {

View file

@ -66,7 +66,7 @@ void menuAboutView(uint8_t event)
break;
}
lcd_bmp(0, 0, about_bmp);
lcdDrawBitmap(0, 0, about_bmp);
lcdDrawText(64, 0, STR_ABOUTUS, DBLSIZE);
lcdDrawSolidHorizontalLine(ABOUT_X, 18, 120);
lcdDrawSolidHorizontalLine(ABOUT_X, 19, 130, GREY_DEFAULT);

View file

@ -198,7 +198,7 @@ void displayTopBarGauge(coord_t x, int count, bool blinking=false)
}
#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)
void displayTopBar()
@ -513,7 +513,7 @@ void menuMainView(uint8_t event)
// Sliders (Pots / Sliders)
drawSliders();
lcd_bmp(BITMAP_X, BITMAP_Y, modelBitmap);
lcdDrawBitmap(BITMAP_X, BITMAP_Y, modelBitmap);
// Switches
if (getSwitchCount() > 8) {

View file

@ -24,10 +24,21 @@ const pm_uchar bmp_sleep[] PROGMEM = {
#include "../../bitmaps/taranis/sleep.lbm"
};
void displaySleepBitmap()
void drawSleepBitmap()
{
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();
}
@ -58,7 +69,7 @@ void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
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);
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);

View file

@ -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
const pm_char * error = bmpLoad(bitmap, filename, LCD_W/2, LCD_H);
if (!error) {
lcd_bmp(x, y, bitmap);
lcdDrawBitmap(x, y, bitmap);
}
return 0;
}
@ -464,7 +464,7 @@ static int luaLcdDrawScreenTitle(lua_State *L)
int idx = luaL_checkinteger(L, 2);
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);
title(str);

View file

@ -391,7 +391,7 @@ enum BeeperMode {
int8_t backgroundVolume;
#endif
#if defined(PCBTARANIS)
#if defined(PCBTARANIS) || defined(PCBHORUS)
#if defined(REV9E)
#define swconfig_t uint64_t
#define swarnstate_t uint64_t
@ -427,10 +427,10 @@ enum UartModes {
#define EXTRA_GENERAL_FIELDS \
EXTRA_GENERAL_FIELDS_ARM \
uint8_t serial2Mode:6; \
uint8_t spare:2; \
uint8_t slidersConfig:2; \
CustomFunctionData customFn[NUM_CFN]; \
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 anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
char currModelFilename[LEN_MODEL_FILENAME+1];
@ -463,7 +463,7 @@ enum UartModes {
EXTRA_GENERAL_FIELDS_ARM \
uint8_t serial2Mode:6; \
uint8_t slidersConfig:2; \
uint8_t potsConfig; /*two bits for every pot*/\
uint8_t potsConfig; /* two bits per pot */\
uint8_t backlightColor; \
swarnstate_t switchUnlockStates; \
CustomFunctionData customFn[NUM_CFN]; \
@ -1926,15 +1926,15 @@ enum MixSources {
MIXSRC_FIRST_POT,
#if defined(PCBHORUS)
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
MIXSRC_S1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer S1")
MIXSRC_6POS, LUA_EXPORT("6pos", "Multipos Switch")
MIXSRC_S2, LUA_EXPORT("s2", "Potentiometer S2")
MIXSRC_FIRST_SLIDER,
MIXSRC_SLIDER1 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("ls", "Left slider")
MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
MIXSRC_SLIDER3, LUA_EXPORT("lcs", "Left center slider")
MIXSRC_SLIDER4, LUA_EXPORT("rcs", "Right center slider")
MIXSRC_LAST_POT = MIXSRC_SLIDER4,
MIXSRC_S3 = MIXSRC_FIRST_SLIDER, LUA_EXPORT("s3", "Slider S3")
MIXSRC_S4, LUA_EXPORT("s4", "Slider S4")
MIXSRC_LS, LUA_EXPORT("ls", "Left rear slider")
MIXSRC_RS, LUA_EXPORT("rs", "Right rear slider")
MIXSRC_LAST_POT = MIXSRC_RS,
#elif defined(PCBFLAMENCO)
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("sd", "Potentiometer D")
MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")

View file

@ -244,12 +244,15 @@ void generalDefault()
g_eeGeneral.vBatWarn = 33;
g_eeGeneral.vBatMin = -60; // 0 is 9.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)
g_eeGeneral.potsConfig = 0x05; // S1 and S2 = pots with detent
g_eeGeneral.slidersConfig = 0x03; // LS and RS = sliders with detent
#endif
#if defined(PCBTARANIS)
#if defined(PCBTARANIS) || defined(PCBHORUS)
g_eeGeneral.switchConfig = 0x00007bff; // 6x3POS, 1x2POS, 1xTOGGLE
#endif
@ -368,7 +371,7 @@ void applyDefaultTemplate()
#endif
for (int i=0; i<NUM_STICKS; i++) {
MixData *mix = mixAddress(i);
MixData * mix = mixAddress(i);
mix->destCh = i;
mix->weight = 100;
#if defined(VIRTUALINPUTS)
@ -989,12 +992,12 @@ bool readonlyUnlocked()
#if defined(SPLASH)
void doSplash()
{
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
bool refresh = false;
#endif
if (SPLASH_NEEDED()) {
displaySplash();
drawSplash();
#if !defined(CPUARM)
AUDIO_TADA();
@ -1038,7 +1041,7 @@ void doSplash()
}
#endif
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
break;
@ -1047,7 +1050,7 @@ void doSplash()
refresh = true;
}
else if (pwr_check == e_power_on && refresh) {
displaySplash();
drawSplash();
refresh = false;
}
#else
@ -1197,7 +1200,7 @@ void checkTHR()
// first - display warning; also deletes inputs if any have been before
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
bool refresh = false;
#endif
@ -1211,7 +1214,7 @@ void checkTHR()
v = calibratedStick[thrchn];
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
break;
@ -1255,7 +1258,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
{
MESSAGE(t, s, STR_PRESSANYKEY, sound);
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
bool refresh = false;
#endif
@ -1269,7 +1272,7 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
wdt_reset();
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
boardOff();
@ -2515,7 +2518,7 @@ int main(void)
#endif
#if defined(PCBTARANIS)
displaySplash();
drawSplash();
#endif
sei(); // interrupts needed now
@ -2592,13 +2595,9 @@ int main(void)
}
#endif // !SIMU
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
#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 pwrPressedDuration()
@ -2660,9 +2659,7 @@ uint32_t pwrCheck()
else {
lcdRefreshWait();
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
lcdClear();
lcd_bmp(76, 2, bmp_shutdown, index*60, 60);
lcdRefresh();
drawShutdownBitmap(index);
return e_power_press;
}
}

View file

@ -352,12 +352,12 @@
#if defined(PCBHORUS)
#define IS_POT_AVAILABLE(x) (true)
#define IS_POT_MULTIPOS(x) (x==0)
#define IS_POT_WITHOUT_DETENT(x) (x==0)
#define IS_POT_MULTIPOS(x) ((x)==POT2)
#define IS_POT_WITHOUT_DETENT(x) (true)
#elif defined(PCBFLAMENCO)
#define IS_POT_AVAILABLE(x) (true)
#define IS_POT_MULTIPOS(x) (x==0)
#define IS_POT_WITHOUT_DETENT(x) (x==0)
#define IS_POT_MULTIPOS(x) (false)
#define IS_POT_WITHOUT_DETENT(x) (false)
#elif defined(PCBTARANIS) && defined(REV9E)
#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)))
@ -379,6 +379,10 @@
#define IS_POT(x) ((x)>=POT1 && (x)<=POT_LAST)
#if defined(PCBFLAMENCO) || defined(PCBHORUS) || (defined(PCBTARANIS) && defined(REV9E))
#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)

View file

@ -130,14 +130,14 @@ void adcInit()
#define SPI_STICK2 1
#define SPI_STICK3 2
#define SPI_STICK4 3
#define SPI_POT1 4
#define SPI_POT2 5
#define SPI_POT3 6
#define SPI_SLIDER1 7
#define SPI_SLIDER2 8
#define SPI_S1 4
#define SPI_6POS 5
#define SPI_S2 6
#define SPI_S3 7
#define SPI_S4 8
#define SPI_TX_VOLTAGE 9
#define SPI_SLIDER3 10
#define SPI_SLIDER4 11
#define SPI_RS 10
#define SPI_LS 11
const uint16_t adcCommands[MOUSE1+2] =
{
@ -145,13 +145,13 @@ const uint16_t adcCommands[MOUSE1+2] =
MANUAL_MODE | ( SPI_STICK2 << 7 ),
MANUAL_MODE | ( SPI_STICK3 << 7 ),
MANUAL_MODE | ( SPI_STICK4 << 7 ),
MANUAL_MODE | ( SPI_POT1 << 7 ),
MANUAL_MODE | ( SPI_POT2 << 7 ),
MANUAL_MODE | ( SPI_POT3 << 7 ),
MANUAL_MODE | ( SPI_SLIDER1 << 7 ),
MANUAL_MODE | ( SPI_SLIDER2 << 7 ),
MANUAL_MODE | ( SPI_SLIDER4 << 7 ),
MANUAL_MODE | ( SPI_SLIDER3 << 7 ),
MANUAL_MODE | ( SPI_S1 << 7 ),
MANUAL_MODE | ( SPI_6POS << 7 ),
MANUAL_MODE | ( SPI_S2 << 7 ),
MANUAL_MODE | ( SPI_LS << 7 ),
MANUAL_MODE | ( SPI_RS << 7 ),
MANUAL_MODE | ( SPI_S3 << 7 ),
MANUAL_MODE | ( SPI_S4 << 7 ),
MANUAL_MODE | ( SPI_TX_VOLTAGE << 7 ),
MANUAL_MODE | ( 0 << 7 ),
MANUAL_MODE | ( 0 << 7 )
@ -199,7 +199,7 @@ void adcRead()
// 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)
{

View file

@ -44,18 +44,18 @@
#define ENC_GPIO_PIN_B GPIO_Pin_10 // PH.10
// Switches
#define SWITCHES_GPIO_REG_A_H GPIOI->IDR
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_15 // PI.15
#define SWITCHES_GPIO_REG_A_L GPIOH->IDR
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_9 // PH.09
#define SWITCHES_GPIO_REG_A_H GPIOH->IDR
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_9 // PH.09
#define SWITCHES_GPIO_REG_A_L GPIOI->IDR
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_15 // PI.15
#define SWITCHES_GPIO_REG_B_H GPIOH->IDR
#define SWITCHES_GPIO_PIN_B_H GPIO_Pin_12 // PH.12
#define SWITCHES_GPIO_REG_B_L GPIOB->IDR
#define SWITCHES_GPIO_PIN_B_L GPIO_Pin_12 // PB.12
#define SWITCHES_GPIO_REG_C_H GPIOB->IDR
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_15 // PB.15
#define SWITCHES_GPIO_REG_C_L GPIOD->IDR
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_11 // PD.11
#define SWITCHES_GPIO_REG_C_H GPIOD->IDR
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_11 // PD.11
#define SWITCHES_GPIO_REG_C_L GPIOB->IDR
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_15 // PB.15
#define SWITCHES_GPIO_REG_D_H GPIOJ->IDR
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PJ.07
#define SWITCHES_GPIO_REG_D_L GPIOG->IDR
@ -67,9 +67,9 @@
#define SWITCHES_GPIO_REG_F GPIOH->IDR
#define SWITCHES_GPIO_PIN_F GPIO_Pin_3 // PH.03
#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_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_PIN_H GPIO_Pin_7 // PG.07
@ -100,13 +100,13 @@
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13
// 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_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_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_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_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_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)
// ADC
@ -130,8 +130,8 @@
// Power
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
#define PWR_GPIO GPIOJ
#define PWR_GPIO_PIN_ON GPIO_Pin_0 // PJ.00
#define PWR_GPIO_PIN_SWITCH GPIO_Pin_1 // PJ.01
#define PWR_GPIO_PIN_ON GPIO_Pin_1 // PJ.01
#define PWR_GPIO_PIN_SWITCH GPIO_Pin_0 // PJ.00
// Led
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI

View file

@ -147,6 +147,13 @@ void readKeysAndTrims()
case SW_S ## x ## 2: \
xxx = ~SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
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) \
case SW_S ## x ## 0: \
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(D, 3);
ADD_3POS_CASE(E, 4);
ADD_2POS_CASE(F);
ADD_NEG_2POS_CASE(F);
ADD_3POS_CASE(G, 6);
ADD_2POS_CASE(H);
default:

View file

@ -21,14 +21,9 @@
#include "../../pwr.h"
#include "../horus/board_horus.h"
extern volatile uint32_t g_tmr10ms;
#define get_tmr10ms() g_tmr10ms
void pwrInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
/* GPIO Configuration*/
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
@ -38,25 +33,20 @@ void pwrInit()
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_SWITCH;
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);
// Soft power ON
GPIO_SetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
// Init Module PWR
GPIO_ResetBits(EXTMODULE_GPIO_PWR, EXTMODULE_GPIO_PIN_PWR);
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN_PWR;
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);
// TODO while (pwrPressed()) ;
pwrOn();
}
void pwrOn()
{
GPIO_SetBits(PWR_GPIO, PWR_GPIO_PIN_ON);
}
void pwrOff()
@ -68,33 +58,3 @@ uint32_t pwrPressed()
{
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

View file

@ -1279,14 +1279,15 @@ int lcdRestoreBackupBuffer()
}
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
void pwrInit() { }
void pwrOff() { }
#if defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
uint32_t pwrPressed() { return false; }
#else
uint32_t pwrCheck() { return true; }
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
void pwrInit() { }
void pwrOff() { }
int usbPlugged() { return false; }
void USART_DeInit(USART_TypeDef* ) { }
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { return SUCCESS; }

View file

@ -146,7 +146,7 @@ void boardInit()
#if defined(REV9E)
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
lcdClear();
lcd_bmp(76, 2, bmp_lock, 0, 60);
lcdDrawBitmap(76, 2, bmp_lock, 0, 60);
lcdRefresh();
lcdRefreshWait();
@ -158,10 +158,10 @@ void boardInit()
if (duration < PWR_PRESS_DURATION_MIN) {
unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4);
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) {
displaySleepBitmap();
drawSleepBitmap();
turnBacklightOff();
}
else {

View file

@ -129,7 +129,7 @@ void menusTask(void * pdata)
{
opentxInit();
#if defined(PCBTARANIS) && defined(REV9E)
#if defined(PWR_BUTTON_DELAY)
while (1) {
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
@ -158,9 +158,8 @@ void menusTask(void * pdata)
BACKLIGHT_OFF();
#if defined(COLORLCD)
#elif defined(PCBTARANIS)
displaySleepBitmap();
#if defined(COLORLCD) || defined(PCBTARANIS)
drawSleepBitmap();
#else
lcdClear();
displayPopup(STR_SHUTDOWN);

View file

@ -297,10 +297,10 @@ TEST(Lcd, BMPWrapping)
lcdClear();
uint8_t bitmap[2+40*40/2];
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
lcd_bmp(200, 0, bitmap);
lcd_bmp(200, 60, bitmap);
lcd_bmp(240, 60, bitmap); // x too big
lcd_bmp(20, 200, bitmap); // y too big
lcdDrawBitmap(200, 0, bitmap);
lcdDrawBitmap(200, 60, bitmap);
lcdDrawBitmap(240, 60, bitmap); // x too big
lcdDrawBitmap(20, 200, bitmap); // y too big
EXPECT_TRUE(checkScreenshot("bmpwrapping"));
}
#endif
@ -359,7 +359,7 @@ public:
};
#if defined(PCBTARANIS)
TEST(Lcd, lcd_bmpLoadAndDisplay)
TEST(Lcd, lcdDrawBitmapLoadAndDisplay)
{
lcdClear();
// Test proper BMP files, they should display correctly
@ -367,33 +367,33 @@ TEST(Lcd, lcd_bmpLoadAndDisplay)
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(7, 32));
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_7x32.bmp", 7, 32), (char *)0);
bitmap.leakCheck();
lcd_bmp(10, 2, bitmap.buffer());
lcdDrawBitmap(10, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(6, 32));
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_6x32.bmp", 6, 32), (char *)0);
bitmap.leakCheck();
lcd_bmp(20, 2, bitmap.buffer());
lcdDrawBitmap(20, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(31, 31));
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_31x31.bmp", 31, 31), (char *)0);
bitmap.leakCheck();
lcd_bmp(30, 2, bitmap.buffer());
lcdDrawBitmap(30, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(39, 32));
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/1b_39x32.bmp", 39, 32), (char *)0);
bitmap.leakCheck();
lcd_bmp(70, 2, bitmap.buffer());
lcdDrawBitmap(70, 2, bitmap.buffer());
}
{
TestBuffer<1000> bitmap(BITMAP_BUFFER_SIZE(20, 20));
EXPECT_EQ(bmpLoad(bitmap.buffer(), "./tests/4b_20x20.bmp", 20, 20), (char *)0);
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
{

View file

@ -469,7 +469,7 @@
#define TR_TRIMS_VSRCRAW TR("TrmR""TrmE""TrmT""TrmA", "\313Rud""\313Ele""\313Thr""\313Ail")
#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"
#elif defined(PCBFLAMENCO)
#define TR_POTS_VSRCRAW "SD\0 ""LS\0 ""RS\0 "
@ -597,7 +597,6 @@
#define OFS_EXIT sizeof(TR_ENTER)
#endif
#define TR_MENUWHENDONE CENTER "\006" TR_ENTER " WHEN DONE"
#define TR_FREE "free"
#define TR_DELETEMODEL "DELETE" BREAKSPACE "MODEL"
#define TR_COPYINGMODEL "Copying model..."
@ -729,10 +728,12 @@
#define TR_MENUTOSTART TR_ENTER " TO START"
#define TR_SETMIDPOINT "CENTER STICKS/SLIDERS"
#define TR_MOVESTICKSPOTS "MOVE STICKS/POTS"
#define TR_MENUWHENDONE TR_ENTER " WHEN DONE"
#else
#define TR_MENUTOSTART CENTER "\010" TR_ENTER " TO START"
#define TR_SETMIDPOINT TR(CENTER "\004SET STICKS MIDPOINT", CENTER "\004CENTER STICKS/SLIDERS")
#define TR_MOVESTICKSPOTS CENTER "\006MOVE STICKS/POTS"
#define TR_MENUWHENDONE CENTER "\006" TR_ENTER " WHEN DONE"
#endif
#define TR_RXBATT "Rx Batt:"
#define TR_TXnRX "Tx:\0Rx:"