memclear
boot = true
time.setup(2,1)
watchdog 60
tft.cls()
' Internet Research fpr AM Stations
' in /uploads/loadFreq
javascript "loadFreq.js"
html ||
html ||
'html | hidden |
html ||
html ||
lastfreq = 0
dx = 1
f = 95.1
b = 0
rx f
cnt = 0
store = read("store")
if store<>"" then gosub recall else gosub setfreq
cssclass "body","font-family:Consolas"
cssclass "select","width:120px"
cssclass "button","font-family:Consolas"
textbox zeit
cssID htmlID(),"border:none;width:60px"
button "STORE",dostore
button "Station RECALL",recall
textbox store
cssID htmlID(),"width:50px;"
html | - |
button "AM Broadcast Info",ok
checkbox auto
html " Auto
"
'text-align: center; width:640px;color: navy;font-weight: bold;font-style: italic;font-size: 16px;
pwmfreq 32000
pwmout 38,50 'BACKLIGHT 50
name = ""
txt = "RDS Radio Text or AM Broadcast Info"
volume 40
VOL= 40
textbox txt
idt = htmlid()
cssid htmlid(),"width: 600px;border:none;color:navy;font-style: italic;font-weight: bold;"
html " "
textbox f
'onchange setfreq
idy = htmlid()
cssID htmlID(),"border:6px solid silver;width:300px;font-weight:bold;text-align:center;font-size: 72px"
' copy from javascript to radioscript Frequency Info
html ||
textbox name
cssID htmlID(),"border:none;width:450px;text-align:center;font-weight:bold;font-size: 72px"
html |
|
button "-",minus
Button "Set Freq",jump
button "+",plus
html | - |
Button "-",bfoDN
textbox b
'onchange setfreq
cssID htmlID(),"width:66px;font-weight:bold;text-align:center;"
Button "+",bfoUP
Button "Set Bfo",setbfo
html " - "
button "LSB",dolsb
button "-AM-",dossb
button "USB",dousb
html " DX"
checkbox dx
button " SCAN up ",scan
html " - - "
button " Set Vol: ",setvol
slider VOL,0,62
'onchange setvol
html ""
gosub logo
meter rssi,0,75,10,20,32
html " RSSI "
meter snr,0,75,10,20,32
html " SNR "
meter audio,0,1000
html " Audio "
meter wifi,0,100,20,70,100
html " WiFi "
meter accu,26,42,29,37,42
html " Battery "
radio ST
radio TP
radio TA
html ""
fmlist = "88.8 WDR5,95.1 WDR3,96.5 DLF Kultur,99.2 WDR2,101.3 WDR4,102.8 DLF,103.3 Cosmo,104.2 Antenne"
fmitem = "95.1 WDR3"
dropdown fmitem,fmlist
button " Set FM Station",fmset
html | |
amlist = "5955 Veronica,6085 Mi Amigo Int,6160 SWRadio,9670 Channel 292,9700 Romania G,"
amlist = amlist & "11960 Romania,13635 Ankara,15130,15340 Romania,17650 Chn"
amitem = "6160 SWRadio"
dropdown amitem,amlist
button " Set AM Station",amset
html | |
ssblist = "3690l,4955upper Time,5505u Volmet,7200.LSB Ham,4582u RTTY,7645u RTTY,11038u RTTY,14995u Time,10081u HFDL,14075.usb FT8,14230u SSTV"
ssbitem = "14075.usb FT8"
dropdown ssbitem,ssblist
button " Set SSB Station",ssbset
'0x1100
html | |
'fmbwlist = "0 = Auto,1 = 110 kHz,2 = 84 kHz,3 = 60 kHz,4 = 40 kHz"
'fmbwitem = "0 = Auto"
'dropdown fmbwitem,fmbwlist
'button " Set BW FM",fmbwset
'html | |
ambwlist = "0 = 6 kHz,1 = 4 kHz,2 = 3 kHz,3 = 2 kHz,4 = 1 kHz,5 = 1.8 kHz,6 = 2.5 kHz"
ambwitem = "2 = 3 kHz"
dropdown ambwitem,ambwlist
button " Set BW AM",ambwset
html | |
liste ="0 = 1.2 kHz,1 = 2.2 kHz,2 = 3.0 kHz,3 = 4.0 kHz,4 = 0.5 kHz,5 = 1.0 kHz"
item = "0 = 1.2 kHz"
dropdown item,liste,6
Button " Set BW SSB",[listset]
html | |
' setup html elemet page 3000 ms
timer 3000,tim
boot = false
WAIT
' Station Info Online
ok:
gosub stationinfo
wait
autoinfo:
if auto == 0 then return
if rx.am()==0 then return
if lastfreq == rx.freq() then return
stationinfo:
jscall "s2d()"
jscall "loadFrequency()"
delay 2000
jscall "s2d2()"
lastfreq = rx.freq()
return
fmbwset:
bw = 0x1102
value = val(word(fmbwitem,1))
rx.set(bw,value)
wait
ambwset:
poke val("0x3102"),val(word(ambwitem,1))
wait
[listset]
poke val("0x0101"),(val("0x9010")+val(word(item,1))) 'bit 0:3
wait
fmset:
f = val(word(fmitem,1))
gosub setfreq
name = mid(fmitem,instr(fmitem, word(fmitem,2)))
wait
amset:
f = val(word(amitem,1))
am
gosub setfreq
name = mid(amitem,instr(amitem, word(amitem,2)))
wait
ssbset:
s = upper(word(ssbitem,1))
f = val(s)
gosub setfreq
name = mid(ssbitem,instr(ssbitem, word(ssbitem,2)))
if instr(s,"U")>0 then usb
if instr(s,"L")>0 then lsb
wait
dostore:
fs = " usb=%1.0f lsb=%1.0f am=%1.0f ssb=%1.0f"
store = rx.freq() & " " & b & format(fs,rx.usb(),rx.lsb(),rx.am(),rx.ssb())
write("store",store)
wait
recall:
f = val(word(store,1))
b = val(word(store,2))
gosub setfreq
isam = (instr(store,"am=1")>0)
isssb = (instr(store,"ssb=1")>0)
islsb = (instr(store,"lsb=1")>0)
isusb = (instr(store,"usb=1")>0)
if islsb and isssb then lsb
if isusb and isssb then usb
if boot then return else wait
dossb:
pinout 10,0
am
pinout 10,1
wait
dousb:
If rx.AM()<>0 then usb
wait
dolsb:
If rx.AM()<>0 then lsb
wait
bfoDN:
b = b-10
bfo b
wait
bfoUP:
b = b+10
bfo b
wait
setbfo:
bfo b
wait
setvol:
volume VOL
wait
jump:
gosub setfreq
wait
tim:
watchdog
'tft.circle.fill(320-10,12,3,(cnt%2)*63488)
inc cnt
tft.text.draw(time("time"),320-50,11,2)
'tty "."
if rx.fm()>0 then
n = rx.station()
if n<>"" then name = trim(n)
n = rx.text()
if n<>"" then txt = trim(n)
endif
zeit = time("time")
rssi = rx.rssi()
snr=rx.snr()
wifi = map(wifi.rssi(), -90, -30, 0, 100)
audio = io(adc,11)
accu = io(adc,4)/1023*66
'gosub wifistatus
ST = rx.stereo()
TP = rx.tp()
TA = TP and rx.ta()
' running interval min 700?
watchdog
gosub wifistatus
gosub autoinfo
timer 1000,tim
wait
'#define AMP_EN 10
setfreq:
watchdog
if (rx.am()==1 and f<109) or (rx.fm()==1 and f>109) then pinout 10,0
freq f
pinout 10,1
name=""
txt=""
goto drawfreq
[drawfreq]
sf = format(" %5.0f ",rx.freq())
if f<109 then sf = format(" %5.1f ",rx.freq())
'sf = left(sf,5)
tft.text.datum(4)
tft.text.color(65535,0)
tft.text.draw(sf,160,60,7)
return
scan:
'timercb 0
if f>109 then start = f+5 else start = f + 0.1
if f>109 then stp = 5 else stp = 0.1
f = start
do
dsnr = 12
if dx<>0 then dnsr = 0
gosub setfreq
snr = rx.snr()
rssi = rx.rssi()
if snr>dnsr then wait
f = f + stp
if rx.fm()<>0 and f>108 then
stp = 5
f = 150
endif
loop until f >=30000
wait
plus:
if (rx.am()<>0 and rx.ssb()==0) then f = f + 5
if rx.fm()<>0 then f = f + 0.1
if rx.ssb()<>0 then f = f + 1
gosub setfreq
wait
minus:
if (rx.am()<>0 and rx.ssb()==0) then f = f - 5
if rx.fm()<>0 then f = f - 0.1
if rx.ssb()<>0 then f = f - 1
gosub setfreq
wait
wifistatus:
'REBOOT ON DISCONNECT
if status()<>3 then reboot
tft.text.cursor(4,4)
tft.print(str(status()))
return
logo:
html |