annotate code_part1/OSTC_code_asm_part1/menu.asm @ 1:210410f7c1b4

clean up
author heinrichsweikamp
date Tue, 12 Jan 2010 16:07:28 +0100
parents 96a35aeda5f2
children 588a969a0cae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; Main Menu and Setup menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
21 ; written: 11/1/05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; last updated: 05/15/80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 wait_switches:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 ; bsf LEDg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 movlw d'40'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 btfss button_delay_done ; Start counting?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 movlw d'200'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31 movwf switch_timeout
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 wait_switches1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 WAITMS d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 btfsc SWITCH2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36 bra wait_switches2 ; Check other switch
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 decfsz switch_timeout,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 bra wait_switches1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 btfsc SWITCH2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 bra wait_switches3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 bsf button_delay_done ; Start counting
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 bsf switch_left ; Set button flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 bcf switch_right ; only for the other button
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 ; bcf LEDg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 wait_switches2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 btfss SWITCH1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 bra wait_switches1 ; Wait
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 ; Yes, both switches released before timeout...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 wait_switches3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58 bcf button_delay_done
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 call clear_LEDg
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 bcf deco_mode_changed ; Clear flag (Description is only showed once)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 menu2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74 bsf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 bsf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 call PLED_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
81 menu_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82 call check_switches_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
85 bra do_menu ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
86
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 btfss menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
88 goto restart ; exit menu, restart
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
90 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
96 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
97 call test_charger ; check if charger IC is active
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
100 call get_battery_voltage ; get battery voltage
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
101
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102 bcf onesecupdate ; End of one second tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 goto restart
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 goto restart ; exit menu, restart and enter divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 bra menu_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 check_switches_menu: ; checks switches
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 btfss switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 bra check_switches_menu2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 bsf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 movlw d'6'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 cpfsgt menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 bra refresh_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 bra refresh_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 check_switches_menu2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 btfsc switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 bsf menubit2 ; Enter!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 do_menu: ; calls submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
131 goto menu_logbook
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 goto menu_gassetup
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
134 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 goto menu_reset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137 goto setup_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
138 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 goto more_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 goto restart ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 refresh_cursor:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 btfsc cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
149
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
150 more_menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 more_menu2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 more_menu3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
157 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 bsf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 bsf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 call PLED_more_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
164 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
165 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
167 more_menu_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
168 call check_switches_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
169
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
170 movlw d'5' ; 5 items in "More Menu"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
171 cpfseq menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
172 bra more_menu_loop2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
173 movlw d'6'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
174 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
175 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
176
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
177 more_menu_loop2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
178 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
179 bra do_more_menu ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
180
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
181 btfss menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182 bra menu ; exit setup menu and return to main menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
185 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 call test_charger ; check if charger IC is active
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 call get_battery_voltage ; get battery voltage
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
196 bcf onesecupdate ; End of one second tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
197
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
198 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
199 bra menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
200
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
201 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
202 goto restart ; exit menu, restart and enter divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
203
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
204 bra more_menu_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
205
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
206 do_more_menu: ; calls submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
207 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
208 goto menu_settime
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
209 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
210 goto menu_const_ppO2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
211 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
212 goto menu_battery_state
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
213 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
214 goto menu_simulator
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
215 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
216 goto menu_simulator
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
217 movlw d'5'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
218 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
219 bra menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
220
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
221 setup_menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
222 bcf deco_mode_changed ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
223 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
224 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
225 setup_menu2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
226 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
227 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
228 call PLED_setup_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
229 setup_menu3a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
230 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
231 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
232 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
233 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
234 bsf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
235 bsf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
236 call show_decotype
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
237 call show_salinity_value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
238 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
239 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
240 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
241
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
242 setup_menu_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
243 call check_switches_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
244
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
245 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
246 bra do_setup_menu ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
247
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
248 btfss menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
249 goto restart ; exit menu, restart and enter surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
250 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
251 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
252 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
253 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
254 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
255 call test_charger ; check if charger IC is active
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
256 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
257 call get_battery_voltage ; get battery voltage
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
258
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
259 bcf onesecupdate ; End of one second tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
260
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
261 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
262 goto restart ; exit menu, restart and enter surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
263
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
264 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
265 goto restart ; exit menu, restart and enter divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
266
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
267 bra setup_menu_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
268
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
269
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
270 do_setup_menu: ; calls submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
271 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
272 goto menu_custom_functions
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
273 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
274 goto menu_custom_functions_page2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
275 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
276 bra toggle_salinity
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
277 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
278 bra toggle_decotype
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
279 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
280 bra more_setup_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
281 bra exit_setup_menu ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
283 toggle_decotype:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
284 bsf deco_mode_changed ; Set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
285 read_int_eeprom d'34' ; Read deco data
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
286 incf EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
288 toggle_decotype0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
289 movlw d'6' ; number of different modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
290 cpfseq EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
291 bra toggle_decotype1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
292 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
293
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
294 toggle_decotype1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295 call write_eeprom ; save new mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
296 movlw d'4'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
297 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
298 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
299 bra setup_menu3a ; return to manu loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
300
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
301 show_decotype:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302 read_int_eeprom d'34' ; Read deco data
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
303 tstfsz EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
304 bra show_decotype2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
305 DISPLAYTEXT .101 ; ZH-L16 OC =0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
306 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
307 show_decotype2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
308 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
309 bra show_decotype3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310 DISPLAYTEXT .102 ; Gauge =1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
311 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
312 show_decotype3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
313 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
314 bra show_decotype4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
315 DISPLAYTEXT .104 ; ZH-L16 CC =2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 show_decotype4:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
318 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
319 bra show_decotype5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
320 DISPLAYTEXT .138 ; Apnoe =3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
321 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
322 show_decotype5:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
323 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
324 bra show_decotype6
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
325 DISPLAYTEXT .152 ; L16-GF OC =4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
326 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327 show_decotype6:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
328 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
329 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 DISPLAYTEXT .236 ; L16-GF CC =5
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
332
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
333 exit_setup_menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334 btfss deco_mode_changed ; Was the decomode changed in Setup menu?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
335 goto restart ; No, restart to surfacemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
336
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
337 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 deco_info_screen1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
340 call PLED_topline_box
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341 WIN_INVERT .1 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 DISPLAYTEXT .235 ;Decomode changed!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
343 WIN_INVERT .0 ; Init new Wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 read_int_eeprom d'34' ; Read deco data
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
347 movlw d'7' ; length of description text
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 mulwf EEDATA ; Multiply with Decomode 0-5 (5=Spare)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
350 movf PRODL,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351 addlw d'193' ; Description text offset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
352 movwf menupos ; Used as loop counter temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
354 movlw d'7'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 movwf temp1 ; Loop 7 times
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
357 menu0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
358 movf menupos,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359 call displaytext1 ; Display text!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360 incf menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
361
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
362 decfsz temp1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363 bra menu0 ; loop 7 times
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 movlw d'30'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 call startup_screen3a
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
367 goto restart ; Restart to surfacemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
368
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369 more_setup_menu:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
372 more_setup_menu2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 call PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
375 call PLED_more_setup_menu_mask
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376 more_setup_menu3a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377 clrf timeout_counter2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 bcf sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 bcf menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380 bcf menubit3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 bsf menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
382 bsf cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383 call show_debugstate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 call show_dateformat
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
386 bcf switch_left
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 more_setup_menu_loop:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
390 call check_switches_menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 movlw d'3' ; x-1 menu entries
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 cpfseq menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394 bra more_setup_menu_loop2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
395 movlw d'6'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
397 call PLED_menu_cursor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
398 more_setup_menu_loop2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
399
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
400 btfsc menubit2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
401 bra do_more_setup_menu ; call submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
402
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
403 btfss menubit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
404 goto restart ; exit menu, restart and enter surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
405
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407 call timeout_surfmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
408 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 call set_dive_modes
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
411 call test_charger ; check if charger IC is active
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
412 btfsc onesecupdate
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
413 call get_battery_voltage ; get battery voltage
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
414
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
415 bcf onesecupdate ; End of one second tasks
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
416
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
417 btfsc sleepmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
418 goto setup_menu ; exit menu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
419
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
420 btfsc divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
421 goto restart ; exit menu, restart and enter divemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
422
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
423 bra more_setup_menu_loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425 do_more_setup_menu: ; calls submenu
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
426 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
427 bra toggle_datemode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
428 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
429 bra toggle_debugmode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
430 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
431 bra setup_menu ; spare
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
432 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
433 bra setup_menu ; spare
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
434 dcfsnz menupos,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
435 bra setup_menu ; spare
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
436 movlw d'5' ; set cursor to "More again"
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
437 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
438 bra setup_menu2 ; exit...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
439
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
440 toggle_salinity:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
441 ; Toggles between 1.00 and 1.04
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
442 read_int_eeprom d'26' ; Read Salinity from EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
443 incf EEDATA,F ; Increase value
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
444
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
445 movlw d'99' ; 99% ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
446 cpfsgt EEDATA ; Salinity lower limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
447 bra toggle_salinity_reset ; Out of limit, reset value to 1.00
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
448 movlw d'105' ; 105% ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
449 cpfslt EEDATA ; Salinity higher limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
450 bra toggle_salinity_reset ; Out of limit, reset value to 1.00
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
451
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
452 toggle_salinity2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
453 write_int_eeprom d'26' ; Store salinity
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
454 movlw d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
455 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
456 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
457 bra setup_menu3a ; return to manu loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
458
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
459 toggle_salinity_reset:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
460 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
461 movwf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
462 bra toggle_salinity2 ; back
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
463
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
464 show_salinity_value:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
465 read_int_eeprom d'26' ; Read Salinity from EEPROM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
466 movlw d'99' ; 99% ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467 cpfsgt EEDATA ; Salinity lower limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468 rcall toggle_salinity_reset2 ; Reset before display!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 movlw d'105' ; 105% ?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
470 cpfslt EEDATA ; Salinity higher limit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471 rcall toggle_salinity_reset2 ; Reset before display!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
472 WIN_TOP .95
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
473 WIN_LEFT .83
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
474 WIN_FONT FT_SMALL
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 lfsr FSR2,letter
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 movff EEDATA,lo
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
477 clrf hi
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 bsf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
479 output_16dp d'3'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480 bcf leftbind
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481 movlw 'k'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
483 movlw 'g'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 movlw '/'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
487 movlw 'l'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
488 movwf POSTINC2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
489 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
490 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
492 toggle_salinity_reset2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
493 movlw d'100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
494 movwf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
495 write_int_eeprom d'26' ; Store salinity
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
496 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
497
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
498 toggle_datemode:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
499 ; Toggles setting for
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
500 ; MM/DD/YY =0, Default
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
501 ; DD/MM/YY =1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
502 ; YY/MM/DD =2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
503 read_int_eeprom d'91' ; Read date format
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
504 incf EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
505 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
506 cpfsgt EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 bra toggle_datemode1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
508 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509 toggle_datemode1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
510 write_int_eeprom d'91' ; Store date format
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
511 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
512 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
513 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
514 bra more_setup_menu3a ; return to manu loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
515
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
516 show_dateformat:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
517 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
518 tstfsz EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
519 bra show_dateformat2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
520 DISPLAYTEXTH .259 ; MM/DD/YY = 0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
521 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
522 show_dateformat2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
523 decfsz EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
524 bra show_dateformat3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
525 DISPLAYTEXTH .260 ; DD/MM/YY = 1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
526 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
527 show_dateformat3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
528 DISPLAYTEXTH .261 ; YY/MM/DD = 2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
529 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
530
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
531 toggle_debugmode:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
532 read_int_eeprom d'39' ; Read status
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
533 incf EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
534 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
535 cpfsgt EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
536 bra toggle_debugmode1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
537 clrf EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
538 toggle_debugmode1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
539 write_int_eeprom d'39' ; Store status
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
540 bsf debug_mode ; set flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
541 movlw d'1'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
542 cpfseq EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
543 bcf debug_mode ; clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544 movlw d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 movwf menupos
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 bcf switch_right
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547 bra more_setup_menu3a ; return to manu loop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549 show_debugstate:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550 read_int_eeprom d'39'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551 tstfsz EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
552 bra show_debugstate2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
553 DISPLAYTEXT .131 ; OFF
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
554 show_debugstate2:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 decf EEDATA,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
556 tstfsz EEDATA
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 bra show_decotype3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558 DISPLAYTEXT .130 ; ON
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 return