Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 161:99065ef2d18e
skip fallback warning in OC modes
author | heinrichsweikamp |
---|---|
date | Tue, 09 Sep 2014 16:50:29 +0200 |
parents | 5f71e31bd5b3 |
children | 932e91074bdb |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File menu_tree.asm | |
4 ; | |
5 ; OSTC3 menus | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-11 : [jDG] Creation. | |
11 | |
12 #include "ostc3.inc" ; Mandatory header | |
13 #include "gaslist.inc" | |
14 #include "menu_processor.inc" | |
15 #include "start.inc" | |
16 #include "comm.inc" | |
17 #include "logbook.inc" | |
18 #include "tft.inc" | |
19 #include "eeprom_rs232.inc" | |
20 #include "external_flash.inc" | |
21 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
22 #include "isr.inc" | |
23 #include "ghostwriter.inc" | |
24 #include "adc_lightsensor.inc" | |
25 | |
26 gui CODE | |
27 ;============================================================================= | |
28 ; Main Menu | |
66
00636132cca6
BUGFIX: Maintain last selected customview in surface mode
heinrichsweikamp
parents:
64
diff
changeset
|
29 global do_main_menu,do_main_menu2 |
0 | 30 do_main_menu: |
39
e4e91fe8b09d
remember last customview in dive and surface mode
mh@mh-THINK.fritz.box
parents:
23
diff
changeset
|
31 movff menupos3,customview_surfmode; save last customview |
66
00636132cca6
BUGFIX: Maintain last selected customview in surface mode
heinrichsweikamp
parents:
64
diff
changeset
|
32 do_main_menu2: |
0 | 33 bcf sleepmode ; for timeout |
34 call menu_processor_reset ; restart from first icon. | |
35 | |
36 do_continue_main_menu: | |
37 call menu_processor_pop ; drop exit line. | |
38 call menu_processor_pop ; back to last icon. | |
39 | |
40 extern do_demo_divemode, restart | |
41 MENU_BEGIN tMainMenu, .7 | |
42 MENU_CALL tLogbook, logbook | |
43 MENU_CALL tGasSetup, do_gas_menu | |
44 MENU_CALL tCCRSetup, do_ccr_menu | |
45 MENU_CALL tPlan, do_planner_menu_reset | |
46 MENU_CALL tDiveModeMenu, do_divemode_menu | |
47 MENU_CALL tSystSets, do_settings_menu | |
48 MENU_CALL tExit, restart | |
49 MENU_END | |
50 | |
51 do_info_menu: | |
62 | 52 MENU_BEGIN tInfoMenu, .5 |
0 | 53 MENU_DYNAMIC info_menu_serial, 0 |
54 MENU_DYNAMIC info_menu_firmware, 0 | |
55 MENU_DYNAMIC info_menu_total_dives, 0 | |
62 | 56 MENU_DYNAMIC info_menu_battery_volts,0 |
0 | 57 MENU_CALL tExit, do_return_settings |
58 MENU_END | |
59 | |
60 ;============================================================================= | |
61 ; CCR Setup | |
62 | |
63 return_ccr_menu: | |
64 call menu_processor_pop ; drop exit line. | |
65 call menu_processor_pop ; back to last gas. | |
66 | |
67 do_ccr_menu: | |
113 | 68 bcf menu_show_sensors ; Clear flag |
69 bcf menu_show_sensors2 ; Clear flag | |
70 MENU_BEGIN tCCRSetup, .6 | |
0 | 71 MENU_OPTION tCCRMode, oCCRMode, 0 |
72 MENU_CALL tCCRSensor, do_ccr_sensor | |
113 | 73 MENU_CALL tCalibrateMenu, do_calibrate_menu |
0 | 74 MENU_CALL tDiluentSetup, do_diluent_setup |
75 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
76 MENU_CALL tExit, do_continue_main_menu | |
77 MENU_END | |
78 | |
113 | 79 do_calibrate_menu: |
80 btfss c3_hardware | |
81 bra return_ccr_menu ; Not for normal OSTC3 hardware | |
82 call enable_ir ; Enable IR-Port | |
83 bsf menu_show_sensors2 ; Set flag | |
84 do_calibrate_menu2: | |
85 MENU_BEGIN tCalibrateMenu, .6 | |
86 MENU_CALL tDiveHudMask1, 0 | |
87 MENU_CALL tDiveHudMask2, 0 | |
88 MENU_CALL tDiveHudMask3, 0 | |
89 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | |
90 MENU_CALL tCalibrate, do_calibrate_mix | |
91 MENU_CALL tExit, return_ccr_menu | |
92 MENU_END | |
93 | |
94 do_calibrate_mix: | |
95 extern calibrate_mix | |
96 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected | |
97 goto restart ; Restart into surface mode | |
98 | |
0 | 99 do_ccr_sensor: |
100 call enable_ir ; Enable IR-Port | |
101 bsf menu_show_sensors ; Set flag | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
144
diff
changeset
|
102 MENU_BEGIN tCCRSensor, .5 |
0 | 103 MENU_CALL tDiveHudMask1, 0 |
104 MENU_CALL tDiveHudMask2, 0 | |
105 MENU_CALL tDiveHudMask3, 0 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
144
diff
changeset
|
106 MENU_OPTION tSensorFallback,oSensorFallback, 0 |
0 | 107 MENU_CALL tExit, return_ccr_menu |
108 MENU_END | |
109 | |
110 do_diluent_setup: | |
111 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
139 | 112 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
0 | 113 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
114 MENU_BEGIN tDiluentSetup, .6 | |
115 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
116 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
117 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
118 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
119 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
120 MENU_CALL tExit, return_ccr_menu | |
121 MENU_END | |
122 | |
123 do_return_fixed_setpoints: | |
124 call menu_processor_pop ; drop exit line. | |
125 call menu_processor_pop ; back to last gas. | |
126 | |
127 do_fixed_setpoints: | |
139 | 128 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
0 | 129 MENU_BEGIN tFixedSetpoints, .6 |
130 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
131 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
132 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
133 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
134 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
135 MENU_CALL tExit, return_ccr_menu | |
136 MENU_END | |
137 | |
138 do_edit_sp_menu: | |
139 call gaslist_setSP ; Save current item. | |
140 MENU_BEGIN tFixedSetpoints, .5 | |
141 MENU_DYNAMIC gaslist_strcat_setpoint_0,0 | |
142 MENU_CALL tSPPlus, gaslist_spplus | |
143 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
144 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
145 MENU_CALL tExit, do_return_fixed_setpoints | |
146 MENU_END | |
147 | |
148 ;============================================================================= | |
149 ; OC Gas Setup | |
150 | |
151 return_gas_menu: | |
152 call menu_processor_pop ; drop exit line. | |
153 call menu_processor_pop ; back to last gas. | |
154 | |
155 btfsc ccr_diluent_setup ; Return to CCR-Menu? | |
156 bra do_diluent_setup ; Yes. | |
157 do_gas_menu: | |
158 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
139 | 159 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
0 | 160 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
161 MENU_BEGIN tGaslist, .6 | |
162 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
163 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
164 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
165 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
166 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
167 MENU_CALL tExit, do_continue_main_menu | |
168 MENU_END | |
169 | |
170 return_gas_depth: | |
171 call menu_processor_pop ; drop exit line. | |
172 call menu_processor_pop ; back to last gas. | |
173 bra do_edit_gas_menu_1 | |
174 | |
175 do_edit_gas_menu: | |
176 call gaslist_setgas ; Save current item. | |
177 do_edit_gas_menu_1: ; Keep current gas. | |
178 MENU_BEGIN tGasEdit, .6 | |
179 MENU_DYNAMIC gaslist_gastitle, 0 | |
180 MENU_DYNAMIC gaslist_MOD_END, 0 | |
181 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | |
182 MENU_CALL tSetup_mix, do_setup_mix | |
183 MENU_CALL tGasDepth, do_gas_depth_menu | |
184 MENU_CALL tExit, return_gas_menu | |
185 MENU_END | |
186 | |
187 do_setup_mix: | |
188 MENU_BEGIN tGasEdit, .7 | |
189 MENU_DYNAMIC gaslist_gastitle, 0 | |
190 MENU_DYNAMIC gaslist_MOD_END, 0 | |
191 MENU_CALL tO2Plus, gaslist_pO2 | |
192 MENU_CALL tO2Minus, gaslist_mO2 | |
193 MENU_CALL tHePlus, gaslist_pHe | |
194 MENU_CALL tHeMinus, gaslist_mHe | |
195 MENU_CALL tExit, return_gas_depth | |
196 MENU_END | |
197 | |
198 global do_gas_depth_menu | |
199 do_gas_depth_menu: | |
154
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
148
diff
changeset
|
200 MENU_BEGIN tGasEdit, .7 |
0 | 201 MENU_DYNAMIC gaslist_gastitle, 0 |
202 MENU_DYNAMIC gaslist_MOD_END, 0 | |
154
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
148
diff
changeset
|
203 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth |
0 | 204 MENU_CALL tDepthPlus, gaslist_pDepth |
205 MENU_CALL tDepthMinus, gaslist_mDepth | |
206 MENU_DYNAMIC gaslist_reset_mod_title,gaslist_reset_mod | |
207 MENU_CALL tExit, return_gas_depth | |
208 MENU_END | |
209 | |
210 ;============================================================================= | |
211 ; Simulator menus | |
212 | |
213 global do_planner_menu | |
214 | |
215 do_planner_menu_reset: | |
216 extern option_save_all | |
217 call option_save_all | |
218 ;---- Reset dive time/depth to default values | |
219 extern option_reset | |
220 lfsr FSR0,odiveInterval | |
221 call option_reset | |
222 lfsr FSR0,obottomTime | |
223 call option_reset | |
224 lfsr FSR0,obottomDepth | |
225 call option_reset | |
226 | |
227 do_planner_menu: | |
228 extern do_demo_planner | |
229 MENU_BEGIN tPlan, .6 | |
230 MENU_CALL tInter, do_demo_divemode | |
231 MENU_OPTION tIntvl, odiveInterval, 0 | |
232 MENU_OPTION tBtTm, obottomTime, 0 | |
233 MENU_OPTION tMxDep, obottomDepth, 0 | |
234 MENU_CALL tDeco, do_demo_planner | |
235 MENU_CALL tExit, do_continue_main_menu | |
236 MENU_END | |
237 | |
238 ;============================================================================= | |
239 ; Divemode menu | |
240 | |
241 do_return_divemode_menu: | |
242 call menu_processor_pop ; drop exit line. | |
243 call menu_processor_pop ; back to last gas. | |
244 | |
245 do_divemode_menu: | |
246 MENU_BEGIN tDiveModeMenu, .7 | |
247 MENU_OPTION tDvMode, oDiveMode, 0 | |
248 MENU_OPTION tDkMode, oDecoMode, 0 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
249 MENU_CALL tppO2settings, do_ppo2_menu |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
250 MENU_OPTION tsafetystopmenu,oSafetyStop, 0 |
0 | 251 MENU_OPTION tFTTSMenu, oExtraTime,0 |
252 MENU_CALL tDecoparameters, do_decoparameters_menu | |
253 MENU_CALL tExit, do_continue_main_menu | |
254 MENU_END | |
255 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
256 do_ppo2_menu: |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
257 MENU_BEGIN tppO2settings, .3 |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
258 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
259 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
260 MENU_CALL tExit, do_return_divemode_menu |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
261 MENU_END |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
262 |
0 | 263 do_return_decoparameters_menu: |
264 call menu_processor_pop ; drop exit line. | |
265 call menu_processor_pop ; back to setting | |
266 do_decoparameters_menu: | |
267 MENU_BEGIN tDecoparameters, .7 | |
268 MENU_OPTION tGF_low, oGF_low, 0 | |
269 MENU_OPTION tGF_high, oGF_high, 0 | |
270 MENU_CALL taGFMenu, do_aGF_menu | |
271 MENU_OPTION tSaturationMult,osatmult, 0 | |
272 MENU_OPTION tDesaturationMult,odesatmult,0 | |
273 MENU_OPTION tLastDecostop,oLastDeco, 0 | |
274 MENU_CALL tExit, do_return_divemode_menu | |
275 MENU_END | |
276 | |
277 do_aGF_menu: | |
278 MENU_BEGIN taGFMenu, .4 | |
279 MENU_OPTION taGF_enable,oEnable_aGF, 0 | |
280 MENU_OPTION taGF_low, oaGF_low, 0 | |
281 MENU_OPTION taGF_high, oaGF_high, 0 | |
282 MENU_CALL tExit, do_return_decoparameters_menu | |
283 MENU_END | |
284 ;============================================================================= | |
285 ; Setup Menu | |
286 | |
287 do_return_settings: | |
288 bcf settime_setdate ; Clear flag | |
289 call menu_processor_pop ; Drop exit entry | |
290 call menu_processor_pop ; Pop return line. | |
291 | |
292 extern compass_calibration_loop | |
293 do_settings_menu: | |
294 MENU_BEGIN tSystSets, .7 | |
295 MENU_CALL tInfoMenu, do_info_menu | |
296 MENU_CALL tSetTimeDate, do_date_time_menu | |
297 MENU_CALL tDispSets, do_dispsets_menu | |
298 MENU_OPTION tLanguage, oLanguage, 0 | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
299 MENU_CALL tResetMenu, do_reset_menu |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
300 MENU_CALL tMore, do_settings_menu_more |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
301 MENU_CALL tExit, do_continue_main_menu |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
302 MENU_END |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
303 |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
304 do_settings_menu_more: |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
305 MENU_BEGIN tSystSets, .6 |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
306 MENU_CALL tCompassMenu, do_compass_menu |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
307 MENU_CALL tLogOffset, do_log_offset_menu |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
308 MENU_OPTION tUnits, oUnits, 0 |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
309 MENU_OPTION tSamplingrate,oSamplingRate,0 |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
310 MENU_OPTION tDvSalinity,oDiveSalinity, 0 |
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
311 MENU_CALL tExit, do_return_settings |
0 | 312 MENU_END |
313 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
314 do_compass_menu: |
90
3274e87fd027
NEW: automatic compass gain makes calibration quicker
heinrichsweikamp
parents:
78
diff
changeset
|
315 MENU_BEGIN tSystSets, .2 |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
316 MENU_CALL tCompassMenu, compass_calibration_loop |
90
3274e87fd027
NEW: automatic compass gain makes calibration quicker
heinrichsweikamp
parents:
78
diff
changeset
|
317 ; MENU_OPTION tCompassGain, oCompassGain, 0 |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
318 MENU_CALL tExit, do_return_settings |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
319 MENU_END |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
320 |
0 | 321 ;============================================================================= |
322 ; Reset and confirmation menu. | |
323 | |
324 do_reset_menu: | |
63 | 325 MENU_BEGIN tResetMenu, .6 |
0 | 326 MENU_CALL tExit, do_return_settings |
327 MENU_CALL tReboot, do_reset_menu2 ; Confirm | |
328 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm | |
329 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm | |
63 | 330 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm |
0 | 331 MENU_CALL tResetBattery, new_battery_menu ; New Battery submenu |
332 MENU_END | |
333 | |
334 do_reset_menu2: | |
335 MENU_BEGIN tResetMenu2, .2 | |
336 MENU_CALL tAbort, do_continue_menu_3stack | |
337 MENU_CALL tReboot, do_reboot ; Reboot | |
338 MENU_END | |
339 | |
340 do_reset_menu3: | |
341 MENU_BEGIN tResetMenu2, .2 | |
342 MENU_CALL tAbort, do_continue_menu_3stack | |
343 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | |
344 MENU_END | |
345 | |
346 do_reset_menu4: | |
347 MENU_BEGIN tResetMenu2, .2 | |
348 MENU_CALL tAbort, do_continue_menu_3stack | |
349 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | |
350 MENU_END | |
351 | |
63 | 352 do_reset_menu5: |
353 MENU_BEGIN tResetMenu2, .2 | |
354 MENU_CALL tAbort, do_continue_menu_3stack | |
355 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook | |
356 MENU_END | |
357 | |
358 do_reset_logbook: | |
359 clrf EEADRH ; Make sure to select eeprom bank 0 | |
360 clrf EEDATA | |
78
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
361 read_int_eeprom .2 |
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
362 write_int_eeprom .15 |
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
363 read_int_eeprom .3 |
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
364 write_int_eeprom .16 ; Copy number of dives |
144 | 365 clrf EEDATA |
78
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
366 write_int_eeprom .2 |
668b432dcae9
BUGFIX: Reset Logbook did not reset Logbook TOC properly
mh@mh-THINK.localdomain
parents:
76
diff
changeset
|
367 write_int_eeprom .3 ; Clear total dives |
63 | 368 write_int_eeprom .4 |
369 write_int_eeprom .5 | |
370 write_int_eeprom .6 ; Reset logbook pointers | |
371 call ext_flash_erase_logbook ; And complete logbook (!) | |
372 goto do_continue_main_menu ; back to menu | |
373 | |
0 | 374 |
375 do_reset_deco: | |
376 movlw d'79' ; 79% N2 | |
377 movff WREG,char_I_N2_ratio | |
378 movlw d'0' | |
379 movff WREG,char_I_step_is_1min ; 2 second deco mode | |
380 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine | |
381 movff int_I_pres_respiration+0,int_I_pres_surface+0 ; copy for desat routine | |
382 movff int_I_pres_respiration+1,int_I_pres_surface+1 | |
383 | |
384 extern deco_reset | |
385 call deco_reset | |
386 call deco_calc_desaturation_time ; calculate desaturation time | |
387 banksel common | |
388 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
389 banksel common | |
390 clrf nofly_time+0 ; Reset NoFly | |
391 clrf nofly_time+1 | |
392 clrf desaturation_time+0 ; Reset Desat | |
393 clrf desaturation_time+1 | |
394 goto do_return_settings ; back to menu | |
395 | |
396 do_reset_settings: | |
139 | 397 banksel common |
0 | 398 extern option_reset_all |
399 call option_reset_all ; Reset all options to factory default. | |
76 | 400 goto restart ; Restart into surfacemode |
0 | 401 |
402 do_continue_menu_3stack: ; Return three levels deep | |
403 call menu_processor_pop | |
404 goto do_return_settings | |
405 | |
406 do_reboot: | |
407 call ext_flash_enable_protection ; Enables write protection | |
408 reset | |
409 | |
410 | |
411 do_date_time_menu: | |
412 MENU_BEGIN tSetTimeDate, .4 | |
413 MENU_CALL tSetTime, do_time_menu | |
414 MENU_CALL tSetDate, do_date_menu | |
415 MENU_OPTION tDateFormat,oDateFormat, 0 | |
416 MENU_CALL tExit, do_return_settings | |
417 MENU_END | |
418 | |
419 do_date_menu: | |
420 bsf settime_setdate | |
421 MENU_BEGIN tSetDate, .4 | |
422 MENU_OPTION tSetDay, oSetDay, 0 | |
50 | 423 MENU_OPTION tSetMonth, oSetMonth, 0 |
0 | 424 MENU_OPTION tSetYear, oSetYear, 0 |
425 MENU_CALL tExit, do_continue_menu_3stack | |
426 MENU_END | |
427 | |
428 | |
429 do_reset_seconds: | |
430 clrf secs | |
431 extern rtc_set_rtc | |
432 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | |
433 do_time_menu: | |
434 bsf settime_setdate | |
435 MENU_BEGIN tSetTime, .4 | |
436 MENU_OPTION tSetHours, oSetHours, 0 | |
437 MENU_OPTION tSetMinutes,oSetMinutes, 0 | |
438 MENU_CALL tSetSeconds, do_reset_seconds | |
439 MENU_CALL tExit, do_continue_menu_3stack | |
440 MENU_END | |
441 | |
442 | |
443 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. | |
444 movff opt_ppO2_max,lo ; banksafe | |
445 movlw .10 | |
446 addwf lo,F | |
447 movlw ppo2_highest_setting | |
448 cpfsgt lo | |
449 bra do_toggle_ppo2_max2 | |
450 movlw .120 | |
451 movwf lo | |
452 do_toggle_ppo2_max2: | |
453 movff lo,opt_ppO2_max | |
454 return | |
455 | |
456 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | |
457 movff opt_ppO2_min,lo ; banksafe | |
458 incf lo,F | |
459 movlw .21 | |
460 cpfsgt lo | |
461 bra do_toggle_ppo2_min2 | |
462 movlw ppo2_lowest_setting | |
463 movwf lo | |
464 do_toggle_ppo2_min2: | |
465 movff lo,opt_ppO2_min | |
466 return | |
467 | |
468 | |
469 ; Logbook offset sub-menu | |
470 do_log_offset_menu: | |
471 MENU_BEGIN tLogOffset, .6 | |
472 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | |
473 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | |
474 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | |
475 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | |
476 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | |
477 MENU_CALL tExit, do_dispsets_menu_3stack | |
478 MENU_END | |
479 | |
480 | |
481 do_logoffset_minus1: | |
482 call do_logoffset_common_read ; Read into lo:hi | |
483 movlw d'1' | |
484 subwf lo | |
485 movlw d'0' | |
486 subwfb hi | |
487 btfss hi,7 ; <0? | |
488 goto do_logoffset_common_write ; Store and return | |
489 clrf lo | |
490 clrf hi | |
491 goto do_logoffset_common_write ; Store and return | |
492 | |
493 do_logoffset_minus10: | |
494 call do_logoffset_common_read ; Read into lo:hi | |
495 movlw d'10' | |
496 subwf lo | |
497 movlw d'0' | |
498 subwfb hi | |
499 btfss hi,7 ; <0? | |
500 goto do_logoffset_common_write ; Store and return | |
501 clrf lo | |
502 clrf hi | |
503 goto do_logoffset_common_write ; Store and return | |
504 | |
505 do_logoffset_plus1: | |
506 call do_logoffset_common_read ; Read into lo:hi | |
148 | 507 infsnz lo,F |
508 incf hi,F | |
0 | 509 goto do_logoffset_common_write ; Store and return |
510 | |
511 do_logoffset_plus10: | |
512 call do_logoffset_common_read ; Read into lo:hi | |
513 movlw d'10' | |
514 addwf lo | |
515 movlw d'0' | |
516 addwfc hi | |
517 goto do_logoffset_common_write ; Store and return | |
518 | |
519 do_dispsets_menu_3stack: | |
50 | 520 bcf in_color_menu |
0 | 521 call menu_processor_pop |
522 call menu_processor_pop | |
523 | |
524 do_dispsets_menu: | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
525 MENU_BEGIN tDispSets, .4 |
0 | 526 MENU_OPTION tBright, oBrightness, 0 |
50 | 527 MENU_CALL tColorScheme, do_color_scheme |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
528 MENU_OPTION tFlip, oFlipScreen, 0 |
0 | 529 MENU_CALL tExit, do_return_settings |
530 MENU_END | |
531 | |
50 | 532 |
533 extern oColorSetDive | |
534 do_color_scheme: | |
535 bsf in_color_menu | |
536 MENU_BEGIN tColorScheme, .2 | |
537 MENU_OPTION tColorSetDive,oColorSetDive, 0 | |
538 MENU_CALL tExit, do_dispsets_menu_3stack | |
539 MENU_END | |
540 | |
541 | |
0 | 542 ;============================================================================= |
543 | |
544 global new_battery_menu | |
545 new_battery_menu: | |
546 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | |
547 call TFT_boot ; Initialize TFT (includes clear screen) | |
548 call TFT_Display_FadeIn ; Show splash | |
549 movlw .100 | |
550 movwf batt_percent ; make sure to reset batt_percent | |
551 | |
552 ; Default (In cases of timeout or USB): Use old battery | |
553 clrf EEADRH | |
554 read_int_eeprom 0x07 | |
555 movff EEDATA,battery_gauge+0 | |
556 read_int_eeprom 0x08 | |
557 movff EEDATA,battery_gauge+1 | |
558 read_int_eeprom 0x09 | |
559 movff EEDATA,battery_gauge+2 | |
560 read_int_eeprom 0x0A | |
561 movff EEDATA,battery_gauge+3 | |
562 read_int_eeprom 0x0B | |
563 movff EEDATA,battery_gauge+4 | |
564 read_int_eeprom 0x0C | |
565 movff EEDATA,battery_gauge+5 | |
566 | |
76 | 567 call menu_processor_reset ; restart from first icon. |
568 | |
0 | 569 MENU_BEGIN tNewBattTitle, .3 |
570 MENU_CALL tNewBattOld, use_old_batteries | |
571 MENU_CALL tNewBattNew36, use_new_36V_batteries | |
572 MENU_CALL tNewBattNew15, use_new_15V_batteries | |
573 MENU_END | |
574 | |
575 global use_old_batteries | |
576 use_old_batteries: | |
577 clrf EEADRH | |
578 read_int_eeprom 0x07 | |
579 movff EEDATA,battery_gauge+0 | |
580 read_int_eeprom 0x08 | |
581 movff EEDATA,battery_gauge+1 | |
582 read_int_eeprom 0x09 | |
583 movff EEDATA,battery_gauge+2 | |
584 read_int_eeprom 0x0A | |
585 movff EEDATA,battery_gauge+3 | |
586 read_int_eeprom 0x0B | |
587 movff EEDATA,battery_gauge+4 | |
588 read_int_eeprom 0x0C | |
589 movff EEDATA,battery_gauge+5 | |
590 movlw .100 | |
591 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
592 goto power_on_return | |
593 | |
594 use_new_15V_batteries: | |
595 use_new_36V_batteries: | |
596 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | |
597 goto power_on_return | |
598 | |
599 END |