Taranis 212x64

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 0eb11ae4b6
commit 352c273d32
28 changed files with 171 additions and 113 deletions
+1 -1
View File
@@ -210,7 +210,7 @@ void title(const char * s);
typedef int choice_t;
choice_t editChoice(coord_t x, coord_t y, const char *label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable = nullptr);
choice_t editChoice(coord_t x, coord_t y, const char *label, const char** values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable = nullptr);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
+17 -6
View File
@@ -21,11 +21,21 @@
#include <limits.h>
#include <memory.h>
#include <assert.h>
#include "lcd.h"
#include "common/stdlcd/fonts.h"
#include "common/stdlcd/utf8.h"
#if !defined(SIMU)
#define assert(x)
#else
#include <assert.h>
#endif
#if !defined(BOOT)
#include "opentx.h"
#endif
#if (defined(PCBX9E) || defined(PCBX9DP)) && defined(LCD_DUAL_BUFFER)
pixel_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA;
pixel_t displayBuf2[DISPLAY_BUFFER_SIZE] __DMA;
@@ -386,10 +396,9 @@ void lcdDrawTextAlignedLeft(coord_t y, const char * s)
}
#if !defined(BOOT)
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags flags)
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char** s,uint8_t idx, LcdFlags flags)
{
uint8_t length = *(s++);
lcdDrawSizedText(x, y, s+length*idx, length, flags);
lcdDrawSizedText(x, y, s[idx], UINT8_MAX, flags);
}
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
@@ -608,8 +617,10 @@ void putsVBat(coord_t x, coord_t y, LcdFlags att)
void drawStickName(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);
// Skip "---": idx + 1
// Skip source symbol: + 2
const char* stickName = STR_VSRCRAW[idx + 1] + 2;
lcdDrawSizedText(x, y, stickName, UINT8_MAX, att);
}
void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
+1 -1
View File
@@ -111,7 +111,7 @@ void lcdDrawChar(coord_t x, coord_t y, uint8_t c);
void lcdDrawChar(coord_t x, coord_t y, uint8_t c, LcdFlags mode);
void lcdDrawCenteredText(coord_t y, const char * s, LcdFlags flags = 0);
void lcdDrawText(coord_t x, coord_t y, const char * s, LcdFlags mode);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char * s,uint8_t idx, LcdFlags mode);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char** s,uint8_t idx, LcdFlags mode);
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len, LcdFlags mode);
void lcdDrawText(coord_t x, coord_t y, const char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
+3 -1
View File
@@ -63,6 +63,8 @@ enum GVarFields {
#define GVAR_2ND_COLUMN (12*FW)
static const char* _str_units[] = { "-", "%" };
void menuModelGVarOne(event_t event)
{
GVarData * gvar = &g_model.gvars[s_currIdx];
@@ -86,7 +88,7 @@ void menuModelGVarOne(event_t event)
break;
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;
case GVAR_FIELD_PREC:
+6 -4
View File
@@ -363,6 +363,7 @@ void onBluetoothConnectMenu(const char * result)
#include "common/stdlcd/model_setup_afhds3.cpp"
#endif
static const char* _pots_warn_modes[] = { "OFF", "Man", "Auto" };
void menuModelSetup(event_t event)
{
@@ -783,7 +784,7 @@ void menuModelSetup(event_t event)
#endif
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)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
storageDirty(EE_MODEL);
@@ -826,8 +827,9 @@ void menuModelSetup(event_t event)
flags |= INVERS;
}
// TODO add a new function
lcdDrawSizedText(x, y, STR_VSRCRAW+2+STR_VSRCRAW[0]*(NUM_STICKS+1+i), STR_VSRCRAW[0]-1, flags & ~ZCHAR);
// skip "---" (+1) and source symbol (+2)
const char* source = STR_VSRCRAW[NUM_STICKS + 1 + i] + 2;
lcdDrawSizedText(x, y, source, UINT8_MAX, flags);
x = lcdNextPos+3;
}
}
@@ -1669,7 +1671,7 @@ void menuModelSetup(event_t event)
if (isDefaultModelRegistrationID())
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_PXX2_DEFAULT);
else
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID, ZCHAR);
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN, y, g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID);
break;
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_MODEL_NUM:
+1 -1
View File
@@ -82,7 +82,7 @@ void title(const char * s)
lcdDrawText(0, 0, s, INVERS);
}
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable)
choice_t editChoice(coord_t x, coord_t y, const char * label, const char** values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable)
{
if (label) {
drawFieldLabel(x, y, label);