TITLEBAR "Avionics"
html ""
' ---------------------------------------
' Backend communications
' ---------------------------------------
html "
"
' ---------------------------------------
' Timer routine
' ---------------------------------------
html "
"
bf$ = "" ' Bold font
bfr$ = ""
bf2$ = ""
yourDir$ = "../avionics_project/" ' need your directory
html "
"
html "
"
html "
"
sqliteconnect #sql, "avionics.db" ' Connect to the DB
sql$ = "SELECT
pin, loc, name,
yellowLo, amberLo, redLo, yellowVoiceLo, amberVoiceLo, redVoiceLo,
yellowHi, amberHi, redHi, yellowVoiceHi, amberVoiceHi, redVoiceHi,
pcnt, show
FROM gauge ORDER BY loc"
#sql execute(sql$)
WHILE #sql hasanswer()
result$ = #sql nextrow$(" |")
pin = val(word$(result$,1,"|"))
loc = val(word$(result$,2,"|"))
name$ = trim$(word$(result$,3,"|"))
yellowLo = val(word$(result$,4,"|"))
amberLo = val(word$(result$,5,"|"))
redLo = val(word$(result$,6,"|"))
yellowVoiceLo$ = trim$(word$(result$,7,"|"))
amberVoiceLo$ = trim$(word$(result$,8,"|"))
redVoiceLo$ = trim$(word$(result$,9,"|"))
yellowHi = val(word$(result$,10,"|"))
amberHi = val(word$(result$,11,"|"))
redHi = val(word$(result$,12,"|"))
yellowVoiceHi$ = trim$(word$(result$,13,"|"))
amberVoiceHi$ = trim$(word$(result$,14,"|"))
redVoiceHi$ = trim$(word$(result$,15,"|"))
pcnt$ = trim$(word$(result$,16,"|"))
show$ = trim$(word$(result$,17,"|"))
' instrument value
if loc and 1 then
html "
"
else
html "
"
end if
html "
";loc;"
"
html "
";bf$;name$;"
" ' Instrument Name
html "
" ' Instrument Graph
calc$ = ""
for i = 1 to 31
pct$ = trim$(word$(pcnt$,i,":"))
if pct$ = ":" or pct$ = "" then exit for
sho$ = word$(show$,i,":")
calc$ = calc$ + pct$ + ":" + sho$ + ":"
next i
i = i - 1
pass$ = pass$ ; pin;",";yellowLo;",";amberLo;",";redLo;",";yellowHi;",";amberHi;",";redHi;",";i;",";calc$;",";"]"
WEND
html "
"
'
' Tilt Display
'
html "
"
html "
"
for i = 0 to 60
ii$ = using("##",i)
html ""
next i
'
' Pass Parameters (hidden)
'
html "" ' pass data to backend
' ----------------------------------------------
' Compass Display
' ----------------------------------------------
heading = 0 ' make heading 0 degrees North
html "
"
html "
"
html "0 degrees North"
html "
"
html "
"
html "
"
ii = heading + 18
for i = ii to ii + 36
deg = i
if deg > 35 then deg = deg - 36
if deg > 35 then deg = deg - 36
d$ = ""
if deg = 0 then d$ = "N"
if deg = 9 then d$ = "E"
if deg = 18 then d$ = "S"
if deg = 27 then d$ = "W"
html "
";d$;"
"
next i
html "
"
for i = ii to ii + 36
if int(i / 3) * 3 = i then
deg = i
if deg > 35 then deg = deg - 36
if deg > 35 then deg = deg - 36
html "
";deg;"
"
else
html "
|
"
end if
next i
html "
"
' --------------- end compass
html "
"
'
' Time Display
'
html "
"
html "
"
html "
"
'
' Time stamp milliseconds
'
html "
"
html "
"
html ""
html "
"
'
' Buttons
'
html "
"
html "
"
html ""
html "
"
html ""
html "
"
html ""
html "
"
'
' info
'
html "
"
html "
"
for i = 1 to 16
html "
"
next i
html "
"
function repeat$(str$,num)
for i = 1 to num
repeat$ = repeat$ + str$
next i
end function
end