Taranis 128x64
This commit is contained in:
committed by
Raphael Coeffic
parent
352c273d32
commit
cf06efea87
@@ -21,12 +21,22 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <assert.h>
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "thirdparty/libopenui/src/bitfield.h"
|
#include "thirdparty/libopenui/src/bitfield.h"
|
||||||
#include "gui/common/stdlcd/fonts.h"
|
#include "gui/common/stdlcd/fonts.h"
|
||||||
#include "gui/common/stdlcd/utf8.h"
|
#include "gui/common/stdlcd/utf8.h"
|
||||||
|
|
||||||
|
#if !defined(SIMU)
|
||||||
|
#define assert(x)
|
||||||
|
#else
|
||||||
|
#include <assert.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOT)
|
||||||
|
#include "opentx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
pixel_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
|
pixel_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
|
||||||
|
|
||||||
void lcdClear()
|
void lcdClear()
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ enum GVarFields {
|
|||||||
|
|
||||||
#define GVAR_2ND_COLUMN (12*FW)
|
#define GVAR_2ND_COLUMN (12*FW)
|
||||||
|
|
||||||
|
static const char* _str_units[] = { "-", "%" };
|
||||||
|
|
||||||
void menuModelGVarOne(event_t event)
|
void menuModelGVarOne(event_t event)
|
||||||
{
|
{
|
||||||
GVarData * gvar = &g_model.gvars[s_currIdxSubMenu];
|
GVarData * gvar = &g_model.gvars[s_currIdxSubMenu];
|
||||||
@@ -87,7 +89,7 @@ void menuModelGVarOne(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GVAR_FIELD_UNIT:
|
case GVAR_FIELD_UNIT:
|
||||||
gvar->unit = editChoice(GVAR_2ND_COLUMN, y, STR_UNIT, "\001-%", gvar->unit, 0, 1, attr, event);
|
gvar->unit = editChoice(GVAR_2ND_COLUMN, y, STR_UNIT, _str_units, gvar->unit, 0, 1, attr, event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GVAR_FIELD_PREC:
|
case GVAR_FIELD_PREC:
|
||||||
|
|||||||
@@ -424,6 +424,8 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
|
|||||||
NUM_SWITCHES - 1, /* Switch warning */
|
NUM_SWITCHES - 1, /* Switch warning */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const char* _pots_warn_modes[] = { "OFF", "Man", "Auto" };
|
||||||
|
|
||||||
void menuModelSetup(event_t event)
|
void menuModelSetup(event_t event)
|
||||||
{
|
{
|
||||||
int8_t old_editMode = s_editMode;
|
int8_t old_editMode = s_editMode;
|
||||||
@@ -781,9 +783,9 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
case ITEM_MODEL_SETUP_SWITCHES_WARNING1:
|
case ITEM_MODEL_SETUP_SWITCHES_WARNING1:
|
||||||
{
|
{
|
||||||
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
#define FIRSTSW_STR (&STR_VSRCRAW[MIXSRC_FIRST_SWITCH-MIXSRC_FIRST_STICK+1])
|
||||||
uint8_t switchWarningsCount = getSwitchWarningsCount();
|
uint8_t switchWarningsCount = getSwitchWarningsCount();
|
||||||
uint8_t length = STR_VSRCRAW[0];
|
//uint8_t length = STR_VSRCRAW[0];
|
||||||
horzpos_t l_posHorz = menuHorizontalPosition;
|
horzpos_t l_posHorz = menuHorizontalPosition;
|
||||||
|
|
||||||
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > MAX_SWITCH_PER_LINE*(NUM_BODY_LINES-i)) {
|
if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > MAX_SWITCH_PER_LINE*(NUM_BODY_LINES-i)) {
|
||||||
@@ -856,7 +858,7 @@ void menuModelSetup(event_t event)
|
|||||||
c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
||||||
lcdDrawSizedText(
|
lcdDrawSizedText(
|
||||||
MODEL_SETUP_2ND_COLUMN + qr.rem * ((2 * FW) + 1),
|
MODEL_SETUP_2ND_COLUMN + qr.rem * ((2 * FW) + 1),
|
||||||
y + FH * qr.quot, FIRSTSW_STR + (i * length) + 3, 1,
|
y + FH * qr.quot, FIRSTSW_STR[i] + sizeof(STR_CHAR_SWITCH) - 1, 1,
|
||||||
attr && (menuHorizontalPosition == current) ? INVERS : 0);
|
attr && (menuHorizontalPosition == current) ? INVERS : 0);
|
||||||
lcdDrawChar(lcdNextPos, y + FH * qr.quot, c);
|
lcdDrawChar(lcdNextPos, y + FH * qr.quot, c);
|
||||||
++current;
|
++current;
|
||||||
@@ -873,7 +875,7 @@ void menuModelSetup(event_t event)
|
|||||||
|
|
||||||
case ITEM_MODEL_SETUP_POTS_WARNING:
|
case ITEM_MODEL_SETUP_POTS_WARNING:
|
||||||
lcdDrawTextAlignedLeft(y, STR_POTWARNING);
|
lcdDrawTextAlignedLeft(y, STR_POTWARNING);
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, _pots_warn_modes, g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
||||||
if (attr && (menuHorizontalPosition == 0)) {
|
if (attr && (menuHorizontalPosition == 0)) {
|
||||||
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
@@ -910,8 +912,9 @@ void menuModelSetup(event_t event)
|
|||||||
flags |= INVERS;
|
flags |= INVERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add a new function
|
// skip "---" (+1) and source symbol (+2)
|
||||||
lcdDrawSizedText(x, y, STR_VSRCRAW+2+STR_VSRCRAW[0]*(NUM_STICKS+1+i), STR_VSRCRAW[0]-1, flags);
|
const char* source = STR_VSRCRAW[NUM_STICKS + 1 + i] + 2;
|
||||||
|
lcdDrawSizedText(x, y, source, UINT8_MAX, flags);
|
||||||
x = lcdNextPos+3;
|
x = lcdNextPos+3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -571,7 +571,9 @@ char *getSourceString(char (&dest)[L], mixsrc_t idx)
|
|||||||
char* pos = strAppend(dest, STR_CHAR_INPUT, sizeof(STR_CHAR_INPUT) - 1);
|
char* pos = strAppend(dest, STR_CHAR_INPUT, sizeof(STR_CHAR_INPUT) - 1);
|
||||||
if (g_model.inputNames[idx][0] != '\0' && (dest_len > sizeof(g_model.inputNames[idx]))) {
|
if (g_model.inputNames[idx][0] != '\0' && (dest_len > sizeof(g_model.inputNames[idx]))) {
|
||||||
memset(pos, 0, sizeof(g_model.inputNames[idx]) + 1);
|
memset(pos, 0, sizeof(g_model.inputNames[idx]) + 1);
|
||||||
strncpy(pos, g_model.inputNames[idx], sizeof(g_model.inputNames[idx]));
|
size_t input_len = std::min(dest_len - 1, sizeof(g_model.inputNames[idx]));
|
||||||
|
strncpy(pos, g_model.inputNames[idx], input_len);
|
||||||
|
pos[input_len] = '\0';
|
||||||
} else {
|
} else {
|
||||||
strAppendUnsigned(pos, idx + 1, 2);
|
strAppendUnsigned(pos, idx + 1, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#if !defined(BOOT)
|
#if !defined(BOOT)
|
||||||
Fifo<uint8_t, BT_TX_FIFO_SIZE> btTxFifo;
|
Fifo<uint8_t, BT_TX_FIFO_SIZE> btTxFifo;
|
||||||
@@ -123,7 +124,6 @@ extern "C" void BT_USART_IRQHandler(void)
|
|||||||
USART_ClearITPendingBit(BT_USART, USART_IT_RXNE);
|
USART_ClearITPendingBit(BT_USART, USART_IT_RXNE);
|
||||||
uint8_t byte = USART_ReceiveData(BT_USART);
|
uint8_t byte = USART_ReceiveData(BT_USART);
|
||||||
btRxFifo.push(byte);
|
btRxFifo.push(byte);
|
||||||
BLUETOOTH_TRACE_VERBOSE("BT %02X" CRLF, byte);
|
|
||||||
#if defined(BLUETOOTH_PROBE)
|
#if defined(BLUETOOTH_PROBE)
|
||||||
if (!btChipPresent) {
|
if (!btChipPresent) {
|
||||||
// This is to differentiate X7 and X7S and X-Lite with/without BT
|
// This is to differentiate X7 and X7S and X-Lite with/without BT
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "board_common.h"
|
#include "board_common.h"
|
||||||
|
#include "heartbeat_driver.h"
|
||||||
|
|
||||||
|
#if !defined(BOOT)
|
||||||
|
#include "opentx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t rotencPosition;
|
static uint8_t rotencPosition;
|
||||||
volatile rotenc_t rotencValue;
|
volatile rotenc_t rotencValue;
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
|
|
||||||
#include "dataconstants.h"
|
#include "dataconstants.h"
|
||||||
|
|
||||||
|
#if !defined(BOOT)
|
||||||
|
#include "opentx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(AUX_SERIAL)
|
#if defined(AUX_SERIAL)
|
||||||
#include "aux_serial_driver.h"
|
#include "aux_serial_driver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH", \
|
STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH", \
|
||||||
STR_CHAR_SWITCH "SI", STR_CHAR_SWITCH "SJ",
|
STR_CHAR_SWITCH "SI", STR_CHAR_SWITCH "SJ",
|
||||||
#elif defined(RADIO_TX12)
|
#elif defined(RADIO_TX12)
|
||||||
#define TR_POTS_VSRCRAW STR_CHAR_POT "S1", STR_CHAR_POT "S2",
|
#define TR_POTS_VSRCRAW STR_CHAR_POT "S1", STR_CHAR_POT "S2"
|
||||||
#define TR_SW_VSRCRAW \
|
#define TR_SW_VSRCRAW \
|
||||||
STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH \
|
STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH \
|
||||||
"SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH \
|
"SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH \
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2"
|
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2"
|
||||||
#define TR_SW_VSRCRAW STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH "SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SE", STR_CHAR_SWITCH "SF", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH"
|
#define TR_SW_VSRCRAW STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH "SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SE", STR_CHAR_SWITCH "SF", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH"
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2",
|
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2"
|
||||||
#define TR_SW_VSRCRAW STR_CHAR_SWITCH"SA", STR_CHAR_SWITCH"SB", STR_CHAR_SWITCH"SC", STR_CHAR_SWITCH"SD", STR_CHAR_SWITCH"SF", STR_CHAR_SWITCH"SH", STR_CHAR_SWITCH"SI", STR_CHAR_SWITCH"SJ"
|
#define TR_SW_VSRCRAW STR_CHAR_SWITCH"SA", STR_CHAR_SWITCH"SB", STR_CHAR_SWITCH"SC", STR_CHAR_SWITCH"SD", STR_CHAR_SWITCH"SF", STR_CHAR_SWITCH"SH", STR_CHAR_SWITCH"SI", STR_CHAR_SWITCH"SJ"
|
||||||
#elif defined(PCBX9LITES)
|
#elif defined(PCBX9LITES)
|
||||||
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1"
|
#define TR_POTS_VSRCRAW STR_CHAR_POT"S1"
|
||||||
|
|||||||
Reference in New Issue
Block a user