large font for IP address

This commit is contained in:
Hansi, dl9rdz 2019-12-21 17:43:26 +01:00
parent f96086c94e
commit 73133f3e61
2 changed files with 45 additions and 4 deletions

View File

@ -37,7 +37,7 @@
# T type string (RS41/DFM9/DFM6/RS92) # T type string (RS41/DFM9/DFM6/RS92)
# C afC value # C afC value
# N ip address (only tiny font) # N ip address (only tiny font)
# S scan list entry info: l/empty: launch site name, #=entry nr, t=total entries, a=active entries # S scan list entry info: l/empty: launch site name, #=entry nr, t=total entries, a=active entries, /: #/t
# K RS41 kill timer values: Kl launch timer, Kb burst timer, Kc kill countdown # K RS41 kill timer values: Kl launch timer, Kb burst timer, Kc kill countdown
# format: K_4: h:mm k_6: h:mm:ss k_s: sssss, nothing shown for other sonde # format: K_4: h:mm k_6: h:mm:ss k_s: sssss, nothing shown for other sonde
# Mx telemetry value x (t temp p preassure h hyg) [not yet implemented, maybe some day in future] # Mx telemetry value x (t temp p preassure h hyg) [not yet implemented, maybe some day in future]
@ -317,3 +317,34 @@ fonts=0,1
6,0=xTemp: 6,0=xTemp:
6,5=bT C 6,5=bT C
### Alternative display layouts based on https://gist.github.com/bazjo
# Scan display for large 2" TFT dispaly
@Scan.TFT.Bazjo
timer=-1,0,0
key1action=D,#,F,W
key2action=#,#,#,#
timeaction=#,D,+
scale=11,10
fonts=0,2
color=e0e0e0
#Row 1
0.5,0=XScanning...
#Row 2
3,0=xIndex
4,0=S/
3,9=xSite
4,9=S
#Row 3
6,0=xType
7,0=T
6,9=xFrequency
7,9=F
#Row 4
9,0=xWeb UI IP
10,0=N
#Row 5
#Footer
color=6C757D
15,0=xScan Mode
15,18=bVV

View File

@ -457,9 +457,9 @@ void ILI9225Display::welcome() {
} }
void ILI9225Display::drawIP(uint8_t x, uint8_t y, int16_t width, uint16_t fg, uint16_t bg) { void ILI9225Display::drawIP(uint8_t x, uint8_t y, int16_t width, uint16_t fg, uint16_t bg) {
setFont(0);
char buf[20]; char buf[20];
snprintf(buf, 20, "%c %s", sonde.isAP?'A':' ', sonde.ipaddr.c_str()); if(sonde.isAP) strcpy(buf, "A "); else *buf=0;
strncat(buf, sonde.ipaddr.c_str(), 16);
drawString(x, y, buf, width, fg, bg); drawString(x, y, buf, width, fg, bg);
} }
@ -672,6 +672,9 @@ void Display::parseDispElement(char *text, DispEntry *de)
Serial.printf("parsing 'f' entry: extra is '%s'\n", de->extra); Serial.printf("parsing 'f' entry: extra is '%s'\n", de->extra);
break; break;
case 'n': case 'n':
// IP address / small always uses tiny font on TFT for backward compatibility
// Large font can be used arbitrarily
if(de->fmt==fontsma) de->fmt=0;
de->func = disp.drawIP; break; de->func = disp.drawIP; break;
case 's': case 's':
de->func = disp.drawSite; de->func = disp.drawSite;
@ -1061,6 +1064,7 @@ void Display::drawAFC(DispEntry *de) {
drawString(de, buf+strlen(buf)-8); drawString(de, buf+strlen(buf)-8);
} }
void Display::drawIP(DispEntry *de) { void Display::drawIP(DispEntry *de) {
rdis->setFont(de->fmt);
rdis->drawIP(de->x, de->y, de->width, de->fg, de->bg); rdis->drawIP(de->x, de->y, de->width, de->fg, de->bg);
} }
void Display::drawSite(DispEntry *de) { void Display::drawSite(DispEntry *de) {
@ -1070,9 +1074,11 @@ void Display::drawSite(DispEntry *de) {
// currentSonde is index in array starting with 0; // currentSonde is index in array starting with 0;
// but we draw "1" for the first entrie and so on... // but we draw "1" for the first entrie and so on...
snprintf(buf, 3, "%2d", sonde.currentSonde+1); snprintf(buf, 3, "%2d", sonde.currentSonde+1);
buf[2]=0;
break; break;
case 't': case 't':
snprintf(buf, 3, "%d", sonde.config.maxsonde); snprintf(buf, 3, "%d", sonde.config.maxsonde);
buf[2]=0;
break; break;
case 'a': case 'a':
{ {
@ -1081,13 +1087,17 @@ void Display::drawSite(DispEntry *de) {
if(sonde.sondeList[i].active) active++; if(sonde.sondeList[i].active) active++;
} }
snprintf(buf, 3, "%d", active); snprintf(buf, 3, "%d", active);
buf[2]=0;
} }
break; break;
case '/':
snprintf(buf, 6, "%d/%d ", sonde.currentSonde+1, sonde.config.maxsonde);
buf[5]=0;
break;
case 0: case 'l': default: // launch site case 0: case 'l': default: // launch site
drawString(de, sonde.si()->launchsite); drawString(de, sonde.si()->launchsite);
return; return;
} }
buf[2]=0;
if(de->extra[0]) strcat(buf, de->extra+1); if(de->extra[0]) strcat(buf, de->extra+1);
drawString(de, buf); drawString(de, buf);
} }