kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
minor improvements (display, m10)
rodzic
32cb370964
commit
ad244bc771
|
@ -1497,8 +1497,8 @@ void setup()
|
||||||
setupConfigData(); // configuration must be read first due to OLED ports!!!
|
setupConfigData(); // configuration must be read first due to OLED ports!!!
|
||||||
|
|
||||||
// NOT TTGO v1 (fingerprint 64) or Heltec v1/v2 board (fingerprint 4)
|
// NOT TTGO v1 (fingerprint 64) or Heltec v1/v2 board (fingerprint 4)
|
||||||
// and NOT TTGO Lora32 v2.1_1.6 (fingerprint 31)
|
// and NOT TTGO Lora32 v2.1_1.6 (fingerprint 31/63)
|
||||||
if ( (sonde.fingerprint != 31) && ((sonde.fingerprint & 16) == 16) ) {
|
if ( ( (sonde.fingerprint&(64+31)) != 31) && ((sonde.fingerprint & 16) == 16) ) {
|
||||||
// FOr T-Beam 1.0
|
// FOr T-Beam 1.0
|
||||||
for (int i = 0; i < 10; i++) { // try multiple times
|
for (int i = 0; i < 10; i++) { // try multiple times
|
||||||
Wire.begin(21, 22);
|
Wire.begin(21, 22);
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
tft_orient=1
|
tft_orient=1
|
||||||
#gps_rxd=-1
|
#gps_rxd=-1
|
||||||
gps_txd=-1
|
gps_txd=-1
|
||||||
# Show AFC value (for RS41 only, maybe also DFM, but useful for RS92 or M10)
|
# Show AFC value (for RS41 and M10/M20, maybe also DFM, but not useful for RS92)
|
||||||
# showafc=1
|
showafc=1
|
||||||
# Frequency correction, in Hz
|
# Frequency correction, in Hz
|
||||||
# freqofs=0
|
# freqofs=0
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
|
@ -42,7 +42,8 @@ wifi=3
|
||||||
kisstnc.active = 1
|
kisstnc.active = 1
|
||||||
|
|
||||||
# which screens file to use (0: screens.txt, i>0: screens${i}.txt
|
# which screens file to use (0: screens.txt, i>0: screens${i}.txt
|
||||||
screenfile=0
|
# 0: old version; 1: for OLED, 2: for TFT; 3: for TFT (portrait mode)
|
||||||
|
# screenfile=2
|
||||||
# display configuration. List of "displays"
|
# display configuration. List of "displays"
|
||||||
# first entry: "Scanner" display
|
# first entry: "Scanner" display
|
||||||
# second entry: default "Receiver" display
|
# second entry: default "Receiver" display
|
||||||
|
|
|
@ -107,7 +107,7 @@ key2action=#,#,#,#
|
||||||
timeaction=#,D,+
|
timeaction=#,D,+
|
||||||
fonts=5,6
|
fonts=5,6
|
||||||
0,0=XScan
|
0,0=XScan
|
||||||
0,8,-3=S#:
|
0,5,-3=S#:
|
||||||
0,9,5.5=T
|
0,9,5.5=T
|
||||||
3,0=F MHz
|
3,0=F MHz
|
||||||
5,0,16=S
|
5,0,16=S
|
||||||
|
@ -120,11 +120,11 @@ key1action=+,0,F,W
|
||||||
key2action=>,#,#,#
|
key2action=>,#,#,#
|
||||||
timeaction=#,#,0
|
timeaction=#,#,0
|
||||||
color=FFD700
|
color=FFD700
|
||||||
0,0=Is
|
0,0,10.5=Is
|
||||||
color=0000FF
|
color=0000FF
|
||||||
0,11,-5.5=f
|
0,11,-5.5=f
|
||||||
1,1,6=c
|
1,0,4=t
|
||||||
1,12.5,-4=t
|
1,10.5,-6=c
|
||||||
color=00ff00
|
color=00ff00
|
||||||
2,0,7=L
|
2,0,7=L
|
||||||
4,0,7=O
|
4,0,7=O
|
||||||
|
@ -209,12 +209,12 @@ color=e0e0e0
|
||||||
0.5,0=XScanning...
|
0.5,0=XScanning...
|
||||||
#Row 2
|
#Row 2
|
||||||
3,0=xIndex
|
3,0=xIndex
|
||||||
4,0=S/
|
4,0,8=S/
|
||||||
3,9=xSite
|
3,9=xSite
|
||||||
4,9=S
|
4,9=S
|
||||||
#Row 3
|
#Row 3
|
||||||
6,0=xType
|
6,0=xType
|
||||||
7,0=T
|
7,0,6=T
|
||||||
6,9=xFrequency
|
6,9=xFrequency
|
||||||
7,9=F
|
7,9=F
|
||||||
#Row 4
|
#Row 4
|
||||||
|
@ -362,7 +362,7 @@ color=639AFF
|
||||||
fonts=0,5
|
fonts=0,5
|
||||||
color=285454
|
color=285454
|
||||||
11.5,0=xIP ADDRESS:
|
11.5,0=xIP ADDRESS:
|
||||||
10.9,22,-15=N
|
10.9,7,-15=N
|
||||||
#Footer
|
#Footer
|
||||||
color=FF0000
|
color=FF0000
|
||||||
12.7,18=bVV
|
12.7,18=bVV
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const char *version_name = "rdzTTGOsonde";
|
const char *version_name = "rdzTTGOsonde";
|
||||||
const char *version_id = "devel20201230";
|
const char *version_id = "devel20201230";
|
||||||
const int SPIFFS_MAJOR=2;
|
const int SPIFFS_MAJOR=2;
|
||||||
const int SPIFFS_MINOR=7;
|
const int SPIFFS_MINOR=8;
|
||||||
|
|
|
@ -269,7 +269,7 @@ void U8x8Display::welcome() {
|
||||||
drawString(8 - strlen(version_name) / 2, 0, version_name);
|
drawString(8 - strlen(version_name) / 2, 0, version_name);
|
||||||
drawString(8 - strlen(version_id) / 2, 2, version_id);
|
drawString(8 - strlen(version_id) / 2, 2, version_id);
|
||||||
setFont(FONT_SMALL);
|
setFont(FONT_SMALL);
|
||||||
drawString(0, 4, "RS41/92,DFM,M10");
|
drawString(0, 4, "RS41/92,DFM,Mx0");
|
||||||
drawString(0, 6, "by Hansi, DL9RDZ");
|
drawString(0, 6, "by Hansi, DL9RDZ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +386,8 @@ void ILI9225Display::getDispSize(uint8_t *height, uint8_t *width, uint8_t *lines
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: alignright means that there is a box from x to x+(-width), with text right-justified
|
||||||
|
// x is the *left* corner! not the right...
|
||||||
void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t width, uint16_t fg, uint16_t bg) {
|
void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t width, uint16_t fg, uint16_t bg) {
|
||||||
int16_t w,h;
|
int16_t w,h;
|
||||||
boolean alignright=false;
|
boolean alignright=false;
|
||||||
|
@ -402,9 +404,9 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
|
||||||
w = tft->getTextWidth(s);
|
w = tft->getTextWidth(s);
|
||||||
if( width==WIDTH_AUTO ) { width = w; }
|
if( width==WIDTH_AUTO ) { width = w; }
|
||||||
if( width > w ) {
|
if( width > w ) {
|
||||||
tft->fillRectangle(x - width, y, x - w, y + h - 1, bg);
|
tft->fillRectangle(x, y, x + width - w, y + h - 1, bg);
|
||||||
}
|
}
|
||||||
tft->drawText(x - w, y, s, fg);
|
tft->drawText(x + width - w, y, s, fg);
|
||||||
} else {
|
} else {
|
||||||
int curx = tft->drawText(x, y, s, fg);
|
int curx = tft->drawText(x, y, s, fg);
|
||||||
if( width==WIDTH_AUTO ) { return; }
|
if( width==WIDTH_AUTO ) { return; }
|
||||||
|
@ -419,9 +421,14 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
|
||||||
tft->getGFXTextExtent(s, x, y + gfxoffsets[findex-3].yofs, &w, &h);
|
tft->getGFXTextExtent(s, x, y + gfxoffsets[findex-3].yofs, &w, &h);
|
||||||
if(width==WIDTH_AUTO) { width=w; }
|
if(width==WIDTH_AUTO) { width=w; }
|
||||||
if(alignright) {
|
if(alignright) {
|
||||||
if(w > width) width = w;
|
if(w > width) {
|
||||||
x -= width;
|
// fast drawBitmap does bad things if not within viewport
|
||||||
DebugPrintf(DEBUG_DISPLAY, "Reducing x by width %d, its now %d\n", width, x);
|
// Maybe better truncate on the right? (TODO)
|
||||||
|
x = x - w + width; if(x<0) x=0;
|
||||||
|
width = w;
|
||||||
|
}
|
||||||
|
//x -= width;
|
||||||
|
//DebugPrintf(DEBUG_DISPLAY, "Reducing x by width %d, its now %d\n", width, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,10 +503,10 @@ void ILI9225Display::welcome() {
|
||||||
setFont(5);
|
setFont(5);
|
||||||
int l=3*22;
|
int l=3*22;
|
||||||
if(sonde.config.tft_orient&1) {
|
if(sonde.config.tft_orient&1) {
|
||||||
drawString(0, 1*22, "RS41/92,DFM,M10");
|
drawString(0, 1*22, "RS41/92,DFM,M10/20");
|
||||||
} else {
|
} else {
|
||||||
drawString(0, 1*22, "RS41,RS92,");
|
drawString(0, 1*22, "RS41,RS92,");
|
||||||
drawString(0, 2*22, "DFM,M10");
|
drawString(0, 2*22, "DFM,M10/20");
|
||||||
l+=22;
|
l+=22;
|
||||||
}
|
}
|
||||||
drawString(0, l, version_id);
|
drawString(0, l, version_id);
|
||||||
|
|
|
@ -387,11 +387,13 @@ void M10M20::processM10data(uint8_t dt)
|
||||||
// 45 20 7x => M20
|
// 45 20 7x => M20
|
||||||
if(rxp==2 && dataptr[0]==0x45 && dataptr[1]==0x20) { isM20 = true; }
|
if(rxp==2 && dataptr[0]==0x45 && dataptr[1]==0x20) { isM20 = true; }
|
||||||
if(isM20) {
|
if(isM20) {
|
||||||
|
memcpy(sonde.si()->typestr, "M20", 4);
|
||||||
if(rxp>=M20_FRAMELEN) {
|
if(rxp>=M20_FRAMELEN) {
|
||||||
rxsearching = true;
|
rxsearching = true;
|
||||||
haveNewFrame = decodeframeM20(dataptr);
|
haveNewFrame = decodeframeM20(dataptr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
memcpy(sonde.si()->typestr, "M10", 4);
|
||||||
if(rxp>=M10_FRAMELEN) {
|
if(rxp>=M10_FRAMELEN) {
|
||||||
rxsearching = true;
|
rxsearching = true;
|
||||||
haveNewFrame = decodeframeM10(dataptr);
|
haveNewFrame = decodeframeM10(dataptr);
|
||||||
|
|
|
@ -84,6 +84,7 @@ void Sonde::defaultConfig() {
|
||||||
config.tft_orient = 1;
|
config.tft_orient = 1;
|
||||||
config.button2_axp = 0;
|
config.button2_axp = 0;
|
||||||
config.norx_timeout = 20;
|
config.norx_timeout = 20;
|
||||||
|
config.screenfile = 1;
|
||||||
if(initlevels[16]==0) {
|
if(initlevels[16]==0) {
|
||||||
config.oled_sda = 4;
|
config.oled_sda = 4;
|
||||||
config.oled_scl = 15;
|
config.oled_scl = 15;
|
||||||
|
@ -124,6 +125,7 @@ void Sonde::defaultConfig() {
|
||||||
config.tft_rs = 2;
|
config.tft_rs = 2;
|
||||||
config.tft_cs = 0;
|
config.tft_cs = 0;
|
||||||
config.spectrum = -1; // no spectrum for now on large display
|
config.spectrum = -1; // no spectrum for now on large display
|
||||||
|
config.screenfile = 2;
|
||||||
} else {
|
} else {
|
||||||
// OLED display, pins 21,22 ok...
|
// OLED display, pins 21,22 ok...
|
||||||
config.disptype = 0;
|
config.disptype = 0;
|
||||||
|
@ -144,6 +146,7 @@ void Sonde::defaultConfig() {
|
||||||
config.tft_rs = 2;
|
config.tft_rs = 2;
|
||||||
config.tft_cs = 0;
|
config.tft_cs = 0;
|
||||||
config.spectrum = -1; // no spectrum for now on large display
|
config.spectrum = -1; // no spectrum for now on large display
|
||||||
|
config.screenfile = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -509,16 +512,21 @@ void Sonde::receive() {
|
||||||
// If action is to move to a different sonde index, we do update things here, set activate
|
// If action is to move to a different sonde index, we do update things here, set activate
|
||||||
// to force the sx1278 task to call sonde.setup(), and pass information about sonde to
|
// to force the sx1278 task to call sonde.setup(), and pass information about sonde to
|
||||||
// main loop (display update...)
|
// main loop (display update...)
|
||||||
if(action == ACT_NEXTSONDE || action==ACT_PREVSONDE || (action>64&&action<128) ) {
|
if(action == ACT_DISPLAY_SCANNER || action == ACT_NEXTSONDE || action==ACT_PREVSONDE || (action>64&&action<128) ) {
|
||||||
// handled here...
|
// handled here...
|
||||||
if(action==ACT_NEXTSONDE||action==ACT_PREVSONDE)
|
if(action==ACT_DISPLAY_SCANNER) {
|
||||||
nextRxSonde();
|
// nothing to do here, be re-call setup() for M10/M20 for repeating AFC
|
||||||
else
|
}
|
||||||
nextRxFreq( action-64 );
|
else {
|
||||||
action = ACT_SONDE(rxtask.currentSonde);
|
if(action==ACT_NEXTSONDE||action==ACT_PREVSONDE)
|
||||||
|
nextRxSonde();
|
||||||
|
else
|
||||||
|
nextRxFreq( action-64 );
|
||||||
|
action = ACT_SONDE(rxtask.currentSonde);
|
||||||
|
}
|
||||||
if(rxtask.activate==-1) {
|
if(rxtask.activate==-1) {
|
||||||
// race condition here. maybe better use mutex. TODO
|
// race condition here. maybe better use mutex. TODO
|
||||||
rxtask.activate = action;
|
rxtask.activate = ACT_SONDE(rxtask.currentSonde);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = (action<<8) | (res&0xff);
|
res = (action<<8) | (res&0xff);
|
||||||
|
|
Ładowanie…
Reference in New Issue