1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 16:55:20 +03:00

LCD refactoring - saves 6 bytes on 9x stock

This commit is contained in:
bsongis 2014-08-20 21:36:00 +02:00
parent 749afc103e
commit 4d84ba4c19
19 changed files with 349 additions and 334 deletions

View file

@ -36,7 +36,7 @@
#include "opentx.h"
const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width, const uint8_t height)
const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const unsigned int width, const unsigned int height)
{
FIL bmpFile;
UINT read;

View file

@ -108,7 +108,7 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
#else
#define RADIO_SETUP_2ND_COLUMN (LCD_W-6*FW-1-MENUS_SCROLLBAR_WIDTH)
#define RADIO_SETUP_TIME_COLUMN (FW*15+9)
#define RADIO_SETUP_DATE_COLUMN (FW*15+5)
#define RADIO_SETUP_DATE_COLUMN (FW*15+7)
#endif
#if !defined(CPUM64)
@ -220,7 +220,7 @@ void menuGeneralSetup(uint8_t event)
uint8_t sub = m_posVert - 1;
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
uint8_t attr = (sub == k ? blink : 0);
@ -1096,7 +1096,7 @@ void menuGeneralSdManager(uint8_t _event)
reusableBuffer.sdmanager.offset = s_pgOfs;
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
lcdNextPos = 0;
uint8_t attr = (m_posVert-1-s_pgOfs == i ? BSS|INVERS : BSS);
if (reusableBuffer.sdmanager.lines[i][0]) {
@ -1148,9 +1148,9 @@ void menuGeneralTrainer(uint8_t event)
uint8_t attr;
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
lcd_puts(3*FW, 1 + 1*FH, STR_MODESRC);
lcd_puts(3*FW, MENU_TITLE_HEIGHT+1, STR_MODESRC);
y = 1 + 2*FH;
y = MENU_TITLE_HEIGHT + 1 + FH;
for (uint8_t i=1; i<=NUM_STICKS; i++) {
uint8_t chan = channel_order(i);
@ -1183,19 +1183,19 @@ void menuGeneralTrainer(uint8_t event)
}
attr = (m_posVert==5) ? blink : 0;
lcd_putsLeft(6*FH+1, STR_MULTIPLIER);
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, 6*FH+1, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_MULTIPLIER);
lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, MENU_TITLE_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
attr = (m_posVert==6) ? INVERS : 0;
if (attr) s_editMode = 0;
lcd_putsAtt(0*FW, 1+7*FH, STR_CAL, attr);
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+1+6*FH, STR_CAL, attr);
for (uint8_t i=0; i<4; i++) {
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
#if defined (PPM_UNIT_PERCENT_PREC1)
lcd_outdezAtt(x, 1+7*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
#else
lcd_outdezAtt(x, 1+7*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
#endif
}
@ -1213,7 +1213,7 @@ void menuGeneralVersion(uint8_t event)
{
SIMPLE_MENU(STR_MENUVERSION, menuTabDiag, e_Vers, 1);
lcd_putsLeft(2*FH, vers_stamp);
lcd_putsLeft(MENU_TITLE_HEIGHT+FH, vers_stamp);
#if defined(COPROCESSOR)
if (Coproc_valid == 1) {
@ -1226,7 +1226,7 @@ void menuGeneralVersion(uint8_t event)
#endif
#if defined(PCBTARANIS)
lcd_putsLeft(7*FH, STR_EEBACKUP);
lcd_putsLeft(MENU_TITLE_HEIGHT+6*FH, STR_EEBACKUP);
if (event == EVT_KEY_LONG(KEY_ENTER)) {
backupEeprom();
}
@ -1243,26 +1243,26 @@ void menuGeneralDiagKeys(uint8_t event)
{
SIMPLE_MENU(STR_MENUDIAG, menuTabDiag, e_Keys, 1);
lcd_puts(14*FW, 3*FH, STR_VTRIM);
lcd_puts(14*FW, MENU_TITLE_HEIGHT+2*FH, STR_VTRIM);
for(uint8_t i=0; i<9; i++) {
uint8_t y;
coord_t y;
if (i<8) {
y = i/2*FH+FH*4;
y = MENU_TITLE_HEIGHT + FH*3 + FH*(i/2);
lcd_img(14*FW, y, sticks, i/2, 0);
displayKeyState(i&1? 20*FW : 18*FW, y, (EnumKeys)(TRM_BASE+i));
}
if (i<6) {
y = (5-i)*FH+2*FH;
y = (5-i)*FH+MENU_TITLE_HEIGHT+FH;
lcd_putsiAtt(0, y, STR_VKEYS, i, 0);
displayKeyState(5*FW+2, y, (EnumKeys)(KEY_MENU+i));
}
#if !defined(PCBTARANIS)
if (i != SW_ID0-SW_BASE) {
y = i*FH-FH;
y = MENU_TITLE_HEIGHT+i*FH-2*FH;
putsSwitches(8*FW, y, i+1, 0); //ohne off,on
displayKeyState(11*FW+2, y, (EnumKeys)(SW_BASE+i));
}
@ -1271,7 +1271,7 @@ void menuGeneralDiagKeys(uint8_t event)
#if defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION)
for(uint8_t i=0; i<DIM(g_rotenc); i++) {
uint8_t y = i*FH + FH;
coord_t y = MENU_TITLE_HEIGHT /* ??? + 1 ??? */ + i*FH;
lcd_putsiAtt(14*FW, y, STR_VRENCODERS, i, 0);
lcd_outdezNAtt(18*FW, y, g_rotenc[i], LEFT|(switchState((EnumKeys)(BTN_REa+i)) ? INVERS : 0));
}
@ -1294,7 +1294,7 @@ void menuGeneralDiagAna(uint8_t event)
STICK_SCROLL_DISABLE();
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
uint8_t y = 1+FH+(i/2)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + (i/2)*FH;
uint8_t x = i&1 ? 64+5 : 0;
putsStrIdx(x, y, PSTR("A"), i+1);
lcd_putc(lcdNextPos, y, ':');
@ -1304,25 +1304,25 @@ void menuGeneralDiagAna(uint8_t event)
#if !defined(CPUARM)
// Display raw BandGap result (debug)
lcd_puts(64+5, 1+4*FH, STR_BG);
lcd_puts(64+5, MENU_TITLE_HEIGHT+1+3*FH, STR_BG);
lcd_outdezAtt(64+5+6*FW-3, 1+4*FH, BandGap, 0);
#endif
#if defined(PCBTARANIS)
lcd_putsLeft(6*FH+1, STR_BATT_CALIB);
lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
batCalV >>= 11;
batCalV += 2; // because of the diode
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, batCalV, (m_posVert==1 ? INVERS : 0));
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+5*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#elif defined(PCBSKY9X)
lcd_putsLeft(5*FH+1, STR_BATT_CALIB);
lcd_putsLeft(MENU_TITLE_HEIGHT+1+4*FH, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128) * 4191;
batCalV /= 55296;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH+1, batCalV, (m_posVert==1 ? INVERS : 0));
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#elif defined(PCBGRUVIN9X)
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
@ -1367,7 +1367,7 @@ void menuGeneralHardware(uint8_t event)
uint8_t sub = m_posVert - 1;
for (uint8_t i=0; i<ITEM_SETUP_HW_MAX; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
switch(i) {
case ITEM_SETUP_HW_POT1:
@ -1422,7 +1422,7 @@ void menuGeneralHardware(uint8_t event)
uint8_t sub = m_posVert - 1;
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
uint8_t attr = (sub == k ? blink : 0);
@ -1539,14 +1539,14 @@ void menuCommonCalib(uint8_t event)
case 0:
// START CALIBRATION
if (!READ_ONLY()) {
lcd_putsLeft(3*FH, STR_MENUTOSTART);
lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUTOSTART);
}
break;
case 1:
// SET MIDPOINT
lcd_putsAtt(0*FW, 2*FH, STR_SETMIDPOINT, INVERS);
lcd_putsLeft(3*FH, STR_MENUWHENDONE);
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
reusableBuffer.calib.loVals[i] = 15000;
@ -1564,8 +1564,8 @@ void menuCommonCalib(uint8_t event)
case 2:
// MOVE STICKS/POTS
STICK_SCROLL_DISABLE();
lcd_putsAtt(0*FW, 2*FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsLeft(3*FH, STR_MENUWHENDONE);
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {

View file

@ -591,11 +591,11 @@ void menuModelSelect(uint8_t event)
lcd_outdezAtt(17*FW, 0, reusableBuffer.modelsel.eepromfree, 0);
#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);
#elif defined(PCBTARANIS)
#if defined(PCBTARANIS)
displayScreenIndex(e_ModelSelect, DIM(menuTabModel), 0);
lcd_filled_rect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
#elif defined(ROTARY_ENCODER_NAVIGATION)
displayScreenIndex(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);
#endif
@ -603,7 +603,7 @@ void menuModelSelect(uint8_t event)
TITLE(STR_MENUMODELSEL);
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y=(i+1)*FH+1;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
lcd_outdezNAtt(3*FW+2, y, k+1, LEADING0+((!s_copyMode && sub==k) ? INVERS : 0), 2);
@ -702,11 +702,11 @@ void menuModelFailsafe(uint8_t event)
uint8_t col = 0;
#endif
{
uint8_t x = col*COL_W+1;
coord_t x = col*COL_W+1;
// Channels
for (uint8_t line=0; line<8; line++) {
uint8_t y = 9+line*7;
coord_t y = 9+line*7;
int32_t val;
uint8_t ofs = (col ? 0 : 1);
@ -754,7 +754,7 @@ void menuModelFailsafe(uint8_t event)
lcd_rect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
uint8_t x0 = (val>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-len;
coord_t x0 = (val>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-len;
lcd_hline(x0, y+1, len);
lcd_hline(x0, y+2, len);
lcd_hline(x0, y+3, len);
@ -774,7 +774,7 @@ void menuModelFailsafe(uint8_t event)
static uint8_t editNameCursorPos = 0;
#endif
void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uint8_t active)
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active)
{
#if defined(CPUM64)
// in order to save flash
@ -788,6 +788,7 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
else
mode = FIXEDWIDTH;
}
lcd_putsnAtt(x, y, name, size, ZCHAR | mode);
if (active) {
@ -851,7 +852,8 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
name[cur] = v;
eeDirty(EE_MODEL);
}
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), INVERS+FIXEDWIDTH);
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
}
else {
cur = 0;
@ -863,7 +865,7 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
#if defined(CPUM64)
#define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active)
#else
void editSingleName(uint8_t x, uint8_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active)
void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active)
{
lcd_putsLeft(y, label);
editName(x, y, name, size, event, active);
@ -1055,7 +1057,7 @@ void menuModelSetup(uint8_t event)
int8_t editMode = s_editMode;
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
#if defined(CPUARM)
@ -1390,7 +1392,7 @@ void menuModelSetup(uint8_t event)
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), potMode, attr & ((m_posHorz == 0) ? attr : !INVERS));
if (potMode) {
uint8_t x = MODEL_SETUP_2ND_COLUMN+5*FW;
coord_t x = MODEL_SETUP_2ND_COLUMN+5*FW;
for (uint8_t i=0; i<NUM_POTS ; i++) {
#if !defined(REVPLUS)
if (attr && i == POT3-POT1) {
@ -1418,7 +1420,7 @@ void menuModelSetup(uint8_t event)
lcd_putsLeft(y, STR_BEEPCTR);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
// TODO flash saving, \001 not needed in STR_RETA123
uint8_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
coord_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
#if defined(PCBTARANIS) && !defined(REVPLUS)
if (i == POT3) {
if (m_posHorz == POT3) REPEAT_LAST_CURSOR_MOVE();
@ -1589,7 +1591,7 @@ void menuModelSetup(uint8_t event)
}
else {
horzpos_t l_posHorz = m_posHorz;
uint8_t xOffsetBind = MODEL_SETUP_BIND_OFS;
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
if (IS_MODULE_XJT(moduleIdx) && IS_D8_RX(moduleIdx)) {
xOffsetBind = 0;
lcd_putsLeft(y, INDENT "Receiver");
@ -1838,7 +1840,7 @@ static uint8_t s_currIdx;
#endif
#if MENU_COLUMNS > 1
uint8_t editDelay(const xcoord_t x, const uint8_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
{
lcd_puts(x, y, str);
lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -1847,7 +1849,7 @@ uint8_t editDelay(const xcoord_t x, const uint8_t y, const uint8_t event, const
}
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay)
#else
uint8_t editDelay(const uint8_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
{
lcd_putsLeft(y, str);
lcd_outdezAtt(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
@ -1866,7 +1868,7 @@ uint8_t editDelay(const uint8_t y, const uint8_t event, const uint8_t attr, cons
#endif
#if defined(PCBTARANIS)
void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
{
lcd_puts(x, y, STR_FP);
x = lcdNextPos + 1;
@ -1876,7 +1878,7 @@ void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value)
}
}
#else
void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
{
uint8_t p = MAX_FLIGHT_MODES;
do {
@ -1888,7 +1890,7 @@ void displayFlightModes(uint8_t x, uint8_t y, FlightModesType value)
}
#endif
FlightModesType editFlightModes(uint8_t x, uint8_t y, uint8_t event, FlightModesType value, uint8_t attr)
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr)
{
lcd_putsColumnLeft(x, y, STR_FLMODE);
@ -1964,7 +1966,7 @@ void menuModelFlightModesAll(uint8_t event)
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + (i+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
if (k==MAX_FLIGHT_MODES) {
@ -2092,7 +2094,7 @@ void menuModelPhaseOne(uint8_t event)
if (s_currIdx == 0 && sub>=ITEM_MODEL_PHASE_SWITCH) sub += ITEM_MODEL_PHASE_FADE_IN-ITEM_MODEL_PHASE_SWITCH;
for (uint8_t k=0; k<LCD_LINES-1; k++) {
uint8_t y = 1 + (k+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
int8_t i = k + s_pgOfs;
if (s_currIdx == 0 && i>=ITEM_MODEL_PHASE_SWITCH) i += ITEM_MODEL_PHASE_FADE_IN-ITEM_MODEL_PHASE_SWITCH;
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
@ -2239,10 +2241,10 @@ void menuModelFlightModesAll(uint8_t event)
uint8_t att;
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
#if defined(CPUARM)
int8_t y = 1 + (1+i-s_pgOfs)*FH;
if (y<1*FH+1 || y>(LCD_LINES-1)*FH+1) continue;
coord_t y = MENU_TITLE_HEIGHT + 1 + (i-s_pgOfs)*FH;
if (y<MENU_TITLE_HEIGHT+1 || y>(LCD_LINES-1)*FH+MENU_TITLE_HEIGHT-FH) continue;
#else
uint8_t y = 1 + (i+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
#endif
att = (i==sub ? INVERS : 0);
FlightModeData *p = flightModeAddress(i);
@ -2312,7 +2314,7 @@ void menuModelHeli(uint8_t event)
uint8_t sub = m_posVert - 1;
for (uint8_t i=0; i<6; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
switch(i) {
case ITEM_HELI_SWASHTYPE:
@ -2374,7 +2376,7 @@ void DrawFunction(FnFuncP fn, uint8_t offset=0)
uint8_t prev_yv = 255;
for (int8_t xv=-WCHART; xv<=WCHART; xv++) {
uint8_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
coord_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
if (prev_yv != 255) {
if (abs((int8_t)yv-prev_yv) <= 1) {
lcd_plot(X0+xv-offset-1, prev_yv, FORCE);
@ -2396,8 +2398,8 @@ int16_t curveFn(int16_t x)
}
struct point_t {
uint8_t x;
uint8_t y;
coord_t x;
coord_t y;
};
point_t getPoint(uint8_t i)
@ -2772,7 +2774,7 @@ void menuModelCurveOne(uint8_t event)
#endif
#if defined(PCBTARANIS) && defined(CURVES)
void editCurveRef(uint8_t x, uint8_t y, CurveRef & curve, uint8_t event, uint8_t attr)
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr)
{
lcd_putsiAtt(x, y, "\004DiffExpoFuncCstm", curve.type, m_posHorz==0 ? attr : 0);
if (attr && m_posHorz==0) {
@ -3041,7 +3043,7 @@ void menuModelExpoOne(uint8_t event)
int8_t sub = m_posVert;
uint8_t y = FH+1;
coord_t y = MENU_TITLE_HEIGHT + 1;
#if defined(PCBTARANIS)
for (uint8_t k=0; k<LCD_LINES-1; k++) {
@ -3208,7 +3210,7 @@ enum MixFields {
MIX_FIELD_COUNT
};
void gvarWeightItem(xcoord_t x, uint8_t y, MixData *md, uint8_t attr, uint8_t event)
void gvarWeightItem(coord_t x, coord_t y, MixData *md, uint8_t attr, uint8_t event)
{
u_int8int16_t weight;
MD_WEIGHT_TO_UNION(md, weight);
@ -3253,7 +3255,7 @@ void menuModelMixOne(uint8_t event)
for (uint8_t k=0; k<MENU_COLUMNS*(LCD_LINES-1); k++) {
#if MENU_COLUMNS > 1
uint8_t y;
coord_t y;
uint8_t COLUMN_X;
if (k >= LCD_LINES-1) {
y = 1 + (k-LCD_LINES+2)*FH;
@ -3265,7 +3267,7 @@ void menuModelMixOne(uint8_t event)
}
int8_t i = k;
#else
uint8_t y = 1 + (k+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
int8_t i = k + s_pgOfs;
#endif
@ -3494,7 +3496,7 @@ void displayHeaderChannelName(uint8_t ch)
}
#endif
void displayMixInfos(uint8_t y, MixData *md)
void displayMixInfos(coord_t y, MixData *md)
{
#if defined(PCBTARANIS)
putsCurveRef(MIX_LINE_CURVE_POS, y, md->curve, 0);
@ -3513,7 +3515,7 @@ void displayMixInfos(uint8_t y, MixData *md)
}
#if defined(PCBTARANIS)
void displayMixLine(uint8_t y, MixData *md)
void displayMixLine(coord_t y, MixData *md)
{
if (md->name[0]) {
lcd_putsnAtt(EXPO_LINE_NAME_POS, y, md->name, sizeof(md->name), ZCHAR);
@ -3525,7 +3527,7 @@ void displayMixLine(uint8_t y, MixData *md)
displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes);
}
#elif defined(CPUARM)
void displayMixLine(uint8_t y, MixData *md)
void displayMixLine(coord_t y, MixData *md)
{
if (md->name[0]) {
lcd_putsnAtt(EXPO_LINE_NAME_POS, y, md->name, sizeof(md->name), ZCHAR);
@ -3538,7 +3540,7 @@ void displayMixLine(uint8_t y, MixData *md)
#define displayMixLine(y, md) displayMixInfos(y, md)
#endif
void displayExpoInfos(uint8_t y, ExpoData *ed)
void displayExpoInfos(coord_t y, ExpoData *ed)
{
#if defined(PCBTARANIS)
putsCurveRef(EXPO_LINE_CURVE_POS, y, ed->curve, 0);
@ -3553,7 +3555,7 @@ void displayExpoInfos(uint8_t y, ExpoData *ed)
}
#if defined(PCBTARANIS)
void displayExpoLine(uint8_t y, ExpoData *ed)
void displayExpoLine(coord_t y, ExpoData *ed)
{
putsMixerSource(EXPO_LINE_SRC_POS, y, ed->srcRaw, 0);
@ -3571,7 +3573,7 @@ void displayExpoLine(uint8_t y, ExpoData *ed)
}
}
#elif defined(CPUARM)
void displayExpoLine(uint8_t y, ExpoData *ed)
void displayExpoLine(coord_t y, ExpoData *ed)
{
displayExpoInfos(y, ed);
@ -3751,7 +3753,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
for (uint8_t ch=1; ch<=(expo ? NUM_INPUTS : NUM_CHNOUT); ch++) {
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
uint8_t y = 1+(cur-s_pgOfs)*FH;
coord_t y = MENU_TITLE_HEIGHT-FH+1+(cur-s_pgOfs)*FH;
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
if (s_pgOfs < cur && cur-s_pgOfs < LCD_LINES) {
if (expo) {
@ -4028,7 +4030,7 @@ void menuModelLimits(uint8_t event)
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + (i+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
if (k==NUM_CHNOUT) {
@ -4053,7 +4055,9 @@ void menuModelLimits(uint8_t event)
char swVal = '-'; // '-', '<', '>'
if ((channelOutputs[k] - v) > 50) swVal = (ld->revert ? 127 : 126); // Switch to raw inputs? - remove trim!
if ((channelOutputs[k] - v) < -50) swVal = (ld->revert ? 126 : 127);
#if !defined(PCBTARANIS)
putsChn(0, y, k+1, 0);
#endif
lcd_putc(LIMITS_DIRECTION_POS, y, swVal);
#endif
@ -4228,7 +4232,7 @@ void menuModelCurvesAll(uint8_t event)
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i + s_pgOfs;
uint8_t attr = (sub == k ? INVERS : 0);
#if defined(GVARS) && defined(PCBSTD)
@ -4307,13 +4311,13 @@ void menuModelGVars(uint8_t event)
#if MAX_GVARS > 6
for (uint8_t l=0; l<LCD_LINES-1; l++) {
uint8_t i = l+s_pgOfs;
uint8_t y = 1 + FH + l*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + l*FH;
#elif MAX_GVARS == 6
for (uint8_t i=0; i<MAX_GVARS; i++) {
uint8_t y = 1 + 2*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + FH + 1 + i*FH;
#else
for (uint8_t i=0; i<MAX_GVARS; i++) {
uint8_t y = 1 + 3*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 2*FH + 1 + i*FH;
#endif
if (g_model.gvars[i].popup) lcd_putc(3*FW, y, '!');
@ -4321,7 +4325,7 @@ void menuModelGVars(uint8_t event)
for (uint8_t j=0; j<1+MAX_FLIGHT_MODES; j++) {
LcdFlags attr = ((sub==i && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
xcoord_t x = GVARS_FM_COLUMN(j-1);
coord_t x = GVARS_FM_COLUMN(j-1);
#if MAX_GVARS == 6
if (i==0 && j!=9) putsStrIdx(x+2, FH+1, STR_FP, j, SMLSIZE);
@ -4448,7 +4452,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
int v1_val = cs->v1;
for (uint8_t k=0; k<LCD_LINES-1; k++) {
uint8_t y = 1 + (k+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
uint8_t i = k + s_pgOfs;
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
uint8_t cstate = lswFamily(cs->func);
@ -4587,7 +4591,7 @@ void menuModelLogicalSwitches(uint8_t event)
{
SIMPLE_MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1);
uint8_t y = 0;
coord_t y = 0;
uint8_t k = 0;
int8_t sub = m_posVert - 1;
@ -4706,7 +4710,6 @@ void menuModelLogicalSwitches(uint8_t event)
MENU(STR_MENULOGICALSWITCHES, menuTabModel, e_LogicalSwitches, NUM_LOGICAL_SWITCH+1, {0, NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
uint8_t y = 0;
uint8_t k = 0;
int8_t sub = m_posVert - 1;
horzpos_t horz = m_posHorz;
@ -4732,7 +4735,7 @@ void menuModelLogicalSwitches(uint8_t event)
#endif
for (uint8_t i=0; i<LCD_LINES-1; i++) {
y = 1 + (i+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
k = i+s_pgOfs;
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
uint8_t attr1 = (horz==1 ? attr : 0);
@ -5068,8 +5071,6 @@ void menuModelCustomFunctions(uint8_t event)
{
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
uint8_t y;
uint8_t k = 0;
int8_t sub = m_posVert - 1;
#if defined(PCBTARANIS)
@ -5095,8 +5096,8 @@ void menuModelCustomFunctions(uint8_t event)
#endif
for (uint8_t i=0; i<LCD_LINES-1; i++) {
y = 1 + (i+1)*FH;
k = i+s_pgOfs;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i+s_pgOfs;
#if LCD_W >= 212
putsStrIdx(0, y, STR_CF, k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
@ -5216,9 +5217,9 @@ void menuModelCustomFunctions(uint8_t event)
#if defined(CPUARM) && defined(SDCARD)
else if (func == FUNC_PLAY_TRACK || func == FUNC_BACKGND_MUSIC || func == FUNC_PLAY_SCRIPT) {
#if LCD_W >= 212
xcoord_t x = MODEL_CUSTOM_FUNC_3RD_COLUMN;
coord_t x = MODEL_CUSTOM_FUNC_3RD_COLUMN;
#else
xcoord_t x = (func == FUNC_PLAY_TRACK ? MODEL_CUSTOM_FUNC_2ND_COLUMN + FW + FW*strlen(TR_PLAY_TRACK) : MODEL_CUSTOM_FUNC_3RD_COLUMN);
coord_t x = (func == FUNC_PLAY_TRACK ? MODEL_CUSTOM_FUNC_2ND_COLUMN + FW + FW*strlen(TR_PLAY_TRACK) : MODEL_CUSTOM_FUNC_3RD_COLUMN);
#endif
if (ZEXIST(sd->play.name))
lcd_putsnAtt(x, y, sd->play.name, sizeof(sd->play.name), attr);
@ -5438,7 +5439,7 @@ void menuModelCustomScriptOne(uint8_t event)
int8_t sub = m_posVert;
for (uint8_t k=0; k<LCD_LINES-1; k++) {
uint8_t y = 1 + (k+1)*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + k*FH;
uint8_t i = k + s_pgOfs;
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
@ -5503,7 +5504,7 @@ void menuModelCustomScripts(uint8_t event)
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS+1, {0, NAVIGATION_LINE_BY_LINE|3/*repeated*/});
uint8_t y;
coord_t y;
int8_t sub = m_posVert - 1;
switch (event) {
@ -5708,7 +5709,7 @@ void menuModelTelemetry(uint8_t event)
#endif
for (uint8_t i=0; i<LCD_LINES-1; i++) {
uint8_t y = 1 + 1*FH + i*FH;
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
uint8_t k = i + s_pgOfs;
#if defined(CPUARM)
for (int j=0; j<=k; j++) {
@ -6131,7 +6132,7 @@ void menuModelTemplates(uint8_t event)
}
}
uint8_t y = 1 + 1*FH;
coord_t y = MENU_TITLE_HEIGHT + 1;
uint8_t k = 0;
for (uint8_t i=0; i<LCD_LINES-1 && k<TMPL_COUNT; i++) {
k = i+s_pgOfs;

View file

@ -41,7 +41,7 @@ int8_t s_editMode;
uint8_t s_noHi;
uint8_t calibrationState;
void menu_lcd_onoff(uint8_t x, uint8_t y, uint8_t value, LcdFlags attr)
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
{
#if defined(GRAPHICS)
if (value)
@ -59,18 +59,18 @@ void menu_lcd_onoff(uint8_t x, uint8_t y, uint8_t value, LcdFlags attr)
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
{
lcd_outdezAtt(LCD_W, 0, count, attr);
xcoord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
lcd_putcAtt(x, 0, '/', attr);
lcd_outdezAtt(x, 0, index+1, attr);
}
#if !defined(CPUM64)
void displayScrollbar(xcoord_t x, uint8_t y, uint8_t h, uint16_t offset, uint16_t count, uint8_t visible)
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
{
lcd_vlineStip(x, y, h, SOLID, ERASE);
lcd_vlineStip(x, y, h, DOTTED);
uint8_t yofs = (h * offset) / count;
uint8_t yhgt = (h * visible) / count;
coord_t yofs = (h * offset) / count;
coord_t yhgt = (h * visible) / count;
if (yhgt + yofs > h)
yhgt = h - yofs;
lcd_vlineStip(x, y + yofs, yhgt, SOLID, FORCE);
@ -335,7 +335,7 @@ void title(const pm_char * s)
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
#if LCD_W >= 212
uint8_t scrollbar_X = LCD_W-1;
coord_t scrollbar_X = LCD_W-1;
#endif
#if defined(CPUARM)
@ -386,8 +386,6 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
if (p2valdiff || scrollUD || p1valdiff) backlightOn(); // on keypress turn the light on
if (menuTab) {
uint8_t attr = 0;
int8_t cc = curr;
switch (event) {
case EVT_KEY_LONG(KEY_MENU):
@ -427,10 +425,10 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
}
if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) {
displayScreenIndex(curr, menuTabSize, attr);
displayScreenIndex(curr, menuTabSize, 0);
}
lcd_filled_rect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
lcd_filled_rect(0, 0, LCD_W, MENU_TITLE_HEIGHT, SOLID, FILL_WHITE|GREY_DEFAULT);
}
DISPLAY_PROGRESS_BAR(menuTab ? lcdLastPos-2*FW-((curr+1)/10*FWNUM)-2 : 20*FW+1);
@ -631,7 +629,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
}
if (maxrow > LCD_LINES-1 && scrollbar_X) {
displayScrollbar(scrollbar_X, FH, LCD_H-FH, s_pgOfs, menuTab ? maxrow : maxrow+1, LCD_LINES-1);
displayScrollbar(scrollbar_X, MENU_TITLE_HEIGHT, LCD_H-MENU_TITLE_HEIGHT-MENU_NAVIG_HEIGHT, s_pgOfs, menuTab ? maxrow : maxrow+1, LCD_LINES-1);
}
m_posVert = l_posVert;
@ -1095,7 +1093,7 @@ void displayWarning(uint8_t event)
}
}
select_menu_value_t selectMenuItem(uint8_t x, uint8_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event)
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event)
{
lcd_putsColumnLeft(x, y, label);
if (values) lcd_putsiAtt(x, y, values, value-min, attr);
@ -1103,7 +1101,7 @@ select_menu_value_t selectMenuItem(uint8_t x, uint8_t y, const pm_char *label, c
return value;
}
uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label, LcdFlags attr, uint8_t event )
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event )
{
#if defined(GRAPHICS)
menu_lcd_onoff(x, y, value, attr);
@ -1113,7 +1111,7 @@ uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label,
#endif
}
int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t event)
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event)
{
lcd_putsColumnLeft(x, y, STR_SWITCH);
putsSwitches(x, y, value, attr);
@ -1122,14 +1120,14 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
}
#if !defined(CPUM64)
void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr)
void displaySlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
{
lcd_putc(x+(value*4*FW)/max, y, '$');
lcd_hline(x, y+3, 5*FW-1, SOLID);
lcd_hline(x, y+3, 5*FW-1, FORCE);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(x, y, 5*FW-1, FH-1);
}
#elif defined(GRAPHICS)
void display5posSlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr)
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr)
{
lcd_putc(x+2*FW+(value*FW), y, '$');
lcd_hline(x, y+3, 5*FW-1, SOLID);
@ -1139,9 +1137,9 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
#if defined(GVARS)
#if defined(CPUARM)
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event)
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event)
#else
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
#endif
{
uint16_t delta = GV_GET_GV1_VALUE(max);
@ -1198,7 +1196,7 @@ int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t m
return value;
}
#else
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
{
lcd_outdezAtt(x, y, value, attr);
if (attr&INVERS) value = checkIncDec(event, value, min, max, EE_MODEL);

View file

@ -46,11 +46,11 @@ inline void displayColumnHeader(const char **headers, uint8_t index)
}
#if !defined(CPUM64)
void displayScrollbar(xcoord_t x, uint8_t y, uint8_t h, uint16_t offset, uint16_t count, uint8_t visible);
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
#endif
#if LCD_W >= 212
extern uint8_t scrollbar_X;
extern coord_t scrollbar_X;
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);
#else
#define SET_SCROLLBAR_X(x)
@ -98,7 +98,7 @@ extern vertpos_t s_pgOfs;
extern uint8_t s_noHi;
extern uint8_t calibrationState;
void menu_lcd_onoff(uint8_t x, uint8_t y, uint8_t value, LcdFlags attr);
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
typedef void (*MenuFuncP)(uint8_t event);
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
@ -139,9 +139,9 @@ void menuStatisticsDebug(uint8_t event);
void menuAboutView(uint8_t event);
#if !defined(CPUM64)
void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr);
void displaySlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
#elif defined(GRAPHICS)
void display5posSlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr);
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr);
#define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT)
#else
#define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT)
@ -329,9 +329,9 @@ void title(const pm_char * s);
typedef int8_t select_menu_value_t;
#endif
select_menu_value_t selectMenuItem(uint8_t x, uint8_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
uint8_t onoffMenuItem(uint8_t value, uint8_t x, uint8_t y, const pm_char *label, LcdFlags attr, uint8_t event );
int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t event);
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event );
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event);
#if defined(CPUARM) && defined(GVARS)
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) gvarMenuItem(x, y, v, min, max, lcdattr, editflags, event)
@ -341,13 +341,13 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
#if defined(GVARS)
#if defined(CPUARM)
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event);
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event);
#else
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); // @@@ open.20.fsguruh
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); // @@@ open.20.fsguruh
#endif
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
#else
int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event);
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event);
#define displayGVar(x, y, v, min, max) lcd_outdez8(x, y, v)
#endif

View file

@ -129,7 +129,7 @@ void drawPotsBars()
}
}
void drawStick(uint8_t centrex, int16_t xval, int16_t yval)
void drawStick(coord_t centrex, int16_t xval, int16_t yval)
{
lcd_square(centrex-BOX_WIDTH/2, BOX_CENTERY-BOX_WIDTH/2, BOX_WIDTH);
DO_CROSS(centrex, BOX_CENTERY, 3);
@ -156,9 +156,9 @@ void doMainScreenGraphics()
void displayTrims(uint8_t phase)
{
for (uint8_t i=0; i<4; i++) {
static xcoord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X};
static coord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X};
static uint8_t vert[4] = {0,1,1,0};
uint8_t xm, ym;
coord_t xm, ym;
xm = x[CONVERT_MODE(i)];
uint8_t att = ROUND;
@ -232,7 +232,7 @@ void displaySliders()
if (i == POT3) {
continue;
}
xcoord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
coord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
int8_t y = (i>=SLIDER1 ? LCD_H/2+1 : 1);
lcd_vline(x, y, LCD_H/2-2);
lcd_vline(x+1, y, LCD_H/2-2);
@ -251,7 +251,7 @@ void displaySliders()
#define BAR_VOLUME_X BAR_X+147
#define BAR_TIME_X BAR_X+159
void displayTopBarGauge(xcoord_t x, int count, bool blinking=false)
void displayTopBarGauge(coord_t x, int count, bool blinking=false)
{
if (!blinking || BLINK_ON_PHASE)
lcd_filled_rect(x+1, BAR_Y+2, 11, 5, SOLID, ERASE);
@ -311,7 +311,7 @@ void displayTopBar()
}
/* Notifs icons */
xcoord_t x = BAR_NOTIFS_X;
coord_t x = BAR_NOTIFS_X;
if (unexpectedShutdown) {
LCD_NOTIF_ICON(x, ICON_REBOOT);
x -= 12;

View file

@ -393,9 +393,9 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-1);
uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
#if LCD_W >= 212
xcoord_t pos[] = {0, 71, 143, 214};
coord_t pos[] = {0, 71, 143, 214};
#else
xcoord_t pos[] = {0, 65, 130};
coord_t pos[] = {0, 65, 130};
#endif
putsTelemetryChannel(pos[j+1]-2, FH+2*FH*i, field-1, value, att);

View file

@ -40,7 +40,8 @@
#if defined(PCBTARANIS)
#define LCD_W 212
#define LCD_H 64
#define xcoord_t uint16_t
#define coord_t int
#define scoord_t int
#define CENTER "\015"
#define CENTER_OFS (7*FW-FW/2)
#define CONTRAST_MIN 0
@ -48,7 +49,8 @@
#else
#define LCD_W 128
#define LCD_H 64
#define xcoord_t uint8_t
#define coord_t uint8_t
#define scoord_t int8_t
#define CENTER
#define CENTER_OFS 0
#define CONTRAST_MIN 10
@ -67,6 +69,9 @@
#define FWNUM 5
#define FH 8
#define MENU_TITLE_HEIGHT FH
#define MENU_NAVIG_HEIGHT 0
#define LCD_LINES (LCD_H/FH)
#define LCD_COLS (LCD_W/FW)
@ -75,7 +80,6 @@
/* lcd text flags */
#define INVERS 0x02
#define DBLSIZE 0x04
#ifdef BOLD_FONT
#define BOLD 0x40
#else
@ -111,48 +115,53 @@
#define NO_UNIT 0x40
#if defined(CPUARM)
#define MIDSIZE 0x0100
#define FONTSIZE(x) ((x) & 0x0F00)
#define TINSIZE 0x0100
#define SMLSIZE 0x0200
#define TINSIZE 0x0400
#define XXLSIZE 0x0800
#define MIDSIZE 0x0300
#define DBLSIZE 0x0400
#define XXLSIZE 0x0500
#define ERASEBG 0x8000
#else
#define DBLSIZE 0x04
#define MIDSIZE DBLSIZE
#define SMLSIZE 0x00
#define TINSIZE 0x00
#define XXLSIZE 0x00
#endif
#if defined(PCBTARANIS)
#define GREY(x) ((x) * 0x1000)
#define GREY_DEFAULT GREY(11)
#define GREY_MASK(x) ((x) & 0xF000)
#define ERASEBG 0x00
#endif
#if defined(CPUARM)
#define TIMEBLINK 0x010000
#define TIMEHOUR 0x020000
#define STREXPANDED 0x040000
#define TIMEBLINK 0x1000
#define TIMEHOUR 0x2000
#define STREXPANDED 0x4000
#else
#define STREXPANDED 0x00
#endif
#if defined(PCBTARANIS)
#define GREY(x) ((x) * 0x010000)
#define GREY_DEFAULT GREY(11)
#define COLOUR_MASK(x) ((x) & 0x0F0000)
#endif
#if defined(CPUARM)
#define LcdFlags uint32_t
#else
#define LcdFlags uint8_t
#endif
#define DISPLAY_PLAN_SIZE (LCD_W*((LCD_H+7)/8))
#if defined(PCBTARANIS)
#define DISPLAY_BUF_SIZE (4*DISPLAY_PLAN_SIZE)
#define display_t uint8_t
#define DISPLAY_BUF_SIZE (LCD_W*LCD_H*4/8)
#else
#define DISPLAY_BUF_SIZE DISPLAY_PLAN_SIZE
#define display_t uint8_t
#define DISPLAY_BUF_SIZE (LCD_W*((LCD_H+7)/8))
#endif
extern uint8_t displayBuf[DISPLAY_BUF_SIZE];
extern uint8_t lcdLastPos;
extern uint8_t lcdNextPos;
extern display_t displayBuf[DISPLAY_BUF_SIZE];
extern coord_t lcdLastPos;
extern coord_t lcdNextPos;
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
@ -172,42 +181,42 @@ typedef const unsigned char pm_uchar;
typedef const char pm_char;
#endif
void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c);
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags mode);
void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags mode);
void lcd_putsiAtt(xcoord_t x, uint8_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s,unsigned char len, LcdFlags mode);
void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s);
void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(uint8_t y, const pm_char * s);
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags mode);
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
void lcd_puts(coord_t x, coord_t y, const pm_char * s);
void lcd_putsn(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(coord_t y, const pm_char * s);
#define lcd_putsCenter(y, s) lcd_puts((LCD_W-sizeof(TR_##s)*FW+FW-2)/2, y, STR_##s)
void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
void lcd_outhex4(coord_t x, coord_t y, uint16_t val);
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
void lcd_outdez8(coord_t x, coord_t y, int8_t val);
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att);
void putsSwitches(xcoord_t x, uint8_t y, int8_t swtch, LcdFlags att=0);
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att=0);
void putsFlightMode(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
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);
#if defined(PCBTARANIS) && !defined(BOOT)
void putsCurveRef(xcoord_t x, uint8_t y, CurveRef &curve, LcdFlags att);
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att);
#endif
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att=0);
void putsTimerMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att=0);
void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#if defined(ROTARY_ENCODERS)
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att);
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#endif
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags attr);
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att);
void putsVBat(xcoord_t x, uint8_t y, LcdFlags att);
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
void putsVBat(coord_t x, coord_t y, LcdFlags att);
void putsTelemetryChannel(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
#if defined(CPUARM)
#define putstime_t int32_t
@ -215,31 +224,33 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val,
#define putstime_t int16_t
#endif
void putsRtcTime(xcoord_t x, uint8_t y, LcdFlags att);
void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
void putsRtcTime(coord_t x, coord_t y, LcdFlags att);
void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
#define SOLID 0xff
#define DOTTED 0x55
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att=0);
void lcd_plot(coord_t x, coord_t y, LcdFlags att=0);
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att=0);
void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0);
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(xcoord_t x, int8_t y, int8_t h);
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(coord_t x, scoord_t y, scoord_t h);
#if defined(CPUM64)
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat);
void lcd_vlineStip(coord_t x, scoord_t y, int8_t h, uint8_t pat);
#else
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
#endif
#if defined(CPUARM)
void lcd_line(xcoord_t x1, int8_t y1, xcoord_t x2, int8_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
#endif
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_invert_line(int8_t y);
#if defined(CPUARM)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#endif
void lcd_filled_rect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_invert_line(int8_t line);
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
void lcdDrawTelemetryTopBar();
@ -251,16 +262,9 @@ void lcdDrawTelemetryTopBar();
lcd_vline(xx-1,yy-ll,ll); \
lcd_vline(xx ,yy-ll,ll); \
lcd_vline(xx+1,yy-ll,ll);
/*
#define LCD_2DOTS(x, y, att) \
lcd_putcAtt(x, y, ' ', att); \
lcd_vline(x+4, y+3, 2); \
lcd_vline(x+5, y+3, 2); \
lcd_vline(x+4, y+8, 2); \
lcd_vline(x+5, y+8, 2);
*/
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset=0, uint8_t width=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 pm_uchar * img, uint8_t offset=0, uint8_t width=0);
#define LCD_ICON(x, y, icon) lcd_bmp(x, y, icons, icon)
void lcdSetRefVolt(unsigned char val);
void lcdInit();
@ -276,7 +280,7 @@ void lcdSetContrast();
#endif
#if defined(PCBTARANIS)
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const xcoord_t width, const uint8_t height);
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height);
#endif
#if defined(BOOT)
@ -287,7 +291,7 @@ void lcdSetContrast();
#ifdef SIMU
extern bool lcd_refresh;
extern uint8_t lcd_buf[DISPLAY_BUF_SIZE];
extern display_t lcd_buf[DISPLAY_BUF_SIZE];
#endif
#if defined(LUA)

View file

@ -36,7 +36,7 @@
#include "opentx.h"
uint8_t displayBuf[DISPLAY_BUF_SIZE];
display_t displayBuf[DISPLAY_BUF_SIZE];
#if defined(LUA)
bool lcd_locked = false;
@ -47,11 +47,11 @@ void lcd_clear()
memset(displayBuf, 0, sizeof(displayBuf));
}
uint8_t lcdLastPos;
uint8_t lcdNextPos;
coord_t lcdLastPos;
coord_t lcdNextPos;
#if defined(CPUARM)
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
{
bool blink = false;
bool inv = false;
@ -114,6 +114,7 @@ void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width
plot = false;
if (height >= 12) continue;
if (j<0 && !inv) continue;
if (y+j < 0) continue;
}
else {
uint8_t line = (j / 8);
@ -132,16 +133,17 @@ void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width
}
}
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
{
const pm_uchar * q;
uint32_t fontsize = FONTSIZE(flags);
lcdNextPos = x-1;
#if !defined(BOOT)
unsigned char c_remapped = 0;
if (flags & (DBLSIZE+BOLD)) {
if (fontsize == DBLSIZE || (flags&BOLD)) {
// To save space only some DBLSIZE and BOLD chars are available
// c has to be remapped. All non existing chars mapped to 0 (space)
if (c>=',' && c<=':')
@ -156,7 +158,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
flags &= ~BOLD;
}
if (flags & DBLSIZE) {
if (fontsize == DBLSIZE) {
if (c >= 0xC0) {
q = &font_10x14_extra[((uint16_t)(c-0xC0))*20];
}
@ -167,19 +169,19 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
}
lcdPutPattern(x, y, q, 10, 16, flags);
}
else if (flags & XXLSIZE) {
else if (fontsize == XXLSIZE) {
q = &font_22x38_num[((uint16_t)c-'0'+5)*110];
lcdPutPattern(x, y, q, 22, 38, flags);
}
else if (flags & MIDSIZE) {
else if (fontsize == MIDSIZE) {
q = &font_8x10[((uint16_t)c-0x20)*16];
lcdPutPattern(x, y, q, 8, 12, flags);
}
else if (flags & SMLSIZE) {
else if (fontsize == SMLSIZE) {
q = (c < 0xc0 ? &font_4x6[(c-0x20)*5] : &font_4x6_extra[(c-0xc0)*5]);
lcdPutPattern(x, y, q, 5, 7, flags);
}
else if (flags & TINSIZE) {
else if (fontsize == TINSIZE) {
q = &font_3x5[((uint16_t)c-0x2d)*3];
lcdPutPattern(x, y, q, 3, 5, flags);
}
@ -202,21 +204,22 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
}
#endif
void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c)
void lcd_putc(coord_t x, coord_t y, const unsigned char c)
{
lcd_putcAtt(x, y, c, 0);
}
void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlags mode)
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags flags)
{
const xcoord_t orig_x = x;
const coord_t orig_x = x;
#if defined(CPUARM)
const uint8_t orig_len = len;
uint32_t fontsize = FONTSIZE(flags);
#endif
bool setx = false;
while (len--) {
unsigned char c;
switch (mode & (BSS+ZCHAR)) {
switch (flags & (BSS+ZCHAR)) {
case BSS:
c = *s;
break;
@ -238,7 +241,7 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
break;
}
else if (c >= 0x20) {
lcd_putcAtt(x, y, c, mode);
lcd_putcAtt(x, y, c, flags);
x = lcdNextPos;
}
else if (setx) {
@ -255,9 +258,12 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
x = orig_x;
y += FH;
#if defined(CPUARM)
if (mode & DBLSIZE) y += FH;
else if (mode & MIDSIZE) y += 4;
else if (mode & SMLSIZE) y--;
if (fontsize == DBLSIZE)
y += FH;
else if (fontsize == MIDSIZE)
y += 4;
else if (fontsize == SMLSIZE)
y--;
#endif
if (y >= LCD_H) break;
}
@ -275,40 +281,40 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
lcdLastPos = x;
lcdNextPos = x;
#if defined(CPUARM)
if (mode&MIDSIZE)
if (fontsize == MIDSIZE)
lcdLastPos += 1;
#endif
}
void lcd_putsn(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len)
void lcd_putsn(coord_t x, coord_t y, const pm_char * s, uint8_t len)
{
lcd_putsnAtt(x, y, s, len, 0);
}
void lcd_putsAtt(xcoord_t x, uint8_t y, const pm_char * s, LcdFlags flags)
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags flags)
{
lcd_putsnAtt(x, y, s, 255, flags);
}
void lcd_puts(xcoord_t x, uint8_t y, const pm_char * s)
void lcd_puts(coord_t x, coord_t y, const pm_char * s)
{
lcd_putsAtt(x, y, s, 0);
}
void lcd_putsLeft(uint8_t y, const pm_char * s)
void lcd_putsLeft(coord_t y, const pm_char * s)
{
lcd_puts(0, y, s);
}
#if !defined(BOOT)
void lcd_putsiAtt(xcoord_t x, uint8_t y,const pm_char * s,uint8_t idx, LcdFlags flags)
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags)
{
uint8_t length;
length = pgm_read_byte(s++);
lcd_putsnAtt(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
}
void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val)
void lcd_outhex4(coord_t x, coord_t y, uint16_t val)
{
x += FWNUM*4+1;
for(int i=0; i<4; i++) {
@ -320,28 +326,30 @@ void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val)
}
}
void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val)
void lcd_outdez8(coord_t x, coord_t y, int8_t val)
{
lcd_outdezAtt(x, y, val);
}
void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags)
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags)
{
lcd_outdezNAtt(x, y, val, flags);
}
void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t len)
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t len)
{
uint8_t fw = FWNUM;
int8_t mode = MODE(flags);
flags &= ~LEADING0;
bool dblsize = flags & DBLSIZE;
#if defined(CPUARM)
bool xxlsize = flags & XXLSIZE;
bool midsize = flags & MIDSIZE;
bool smlsize = flags & SMLSIZE;
bool tinsize = flags & TINSIZE;
uint32_t fontsize = FONTSIZE(flags);
bool dblsize = (fontsize == DBLSIZE);
bool xxlsize = (fontsize == XXLSIZE);
bool midsize = (fontsize == MIDSIZE);
bool smlsize = (fontsize == SMLSIZE);
bool tinsize = (fontsize == TINSIZE);
#else
bool dblsize = flags & DBLSIZE;
#define xxlsize 0
#define midsize 0
#define smlsize 0
@ -357,7 +365,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
val = -val;
}
xcoord_t xn = 0;
coord_t xn = 0;
uint8_t ln = 2;
if (mode != MODE(LEADING0)) {
@ -488,13 +496,13 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
}
#endif
void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att)
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
{
lcd_hlineStip(x, y, w, 0xff, att);
}
#if defined(CPUARM)
void lcd_line(xcoord_t x1, int8_t y1, xcoord_t x2, int8_t y2, uint8_t pat, LcdFlags att)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
{
int dx = x2-x1; /* the horizontal distance of the line */
int dy = y2-y1; /* the vertical distance of the line */
@ -536,12 +544,12 @@ void lcd_line(xcoord_t x1, int8_t y1, xcoord_t x2, int8_t y2, uint8_t pat, LcdFl
}
#endif
void lcd_vline(xcoord_t x, int8_t y, int8_t h)
void lcd_vline(coord_t x, scoord_t y, scoord_t h)
{
lcd_vlineStip(x, y, h, SOLID);
}
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat, LcdFlags att)
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
lcd_vlineStip(x, y, h, pat);
lcd_vlineStip(x+w-1, y, h, pat);
@ -551,15 +559,15 @@ void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat, LcdFlag
}
#if !defined(BOOT)
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat, LcdFlags att)
void lcd_filled_rect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
#if defined(CPUM64)
for (int8_t i=y; i<y+h; i++) {
for (scoord_t i=y; i<y+h; i++) {
lcd_hlineStip(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
#else
for (int8_t i=y; i<y+h; i++) {
for (scoord_t i=y; i<y+h; i++) {
if ((att&ROUND) && (i==y || i==y+h-1))
lcd_hlineStip(x+1, i, w-2, pat, att);
else
@ -602,13 +610,13 @@ void lcdDrawTelemetryTopBar()
#endif
#if defined(CPUARM) && defined(RTCLOCK)
void putsRtcTime(xcoord_t x, uint8_t y, LcdFlags att)
void putsRtcTime(coord_t x, coord_t y, LcdFlags att)
{
putsTimer(x, y, getValue(MIXSRC_FIRST_TELEM-1+TELEM_TX_TIME), att, att);
}
#endif
void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2)
void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2)
{
div_t qr;
@ -660,24 +668,24 @@ void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att
}
// TODO to be optimized with putsTelemetryValue
void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att)
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
{
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'v', att);
}
void putsVBat(xcoord_t x, uint8_t y, LcdFlags att)
void putsVBat(coord_t x, coord_t y, LcdFlags att)
{
putsVolts(x, y, g_vbat100mV, att);
}
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att)
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att)
{
lcd_putsAtt(x, y, str, att & ~LEADING0);
lcd_outdezNAtt(lcdNextPos, y, idx, att|LEFT, 2);
}
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
{
#if defined(PCBTARANIS)
if (idx == 0) {
@ -742,12 +750,12 @@ void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
lcd_putsiAtt(x, y, STR_VTELEMCHNS, idx-MIXSRC_FIRST_TELEM+1, att);
}
void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, LcdFlags att)
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
{
lcd_putsiAtt(x, y, STR_RETA123, idx-1, att);
}
void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att)
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
{
uint8_t len = sizeof(g_model.header.name);
while (len>0 && !name[len-1]) --len;
@ -759,7 +767,7 @@ void putsModelName(xcoord_t x, uint8_t y, char *name, uint8_t id, LcdFlags att)
}
}
void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx == SWSRC_OFF)
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
@ -776,7 +784,7 @@ void putsSwitches(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
}
#if defined(FLIGHT_MODES)
void putsFlightMode(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
if (idx < 0) { lcd_putcAtt(x-2, y, '!', att); idx = -idx; }
@ -788,7 +796,7 @@ void putsFlightMode(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
#endif
#if defined(PCBTARANIS)
void putsCurveRef(xcoord_t x, uint8_t y, CurveRef &curve, LcdFlags att)
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att)
{
if (curve.value != 0) {
switch (curve.type) {
@ -813,7 +821,7 @@ void putsCurveRef(xcoord_t x, uint8_t y, CurveRef &curve, LcdFlags att)
}
}
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx == 0) {
return lcd_putsiAtt(x, y, STR_MMMINV, 0, att);
@ -827,7 +835,7 @@ void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
putsStrIdx(x, y, STR_CV, idx, att);
}
#else
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx < 0) {
lcd_putcAtt(x-1*FW, y, '!', att);
@ -840,7 +848,7 @@ void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
}
#endif
void putsTimerMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att)
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
{
if (mode >= 0) {
if (mode < TMRMODE_COUNT)
@ -852,7 +860,7 @@ void putsTimerMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att)
}
#if defined(PCBTARANIS)
void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att)
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att)
{
trim_t v = getRawTrimValue(phase, idx);
unsigned int mode = v.mode;
@ -870,7 +878,7 @@ void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags at
}
}
#else
void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att)
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att)
{
trim_t v = getRawTrimValue(phase, idx);
@ -886,7 +894,7 @@ void putsTrimMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags at
#endif
#if ROTARY_ENCODERS > 0
void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, LcdFlags att)
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att)
{
int16_t v = flightModeAddress(phase)->rotaryEncoders[idx];
@ -902,7 +910,7 @@ void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, Lc
#endif
#if defined(FRSKY) || defined(CPUARM)
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_t val, uint8_t unit, LcdFlags att)
void putsTelemetryValue(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
{
convertUnit(val, unit);
lcd_outdezAtt(x, y, val, att & (~NO_UNIT));
@ -922,7 +930,7 @@ const pm_uint8_t bchunit_ar[] PROGMEM = {
UNIT_DIST, // GPS Alt
};
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, LcdFlags att)
void putsTelemetryChannel(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att)
{
switch (channel) {
#if defined(CPUARM) && defined(RTCLOCK)
@ -1064,7 +1072,7 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val,
}
}
#else // defined(FRSKY)
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att)
void putsTelemetryChannel(coord_t x, coord_t y, uint8_t channel, lcdint_t val, uint8_t att)
{
switch (channel) {
case TELEM_TIMER1-1:

View file

@ -39,7 +39,7 @@
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
#if !defined(CPUARM)
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
void lcd_putcAtt(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
{
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
const pm_uchar *q = &font_5x7[(c-0x20)*5];
@ -202,14 +202,14 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
*p ^= mask;
}
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
if (p<DISPLAY_END)
lcd_mask(p, BITMASK(y%8), att);
}
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
@ -229,7 +229,7 @@ void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
}
#if defined(CPUM64)
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat)
void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
{
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
@ -262,7 +262,7 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat)
}
#else
// allows the att parameter...
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
#if defined(CPUARM)
@ -304,18 +304,18 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
void lcd_invert_line(int8_t y)
{
uint8_t *p = &displayBuf[y * LCD_W];
for (xcoord_t x=0; x<LCD_W; x++) {
for (coord_t x=0; x<LCD_W; x++) {
ASSERT_IN_DISPLAY(p);
*p++ ^= 0xff;
}
}
#if !defined(BOOT)
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
{
const pm_uchar *q = img;
#if LCD_W >= 260
xcoord_t w = pgm_read_byte(q++);
coord_t w = pgm_read_byte(q++);
if (w == 255) w += pgm_read_byte(q++);
#else
uint8_t w = pgm_read_byte(q++);
@ -325,7 +325,7 @@ void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags
q += idx*w*hb;
for (uint8_t yb = 0; yb < hb; yb++) {
uint8_t *p = &displayBuf[ (y / 8 + yb) * LCD_W + x ];
for (xcoord_t i=0; i<w; i++){
for (coord_t i=0; i<w; i++){
uint8_t b = pgm_read_byte(q);
q++;
ASSERT_IN_DISPLAY(p);

View file

@ -57,9 +57,9 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
}
}
#define PIXEL_GREY_MASK(y, att) (((y) & 1) ? (0xF0 - (GREY_MASK(att) >> 8)) : (0x0F - (GREY_MASK(att) >> 12)))
#define PIXEL_GREY_MASK(y, att) (((y) & 1) ? (0xF0 - (COLOUR_MASK(att) >> 12)) : (0x0F - (COLOUR_MASK(att) >> 16)))
void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
@ -68,7 +68,7 @@ void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att)
}
}
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
@ -87,7 +87,7 @@ void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
}
}
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
if (y >= LCD_H) return;
@ -111,17 +111,17 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
}
}
void lcd_invert_line(int8_t y)
void lcd_invert_line(int8_t line)
{
uint8_t *p = &displayBuf[y * 4 * LCD_W];
for (xcoord_t x=0; x<LCD_W*4; x++) {
uint8_t *p = &displayBuf[line * 4 * LCD_W];
for (coord_t x=0; x<LCD_W*4; x++) {
ASSERT_IN_DISPLAY(p);
*p++ ^= 0xff;
}
}
#if !defined(BOOT)
void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att)
{
const pm_uchar *q = img;
uint8_t w = pgm_read_byte(q++);
@ -129,7 +129,7 @@ void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
q += idx*w*hb;
for (uint8_t yb = 0; yb < hb; yb++) {
for (xcoord_t i=0; i<w; i++) {
for (coord_t i=0; i<w; i++) {
uint8_t b = pgm_read_byte(q++);
uint8_t val = inv ? ~b : b;
for (int k=0; k<8; k++) {
@ -141,7 +141,7 @@ void lcd_img(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t idx, LcdFlags
}
}
void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_t width)
void lcd_bmp(coord_t x, coord_t y, const pm_uchar * img, uint8_t offset, uint8_t width)
{
const pm_uchar *q = img;
uint8_t w = pgm_read_byte(q++);
@ -156,7 +156,7 @@ void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_
for (uint8_t row=0; row<rows; row++) {
q = img + 2 + row*w + offset;
uint8_t *p = &displayBuf[(row + (y/2)) * LCD_W + x];
for (xcoord_t i=0; i<width; i++) {
for (coord_t i=0; i<width; i++) {
uint8_t b = pgm_read_byte(q++);
if (y & 1) {
*p = (*p & 0x0f) + ((b & 0x0f) << 4);

View file

@ -1225,31 +1225,29 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
#if LCD_W >= 212
lcd_bmp(0, 0, asterisk_lbm);
#define TITLE_LCD_OFFSET 60
#define MESSAGE_LCD_OFFSET 60
#else
lcd_img(2, 0, asterisk_lbm, 0, 0);
#define TITLE_LCD_OFFSET 6*FW
#define MESSAGE_LCD_OFFSET 0
#define MESSAGE_LCD_OFFSET 6*FW
#endif
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
lcd_putsAtt(TITLE_LCD_OFFSET, 0, STR_WARNING, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 2*FH, title, DBLSIZE);
lcd_putsAtt(MESSAGE_LCD_OFFSET, 0, STR_WARNING, DBLSIZE);
lcd_putsAtt(MESSAGE_LCD_OFFSET, 2*FH, title, DBLSIZE);
#else
lcd_putsAtt(TITLE_LCD_OFFSET, 0, title, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
lcd_putsAtt(MESSAGE_LCD_OFFSET, 0, title, DBLSIZE);
lcd_putsAtt(MESSAGE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
#endif
#if LCD_W >= 212
lcd_filled_rect(60, 0, LCD_W-MESSAGE_LCD_OFFSET, 32);
lcd_filled_rect(MESSAGE_LCD_OFFSET, 0, LCD_W-MESSAGE_LCD_OFFSET, 32);
if (t) lcd_puts(MESSAGE_LCD_OFFSET, 5*FH, t);
if (last) {
lcd_puts(MESSAGE_LCD_OFFSET, 7*FH, last);
AUDIO_ERROR_MESSAGE(sound);
}
#else
lcd_filled_rect(0, 0, LCD_W-MESSAGE_LCD_OFFSET, 32);
lcd_filled_rect(0, 0, LCD_W, 32);
if (t) lcd_putsLeft(5*FH, t);
if (last) {
lcd_putsLeft(7*FH, last);

View file

@ -42,6 +42,12 @@
#include <stddef.h>
#include <stdlib.h>
#if defined(SIMU)
#define SWITCH_SIMU(a, b) (a)
#else
#define SWITCH_SIMU(a, b) (b)
#endif
#if defined(PCBSKY9X)
#define IS_PCBSKY9X true
#define CASE_PCBSKY9X(x) x,
@ -1568,7 +1574,7 @@ void checkFlashOnBeep();
#if defined(FRSKY) || defined(CPUARM)
void convertUnit(getvalue_t & val, uint8_t & unit); // TODO check FORCEINLINE on stock
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_t val, uint8_t unit, LcdFlags att);
void putsTelemetryValue(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att);
#else
#define convertUnit(...)
#endif

View file

@ -70,10 +70,10 @@ class Open9xSim: public FXMainWindow
FXSlider *sliders[8];
FXKnob *knobs[NUM_POTS];
};
// Message Map
FXDEFMAP(Open9xSim) Open9xSimMap[] = {
//________Message_Type_________ID_____________________Message_Handler_______
//Message_Type _________ ID____Message_Handler_______
FXMAPFUNC(SEL_TIMEOUT, 2, Open9xSim::onTimeout),
FXMAPFUNC(SEL_KEYPRESS, 0, Open9xSim::onKeypress),
};
@ -84,7 +84,7 @@ Open9xSim::Open9xSim(FXApp* a):
FXMainWindow(a, "OpenTX Simu", NULL, NULL, DECOR_ALL, 20, 90, 0, 0)
{
firstTime = true;
for(int i=0; i<(LCD_W*LCD_H/8); i++) displayBuf[i]=0;//rand();
memset(displayBuf, 0, sizeof(displayBuf));
bmp = new FXPPMImage(getApp(),NULL,IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
FXHorizontalFrame *hf11=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
@ -92,8 +92,7 @@ Open9xSim::Open9xSim(FXApp* a):
//rh lv rv lh
for (int i=0; i<4; i++) {
switch(i)
{
switch (i) {
#define L LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_X|LAYOUT_FIX_Y
#undef X0
#define X0 10
@ -164,6 +163,7 @@ void Open9xSim::makeSnapshot(const FXDrawable* drawable)
printf("Cannot create snapshot %s\n", buf);
}
}
void Open9xSim::doEvents()
{
getApp()->runOneEvent(false);
@ -305,7 +305,7 @@ void Open9xSim::refreshDisplay()
for (int x=0; x<LCD_W; x++) {
for (int y=0; y<LCD_H; y++) {
#if defined(PCBTARANIS)
uint8_t * p = & lcd_buf[y / 2 * LCD_W + x];
display_t * p = &lcd_buf[y / 2 * LCD_W + x];
uint8_t z = (y & 1) ? (*p >> 4) : (*p & 0x0F);
if (z) {
FXColor color;

View file

@ -119,7 +119,7 @@ void lcdRefresh()
#endif
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0);
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RnW);
for (xcoord_t x=LCD_W; x>0; --x) {
for (coord_t x=LCD_W; x>0; --x) {
PORTA_LCD_DAT = *p++;
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_E);
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_E);

View file

@ -634,7 +634,7 @@ uint32_t Card_CSD[4]; // TODO elsewhere
#endif
bool lcd_refresh = true;
uint8_t lcd_buf[DISPLAY_BUF_SIZE];
display_t lcd_buf[DISPLAY_BUF_SIZE];
void lcdSetRefVolt(uint8_t val)
{
@ -642,7 +642,7 @@ void lcdSetRefVolt(uint8_t val)
void lcdRefresh()
{
memcpy(lcd_buf, displayBuf, DISPLAY_BUF_SIZE);
memcpy(lcd_buf, displayBuf, sizeof(lcd_buf));
lcd_refresh = true;
}

View file

@ -125,7 +125,7 @@ void lcdRefresh()
#endif
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0);
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RnW);
for (xcoord_t x=LCD_W; x>0; --x) {
for (coord_t x=LCD_W; x>0; --x) {
PORTA_LCD_DAT = *p++;
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_E);
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_E);

View file

@ -330,7 +330,7 @@ enum AlarmLevel {
#define TELEMETRY_CELL_VOLTAGE_MUTLIPLIER 1
#define TELEMETRY_BARO_ALT_AVAILABLE() (frskyData.hub.baroAltitudeOffset)
#define TELEMETRY_BARO_ALT_AVAILABLE() SWITCH_SIMU(true, frskyData.hub.baroAltitudeOffset)
#define TELEMETRY_BARO_ALT_UNIT (IS_IMPERIAL_ENABLE() ? LENGTH_UNIT_IMP : LENGTH_UNIT_METR)
#define TELEMETRY_GPS_SPEED_BP frskyData.hub.gpsSpeed_bp