more cleanup and better support for ILI9225 displays
This commit is contained in:
parent
69b269b0b9
commit
06204b1ad7
|
|
@ -12,7 +12,8 @@
|
|||
# - W: activate WiFi scan
|
||||
# - F: activate frequency spectrum display
|
||||
# - 0: activate "Scan:" display (this is basically just display mode 0)
|
||||
# - x: (1..N): activate display mode x
|
||||
# - x: (1..N): activate display mode x [deprecated]
|
||||
# - >: activate next display mode
|
||||
# - D: activate default receiver display (display mode specified in config)
|
||||
# - +: advance to next active sonde from QRG config
|
||||
# - #: no action
|
||||
|
|
@ -116,7 +117,7 @@ timeaction=#,D,+
|
|||
@Legacy
|
||||
timer=-1,-1,20000
|
||||
key1action=+,0,F,W
|
||||
key2action=2,#,#,#
|
||||
key2action=>,#,#,#
|
||||
timeaction=#,#,0
|
||||
0,5=f MHz
|
||||
1,8=c
|
||||
|
|
@ -136,7 +137,7 @@ timeaction=#,#,0
|
|||
@Field
|
||||
timer=-1,-1,-1
|
||||
key1action=+,0,F,W
|
||||
key2action=3,#,#,#
|
||||
key2action=>,#,#,#
|
||||
timeaction=#,#,#
|
||||
2,0=L
|
||||
4,0=O
|
||||
|
|
@ -152,7 +153,7 @@ timeaction=#,#,#
|
|||
@Field2
|
||||
timer=-1,-1,-1
|
||||
key1action=+,0,F,W
|
||||
key2action=4,#,#,#
|
||||
key2action=>,#,#,#
|
||||
timeaction=#,#,#
|
||||
2,0=L
|
||||
4,0=O
|
||||
|
|
@ -170,7 +171,7 @@ timeaction=#,#,#
|
|||
@GPSDIST
|
||||
timer=-1,-1,-1
|
||||
key1action=+,0,F,W
|
||||
key2action=1,#,#,#
|
||||
key2action=>,#,#,#
|
||||
timeaction=#,#,#
|
||||
0,0=Is
|
||||
0,9=f
|
||||
|
|
@ -206,7 +207,7 @@ fonts=5,6
|
|||
@MainTFT
|
||||
timer=-1,-1,20000
|
||||
key1action=+,0,F,W
|
||||
key2action=2,#,#,#
|
||||
key2action=>,#,#,#
|
||||
timeaction=#,#,0
|
||||
color=FFD700
|
||||
0,0=Is
|
||||
|
|
|
|||
|
|
@ -627,6 +627,8 @@ static uint8_t ACTION(char c) {
|
|||
return ACT_NEXTSONDE;
|
||||
case '#':
|
||||
return ACT_NONE;
|
||||
case '>':
|
||||
return ACT_DISPLAY_NEXT;
|
||||
default:
|
||||
if(c>='0'&&c<='9')
|
||||
return ACT_DISPLAY(c-'0');
|
||||
|
|
@ -759,7 +761,7 @@ void Display::initFromFile() {
|
|||
}
|
||||
layouts = newlayouts;
|
||||
nLayouts = idx+1;
|
||||
setLayout(0);
|
||||
/// DONE by caller setLayout(0);
|
||||
}
|
||||
|
||||
void Display::circ(uint16_t *bm, int16_t size, int16_t x0, int16_t y0, int16_t r, uint16_t fg, boolean fill, uint16_t bg) {
|
||||
|
|
@ -798,10 +800,11 @@ void Display::circ(uint16_t *bm, int16_t size, int16_t x0, int16_t y0, int16_t r
|
|||
}
|
||||
|
||||
|
||||
void Display::setLayout(int layoutIdx) {
|
||||
Serial.printf("setLayout: %d (max is %d)\n", layoutIdx, nLayouts);
|
||||
if(layoutIdx>=nLayouts) layoutIdx = 0;
|
||||
layout = &layouts[layoutIdx];
|
||||
void Display::setLayout(int newidx) {
|
||||
Serial.printf("setLayout: %d (max is %d)\n", newidx, nLayouts);
|
||||
if(newidx>=nLayouts) newidx = 0;
|
||||
layout = &layouts[newidx];
|
||||
layoutIdx = newidx;
|
||||
}
|
||||
|
||||
void Display::drawString(DispEntry *de, const char *str) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <SPI.h>
|
||||
#include <TFT22_ILI9225.h>
|
||||
#include <U8x8lib.h>
|
||||
#include <SPIFFS.h>
|
||||
|
||||
#define WIDTH_AUTO 9999
|
||||
struct DispEntry {
|
||||
|
|
@ -23,6 +24,7 @@ struct DispInfo {
|
|||
DispEntry *de;
|
||||
uint8_t *actions;
|
||||
int16_t *timeouts;
|
||||
char *label;
|
||||
};
|
||||
|
||||
struct CircleInfo {
|
||||
|
|
@ -98,17 +100,21 @@ public:
|
|||
class Display {
|
||||
private:
|
||||
void freeLayouts();
|
||||
int allocDispInfo(int entries, DispInfo *d);
|
||||
int allocDispInfo(int entries, DispInfo *d, char *label);
|
||||
void parseDispElement(char *text, DispEntry *de);
|
||||
int xscale=13, yscale=22;
|
||||
int fontsma=0, fontlar=1;
|
||||
uint16_t colfg, colbg;
|
||||
static void circ(uint16_t *bm, int16_t w, int16_t x0, int16_t y0, int16_t r, uint16_t fg, boolean fill, uint16_t bg);
|
||||
static int countEntries(File f);
|
||||
public:
|
||||
void initFromFile();
|
||||
|
||||
void setLayout(DispInfo *layout);
|
||||
int layoutIdx;
|
||||
DispInfo *layout;
|
||||
|
||||
DispInfo *layouts;
|
||||
int nLayouts;
|
||||
static RawDisplay *rdis;
|
||||
|
||||
Display();
|
||||
|
|
|
|||
|
|
@ -507,13 +507,28 @@ uint8_t Sonde::updateState(uint8_t event) {
|
|||
int n = event;
|
||||
if(event==ACT_DISPLAY_DEFAULT) {
|
||||
n = config.display[1];
|
||||
} else if(event==ACT_DISPLAY_SCANNER) {
|
||||
n= config.display[0];
|
||||
} else if(event==ACT_DISPLAY_NEXT) {
|
||||
int i;
|
||||
for(i=0; config.display[i]!=-1; i++) {
|
||||
if(config.display[i] == disp.layoutIdx) break;
|
||||
}
|
||||
if(config.display[i]==-1 || config.display[i+1]==-1) {
|
||||
//unknown index, or end of list => loop to start
|
||||
n = config.display[1];
|
||||
}
|
||||
}
|
||||
if(n>=0&&n<disp.nLayouts) {
|
||||
if(n>=0 && n<ACT_MAXDISPLAY) {
|
||||
if(n>=disp.nLayouts) {
|
||||
Serial.println("WARNNG: next layout out of range");
|
||||
n = config.display[1];
|
||||
}
|
||||
Serial.printf("Setting display mode %d\n", n);
|
||||
disp.setLayout(n);
|
||||
sonde.clearDisplay();
|
||||
return 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
// Moving to a different value for currentSonde
|
||||
// TODO: THis should be done in sx1278 task, not in main loop!!!!!
|
||||
|
|
@ -564,6 +579,7 @@ void Sonde::updateDisplayIP() {
|
|||
}
|
||||
|
||||
void Sonde::updateDisplayScanner() {
|
||||
// TODO: WTF??? not used any more?
|
||||
disp.setLayout(config.display[0]);
|
||||
disp.updateDisplay();
|
||||
disp.setLayout(config.display[1]);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ extern const char *RXstr[];
|
|||
//int8_t actions[EVT_MAX];
|
||||
#define ACT_NONE 255
|
||||
#define ACT_DISPLAY(n) (n)
|
||||
#define ACT_MAXDISPLAY 50
|
||||
#define ACT_DISPLAY_SCANNER 0
|
||||
#define ACT_DISPLAY_NEXT 64
|
||||
#define ACT_DISPLAY_DEFAULT 63
|
||||
#define ACT_DISPLAY_SPECTRUM 62
|
||||
|
|
|
|||
Loading…
Reference in New Issue