ILI9351 support

pull/123/head
Hansi, dl9rdz 2021-08-06 16:10:02 +02:00
rodzic cf47a01cb0
commit 4601fb6cb4
5 zmienionych plików z 815 dodań i 100 usunięć

Wyświetl plik

@ -545,7 +545,7 @@ struct st_configitems config_list[] = {
{"wifi", "Wifi mode (0/1/2/3)", 0, &sonde.config.wifi},
{"debug", "Debug mode (0/1)", 0, &sonde.config.debug},
{"maxsonde", "Maxsonde", 0, &sonde.config.maxsonde},
{"screenfile", "Screen config (0=old, 1=OLED, 2=TFT, 3=TFT[port])", 0, &sonde.config.screenfile},
{"screenfile", "Screen config (0=old, 1=OLED, 2/3=ILI9251 l/p, 4/5=ILI9341 l/p", 0, &sonde.config.screenfile},
{"display", "Display screens (scan,default,...)", -6, sonde.config.display},
/* Spectrum display settings */
{"spectrum", "Show spectrum (-1=no, 0=forever, >0=seconds)", 0, &sonde.config.spectrum},
@ -601,7 +601,7 @@ struct st_configitems config_list[] = {
/* Hardware dependeing settings */
{"", "Hardware configuration (requires reboot)", -5, NULL},
{"disptype", "Display type (0=OLED/SSD1306, 1=TFT/ILI9225, 2=OLED/SH1106)", 0, &sonde.config.disptype},
{"disptype", "Display type (0=OLED/SSD1306, 1=ILI9225, 2=OLED/SH1106, 3=ILI9341)", 0, &sonde.config.disptype},
{"norx_timeout", "No-RX-Timeout in seconds (-1=disabled)", 0, &sonde.config.norx_timeout},
{"oled_sda", "OLED SDA/TFT SDA", 0, &sonde.config.oled_sda},
{"oled_scl", "OLED SCL/TFT CLK", 0, &sonde.config.oled_scl},

Wyświetl plik

@ -0,0 +1,574 @@
## screens2.txt: TFT display (landscape)
# Definition of display content and action behaviour
#
# Timer: (view timer, rx timer, norx timer)
# - value -1: timer is disabled; value>=0: timer fires after (value) seconds
# - view timer: time since current view (display mode and sonde) was started
# - rx timer: time since when sonde data has been received continuously (trigger immediatly after RX)
# - norx timer: time since when no sonde data has been received continuously
# (rx and norx timer is started after tuning a new frequency and receiving a signal or not receiving
# anything for a 1s period)
#
# Actions:
# - 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 [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
#
# Display content (lower/upper case: small/large font)
# line,column=content
# for ILI9225 its also possible to indicate
# line,column,width=content for text within a box of width 'width'
# line,column,-width=content for right-justified text
#
# XText : Text
# F(suffix): frequency (with suffix, e.g., " MHz")
# L latitade
# O lOngitute
# A altitude
# Hm(suffix) hor. speed m/s (suffix: e.g. "m/s"; no suffix=>m/s as 16x8 bitmap for SSD1306 display only)
# Hk(suffix) hor. speed km/h (suffix: e.g. "km/h"; no suffix=>km/h as 16x8 bitmap for SSD1306 display only)
# V(suffix) vert. speef (suffix: e.g. "m/s"; no suffix=>m/s as 16x8 bitmap for SSD1306 display only)
# Ix sonde ID (default/d: dxlaprs; s: short id, n: real serial number)
# RS41,RS92: all identical R1234567
# DFMx: ID M12345678; short ID and serial 12345678
# M10: ID ME95231F0; short ID: M95231F0; serial 9062104592
# Q signal quality statistics bar
# T type string (RS41/DFM9/DFM6/RS92)
# C afC value
# N ip address (only tiny font)
# 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
# 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]
# Gx GPS-related data
# raw data from GPS: GA, GO, GH, GC: LAtitude, lOngitude, Altutide(Height), Course over ground
# relative to sonde: GD, GI, GB: Distance, dIrection (absolute), relative Bearing
# G0 GPS circle diagram e.g. 3,5=g0NCS,50,ff0000,000033,5,ffff00,4,ffffff
# "N" (what is on top: N=north C=course)
# "C" (where does the arrow point to: C=course, S=sonde)
# "S" (what is shown by the bullet: C=course, S=sonde)
# 50: circle radius, followed by fg and bg color
# 5: bullet radius, followed by fg color
# 4: arrow width, followed by fg color
# R RSSI
# B battery(T-Beam 1.0) S=status V=Batt.Volt C=charge current D=discharge current
# U=USB volt I=USB current T=IC temp
#
# fonts=x,y can be used to select font (x=small, y=large) for all items below
# for SSD1306, x and y can be used to select one of those fonts:
# (y should be a 1x2 font (1,5,6,7), x a small font)
# u8x8_font_chroma48medium8_r, // 0 ** default small
# u8x8_font_7x14_1x2_f, // 1 ** default large
# u8x8_font_amstrad_cpc_extended_f, // 2
# u8x8_font_5x7_f, // 3
# u8x8_font_5x8_f, // 4
# u8x8_font_8x13_1x2_f, // 5
# u8x8_font_8x13B_1x2_f, // 6
# u8x8_font_7x14B_1x2_f, // 7
# u8x8_font_artossans8_r, // 8
# u8x8_font_artosserif8_r, // 9
# u8x8_font_torussansbold8_r, // 10
# u8x8_font_victoriabold8_r, // 11
# u8x8_font_victoriamedium8_r, // 12
# u8x8_font_pressstart2p_f, // 13
# u8x8_font_pcsenior_f, // 14
# u8x8_font_pxplusibmcgathin_f, // 15
# u8x8_font_pxplusibmcga_f, // 16
# u8x8_font_pxplustandynewtv_f, // 17
#
# for ILI9225, these fonts are available:
# Terminal6x8 // 0
# Terminal11x16 // 1
# Terminal12x16 // 2
# FreeMono9pt7b, // 3
# FreeMono12pt7b, // 4
# FreeSans9pt7b, // 5
# FreeSans12pt7b, // 6
# Picopixel, // 7
#
# color=rrggbb,rrggbb can be used to select color (foreground, background)
# see https://github.com/Nkawu/TFT_22_ILI9225/wiki#color-reference for example (use without "#"-sign)
#
# for TFT display, coordinates and width are multiplied by xscale,yscale and later used in pixels
# with scale=1,1 you can directly use pixel coordinates. (default: xscale=13,yscale=22 => 8 lines, 16 columns)
###########
############
# Scan display for large 2" TFT dispaly
@ScannerTFT
scale=30,18
timer=-1,0,0
key1action=D,#,F,W
key2action=D,#,#,#
timeaction=#,D,+
fonts=5,6
0,0=XScan
0,5,-3=S#:
0,9,5.5=T
3,0=F MHz
5,0,16=S
7,5=n
############
@MainTFT
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,0
color=FFD700
0,0,10.5=Is
color=0000FF
0,11,-5.5=f
1,0,4=t
1,10.5,-6=c
color=00ff00
2,0,7=L
4,0,7=O
color=FFA500
2,9.5,-7=A
3,9.5,-7=vm/s
color=AA5522
4,9.5,-7=hkkm/h
color=FFFFFF
6,2=r
6.3,10=Q4
7,0=xd=
7,2,6=gD
7,12=gI
############
@PeilungTFT
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
color=ffff00,000033
color=bbbbbb,000000
0,2=xN Top:
0,8=xCourse Top:
color=ffff00,000033
1,0=g0NCS,48,ffff00,000044,6,33ff33,5,eeaa00
1,8=g0CCS,48,ffff00,000044,6,55ff55,5,eeaa00
color=ffffff,000000
6,0=xDirection:
6,8,4=gI
7,0=xCOG:
7,4,4=gC
7,8=xturn:
7,12,4=gB
############
@GPSdataTFT
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
0,0=xOn-board GPS:
1,0,8=gA
2,0,8=gO
3,0,8=gH
4,0,8=gC
5,0=xGPS vs Sonde:
6,0,8=gD
7,0,8=gI
7,8,8=gB
############
@BatteryTFT
timer=-1,-1,-1
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
0,0=xBattery status:
0,14=bS
1,0=xBatt:
1,5,5=bVV
2,0,16=bCmA(charging)
3,0,16=bDmA(discharging)
4.4,0=xUSB:
4.4,5,5=bUV
5.4,0,10=bImA
6.4,0=xTemp:
6.4,5,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=D,#,#,#
timeaction=#,D,+
scale=11,10
fonts=0,2
color=e0e0e0
#Row 1
0.5,0=XScanning...
#Row 2
3,0=xIndex
4,0,8=S/
3,9=xSite
4,9=S
#Row 3
6,0=xType
7,0,6=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
############
@Decode/General.TFT.Bazjo
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,0
scale=11,10
fonts=0,2
#Row 1
color=996A06
0,0=xSerial
0,5=t
color=FFB10B
1,0=Is
color=996A06
0,11=xFreq.
0,16=c
color=FFB10B
1,11=F
#Row 2
color=3C5C99
3,0=xLatitude
color=639AFF
4,0=L
color=3C5C99
3,11=xLongitude
color=639AFF
4,11=O
#Row 3
color=3C5C99
6,0=xHoriz. Speed
color=639AFF
7,0=Hkkm/h
color=3C5C99
6,11=xVert. Speed
color=639AFF
7,11=Vm/s
#Row 4
color=99004A
9,0=xAltitude
color=FF007B
10,0=A
color=99004A
9,11=xBearing
color=FF007B
10,11=GB
#Row 5
color=06998E
12,0=xRSSI
color=0AFFEF
13,0=R
color=06998E
12,11=xHistory
color=0AFFEF
13.5,11=Q4
#Footer
color=6C757D
15,0=xDecode Mode / General View
15,18=bVV
############
@Decode/Battery.TFT.Bazjo
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
scale=11,10
fonts=0,2
#Row 1
color=99001F
0,0=xBattery Status
0,11=xBattery Voltage
color=FF0035
1,0=BS
1,11=BVV
#Row 2
color=99001F
3,0=xCharge Current
3,11=xDischarge Current
color=FF0035
4,0=BCmA
4,11=BDmA
#Row 3
color=99001F
6,0=xUSB Voltage
6,11=xUSB Current
color=FF0035
7,0=BUV
7,11=BImA
#Row 4
color=99001F
9,0=xIC Temperature
#9,11=xKey
color=FF0035
10,0=BTC
#10,11=XValue
#Row 5
#12,0=xKey
#12,11=xKey
#13,0=XValue
#13,11=XValue
#Footer
color=99001F
15,0=xDecode Mode/Battery View
15,18=bVV
# based on https://github.com/puspis/rdz_ttgo_sonde
##########
@Scanner.Puspis
timer=-1,0,4
key1action=D,#,F,W
key2action=D,#,#,#
timeaction=#,D,+
scale=13,10
fonts=0,1
#Row 1
color=90EE90
0.5,3=XFREQUENCY SCAN
#Row 2
color=00FF00
3,0=xMEMORY
3,9=xLAUNCH SITE
color=639AFF
4,0,9=S/
4,9=S
#Row 3
color=00FF00
6,0=xTYPE
6,9=xFREQUENCY
color=639AFF
7,0,9=T
7,9=F MHz
#Row 4
fonts=0,5
color=285454
11.5,0=xIP ADDRESS:
10.9,7,-15=N
#Footer
color=FF0000
12.7,18=bVV
############
@Main.Puspis
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,0
scale=11,10
fonts=0,2
#Row 1
color=00FF00
0,0=xSONDE ID
0,11=xFREQUENCY
color=90EE90
0,7.4=t
1,0=Is
1,11=F
#Row 2
fonts=0,1
color=00FF00
3,0=xLATITUDE
3,11=xLONGITUDE
color=FF007B
4,0=L
4,11=O
#Row 3
color=00FF00
6,0=xWIND SPEED
6,11=xCLIMB RATE
color=639AFF
7,0=Hkkm/h
7,11=Vm/s
#Row 4
color=00FF00
9,0=xRX ALTITUDE
9,11=xSONDE ALTITUDE
color=639AFF
10,0=GH
10,11=A
#Row 5
color=00FF00
12,0=xDISTANCE
12,11=xFRAMES
color=FFFFFF
13,0=GD
13.5,11=Q4
#Footer
color=FF0000
15,0.2=xIP:
15,2.5=n
15,18=bVV
############
@JotaEme.Puspis
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,0
scale=11,10
fonts=0,1
#Row 1
color=90EE90
0,0=Is
0.7,10.5=t
0,14=F
#Row 2
color=00FF00
2,1.2=xWIND SPEED
2,14=xCLIMB RATE
color=639AFF
3,1=Hkkm/h
3,13=Vm/s
#Row 3
color=00FF00
5,1=xRX ALTITUDE
5,12.5=xSONDE ALTITUDE
color=639AFF
6,2=GH
6,14=A
#Row 4
color=00FF00
8,0=xSONDE POSITION
color=FF007B
9,2=l
10,2=o
#Row 5
color=00FF00
11.4,2=xDISTANCE
color=FFFFFF
12.4,1.5=GD
#Circle
color=EEAA00,000033
8,13.8=g0CCS,28,FFFF00,000033,5,9ACD32,5,EEAA00
#Footer
color=FF0000
15,0=n
color=FFFFFF,000000
15,8.7=Q4
color=FF0000
15,18.4=bVV
############
@CompassTFT.Puspis
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
scale=13,10
fonts=0,1
#Row 1
color=90EE90
0.5,1.5=XCOMPASS
#Row 2
color=00FF00
4,2=xRX HEADING
color=639AFF
5,3.8=GC
#Row 3
color=00FF00
9.5,3=xDISTANCE
9.5,13.5=xBEARING
color=639AFF
10.5,3.4=GD
10.5,14.3=GI
#Circle
color=EEAA00,000033
0.2,10=g0CCS,52,FFFF00,000033,10,9ACD32,6,EEAA00
#Footer
color=FF0000,000000
12.7,1=Q4
12.7,18=bVV
############
@GPSdataTFT.Puspis
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
scale=13,10
fonts=0,1
#Row 1
color=90EE90
0.5,0.5=XGPS RECEIVER STATION
#Row 2
color=00FF00
3,0=xRX LATITUDE
3,12=xRX LONGITUDE
color=639AFF
4,0=GA
4,12=GO
#Row 3
color=00FF00
6,0=xRX ALTITUDE
6,12=xRX HEADING
color=639AFF
7,0=GH
7,12=GC
#Row 4
color=00FF00
9,0=xDISTANCE
9,12=xBEARING
color=639AFF
10,0=GD
10,12=GB
#Footer
color=FF0000,000000
12.7,0.4=Q4
12.7,18=bVV
############
@BatteryTFT.Puspis
timer=-1,-1,-1
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
scale=13,10
fonts=0,1
#Row 1
color=90EE90
0.5,4=XBATTERY STATUS
#Row 2
color=00FF00
3,0=x(C)HARGE/(B)ATT
3,11.5=xBATTERY VOLTAGE
color=639AFF
4,4=BS
4,11.5=BVV
#Row 3
color=00FF00
6,0=xCHARGE CURRENT
6,11.5=xDISCHG. CURRENT
color=639AFF
7,0=BCmA
7,11.5=BDmA
#Row 3
color=00FF00
9,0=xIC TEMPERATURE
9,11.5=xFREQ. OFFSET
color=639AFF
10,0=BTC
10,10=C
#Footer
color=FF0000,000000
12.7,0.4=Q4
12.7,18=bVV

Wyświetl plik

@ -0,0 +1,217 @@
## screens3.txt: TFT display (portrait)
## based on http://www.p1337.synology.me/dokuwiki/doku.php?id=public:wettersonden
# Definition of display content and action behaviour
#
# Timer: (view timer, rx timer, norx timer)
# - value -1: timer is disabled; value>=0: timer fires after (value) seconds
# - view timer: time since current view (display mode and sonde) was started
# - rx timer: time since when sonde data has been received continuously (trigger immediatly after RX)
# - norx timer: time since when no sonde data has been received continuously
# (rx and norx timer is started after tuning a new frequency and receiving a signal or not receiving
# anything for a 1s period)
#
# Actions:
# - 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 [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
#
# Display content (lower/upper case: small/large font)
# line,column=content
# for ILI9225 its also possible to indicate
# line,column,width=content for text within a box of width 'width'
# line,column,-width=content for right-justified text
#
# XText : Text
# F(suffix): frequency (with suffix, e.g., " MHz")
# L latitade
# O lOngitute
# A altitude
# Hm(suffix) hor. speed m/s (suffix: e.g. "m/s"; no suffix=>m/s as 16x8 bitmap for SSD1306 display only)
# Hk(suffix) hor. speed km/h (suffix: e.g. "km/h"; no suffix=>km/h as 16x8 bitmap for SSD1306 display only)
# V(suffix) vert. speef (suffix: e.g. "m/s"; no suffix=>m/s as 16x8 bitmap for SSD1306 display only)
# Ix sonde ID (default/d: dxlaprs; s: short id, n: real serial number)
# RS41,RS92: all identical R1234567
# DFMx: ID M12345678; short ID and serial 12345678
# M10: ID ME95231F0; short ID: M95231F0; serial 9062104592
# Q signal quality statistics bar
# T type string (RS41/DFM9/DFM6/RS92)
# C afC value
# N ip address (only tiny font)
# 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
# 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]
# Gx GPS-related data
# raw data from GPS: GA, GO, GH, GC: LAtitude, lOngitude, Altutide(Height), Course over ground
# relative to sonde: GD, GI, GB: Distance, dIrection (absolute), relative Bearing
# G0 GPS circle diagram e.g. 3,5=g0NCS,50,ff0000,000033,5,ffff00,4,ffffff
# "N" (what is on top: N=north C=course)
# "C" (where does the arrow point to: C=course, S=sonde)
# "S" (what is shown by the bullet: C=course, S=sonde)
# 50: circle radius, followed by fg and bg color
# 5: bullet radius, followed by fg color
# 4: arrow width, followed by fg color
# R RSSI
# B battery(T-Beam 1.0) S=status V=Batt.Volt C=charge current D=discharge current
# U=USB volt I=USB current T=IC temp
#
# fonts=x,y can be used to select font (x=small, y=large) for all items below
# for SSD1306, x and y can be used to select one of those fonts:
# (y should be a 1x2 font (1,5,6,7), x a small font)
# u8x8_font_chroma48medium8_r, // 0 ** default small
# u8x8_font_7x14_1x2_f, // 1 ** default large
# u8x8_font_amstrad_cpc_extended_f, // 2
# u8x8_font_5x7_f, // 3
# u8x8_font_5x8_f, // 4
# u8x8_font_8x13_1x2_f, // 5
# u8x8_font_8x13B_1x2_f, // 6
# u8x8_font_7x14B_1x2_f, // 7
# u8x8_font_artossans8_r, // 8
# u8x8_font_artosserif8_r, // 9
# u8x8_font_torussansbold8_r, // 10
# u8x8_font_victoriabold8_r, // 11
# u8x8_font_victoriamedium8_r, // 12
# u8x8_font_pressstart2p_f, // 13
# u8x8_font_pcsenior_f, // 14
# u8x8_font_pxplusibmcgathin_f, // 15
# u8x8_font_pxplusibmcga_f, // 16
# u8x8_font_pxplustandynewtv_f, // 17
#
# for ILI9225, these fonts are available:
# Terminal6x8 // 0
# Terminal11x16 // 1
# Terminal12x16 // 2
# FreeMono9pt7b, // 3
# FreeMono12pt7b, // 4
# FreeSans9pt7b, // 5
# FreeSans12pt7b, // 6
# Picopixel, // 7
#
# color=rrggbb,rrggbb can be used to select color (foreground, background)
# see https://github.com/Nkawu/TFT_22_ILI9225/wiki#color-reference for example (use without "#"-sign)
#
# for TFT display, coordinates and width are multiplied by xscale,yscale and later used in pixels
# with scale=1,1 you can directly use pixel coordinates. (default: xscale=13,yscale=22 => 8 lines, 16 columns)
###########
#
# Default configuration for "Scanner" display:
# - view timer disabled; rx timer=0; norx timer = 0
# => after 1 second immediately an action is triggered
# (norx: go to next sonde; rx: go to default receiver display)
# - key1 actions: D,0,F,W
# => Button press activates default receiver view, double press does nothing
# Mid press activates Spectrum display, long press activates Wifi scan
# - key2 has no function
@ScannerPortrait
timer=-1,0,0
key1action=D,#,F,W
key2action=>,#,#,#
timeaction=#,D,+
0,0=XScan
0,5=S#:
0,9,4.5=T
6,0=XHoehe
6,5=GH
color=ffff00
2,0=F MHz
4,0=S
color=00ff00,444444
7,5=n
7,0=bV
############
# Default configuration for "Legacy" display:
# - view timer=-1, rx timer=-1 (disabled); norx timer=20 (or -1 for "old" behaviour)
# => norx timer fires after not receiving a singla for 20 seconds
# - key1 actions: +,0,F,W
# => Button1 press: next sonde; double press => @Scanner display
# => Mid press activates Spectrum display, long press activates Wifi scan
# - key2 actions: 2,#,#,#
# => BUtton2 activates display 2 (@Field)
# - timer actions: #,#,0
# (norx timer: if no signal for >20 seconds: go back to scanner mode)
#
@LegacyPortrait
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,0
9,10=f
9,0=r
9,4=Q
5,0=g0NCS,35,ffff00,000044,6,33ff33,5,eeaa00
5,7=g0CCS,35,ffff00,000044,6,55ff55,5,eeaa00
0,0=s
0,9=is
2,0=L
3,0=O
color=FFFF00
1,6=Hk km/h
color=FF0000
1,0=GD
color=FFFFFF
4,9=GH
3,9=V
4,0=A
############
@PeilungTFTPortrait
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
color=ffff00,000033
color=bbbbbb,000000
0,2=xN Top:
0,8=xCourse Top:
color=ffff00,000033
1,0=g0NCS,35,ffff00,000044,6,33ff33,5,eeaa00
1,7=g0CCS,35,ffff00,000044,6,55ff55,5,eeaa00
color=ffffff,000000
6,0=xDirection:
6,8,4=gI
7,0=xCOG:
7,4,4=gC
7,8=xturn:
7,12,4=gB
############
@GPSdataTFTPortrait
timer=-1,-1,N
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
0,0=xOn-board GPS:
1,0,8=gA
2,0,8=gO
3,0,8=gH
4,0,8=gC
5,0=xGPS vs Sonde:
6,0,8=gD
7,0,8=gI
7,8,8=gB
############
@BatteryTFTPortrait
timer=-1,-1,-1
key1action=+,0,F,W
key2action=>,#,#,#
timeaction=#,#,#
0,0=xBattery status:
0,14=bS
1,0=xBatt:
1,5,5=bVV
2,0,16=bCmA(charging)
3,0,16=bDmA(discharging)
4.4,0=xUSB:
4.4,5,5=bUV
5.4,0,10=bImA
6.4,0=xTemp:
6.4,5,5=bT C

Wyświetl plik

@ -312,14 +312,8 @@ void U8x8Display::drawQS(uint8_t x, uint8_t y, uint8_t len, uint8_t /*size*/, ui
const GFXfont *gfl[] = {
#ifdef ALT9225
&Terminal11x16Font, // 3 (replacement for 1 or 2 with old library)
&Terminal11x16Font, // 4 (replacement for 1 or 2 with old library)
#else
// nobody was using them, so removed with new library
&FreeMono9pt7b, // 3
&FreeMono12pt7b, // 4
#endif
&FreeSans9pt7b, // 5
&FreeSans12pt7b, // 6
&Picopixel, // 7
@ -331,13 +325,8 @@ struct gfxoffset_t {
// first value: offset: max offset from font glyphs (last column * (-1)) (check /, \, `, $)`
// yclear:max height: max of (height in 3rd column) + (yofs + 6th column) (check j)
const struct gfxoffset_t gfxoffsets[]={
#ifdef ALT9225
{ 16, 18},
{ 16, 18},
#else
{ 11, 15 }, // 13+11-9 "j"
{ 15, 20 }, // 19+15-14
#endif
{ 13, 18 }, // 17+13-12 "j"
{ 17, 23 }, // 23+17-17
{ 4, 6}, // 6+4-4
@ -348,55 +337,36 @@ static int ngfx = sizeof(gfl)/sizeof(GFXfont *);
#define TFT_LED 0 // 0 if wired to +5V directly
#define TFT_BRIGHTNESS 100 // Initial brightness of TFT backlight (optional)
#ifdef ALT9225
Arduino_DataBus *bus;
#endif
void ILI9225Display::begin() {
#ifdef ALT9225
Serial.println("ILI9225 init (alt driver)");
bus = new Arduino_ESP32SPI( sonde.config.tft_rs, sonde.config.tft_cs,
sonde.config.oled_scl, sonde.config.oled_sda, -1, HSPI);
tft = new Arduino_ILI9225(bus, sonde.config.oled_rst);
if(_type == 3)
tft = new Arduino_ILI9341(bus, sonde.config.oled_rst);
else
tft = new Arduino_ILI9225(bus, sonde.config.oled_rst);
Serial.println("ILI9225 init (alt driver): done");
tft->begin();
tft->fillScreen(BLACK);
tft->setRotation(sonde.config.tft_orient);
tft->setTextWrap(false);
#else
tft = new MY_ILI9225(sonde.config.oled_rst, sonde.config.tft_rs, sonde.config.tft_cs,
sonde.config.oled_sda, sonde.config.oled_scl, TFT_LED, TFT_BRIGHTNESS);
tft->setModeFlip(sonde.config.tft_modeflip);
tft->begin(spiDisp);
tft->setOrientation(sonde.config.tft_orient);
#endif
}
void ILI9225Display::clear() {
#ifdef ALT9225
tft->fillScreen(0);
#else
tft->clear();
#endif
tft->fillScreen(BLACK);
}
// for now, 0=small=FreeSans9pt7b, 1=large=FreeSans18pt7b
void ILI9225Display::setFont(uint8_t fontindex) {
#ifdef ALT9225
if(fontindex==1 || fontindex==2) { fontindex=3; }
#endif
findex = fontindex;
switch(fontindex) {
#ifdef ALT9225
case 0: tft->setFont(NULL); tft->setTextSize(1); break;
case 1: tft->setFont(NULL); tft->setTextSize(2); break;
case 2: tft->setFont(NULL); tft->setTextSize(2); break;
default: tft->setFont(gfl[fontindex-3]);
#else
case 0: tft->setFont(Terminal6x8); break;
case 1: tft->setFont(Terminal11x16); break;
case 2: tft->setFont(Terminal12x16); break;
default: tft->setGFXFont(gfl[fontindex-3]);
#endif
}
}
@ -418,7 +388,6 @@ void ILI9225Display::getDispSize(uint8_t *height, uint8_t *width, uint8_t *lines
break;
default: // get size from GFX Font
{
#ifdef ALT9225
int16_t x, y;
uint16_t w, h;
tft->getTextBounds("|", 0, 0, &x, &y, &w, &h);
@ -426,13 +395,6 @@ void ILI9225Display::getDispSize(uint8_t *height, uint8_t *width, uint8_t *lines
tft->getTextBounds("A", 0, 0, &x, &y, &w, &h);
if(colskip) *colskip = w+2;
if(lineskip&&colskip) { Serial.printf("skip size from bounds: %d, %d\n", *lineskip, *colskip); }
#else
int16_t w,h,a;
tft->getGFXCharExtent('|',&w,&h,&a);
if(lineskip) *lineskip = h+2;
tft->getGFXCharExtent('A',&w,&h,&a);
if(colskip) *colskip = w+2; // just an approximation
#endif
}
}
}
@ -449,15 +411,10 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
// Standard font
if(findex<3) {
DebugPrintf(DEBUG_DISPLAY, "Simple Text %s at %d,%d [%d]\n", s, x, y, width);
#ifdef ALT9225
// for gpx fonts and new library, cursor is at baseline!!
int h = 6; if(findex>1) h=12;
#else
tft->setBackgroundColor(bg);
int h = tft->getFont().height;
#endif
if( alignright ) {
#ifdef ALT9225
#if 1
//w = tft->getTextWidth(s);
/// TODO
if( width==WIDTH_AUTO ) { width = w; }
@ -476,7 +433,6 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
tft->drawText(x + width - w, y, s, fg);
#endif
} else {
#ifdef ALT9225
tft->setCursor(x, y);
tft->setTextColor(fg, bg);
tft->print(s);
@ -486,25 +442,14 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
//if(curx < x + width) {
// tft->fillRectangle(curx, y, x + width - 1, y + h - 1, bg);
//}
#else
int curx = tft->drawText(x, y, s, fg);
if( width==WIDTH_AUTO ) { return; }
if(curx < x + width) {
tft->fillRectangle(curx, y, x + width - 1, y + h - 1, bg);
}
#endif
}
return;
}
// GFX font
int16_t x1, y1;
if(1||width==WIDTH_AUTO || alignright) {
#ifdef ALT9225
tft->getTextBounds(s, x, y + gfxoffsets[findex-3].yofs, &x1, &y1, (uint16_t *)&w, (uint16_t *)&h);
w += x1 - x + 1;
#else
tft->getGFXTextExtent(s, x, y + gfxoffsets[findex-3].yofs, &w, &h);
#endif
if(width==WIDTH_AUTO) { width=w; }
if(alignright) {
if(w > width) {
@ -530,7 +475,7 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
}
#else
// Text by drawing bitmap.... => less "flicker"
#ifdef ALT9225
#if 1
//TODO
tft->setCursor( alignright? x+width-w : x, y + gfxoffsets[findex-3].yofs);
tft->setTextColor( fg, bg );
@ -571,7 +516,6 @@ void ILI9225Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t wid
}
void ILI9225Display::drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr) {
#ifdef ALT9225
int i,j;
tft->startWrite();
for(i=0; i<cnt*8; i++) {
@ -582,9 +526,6 @@ void ILI9225Display::drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_p
}
}
tft->endWrite();
#else
tft->drawTile(x, y, cnt, tile_ptr);
#endif
#if 0
int i,j;
tft->startWrite();
@ -609,19 +550,11 @@ void ILI9225Display::drawTriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_
}
void ILI9225Display::drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h) {
#ifdef ALT9225
tft->draw16bitRGBBitmap(x1, y1, bitmap, w, h);
#else
tft->drawBitmap(x1, y1, bitmap, w, h);
#endif
}
void ILI9225Display::welcome() {
#ifdef ALT9225
tft->fillScreen(0);
#else
tft->clear();
#endif
setFont(6);
drawString(0, 0*22, version_name, WIDTH_AUTO, 0xff00);
setFont(5);
@ -669,8 +602,9 @@ void ILI9225Display::drawQS(uint8_t x, uint8_t y, uint8_t len, uint8_t size, uin
#define pgm_read_pointer(addr) ((void *)pgm_read_dword(addr))
#ifdef ALT9225
#if 1
#else
// TO BE REMOVED
void MY_ILI9225::drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr) {
int i,j;
startWrite();
@ -731,8 +665,8 @@ RawDisplay *Display::rdis = NULL;
//TODO: maybe merge with initFromFile later?
void Display::init() {
Serial.printf("disptype is %d\n",sonde.config.disptype);
if(sonde.config.disptype==1) {
rdis = new ILI9225Display();
if(sonde.config.disptype==1 || sonde.config.disptype==3) {
rdis = new ILI9225Display(sonde.config.disptype);
} else {
rdis = new U8x8Display(sonde.config.disptype);
}
@ -741,6 +675,8 @@ void Display::init() {
delay(100);
Serial.println("Display initialized");
rdis->clear();
delay(3000);
Serial.println("Cleared");
}
@ -1086,7 +1022,7 @@ void Display::initFromFile(int index) {
char text[61];
n=sscanf(s, "%f,%f,%f", &y, &x, &w);
sscanf(ptr+1, "%60[^\r\n]", text);
if(sonde.config.disptype==1) { x*=xscale; y*=yscale; w*=xscale; }
if(sonde.config.disptype==1 || sonde.config.disptype==3) { x*=xscale; y*=yscale; w*=xscale; }
newlayouts[idx].de[what].x = x;
newlayouts[idx].de[what].y = y;
newlayouts[idx].de[what].width = n>2 ? w : WIDTH_AUTO;
@ -1538,7 +1474,8 @@ void Display::drawGPS(DispEntry *de) {
}
Serial.printf("GPS0: %c%c%c N=%d, A=%d, B=%d\n", circinfo->top, circinfo->arr, circinfo->bul, angN, angA, angB);
// "N" in direction angN
#ifdef ALT9225
#if 1
// TODO
#else
static_cast<ILI9225Display *>(rdis)->tft->drawGFXcharBM(x0 + circinfo->radius*sin(angN*PI/180)-6, y0 - circinfo->radius*cos(angN*PI/180)+7, 'N', 0xffff, bitmap, size, size);
#endif

Wyświetl plik

@ -1,5 +1,3 @@
#define ALT9225
#ifndef Display_h
#define Display_h
@ -7,11 +5,7 @@
#define FONT_SMALL 0
#include <SPI.h>
#ifdef ALT9225
#include <Arduino_GFX_Library.h>
#else
#include <TFT22_ILI9225.h>
#endif
#include <U8x8lib.h>
#include <SPIFFS.h>
@ -81,12 +75,12 @@ public:
class U8x8Display : public RawDisplay {
private:
U8X8 *u8x8 = NULL; // initialize later after reading config file
int _type;
uint8_t _type;
const uint8_t **fontlist;
int nfonts;
public:
U8x8Display(int type = 0) { _type = type; }
U8x8Display(uint8_t type = 0) { _type = type; }
void begin();
void clear();
void setFont(uint8_t fontindex);
@ -100,24 +94,17 @@ public:
void drawQS(uint8_t x, uint8_t y, uint8_t len, uint8_t size, uint8_t *stat, uint16_t fg=0xffff, uint16_t bg=0);
};
#ifdef ALT9225
typedef Arduino_GFX MY_ILI9225;
#else
class MY_ILI9225 : public TFT22_ILI9225 {
using TFT22_ILI9225::TFT22_ILI9225;
public:
uint16_t drawGFXChar(int16_t x, int16_t y, unsigned char c, uint16_t color);
void drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr);
};
#endif
typedef Arduino_GFX MY_ILI9225;
class ILI9225Display : public RawDisplay {
private:
uint8_t yofs=0;
uint8_t findex=0;
uint8_t _type;
public:
MY_ILI9225 *tft = NULL; // initialize later after reading config file
ILI9225Display(int type = 1) { _type = type; }
void begin();
void clear();
void setFont(uint8_t fontindex);