comparison src/menu_tree.asm @ 604:ca4556fb60b9

bump to 2.99beta, work on 3.00 stable
author heinrichsweikamp
date Thu, 22 Nov 2018 19:47:26 +0100
parents cb59872ad53d
children 6341f6663579
comparison
equal deleted inserted replaced
603:00b24fb4324d 604:ca4556fb60b9
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File menu_tree.asm REFACTORED VERSION V2.98 3 ; File menu_tree.asm REFACTORED VERSION V2.99e
4 ; 4 ;
5 ; OSTC menus 5 ; OSTC menus
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
9 ; HISTORY 9 ; HISTORY
10 ; 2011-07-11 : [jDG] Creation. 10 ; 2011-07-11 : [jDG] Creation.
11 11
12 #include "hwos.inc" ; Mandatory header 12 #include "hwos.inc" ; mandatory header
13 #include "gaslist.inc" 13 #include "gaslist.inc"
14 #include "menu_processor.inc" 14 #include "menu_processor.inc"
15 #include "start.inc" 15 #include "start.inc"
16 #include "comm.inc" 16 #include "comm.inc"
17 #include "logbook.inc" 17 #include "logbook.inc"
18 #include "tft.inc" 18 #include "tft.inc"
19 #include "eeprom_rs232.inc" 19 #include "eeprom_rs232.inc"
20 #include "external_flash.inc" 20 #include "external_flash.inc"
21 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c 21 #include "shared_definitions.h" ; mailbox from/to p2_deco.c
22 #include "isr.inc" 22 #include "isr.inc"
23 #include "ghostwriter.inc" 23 #include "ghostwriter.inc"
24 #include "adc_lightsensor.inc" 24 #include "adc_lightsensor.inc"
25 #include "wait.inc" 25 #include "wait.inc"
26 #include "i2c.inc" 26 #include "i2c.inc"
37 extern compass_calibration_loop 37 extern compass_calibration_loop
38 extern option_reset_all 38 extern option_reset_all
39 extern rtc_set_rtc 39 extern rtc_set_rtc
40 extern surfloop 40 extern surfloop
41 extern oColorSetDive 41 extern oColorSetDive
42 42 extern option_cleanup_oCCRMode
43 43
44 gui CODE 44
45 menu_tree CODE
45 46
46 ;============================================================================= 47 ;=============================================================================
47 ; Main Menu 48 ; Main Menu
48 49
49 do_return_main_menu: 50 do_return_main_menu:
50 call menu_processor_double_pop ; drop exit line and back to last line 51 call menu_processor_double_pop ; drop exit line and back to last line
51 bra do_main_menu_common 52 bra do_main_menu_common
52 53
53 global do_main_menu 54 global do_main_menu
54 do_main_menu: 55 do_main_menu:
55 movff menupos3,customview_surfmode ; save last customview 56 movff menupos3,customview_surfmode ; save last customview
77 78
78 do_return_ccr_menu: 79 do_return_ccr_menu:
79 call menu_processor_double_pop ; drop exit line and back to last line 80 call menu_processor_double_pop ; drop exit line and back to last line
80 81
81 do_ccr_menu: 82 do_ccr_menu:
82 bcf menu_show_sensors2 ; stop imprinting of live sensor values 83 bcf menu_update_sensor_mv ; stop imprinting of live sensor values
84 call option_cleanup_oCCRMode ; in pSCR mode, revert AutoSP (2) to calculated SP (0)
83 85
84 btfsc analog_o2_input 86 btfsc analog_o2_input
85 bra do_ccr_menu_cR 87 bra do_ccr_menu_cR
86 88
87 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu 89 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu
92 MENU_OPTION tCCRMode, oCCRMode, 0 94 MENU_OPTION tCCRMode, oCCRMode, 0
93 MENU_CALL tDiluentSetup, do_diluent_setup 95 MENU_CALL tDiluentSetup, do_diluent_setup
94 MENU_CALL tFixedSetpoints, do_fixed_setpoints 96 MENU_CALL tFixedSetpoints, do_fixed_setpoints
95 MENU_CALL tPSCRMenu, do_PSCR_menu 97 MENU_CALL tPSCRMenu, do_PSCR_menu
96 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 98 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0
97 MENU_CALL tExit, do_return_main_menu 99 MENU_CALL tBack, do_return_main_menu
98 MENU_END 100 MENU_END
99 101
100 102
101 do_ccr_menu_cR: ; cR menu 103 do_ccr_menu_cR: ; cR menu
102 MENU_BEGIN tCCRSetup, .7 104 MENU_BEGIN tCCRSetup, .7
104 MENU_CALL tCalibrateMenu, do_calibrate_menu 106 MENU_CALL tCalibrateMenu, do_calibrate_menu
105 MENU_CALL tDiluentSetup, do_diluent_setup 107 MENU_CALL tDiluentSetup, do_diluent_setup
106 MENU_CALL tFixedSetpoints, do_fixed_setpoints 108 MENU_CALL tFixedSetpoints, do_fixed_setpoints
107 MENU_CALL tPSCRMenu, do_PSCR_menu 109 MENU_CALL tPSCRMenu, do_PSCR_menu
108 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 110 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0
109 MENU_CALL tExit, do_return_main_menu 111 MENU_CALL tBack, do_return_main_menu
110 MENU_END 112 MENU_END
111 113
112 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu 114 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu
113 ;do_ccr_menu_ostc2: 115 ;do_ccr_menu_ostc2:
114 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu 116 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu
115 ; MENU_OPTION tCCRMode, oCCRMode, 0 117 ; MENU_OPTION tCCRMode, oCCRMode, 0
116 ; MENU_CALL tDiluentSetup, do_diluent_setup 118 ; MENU_CALL tDiluentSetup, do_diluent_setup
117 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints 119 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints
118 ; MENU_CALL tPSCRMenu, do_PSCR_menu 120 ; MENU_CALL tPSCRMenu, do_PSCR_menu
119 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 121 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0
120 ; MENU_CALL tExit, do_return_main_menu 122 ; MENU_CALL tBack, do_return_main_menu
121 ; MENU_END 123 ; MENU_END
122 124
123 125
124 do_calibrate_menu: 126 do_calibrate_menu:
125 call enable_ir_s8 ; Enable IR/S8-Port 127 call enable_ir_s8 ; enable IR/S8-Port
126 bsf menu_show_sensors2 ; start imprinting of live sensor values 128 bsf menu_update_sensor_mv ; start imprinting of live sensor values
127 129
128 do_calibrate_menu2: 130 do_calibrate_menu2:
129 MENU_BEGIN tCalibrateMenu, .6 131 MENU_BEGIN tCalibrateMenu, .6
130 MENU_CALL tDiveHudMask1, 0 132 MENU_CALL tDiveHudMask1, 0
131 MENU_CALL tDiveHudMask2, 0 133 MENU_CALL tDiveHudMask2, 0
132 MENU_CALL tDiveHudMask3, 0 134 MENU_CALL tDiveHudMask3, 0
133 MENU_OPTION tCalibrationGas,oCalGasO2, 0 135 MENU_OPTION tCalibrationGas,oCalGasO2, 0
134 MENU_CALL tCalibrate, do_calibrate_mix 136 MENU_CALL tCalibrate, do_calibrate_mix
135 MENU_CALL tExit, do_return_ccr_menu 137 MENU_CALL tBack, do_return_ccr_menu
136 MENU_END 138 MENU_END
137 139
138 140
139 do_calibrate_mix: 141 do_calibrate_mix:
140 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected 142 call calibrate_mix ; calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected
141 WAITMS d'250' ; Wait for HUD v3 143 WAITMS d'250' ; wait for HUD v3
142 movlw .9 144 movlw .9
143 movff WREG,customview_surfmode ; show sensor mV custom view after restart 145 movff WREG,customview_surfmode ; show sensor mV custom view after restart
144 goto restart ; Restart into surface mode 146 goto restart ; restart into surface mode
145 147
146 148
147 do_diluent_setup: 149 do_diluent_setup:
148 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") 150 bsf FLAG_diluent_setup ; setting up diluents
149 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 151 bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint
150 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth 152 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only)
153 call gaslist_cleanup_list ; take care that only one gas can be first
151 154
152 MENU_BEGIN tDiluentSetup, .6 155 MENU_BEGIN tDiluentSetup, .6
153 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 156 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
154 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 157 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
155 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 158 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
156 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 159 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
157 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 160 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
158 MENU_CALL tExit, do_return_ccr_menu 161 MENU_CALL tBack, do_return_ccr_menu
159 MENU_END 162 MENU_END
160 163
161 164
162 do_return_fixed_setpoints: 165 do_return_fixed_setpoints:
163 call menu_processor_double_pop ; drop exit line and back to last line 166 call menu_processor_double_pop ; drop exit line and back to last line
164 167
165 do_fixed_setpoints: 168 do_fixed_setpoints:
166 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 169 bcf short_gas_decriptions ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint
170 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only)
167 171
168 MENU_BEGIN tFixedSetpoints, .6 172 MENU_BEGIN tFixedSetpoints, .6
169 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu 173 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu
170 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu 174 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu
171 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu 175 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu
172 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu 176 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu
173 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu 177 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu
174 MENU_CALL tExit, do_return_ccr_menu 178 MENU_CALL tBack, do_return_ccr_menu
175 MENU_END 179 MENU_END
176 180
177 181
178 do_edit_sp_menu: 182 do_edit_sp_menu:
179 call gaslist_setSP ; Save current item. 183 movff PRODL,gaslist_gas ; get menu item we came from (0-4)
180 184
181 MENU_BEGIN tFixedSetpoints, .5 185 MENU_BEGIN tFixedSetpoints, .5
182 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 186 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0
183 MENU_CALL tSPPlus, gaslist_spplus 187 MENU_CALL tSPPlus, gaslist_spplus
184 MENU_CALL tDepthPlus, gaslist_spdepthplus 188 MENU_CALL tDepthPlus, gaslist_spdepthplus
185 MENU_CALL tDepthMinus, gaslist_spdepthminus 189 MENU_CALL tDepthMinus, gaslist_spdepthminus
186 MENU_CALL tExit, do_return_fixed_setpoints 190 MENU_CALL tBack, do_return_fixed_setpoints
187 MENU_END 191 MENU_END
188 192
189 193
190 do_PSCR_menu: 194 do_PSCR_menu:
191 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu 195 MENU_BEGIN tPSCRMenu, .3 ; pSCR Menu
192 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 196 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0
193 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 197 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0
194 MENU_CALL tExit, do_return_ccr_menu 198 MENU_CALL tBack, do_return_ccr_menu
195 MENU_END 199 MENU_END
196 200
197 ;============================================================================= 201 ;=============================================================================
198 ; OC Gas Setup 202 ; OC Gas Setup
199 203
200 do_return_gas_menu: 204 do_return_gas_menu:
201 call menu_processor_double_pop ; drop exit line and back to last line 205 call menu_processor_double_pop ; drop exit line and back to last line
202 206
203 btfsc ccr_diluent_setup ; Return to CCR-Menu? 207 btfsc FLAG_diluent_setup ; return to CCR-Menu?
204 bra do_diluent_setup ; Yes. 208 bra do_diluent_setup ; YES
205 209
206 do_gas_menu: 210 do_gas_menu:
207 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") 211 bcf FLAG_diluent_setup ; not setting up diluents
208 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 212 bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint
209 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth 213 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only)
214 call gaslist_cleanup_list ; takes care that only one gas can be first
210 215
211 MENU_BEGIN tGaslist, .6 216 MENU_BEGIN tGaslist, .6
212 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 217 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
213 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 218 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
214 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 219 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
215 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 220 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
216 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu 221 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu
217 MENU_CALL tExit, do_return_main_menu 222 MENU_CALL tBack, do_return_main_menu
218 MENU_END 223 MENU_END
219 224
220 225
221 do_return_edit_gas_menu: 226 do_return_edit_gas_menu:
227 IFDEF _rx_functions
228 bcf menu_update_tank_pres ; stop imprinting of tank pressure updates
229 bcf FLAG_pairing_mode ; not in pairing menu any more (back to normal timeout)
230 ENDIF
222 call menu_processor_pop ; drop exit line and ... 231 call menu_processor_pop ; drop exit line and ...
223 do_abort_gas_depth_menu: 232 do_abort_gas_depth_menu:
224 call menu_processor_pop ; back to last line 233 call menu_processor_pop ; back to last line
225 bra do_edit_gas_menu_common 234 bra do_edit_gas_menu_common
226
227 do_edit_gas_menu: 235 do_edit_gas_menu:
228 call gaslist_setgas ; set gaslist_gas 236 movff PRODL,gaslist_gas ; get menu item we came from (0-4)
229 237 movlw .5 ; offset between gases and diluents
230 do_edit_gas_menu_common: ; keep current gas 238 btfsc FLAG_diluent_setup ; in CCR menu?
231 MENU_BEGIN tGasEdit, .6 239 addwf gaslist_gas,F ; YES - add the offset
240
241 do_edit_gas_menu_common:
242 MENU_BEGIN tGasEdit, .7
232 MENU_DYNAMIC gaslist_gastitle, 0 243 MENU_DYNAMIC gaslist_gastitle, 0
233 MENU_DYNAMIC gaslist_MOD_END, 0 244 MENU_DYNAMIC gaslist_MOD_END, 0
234 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type 245 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type
235 MENU_CALL tSetup_mix, do_setup_mix 246 MENU_CALL tSetup_GasMix, do_setup_mix_menu
236 MENU_CALL tGasDepth, do_gas_depth_menu 247 MENU_DYNAMIC gaslist_GasDepth, do_setup_depth_menu
237 MENU_CALL tExit, do_return_gas_menu 248 MENU_CALL tSetup_Tank, do_setup_tank_menu
238 MENU_END 249 MENU_CALL tBack, do_return_gas_menu
239 250 MENU_END
240 251
241 do_setup_mix: 252
253 do_setup_mix_menu:
242 MENU_BEGIN tGasEdit, .7 254 MENU_BEGIN tGasEdit, .7
243 MENU_DYNAMIC gaslist_gastitle, 0 255 MENU_DYNAMIC gaslist_gastitle, 0
244 MENU_DYNAMIC gaslist_MOD_END, 0 256 MENU_DYNAMIC gaslist_MOD_END, 0
245 MENU_CALL tO2Plus, gaslist_pO2 257 MENU_CALL tO2Plus, gaslist_pO2
246 MENU_CALL tO2Minus, gaslist_mO2 258 MENU_CALL tO2Minus, gaslist_mO2
247 MENU_CALL tHePlus, gaslist_pHe 259 MENU_CALL tHePlus, gaslist_pHe
248 MENU_CALL tHeMinus, gaslist_mHe 260 MENU_CALL tHeMinus, gaslist_mHe
249 MENU_CALL tExit, do_return_edit_gas_menu 261 MENU_CALL tBack, do_return_edit_gas_menu
250 MENU_END 262 MENU_END
251 263
252 264
253 do_gas_depth_menu: 265 do_setup_tank_menu:
254 movff gaslist_gas,WREG 266 IFDEF _rx_functions
255 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] 267 btfsc FLAG_tr_enabled ; TR functions enabled?
256 movff PLUSW1,lo ; Used as temp 268 bra do_setup_tank_menu_rx ; YES
257 movlw .3 ; 3=Deco 269 ENDIF
258 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") 270
259 movlw .2 ; 2=Normal 271 MENU_BEGIN tSetup_Tank, .6
260 cpfseq lo 272 MENU_DYNAMIC gaslist_gastitle, 0
261 bra do_abort_gas_depth_menu ; Non-Deco gas or "Normal" Diluent, abort! 273 MENU_DYNAMIC gaslist_tank_size_pres, 0
274 MENU_CALL tTankSize, gaslist_tank_size
275 MENU_CALL tTankUsablePress, gaslist_tank_pres
276 MENU_CALL tCopyDilToOC, gaslist_copy_dil_to_oc
277 MENU_CALL tBack, do_return_edit_gas_menu
278 MENU_END
279
280
281 IFDEF _rx_functions
282
283 do_setup_tank_menu_rx:
284 setf pairing_slot ; prime slot number with 255 aka -1, used in pairing function
285 bsf FLAG_pairing_mode ; in pairing menu (longer timeout)
286
287 MENU_BEGIN tSetup_Tank, .7
288 MENU_DYNAMIC gaslist_gastitle, 0
289 MENU_DYNAMIC gaslist_tank_id_pres, 0 ; when changing position, adopt TFT_menu_tank_pres!
290 MENU_DYNAMIC gaslist_tank_size_pres, 0
291 MENU_CALL tTankPairing, gaslist_tank_pairing
292 MENU_CALL tTankSize, gaslist_tank_size
293 MENU_CALL tTankUsablePress, gaslist_tank_pres
294 MENU_CALL tBack, do_return_edit_gas_menu
295 MENU_END
296
297 ENDIF
298
299
300 do_setup_depth_menu:
262 301
263 MENU_BEGIN tGasEdit, .7 302 MENU_BEGIN tGasEdit, .7
264 MENU_DYNAMIC gaslist_gastitle, 0 303 MENU_DYNAMIC gaslist_gastitle, 0
265 MENU_DYNAMIC gaslist_MOD_END, 0 304 MENU_DYNAMIC gaslist_MOD_END, 0
266 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth 305 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth
267 MENU_CALL tDepthPlus, gaslist_pDepth 306 MENU_CALL tDepthPlus, gaslist_pDepth
268 MENU_CALL tDepthMinus, gaslist_mDepth 307 MENU_CALL tDepthMinus, gaslist_mDepth
269 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod 308 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod
270 MENU_CALL tExit, do_return_edit_gas_menu 309 MENU_CALL tBack, do_return_edit_gas_menu
271 MENU_END 310 MENU_END
272 311
273 312
274 ;============================================================================= 313 ;=============================================================================
275 ; Simulator menus 314 ; Simulator Menus
276 315
277 do_return_planner_menu: 316 do_return_planner_menu:
278 call menu_processor_pop ; drop exit line and ... 317 call menu_processor_pop ; drop exit line and ...
279 318
280 global do_return_demo_planner 319 global do_return_demo_planner
284 323
285 do_planner_menu: 324 do_planner_menu:
286 ; to have correct simulator results after mode changes without prior excursion to surfacemode 325 ; to have correct simulator results after mode changes without prior excursion to surfacemode
287 call option_save_all 326 call option_save_all
288 call restart_set_modes_and_flags 327 call restart_set_modes_and_flags
289 ; Reset dive time/depth to default values 328 ; reset dive time/depth to default values
290 lfsr FSR0,odiveInterval 329 lfsr FSR0,odiveInterval
291 call option_reset 330 call option_reset
292 lfsr FSR0,obottomTime 331 lfsr FSR0,obottomTime
293 call option_reset 332 call option_reset
294 lfsr FSR0,obottomDepth 333 lfsr FSR0,obottomDepth
295 call option_reset 334 call option_reset
335 lfsr FSR0,oSimAGF
336 call option_reset
296 337
297 do_planner_common: 338 do_planner_common:
339 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
340 dcfsnz WREG,W ; subtract one, became zero?
341 bra do_planner_common_ccr ; YES - use CCR version
342
343 MENU_BEGIN tPlan, .7
344 MENU_OPTION tIntvl, odiveInterval, 0
345 MENU_OPTION tBtDep, obottomDepth, 0
346 MENU_CALL tInter, do_demo_divemode
347 MENU_OPTION tBtTm, obottomTime, 0
348 MENU_OPTION tuseAGF, oSimAGF, 0
349 MENU_CALL tDeco, do_demo_planner
350 MENU_CALL tBack, do_return_main_menu
351 MENU_END
352
353 do_planner_common_ccr:
298 MENU_BEGIN tPlan, .7 354 MENU_BEGIN tPlan, .7
299 MENU_OPTION tIntvl, odiveInterval, 0 355 MENU_OPTION tIntvl, odiveInterval, 0
300 MENU_OPTION tBtDep, obottomDepth, 0 356 MENU_OPTION tBtDep, obottomDepth, 0
301 MENU_CALL tInter, do_demo_divemode 357 MENU_CALL tInter, do_demo_divemode
302 MENU_OPTION tBtTm, obottomTime, 0 358 MENU_OPTION tBtTm, obottomTime, 0
303 MENU_CALL tDecoSetup, do_planner_config 359 MENU_CALL tDecoSetup, do_planner_config
304 MENU_CALL tDeco, do_demo_planner 360 MENU_CALL tDeco, do_demo_planner
305 MENU_CALL tExit, do_return_main_menu 361 MENU_CALL tBack, do_return_main_menu
306 MENU_END 362 MENU_END
307
308 363
309 do_planner_config: 364 do_planner_config:
310 MENU_BEGIN tPlan, .3 365 MENU_BEGIN tPlan, .3
311 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 366 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0
312 MENU_OPTION tuseAGF, oSimAGF, 0 367 MENU_OPTION tuseAGF, oSimAGF, 0
313 MENU_CALL tExit, do_return_planner_menu 368 MENU_CALL tBack, do_return_planner_menu
314 MENU_END 369 MENU_END
315 370
316 371
317 ;============================================================================= 372 ;=============================================================================
318 ; Divemode menu 373 ; Divemode Menu
319 374
320 do_return_divemode_menu: 375 do_return_divemode_menu:
321 call menu_processor_double_pop ; drop exit line and back to last line 376 call menu_processor_double_pop ; drop exit line and back to last line
322 377
323 do_divemode_menu: 378 do_divemode_menu:
324 MENU_BEGIN tDiveModeMenu, .7 379 MENU_BEGIN tDiveModeMenu, .7
325 MENU_OPTION tDvMode, oDiveMode, 0 380 MENU_OPTION tDvMode, oDiveMode, 0
326 MENU_OPTION tDkMode, oDecoMode, 0 381 MENU_OPTION tDkMode, oDecoMode, 0
327 MENU_CALL tppO2settings, do_ppo2_menu 382 MENU_CALL tppO2settings, do_ppo2_menu
328 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 383 MENU_OPTION tsafetystopmenu, oSafetyStop, 0
384 MENU_CALL tDecoparameters, do_decoparameters_menu
329 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu 385 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu
330 MENU_CALL tDecoparameters, do_decoparameters_menu 386 MENU_CALL tBack, do_return_main_menu
331 MENU_CALL tExit, do_return_main_menu
332 MENU_END 387 MENU_END
333 388
334 389
335 do_ppo2_menu: 390 do_ppo2_menu:
336 MENU_BEGIN tppO2settings, .6 391 MENU_BEGIN tppO2settings, .6
337 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max 392 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max
338 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco 393 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco
339 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min 394 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min
340 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc 395 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc
341 MENU_OPTION tShowppO2, oShowppO2, 0 396 MENU_OPTION tShowppO2, oShowppO2, 0
342 MENU_CALL tExit, do_return_divemode_menu 397 MENU_CALL tBack, do_return_divemode_menu
343 MENU_END 398 MENU_END
344 399
345 400
346 do_return_decoparameters_menu: 401 do_return_decoparameters_menu:
347 call menu_processor_double_pop ; drop exit line and back to last line 402 call menu_processor_double_pop ; drop exit line and back to last line
348 403
349 do_decoparameters_menu: 404 do_decoparameters_menu:
350 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF 405 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF
351 tstfsz lo 406 tstfsz lo
352 bra do_decoparameters_menugf ; <> 0 -> GF menu! 407 bra do_decoparameters_menu_gf ; <> 0 -> GF menu!
353 ; NON-GF menu 408 ; NON-GF menu
354 MENU_BEGIN tDecoparameters, .4 409 MENU_BEGIN tDecoparameters, .6
410 MENU_OPTION tSetBotUse, obottom_usage, 0
411 MENU_OPTION tSetDecoUse, odeco_usage, 0
355 MENU_OPTION tSaturationMult, osatmult, 0 412 MENU_OPTION tSaturationMult, osatmult, 0
356 MENU_OPTION tDesaturationMult, odesatmult, 0 413 MENU_OPTION tDesaturationMult, odesatmult, 0
357 MENU_OPTION tLastDecostop, oLastDeco, 0 414 MENU_CALL tMore, do_decoparameters_menu_more
358 MENU_CALL tExit, do_return_divemode_menu 415 MENU_CALL tBack, do_return_divemode_menu
359 MENU_END 416 MENU_END
360 417
361 do_decoparameters_menugf: 418 do_decoparameters_menu_gf:
362 ; GF menu 419 ; GF menu
363 MENU_BEGIN tDecoparameters, .7 420 MENU_BEGIN tDecoparameters, .7
421 MENU_OPTION tSetBotUse, obottom_usage, 0
422 MENU_OPTION tSetDecoUse, odeco_usage, 0
423 MENU_CALL tGFMenu, do_GF_menu
424 MENU_OPTION tSaturationMult, osatmultgf, 0
425 MENU_OPTION tDesaturationMult, odesatmultgf, 0
426 MENU_CALL tMore, do_decoparameters_menu_more
427 MENU_CALL tBack, do_return_divemode_menu
428 MENU_END
429
430
431 do_decoparameters_menu_more:
432 MENU_BEGIN tDecoparameters, .4
433 MENU_OPTION tLastDecostop, oLastDeco, 0
434 MENU_OPTION tAscentSpeed, oAscentSpeed, 0
435 MENU_OPTION tGasChangeTime, oGasChangeTime, 0
436 MENU_CALL tBack, do_return_decoparameters_menu
437 MENU_END
438
439
440 do_2nd_deco_plan_menu:
441 MENU_BEGIN t2ndDecoPlanMenu, .3
442 MENU_OPTION tFTTSMenu, oExtraTime, 0
443 MENU_OPTION tCalcAscGas, oCalcAscGas, 0
444 MENU_CALL tBack, do_return_divemode_menu
445 MENU_END
446
447
448 do_GF_menu:
449 MENU_BEGIN tGFMenu, .6
364 MENU_OPTION tGF_low, oGF_low, 0 450 MENU_OPTION tGF_low, oGF_low, 0
365 MENU_OPTION tGF_high, oGF_high, 0 451 MENU_OPTION tGF_high, oGF_high, 0
366 MENU_CALL taGFMenu, do_aGF_menu
367 MENU_OPTION tSaturationMult, osatmultgf, 0
368 MENU_OPTION tDesaturationMult, odesatmultgf, 0
369 MENU_OPTION tLastDecostop, oLastDeco, 0
370 MENU_CALL tExit, do_return_divemode_menu
371 MENU_END
372
373
374 do_return_2nd_deco_plan_menu:
375 call menu_processor_double_pop ; drop exit line and back to last line
376
377 do_2nd_deco_plan_menu
378 MENU_BEGIN t2ndDecoPlanMenu, .7
379 MENU_OPTION tFTTSMenu, oExtraTime, 0
380 MENU_OPTION tCalcAscGas, oCalcAscGas, 0
381 MENU_OPTION tSetBotUse, obottom_usage, 0
382 MENU_OPTION tSetDecoUse, odeco_usage, 0
383 MENU_CALL tTankSizes, do_tank_sizes_menu
384 MENU_CALL tTankFillPress, do_tank_fill_press_menu
385 MENU_CALL tExit, do_return_divemode_menu
386 MENU_END
387
388
389 do_tank_sizes_menu:
390 MENU_BEGIN tTankSizes, .6
391 MENU_OPTION tGas1, oTankSize1, 0
392 MENU_OPTION tGas2, oTankSize2, 0
393 MENU_OPTION tGas3, oTankSize3, 0
394 MENU_OPTION tGas4, oTankSize4, 0
395 MENU_OPTION tGas5, oTankSize5, 0
396 MENU_CALL tExit, do_return_2nd_deco_plan_menu
397 MENU_END
398
399
400 do_tank_fill_press_menu:
401 MENU_BEGIN tTankFillPress, .6
402 MENU_OPTION tGas1, oTankFillPres1, 0
403 MENU_OPTION tGas2, oTankFillPres2, 0
404 MENU_OPTION tGas3, oTankFillPres3, 0
405 MENU_OPTION tGas4, oTankFillPres4, 0
406 MENU_OPTION tGas5, oTankFillPres5, 0
407 MENU_CALL tExit, do_return_2nd_deco_plan_menu
408 MENU_END
409
410
411 do_aGF_menu:
412 MENU_BEGIN taGFMenu, .4
413 MENU_OPTION taGF_enable, oEnable_aGF, 0 452 MENU_OPTION taGF_enable, oEnable_aGF, 0
414 MENU_OPTION taGF_low, oaGF_low, 0 453 MENU_OPTION taGF_low, oaGF_low, 0
415 MENU_OPTION taGF_high, oaGF_high, 0 454 MENU_OPTION taGF_high, oaGF_high, 0
416 MENU_CALL tExit, do_return_decoparameters_menu 455 MENU_CALL tBack, do_return_decoparameters_menu
417 MENU_END 456 MENU_END
418 457
419 458
420 ;============================================================================= 459 ;=============================================================================
421 ; Setup Menu 460 ; Setup Menu
424 bcf settime_setdate ; clear flag 463 bcf settime_setdate ; clear flag
425 call menu_processor_pop ; drop one more stack entry 464 call menu_processor_pop ; drop one more stack entry
426 465
427 do_return_settings: 466 do_return_settings:
428 call menu_processor_double_pop ; drop exit line and back to last line 467 call menu_processor_double_pop ; drop exit line and back to last line
468 IFDEF _rx_mode
469 bcf FLAG_tr_enabled ; clear TR functions flag by default
470 movff opt_TR_mode,WREG ; get TR functions mode
471 tstfsz WREG ; TR functions enabled?
472 bsf FLAG_tr_enabled ; YES
473 ENDIF
429 474
430 do_settings_menu: 475 do_settings_menu:
431 btfsc ble_available ; ble available? 476 btfsc ble_available ; ble available?
432 bra do_settings_menu_ble ; YES 477 bra do_settings_menu_ble ; YES
433 478
434 MENU_BEGIN tSystSets, .6 479 MENU_BEGIN tSystSets, .5
435 MENU_CALL tInfoMenu, do_info_menu 480 MENU_CALL tInfoMenu, do_info_menu
436 MENU_CALL tSetTimeDate, do_date_time_menu 481 MENU_CALL tSetTimeDate, do_date_time_menu
437 MENU_CALL tDispSets, do_dispsets_menu 482 MENU_CALL tDispSets, do_dispsets_menu
438 MENU_OPTION tLanguage, oLanguage, 0
439 MENU_CALL tMore, do_settings_menu_more 483 MENU_CALL tMore, do_settings_menu_more
440 MENU_CALL tExit, do_return_main_menu 484 MENU_CALL tBack, do_return_main_menu
441 MENU_END 485 MENU_END
442 486
443 do_settings_menu_ble: 487 do_settings_menu_ble:
444 MENU_BEGIN tSystSets, .7 488 IFDEF _rx_functions
489 btfsc ostc_rx_present ; RX model?
490 bra do_settings_menu_rx ; YES
491 ENDIF
492
493 MENU_BEGIN tSystSets, .6
445 MENU_CALL tInfoMenu, do_info_menu 494 MENU_CALL tInfoMenu, do_info_menu
446 MENU_CALL tBleTitle, comm_mode0 495 MENU_CALL tBleTitle, comm_mode0
447 MENU_CALL tSetTimeDate, do_date_time_menu 496 MENU_CALL tSetTimeDate, do_date_time_menu
448 MENU_CALL tDispSets, do_dispsets_menu 497 MENU_CALL tDispSets, do_dispsets_menu
449 MENU_OPTION tLanguage, oLanguage, 0
450 MENU_CALL tMore, do_settings_menu_more 498 MENU_CALL tMore, do_settings_menu_more
451 MENU_CALL tExit, do_return_main_menu 499 MENU_CALL tBack, do_return_main_menu
452 MENU_END 500 MENU_END
501
502 IFDEF _rx_functions
503 do_settings_menu_rx:
504 MENU_BEGIN tSystSets, .7
505 MENU_CALL tInfoMenu, do_info_menu
506 MENU_CALL tBleTitle, comm_mode0
507 MENU_CALL tTrSettings, do_settings_menu_TR
508 MENU_CALL tSetTimeDate, do_date_time_menu
509 MENU_CALL tDispSets, do_dispsets_menu
510 MENU_CALL tMore, do_settings_menu_more
511 MENU_CALL tBack, do_return_main_menu
512 MENU_END
513 ENDIF
514
453 515
454 do_info_menu: 516 do_info_menu:
517 IFDEF _rx_functions
518 btfsc ostc_rx_present ; TR model?
519 bra do_info_menu_TR ; YES
520 ENDIF
521
455 MENU_BEGIN tInfoMenu, .6 522 MENU_BEGIN tInfoMenu, .6
456 MENU_DYNAMIC info_menu_serial, 0 523 MENU_DYNAMIC info_menu_serial, 0
457 MENU_DYNAMIC info_menu_firmware, 0 524 MENU_DYNAMIC info_menu_firmware, 0
458 MENU_DYNAMIC info_menu_battery_volts, 0 525 MENU_DYNAMIC info_menu_battery_volts, 0
459 MENU_DYNAMIC info_menu_uptime, 0 526 MENU_DYNAMIC info_menu_uptime, 0
460 MENU_DYNAMIC info_menu_total_dives, 0 527 MENU_DYNAMIC info_menu_total_dives, 0
461 MENU_CALL tExit, do_return_settings 528 MENU_CALL tBack, do_return_settings
462 MENU_END 529 MENU_END
530
531 IFDEF _rx_functions
532 do_info_menu_TR:
533 MENU_BEGIN tInfoMenu, .7
534 MENU_DYNAMIC info_menu_serial, 0
535 MENU_DYNAMIC info_menu_firmware, 0
536 MENU_DYNAMIC info_menu_firmware_rx, 0
537 MENU_DYNAMIC info_menu_total_dives, 0
538 MENU_DYNAMIC info_menu_battery_volts, 0
539 MENU_DYNAMIC info_menu_uptime, 0
540 MENU_CALL tBack, do_return_settings
541 MENU_END
542 ENDIF
543
544
545 IFDEF _rx_functions
546 do_settings_menu_TR:
547 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
548 incf WREG,W ; add 1
549 dcfsnz WREG,W ; subtract one, became zero?
550 bra do_settings_menu_TR_MaxDelta; YES - OC
551 dcfsnz WREG,W ; subtract one, became zero?
552 bra do_settings_menu_TR_BailPres; YES - CCR
553 dcfsnz WREG,W ; subtract one, became zero?
554 bra do_settings_menu_TR_MaxDelta; YES - Gauge
555 dcfsnz WREG,W ; subtract one, became zero?
556 bra do_settings_menu_TR_abort ; YES - Apnea, abort
557 dcfsnz WREG,W ; subtract one, became zero?
558 bra do_settings_menu_TR_both ; YES - pSCR
559 do_settings_menu_TR_abort:
560 call menu_processor_pop ; drop last menu selection
561 bra do_settings_menu ; back to last menu
562
563 do_settings_menu_TR_MaxDelta: ; menu with oTrMaxDeltaPres
564 MENU_BEGIN tTrSettings, .5
565 MENU_OPTION tTrMode, oTrMode, 0
566 MENU_OPTION tTr1stPres, oTr1stPres, 0
567 MENU_OPTION tTr2ndPres, oTr2ndPres, 0
568 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff
569 MENU_CALL tBack, do_return_settings
570 MENU_END
571
572 do_settings_menu_TR_BailPres: ; menu with oTrBailPres
573 MENU_BEGIN tTrSettings, .5
574 MENU_OPTION tTrMode, oTrMode, 0
575 MENU_OPTION tTr1stPres, oTr1stPres, 0
576 MENU_OPTION tTr2ndPres, oTr2ndPres, 0
577 MENU_OPTION tTrBailPres, oTrBailPres, 0
578 MENU_CALL tBack, do_return_settings
579 MENU_END
580
581 do_settings_menu_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres
582 MENU_BEGIN tTrSettings, .6
583 MENU_OPTION tTrMode, oTrMode, 0
584 MENU_OPTION tTr1stPres, oTr1stPres, 0
585 MENU_OPTION tTr2ndPres, oTr2ndPres, 0
586 MENU_OPTION tTrBailPres, oTrBailPres, 0
587 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff
588 MENU_CALL tBack, do_return_settings
589 MENU_END
590
591
592 do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max.
593 movff char_I_max_pres_diff,lo ; get current value
594 movlw .5 ; load increment
595 addwf lo,F ; add increment
596 movlw max_pres_diff_max ; load maximum value
597 cpfsgt lo ; above maximum value?
598 bra do_toggle_max_pres_diff_1 ; NO - store new value
599 movlw max_pres_diff_min ; YES - load minimum value
600 movwf lo ; - into lo
601 do_toggle_max_pres_diff_1:
602 movff lo,char_I_max_pres_diff ; write back new value
603 return ; done
604 ENDIF
463 605
464 606
465 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu 607 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu
466 call menu_processor_pop ; drop one more stack entry 608 call menu_processor_pop ; drop one more stack entry
467 609
475 bra do_settings_menu_more_ostc3p 617 bra do_settings_menu_more_ostc3p
476 ; All MENU_CALLs that are 618 ; All MENU_CALLs that are
477 MENU_BEGIN tSystSets, .6 ; in all of this 3 menus 619 MENU_BEGIN tSystSets, .6 ; in all of this 3 menus
478 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together 620 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together
479 MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in 621 MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in
480 MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mass up the 622 MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mess up the
481 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the 623 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the
482 MENU_CALL tResetMenu, do_reset_menu ; do_return_settings ! 624 MENU_CALL tResetMenu, do_reset_menu ; do_return_settings !
483 MENU_CALL tExit, do_return_settings 625 MENU_CALL tBack, do_return_settings
484 MENU_END 626 MENU_END
485 627
486 628
487 do_return_settings_menu_more_pz: 629 do_return_settings_menu_more_pz:
488 call TFT_ClearScreen 630 call TFT_ClearScreen
489 call piezo_config ; Configure buttons 631 call piezo_config ; configure buttons
490 call menu_processor_double_pop ; drop exit line and back to last line 632 call menu_processor_double_pop ; drop exit line and back to last line
491 633
492 do_settings_menu_more_piezo: 634 do_settings_menu_more_piezo:
493 MENU_BEGIN tSystSets, .7 635 MENU_BEGIN tSystSets, .7
494 MENU_CALL tCompassMenu, do_compass_menu 636 MENU_CALL tCompassMenu, do_compass_menu ; see above
495 MENU_CALL tLogOffset, do_log_offset_menu 637 MENU_CALL tLogOffset, do_log_offset_menu ;
496 MENU_OPTION tAltMode, oAltMode, 0 638 MENU_OPTION tAltMode, oAltMode, 0
497 MENU_OPTION tDvSalinity, oDiveSalinity, 0 639 MENU_OPTION tDvSalinity, oDiveSalinity, 0
498 MENU_CALL tResetMenu, do_reset_menu 640 MENU_CALL tResetMenu, do_reset_menu ;
499 MENU_CALL tMore, do_settings_piezo_menu 641 MENU_CALL tMore, do_settings_piezo_menu ;
500 MENU_CALL tExit, do_return_settings 642 MENU_CALL tBack, do_return_settings
501 MENU_END 643 MENU_END
502 644
503 do_settings_menu_more_ostc3p: ; Menu with BLE feature 645 do_settings_menu_more_ostc3p: ; menu with BLE feature
504 MENU_BEGIN tSystSets, .6 646 MENU_BEGIN tSystSets, .6
505 MENU_CALL tCompassMenu, do_compass_menu 647 MENU_CALL tCompassMenu, do_compass_menu ; see above
506 MENU_CALL tLogOffset, do_log_offset_menu 648 MENU_CALL tLogOffset, do_log_offset_menu ;
507 MENU_OPTION tAltMode, oAltMode, 0 649 MENU_OPTION tAltMode, oAltMode, 0
508 MENU_OPTION tDvSalinity, oDiveSalinity, 0 650 MENU_OPTION tDvSalinity, oDiveSalinity, 0
509 MENU_CALL tResetMenu, do_reset_menu 651 MENU_CALL tResetMenu, do_reset_menu ;
510 MENU_CALL tExit, do_return_settings 652 MENU_CALL tBack, do_return_settings
511 MENU_END 653 MENU_END
512 654
513 655
514 do_settings_piezo_menu: 656 do_settings_piezo_menu:
515 ; Menu with features only available in piezo button hardware 657 ; Menu with features only available in piezo button hardware
516 MENU_BEGIN tSystSets, .3 658 MENU_BEGIN tSystSets, .3
517 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity 659 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity
518 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity 660 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity
519 MENU_CALL tExit, do_return_settings_menu_more_pz 661 MENU_CALL tBack, do_return_settings_menu_more_pz
520 MENU_END 662 MENU_END
521 663
522 664
523 do_compass_menu: 665 do_compass_menu:
524 MENU_BEGIN tSystSets, .5 666 MENU_BEGIN tSystSets, .5
525 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surfloop 667 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surfloop
526 ; MENU_OPTION tCompassGain, oCompassGain, 0 668 ; MENU_OPTION tCompassGain, oCompassGain, 0
527 MENU_DYNAMIC menu_cal_x, 0 669 MENU_DYNAMIC menu_cal_x, 0
528 MENU_DYNAMIC menu_cal_y, 0 670 MENU_DYNAMIC menu_cal_y, 0
529 MENU_DYNAMIC menu_cal_z, 0 671 MENU_DYNAMIC menu_cal_z, 0
530 MENU_CALL tExit, do_return_settings_more 672 MENU_CALL tBack, do_return_settings_more
531 MENU_END 673 MENU_END
532 674
533 675
534 ;============================================================================= 676 ;=============================================================================
535 ; Reset and confirmation menu. 677 ; Reset and confirmation menu
536 678
537 do_reset_menu: 679 do_reset_menu:
538 MENU_BEGIN tResetMenu, .6 680 MENU_BEGIN tResetMenu, .6
539 MENU_CALL tExit, do_return_settings_more 681 MENU_CALL tBack, do_return_settings_more
540 MENU_CALL tReboot, do_reset_menu2 ; Confirm 682 MENU_CALL tReboot, do_reset_menu2 ; confirm
541 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm 683 MENU_CALL tResetDeco, do_reset_menu3 ; confirm
542 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm 684 MENU_CALL tResetSettings, do_reset_menu4 ; confirm
543 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm 685 MENU_CALL tResetLogbook, do_reset_menu5 ; confirm
544 MENU_CALL tResetBattery, do_new_battery_menu ; Confirm 686 MENU_CALL tResetBattery, do_new_battery_menu ; confirm
545 MENU_END 687 MENU_END
546 688
547 do_reset_menu2: 689 do_reset_menu2:
548 MENU_BEGIN tResetMenu2, .2 690 MENU_BEGIN tResetMenu2, .2
549 MENU_CALL tAbort, do_return_settings_more_deeper 691 MENU_CALL tAbort, do_return_settings_more_deeper
550 MENU_CALL tReboot, do_reboot ; Reboot 692 MENU_CALL tReboot, do_reboot ; reboot
551 MENU_END 693 MENU_END
552 694
553 do_reset_menu3: 695 do_reset_menu3:
554 MENU_BEGIN tResetMenu2, .2 696 MENU_BEGIN tResetMenu2, .2
555 MENU_CALL tAbort, do_return_settings_more_deeper 697 MENU_CALL tAbort, do_return_settings_more_deeper
556 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco 698 MENU_CALL tResetDeco, do_reset_deco ; reset deco
557 MENU_END 699 MENU_END
558 700
559 do_reset_menu4: 701 do_reset_menu4:
560 MENU_BEGIN tResetMenu2, .2 702 MENU_BEGIN tResetMenu2, .2
561 MENU_CALL tAbort, do_return_settings_more_deeper 703 MENU_CALL tAbort, do_return_settings_more_deeper
562 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings 704 MENU_CALL tResetSettings, do_reset_settings ; reset all settings
563 MENU_END 705 MENU_END
564 706
565 do_reset_menu5: 707 do_reset_menu5:
566 MENU_BEGIN tResetMenu2, .2 708 MENU_BEGIN tResetMenu2, .2
567 MENU_CALL tAbort, do_return_settings_more_deeper 709 MENU_CALL tAbort, do_return_settings_more_deeper
568 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook 710 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook
569 MENU_END 711 MENU_END
570 712
571 713
572 do_reset_logbook: 714 do_reset_logbook:
573 clrf EEADRH ; Make sure to select EEPROM bank 0 715 clrf EEADRH ; make sure to select EEPROM bank 0
574 clrf EEDATA 716 clrf EEDATA
575 read_int_eeprom .2 717 read_int_eeprom .2
576 write_int_eeprom .16 718 write_int_eeprom .16
577 read_int_eeprom .3 719 read_int_eeprom .3
578 write_int_eeprom .17 ; Copy number of dives 720 write_int_eeprom .17 ; copy number of dives
579 clrf EEDATA 721 clrf EEDATA
580 write_int_eeprom .2 722 write_int_eeprom .2
581 write_int_eeprom .3 ; Clear total dives 723 write_int_eeprom .3 ; clear total dives
582 write_int_eeprom .4 724 write_int_eeprom .4
583 write_int_eeprom .5 725 write_int_eeprom .5
584 write_int_eeprom .6 ; Reset logbook pointers 726 write_int_eeprom .6 ; reset logbook pointers
585 call ext_flash_erase_logbook ; And complete logbook (!) 727 call ext_flash_erase_logbook ; and complete logbook
586 728 bra do_return_settings_more_deeper
587 goto do_return_settings_more_deeper
588 729
589 730
590 do_reset_deco: 731 do_reset_deco:
591 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine 732 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine
592 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine 733 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine
593 734
594 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) 735 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code)
595 call deco_calc_dive_interval_1min; calculate deco in surface mode 736 call deco_calc_dive_interval_1min; calculate deco in surface mode
596 call deco_calc_desaturation_time ; calculate desaturation and no-fly time 737 call deco_calc_desaturation_time ; calculate desaturation and no-fly time
597 banksel common 738 banksel common
598 739 bra do_return_settings_more_deeper
599 goto do_return_settings_more_deeper
600 740
601 741
602 do_reset_settings: 742 do_reset_settings:
603 call TFT_ClearScreen ; Clear screen 743 call TFT_ClearScreen ; clear screen
604 banksel common ; (probably not needed) 744 call option_reset_all ; reset all options to factory default
605 call option_reset_all ; Reset all options to factory default. 745 goto restart ; restart into surfacemode
606 goto restart ; Restart into surfacemode
607 746
608 do_reboot: 747 do_reboot:
609 call ext_flash_enable_protection ; Enables write protection 748 call ext_flash_enable_protection ; enables write protection
610 reset 749 reset
611 750
612 751
613 do_date_time_menu: 752 do_date_time_menu:
614 MENU_BEGIN tSetTimeDate, .4 753 MENU_BEGIN tSetTimeDate, .4
615 MENU_CALL tSetTime, do_time_menu 754 MENU_CALL tSetTime, do_time_menu
616 MENU_CALL tSetDate, do_date_menu 755 MENU_CALL tSetDate, do_date_menu
617 MENU_OPTION tDateFormat,oDateFormat, 0 756 MENU_OPTION tDateFormat,oDateFormat, 0
618 MENU_CALL tExit, do_return_settings 757 MENU_CALL tBack, do_return_settings
619 MENU_END 758 MENU_END
620 759
621 760
622 do_date_menu: 761 do_date_menu:
623 bsf settime_setdate 762 bsf settime_setdate
624 763
625 MENU_BEGIN tSetDate, .4 764 MENU_BEGIN tSetDate, .4
626 MENU_OPTION tSetDay, oSetDay, 0 765 MENU_OPTION tSetDay, oSetDay, 0
627 MENU_OPTION tSetMonth, oSetMonth, 0 766 MENU_OPTION tSetMonth, oSetMonth, 0
628 MENU_OPTION tSetYear, oSetYear, 0 767 MENU_OPTION tSetYear, oSetYear, 0
629 MENU_CALL tExit, do_return_settings_deeper 768 MENU_CALL tBack, do_return_settings_deeper
630 MENU_END 769 MENU_END
631 770
632 771
633 do_reset_seconds: 772 do_reset_seconds:
634 clrf secs 773 clrf secs
641 780
642 MENU_BEGIN tSetTime, .4 781 MENU_BEGIN tSetTime, .4
643 MENU_OPTION tSetHours, oSetHours, 0 782 MENU_OPTION tSetHours, oSetHours, 0
644 MENU_OPTION tSetMinutes, oSetMinutes, 0 783 MENU_OPTION tSetMinutes, oSetMinutes, 0
645 MENU_CALL tSetSeconds, do_reset_seconds 784 MENU_CALL tSetSeconds, do_reset_seconds
646 MENU_CALL tExit, do_return_settings_deeper 785 MENU_CALL tBack, do_return_settings_deeper
647 MENU_END 786 MENU_END
648 787
649 788
650 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. 789 do_toggle_ppo2_max: ; add 0.1 bar, with hard-coded max.
651 movff char_I_ppO2_max,lo ; banksafe 790 movff char_I_ppO2_max,lo ; banksafe
652 movlw .10 791 movlw .10
653 addwf lo,F 792 addwf lo,F
654 movlw ppo2_warning_high_highest 793 movlw ppo2_warning_high_highest
655 cpfsgt lo 794 cpfsgt lo
658 movwf lo 797 movwf lo
659 do_toggle_ppo2_max2: 798 do_toggle_ppo2_max2:
660 movff lo,char_I_ppO2_max 799 movff lo,char_I_ppO2_max
661 return 800 return
662 801
663 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. 802 do_toggle_ppo2_max_deco: ; add 0.1 bar, with hard-coded max.
664 movff char_I_ppO2_max_deco,lo ; banksafe 803 movff char_I_ppO2_max_deco,lo ; banksafe
665 movlw .10 804 movlw .10
666 addwf lo,F 805 addwf lo,F
667 movlw ppo2_warning_deco_highest 806 movlw ppo2_warning_deco_highest
668 cpfsgt lo 807 cpfsgt lo
671 movwf lo 810 movwf lo
672 do_toggle_ppo2_max_deco2: 811 do_toggle_ppo2_max_deco2:
673 movff lo,char_I_ppO2_max_deco 812 movff lo,char_I_ppO2_max_deco
674 return 813 return
675 814
676 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. 815 do_toggle_ppo2_min: ; sub 0.1 bar, with hard-coded min.
677 movff char_I_ppO2_min,lo ; banksafe 816 movff char_I_ppO2_min,lo ; banksafe
678 incf lo,F 817 incf lo,F
679 movlw ppo2_warning_low_highest 818 movlw ppo2_warning_low_highest
680 cpfsgt lo 819 cpfsgt lo
681 bra do_toggle_ppo2_min2 820 bra do_toggle_ppo2_min2
683 movwf lo 822 movwf lo
684 do_toggle_ppo2_min2: 823 do_toggle_ppo2_min2:
685 movff lo,char_I_ppO2_min 824 movff lo,char_I_ppO2_min
686 return 825 return
687 826
688 do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. 827 do_toggle_ppo2_min_cc: ; sub 0.1 bar, with hard-coded min.
689 movff char_I_ppO2_min_loop,lo ; banksafe 828 movff char_I_ppO2_min_loop,lo ; banksafe
690 incf lo,F 829 incf lo,F
691 movlw ppo2_warning_loop_highest 830 movlw ppo2_warning_loop_highest
692 cpfsgt lo 831 cpfsgt lo
693 bra do_toggle_ppo2_min_cc2 832 bra do_toggle_ppo2_min_cc2
704 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 843 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0
705 MENU_CALL tLogOffsetp1, do_logoffset_plus1 844 MENU_CALL tLogOffsetp1, do_logoffset_plus1
706 MENU_CALL tLogOffsetp10, do_logoffset_plus10 845 MENU_CALL tLogOffsetp10, do_logoffset_plus10
707 MENU_CALL tLogOffsetm1, do_logoffset_minus1 846 MENU_CALL tLogOffsetm1, do_logoffset_minus1
708 MENU_CALL tLogOffsetm10, do_logoffset_minus10 847 MENU_CALL tLogOffsetm10, do_logoffset_minus10
709 MENU_CALL tExit, do_return_settings_more 848 MENU_CALL tBack, do_return_settings_more
710 MENU_END 849 MENU_END
711 850
712 851
713 do_logoffset_minus1: 852 do_logoffset_minus1:
714 call do_logoffset_common_read ; Read into lo:hi 853 call do_logoffset_common_read ; read into lo:hi
715 movlw .1 854 movlw .1
716 subwf lo 855 subwf lo
717 movlw .0 856 movlw .0
718 subwfb hi 857 subwfb hi
719 btfss hi,7 ; <0? 858 btfss hi,7 ; < 0 ?
720 goto do_logoffset_common_write ; Store and return 859 bra do_logoffset_exit ; store and return
721 clrf lo 860 clrf lo
722 clrf hi 861 clrf hi
723 goto do_logoffset_common_write ; Store and return 862 bra do_logoffset_exit ; store and return
724 863
725 do_logoffset_minus10: 864 do_logoffset_minus10:
726 call do_logoffset_common_read ; Read into lo:hi 865 call do_logoffset_common_read ; read into lo:hi
727 movlw .10 866 movlw .10
728 subwf lo 867 subwf lo
729 movlw .0 868 movlw .0
730 subwfb hi 869 subwfb hi
731 btfss hi,7 ; <0? 870 btfss hi,7 ; < 0 ?
732 goto do_logoffset_common_write ; Store and return 871 bra do_logoffset_exit ; store and return
733 clrf lo 872 clrf lo
734 clrf hi 873 clrf hi
735 goto do_logoffset_common_write ; Store and return 874 bra do_logoffset_exit ; store and return
736 875
737 do_logoffset_plus1: 876 do_logoffset_plus1:
738 call do_logoffset_common_read ; Read into lo:hi 877 call do_logoffset_common_read ; read into lo:hi
739 infsnz lo,F 878 infsnz lo,F
740 incf hi,F 879 incf hi,F
741 goto do_logoffset_common_write ; Store and return 880 bra do_logoffset_exit ; store and return
742 881
743 do_logoffset_plus10: 882 do_logoffset_plus10:
744 call do_logoffset_common_read ; Read into lo:hi 883 call do_logoffset_common_read ; read into lo:hi
745 movlw .10 884 movlw .10
746 addwf lo 885 addwf lo
747 movlw .0 886 movlw .0
748 addwfc hi 887 addwfc hi
749 goto do_logoffset_common_write ; Store and return 888 do_logoffset_exit:
889 goto do_logoffset_common_write ; store and return
750 890
751 do_return_dispsets_menu: 891 do_return_dispsets_menu:
752 bcf in_color_menu 892 bcf in_color_menu
753 call menu_processor_double_pop ; drop exit line and back to last line 893 call menu_processor_double_pop ; drop exit line and back to last line
754 894
755 do_dispsets_menu: 895 do_dispsets_menu:
756 MENU_BEGIN tDispSets, .5 896
897 IF _language_2!=none
898 MENU_BEGIN tDispSets, .7
757 MENU_OPTION tBright, oBrightness, 0 899 MENU_OPTION tBright, oBrightness, 0
900 MENU_OPTION tLanguage, oLanguage, 0
901 MENU_OPTION tUnits, oUnits, 0
758 MENU_CALL tColorScheme, do_color_scheme 902 MENU_CALL tColorScheme, do_color_scheme
759 MENU_OPTION tFlip, oFlipScreen, 0 903 MENU_OPTION tFlip, oFlipScreen, 0
760 MENU_CALL tMore, do_dispsets_menu_more 904 MENU_CALL tMore, do_dispsets_menu_more
761 MENU_CALL tExit, do_return_settings 905 MENU_CALL tBack, do_return_settings
762 MENU_END 906 MENU_END
907 ELSE
908 MENU_BEGIN tDispSets, .6
909 MENU_OPTION tBright, oBrightness, 0
910 MENU_OPTION tUnits, oUnits, 0
911 MENU_CALL tColorScheme, do_color_scheme
912 MENU_OPTION tFlip, oFlipScreen, 0
913 MENU_CALL tMore, do_dispsets_menu_more
914 MENU_CALL tBack, do_return_settings
915 MENU_END
916 ENDIF
763 917
764 918
765 do_dispsets_menu_more: 919 do_dispsets_menu_more:
766 MENU_BEGIN tDispSets, .7 920 MENU_BEGIN tDispSets, .7
767 MENU_OPTION tMODwarning, oMODwarning, 0 921 MENU_OPTION tMODwarning, oMODwarning, 0
768 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 922 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0
769 MENU_OPTION tVSItext2, oVSItextv2, 0 923 MENU_OPTION tVSItext2, oVSItextv2, 0
770 MENU_OPTION tVSIgraph, oVSIgraph, 0 924 MENU_OPTION tVSIgraph, oVSIgraph, 0
771 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 925 MENU_OPTION tTimeoutDive, oDiveTimeout, 0
772 MENU_OPTION tUnits, oUnits, 0 926 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0
773 MENU_CALL tExit, do_return_dispsets_menu 927 MENU_CALL tBack, do_return_dispsets_menu
774 MENU_END 928 MENU_END
775 929
776 930
777 do_color_scheme: 931 do_color_scheme:
778 bsf in_color_menu 932 bsf in_color_menu
779 933
780 MENU_BEGIN tColorScheme, .2 934 MENU_BEGIN tColorScheme, .2
781 MENU_OPTION tColorSetDive, oColorSetDive, 0 935 MENU_OPTION tColorSetDive, oColorSetDive, 0
782 MENU_CALL tExit, do_return_dispsets_menu 936 MENU_CALL tBack, do_return_dispsets_menu
783 MENU_END 937 MENU_END
784 938
785 939
786 ;============================================================================= 940 ;=============================================================================
787 941
791 MENU_CALL tYes, do_new_battery_select 945 MENU_CALL tYes, do_new_battery_select
792 MENU_END 946 MENU_END
793 947
794 global do_new_battery_select 948 global do_new_battery_select
795 do_new_battery_select: 949 do_new_battery_select:
796 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately 950
797 call TFT_boot ; Initialize TFT (includes clear screen) 951 IFDEF _screendump
798 call TFT_Display_FadeIn ; Show splash 952 bsf enable_screen_dumps ; to prevent exiting into COMM mode immediately
953 ELSE
954 bsf disable_comm_mode ; to prevent exiting into COMM mode immediately
955 ENDIF
956
957 call TFT_boot ; initialize TFT (includes clear screen)
958 call TFT_Display_FadeIn ; show splash
799 movlw .100 959 movlw .100
800 movwf batt_percent ; make sure to reset batt_percent 960 movwf batt_percent ; make sure to reset batt_percent
801 961
802 ; Default (In cases of timeout or USB): Use old battery 962 ; Default (in cases of timeout or USB): use old battery
803 clrf EEADRH 963 clrf EEADRH
804 read_int_eeprom 0x07 964 read_int_eeprom 0x07
805 movff EEDATA,battery_gauge+0 965 movff EEDATA,battery_gauge+0
806 read_int_eeprom 0x08 966 read_int_eeprom 0x08
807 movff EEDATA,battery_gauge+1 967 movff EEDATA,battery_gauge+1
812 read_int_eeprom 0x0B 972 read_int_eeprom 0x0B
813 movff EEDATA,battery_gauge+4 973 movff EEDATA,battery_gauge+4
814 read_int_eeprom 0x0C 974 read_int_eeprom 0x0C
815 movff EEDATA,battery_gauge+5 975 movff EEDATA,battery_gauge+5
816 976
817 call menu_processor_reset ; restart from first icon. 977 call menu_processor_reset ; restart from first item
818 978
819 ; hardware_flag: 979 ; hardware_flag1:
820 ; 3: 0x0A or 0x13 (2016) 980 ; 3: 0x0A or 0x13 (2016)
821 ; cR: 0x05 981 ; cR: 0x05
822 ; 2 with BLE: 0x11 982 ; 2 with BLE: 0x11
823 ; Sport: 0x12 983 ; Sport: 0x12
824 ; 3 with BLE: 0x1A 984 ; 3 with BLE: 0x1A
825 985
826 movlw 0x0A 986 movlw 0x0A
827 cpfseq hardware_flag 987 cpfseq hardware_flag1
828 bra $+4 988 bra $+4
829 bra menu_new_battery_AA 989 bra menu_new_battery_AA
830 movlw 0x13 990 movlw 0x13
831 cpfseq hardware_flag 991 cpfseq hardware_flag1
832 bra $+4 992 bra $+4
833 bra menu_new_battery_AA_16650 993 bra menu_new_battery_AA_16650
834 movlw 0x12 994 movlw 0x12
835 cpfseq hardware_flag 995 cpfseq hardware_flag1
836 bra $+4 996 bra $+4
837 bra menu_new_battery_AA 997 bra menu_new_battery_AA
838 movlw 0x1A 998 movlw 0x1A
839 cpfseq hardware_flag 999 cpfseq hardware_flag1
840 bra $+4 1000 bra $+4
841 bra menu_new_battery_AA 1001 bra menu_new_battery_AA
842 movlw 0x11 1002 movlw 0x11
843 cpfseq hardware_flag 1003 cpfseq hardware_flag1
844 bra $+4 1004 bra $+4
845 bra menu_new_battery_18650 1005 bra menu_new_battery_18650
846 movlw 0x05 1006 movlw 0x05
847 cpfseq hardware_flag 1007 cpfseq hardware_flag1
848 bra $+4 1008 bra $+4
849 bra menu_new_battery_18650 1009 bra menu_new_battery_18650
850 bra use_old_batteries ; any unsupported value 1010 bra use_old_batteries ; any unsupported value
851 1011
852 1012
878 1038
879 global use_old_prior_209 1039 global use_old_prior_209
880 use_old_prior_209: 1040 use_old_prior_209:
881 clrf EEADRH 1041 clrf EEADRH
882 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah 1042 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
883 incfsz EEDATA,F ; Was 0xFF? 1043 incfsz EEDATA,F ; was 0xFF?
884 return ; No, done. 1044 return ; NO - done
885 1045
886 call lt2942_get_status ; Check for gauge IC 1046 call lt2942_get_status ; check for gauge IC
887 movlw .3 ; Assume a 18650 1047 movlw .3 ; Assume a 18650
888 btfss battery_gauge_available ; cR/2 hardware? 1048 btfss battery_gauge_available ; cR/2 hardware?
889 movlw .1 ; Assume a Saft 1049 movlw .1 ; assume a Saft
890 movwf EEDATA 1050 movwf EEDATA
891 write_int_eeprom 0x0F ; Store the new battery type into EEPROM 1051 write_int_eeprom 0x0F ; store the new battery type into EEPROM
892 return 1052 return
893 1053
894 1054
895 global use_old_batteries 1055 global use_old_batteries
896 use_old_batteries: 1056 use_old_batteries:
908 read_int_eeprom 0x0C 1068 read_int_eeprom 0x0C
909 movff EEDATA,battery_gauge+5 1069 movff EEDATA,battery_gauge+5
910 read_int_eeprom 0x0F 1070 read_int_eeprom 0x0F
911 movff EEDATA,battery_type ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah 1071 movff EEDATA,battery_type ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah
912 1072
913 rcall setup_new_saft ; Any other value 1073 rcall setup_new_saft ; any other value
914 incf EEDATA,F ; 1 ... 5 1074 incf EEDATA,F ; 1...5
915 dcfsnz EEDATA,F 1075 dcfsnz EEDATA,F
916 rcall setup_new_15v ;=0 1076 rcall setup_new_15v ; =0
917 dcfsnz EEDATA,F 1077 dcfsnz EEDATA,F
918 rcall setup_new_saft ;=1 1078 rcall setup_new_saft ; =1
919 dcfsnz EEDATA,F 1079 dcfsnz EEDATA,F
920 rcall setup_new_panasonic ;=2 1080 rcall setup_new_panasonic ; =2
921 dcfsnz EEDATA,F 1081 dcfsnz EEDATA,F
922 rcall setup_new_18650 ;=3 1082 rcall setup_new_18650 ; =3
923 dcfsnz EEDATA,F 1083 dcfsnz EEDATA,F
924 rcall setup_new_16650 ;=4 1084 rcall setup_new_16650 ; =4
925 1085
926 bcf use_old_batt_flag ; clear flag 1086 bcf use_old_batt_flag ; clear flag
927 goto surfloop ; Jump to Surfaceloop! 1087
1088 IFNDEF _screendump
1089 bcf disable_comm_mode ; re-enable COMM mode again
1090 ENDIF
1091
1092 goto surfloop ; jump to surface loop
928 1093
929 1094
930 setup_new_15v: 1095 setup_new_15v:
931 bsf charge_disable 1096 bsf charge_disable
932 bcf TRISE,2 1097 bcf TRISE,2
933 movlw .100 1098 movlw .100
934 movwf batt_percent ; To have 1,5V batteries right after firmware update 1099 movwf batt_percent ; to have 1.5V batteries right after firmware update
935 movlw .0 1100 movlw .0
936 movff WREG,battery_type 1101 movff WREG,battery_type
937 return 1102 return
938 1103
939 1104
958 movff WREG,battery_type 1123 movff WREG,battery_type
959 return 1124 return
960 1125
961 1126
962 setup_new_panasonic: 1127 setup_new_panasonic:
963 banksel battery_capacity 1128 banksel battery_capacity
964 movlw LOW internal_panasonic_capacity 1129 movlw LOW internal_panasonic_capacity
965 movwf internal_battery_capacity+0 1130 movwf internal_battery_capacity+0
966 movlw HIGH internal_panasonic_capacity 1131 movlw HIGH internal_panasonic_capacity
967 movwf internal_battery_capacity+1 1132 movwf internal_battery_capacity+1
968 movlw LOW panasonic_capacity 1133 movlw LOW panasonic_capacity
1021 return 1186 return
1022 1187
1023 1188
1024 use_16650_battery: 1189 use_16650_battery:
1025 rcall setup_new_16650 1190 rcall setup_new_16650
1026 bra use_new_36V_2 1191 bra use_batt_exit
1027 use_18650_battery: 1192 use_18650_battery:
1028 rcall setup_new_18650 1193 rcall setup_new_18650
1029 bra use_new_36V_2 1194 bra use_batt_exit
1030 use_new_36V_batteries: 1195 use_new_36V_batteries:
1031 rcall setup_new_saft 1196 rcall setup_new_saft
1032 bra use_new_36V_2 1197 bra use_batt_exit
1033 use_new_15V_batteries: 1198 use_new_15V_batteries:
1034 rcall setup_new_15v 1199 rcall setup_new_15v
1035 use_new_36V_2: 1200 use_batt_exit:
1036 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 1201 call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5
1037 goto surfloop ; Jump to Surface loop! 1202 use_batt_exit1:
1203
1204 IFNDEF _screendump
1205 bcf disable_comm_mode ; re-enable COMM mode again
1206 ENDIF
1207
1208 goto surfloop ; jump to surface loop
1209
1038 use_36V_rechargeable: 1210 use_36V_rechargeable:
1039 rcall setup_new_panasonic 1211 rcall setup_new_panasonic
1040 call reset_battery_internal_only 1212 call reset_battery_internal_only
1041 goto surfloop ; Jump to Surface loop! 1213 bra use_batt_exit1 ; jump to surface loop
1042 1214
1043 END 1215 END