-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpsMenu.spin
228 lines (211 loc) · 5.18 KB
/
gpsMenu.spin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
CON
_clkmode=xtal1+pll16x
_xinfreq=5_000_000
single = 0
track = 1
save = 2
google = 3
obj
SC : "Screen"
TC : "trackBallEx"
GPS : "gps"
SN : "Simple_Numbers"
var
long currentItem
pub main| canExit,frame, retVal
frame:=0
SC.Init
SC.Clear
SC.TxtColor($FF,$E0)
SC.Position(4,4)
SC.Print(string("Single"))
SC.Position(4,14)
SC.Print(string("Track"))
SC.Position(8,4)
SC.Print(string("Save"))
SC.Position(8,14)
SC.Print(string("Google"))
SC.DrawRec(70,45,25,25,$F8,$00)
currentItem:=single
canExit:=false
TC.Run
if TC.isPressed == true
repeat until TC.isPressed==false
TC.Run
repeat until canExit==true
TC.Run
if TC.isRight ==true
SC.Click
ClearCurrent
case currentItem
single: currentItem:=track
save: currentItem:=google
'draw currentItem
DrawItem
if TC.isLeft == true
SC.Click
ClearCurrent
case currentItem
track: currentItem:=single
google: currentItem:=save
DrawItem
if TC.isDown ==true
SC.Click
ClearCurrent
case currentItem
single: currentItem:=save
track: currentItem:=google
'draw currentItem
DrawItem
if TC.isUp ==true
SC.Click
ClearCurrent
case currentItem
save: currentItem:=single
google: currentItem:=track
'draw currentItem
DrawItem
if TC.isPressed == true
TC.Run
repeat until TC.isPressed==false
'do nothing
TC.Run
case currentItem
single:
GPS.Init
SC.SetByteAddr($00,$00,$00,$00)
retVal:=GPS.PlaySpinnerWhileLocking(500)
if retVal == -1
return
SC.FadeIn
SC.Clear
Print
GPS.Kill
TC.WaitForBtnPress
return
save:
GPS.Init
SC.FadeOut
repeat until GPS.SatCount=>3
'Do nothing
TC.Run
if TC.isPressed ==true
GPS.Kill
return
SC.FadeIn
SC.Clear
'prepare card
SC.MediaInit
SC.SetByteAddr($00,$00,$00,$00)
SC.ShowFrame(15)
SC.Clear
SC.SetSectorGPS
Print
'Save that mother
SaveData
SC.Flush
GPS.Kill
track:
SC.MediaInit
SC.SetByteAddr($00,$00,$00,$00)
GPS.Init
'wait for connection
retVal:=GPS.PlaySpinnerWhileLocking(250)
if retVal==-1
SC.On
SC.Clear
SC.Print(string("Aborted"))
GPS.Kill
repeat 2
waitcnt(clkfreq+cnt)
return
SC.SetSectorGPSMap
SC.FadeOut
'save coords
TC.Run
repeat until TC.isPressed==true
repeat until GPS.SatCount => 3
TC.Run
if TC.isPressed==true
return
SaveData
GPS.Kill
repeat 60
TC.Run
if TC.isPressed==true
quit
waitcnt(clkfreq+cnt)
TC.Run
if TC.isPressed==true
quit
GPS.Init
waitcnt(clkfreq+cnt)
waitcnt(clkfreq+cnt)'ensure that pulled data is current
SC.Flush
GPS.Kill
SC.FadeIn
SC.Clear
SC.Print(string("Coordinates Saved"))
repeat 2
waitcnt(clkfreq+cnt)
google:
GPS.Init
'SC.Print(SN.dec(GPS.SatCount))
SC.Clear
SC.Print(string("Warning, not accurate"))
SC.Position(1,0)
SC.Print(string("might put you"))
SC.Position(2,0)
SC.Print(string("in the right city"))
SC.Position(0,0)
waitcnt(clkfreq+cnt)
waitcnt(clkfreq+cnt)
SC.Clear
SC.SetByteAddr($00,$00,$00,$00)
retVal:=gps.PlaySpinnerWhileLocking(250)
if retVal==-1
return
SC.FadeIn
SC.Clear
repeat until gps.isDataValid == true
TC.Run
if TC.isPressed==true
return
GPS.PrintStdLat
SC.Position(1,0)
GPS.PrintStdLong
GPS.Kill
TC.WaitForBtnPress
canExit:=true
pri SaveData
repeat until gps.isDataValid == true
'do nothing
SC.SaveStr(string("$Lat:"))
SC.SaveStr(GPS.Latitude)
SC.SaveStr(GPS.NS)
SC.SaveStr(string("$Lon:"))
SC.SaveStr(GPS.Longitude)
SC.SaveStr(GPS.EW)
SC.SaveStr(string("$Alt:"))
SC.SaveStr(GPS.PrintAlt)
SC.SoundNotifiy
pri Print
repeat until gps.isDataValid == true
'do nothing
SC.Print(GPS.Latitude)
SC.Print(GPS.NS)
SC.Position(1,0)
SC.Print(GPS.Longitude)
SC.Print(GPS.EW)
pri DrawItem
case currentItem
single: SC.DrawRec(70,45,25,25,$F8,$00)
track: SC.DrawRec(140,45,90,25,$F8,$00)
save: SC.DrawRec(70,80,25,60,$F8,$00)
google: SC.DrawRec(157,77,90,55,$F8,$00)
pri ClearCurrent
case currentItem
single: SC.DrawRec(70,45,25,25,$00,$00)
track: SC.DrawRec(140,45,90,25,$00,$00)
save: SC.DrawRec(70,80,25,60,$00,$00)
google: SC.DrawRec(157,77,90,55,$00,$00)