Mercurial > public > hwos_code
comparison src/menu_tree.asm @ 582:b455b31ce022
work on 2.97 stable
author | heinrichsweikamp |
---|---|
date | Mon, 26 Feb 2018 16:40:28 +0100 |
parents | 8b7ea27ea1fa |
children | cb59872ad53d |
comparison
equal
deleted
inserted
replaced
581:f5de1ff88814 | 582:b455b31ce022 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File menu_tree.asm REFACTORED VERSION V2.95 | 3 ; File menu_tree.asm REFACTORED VERSION V2.98 |
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" |
27 | 27 |
28 CBLOCK tmp+0x40 ; Keep space for menu processor | 28 |
29 gaslist_gas ; Check ram position in gaslist.asm, too! | 29 extern do_demo_divemode |
30 ENDC | 30 extern restart |
31 | 31 extern option_save_all |
32 gui CODE | 32 extern option_reset |
33 extern do_demo_planner | |
34 extern calibrate_mix | |
35 extern comm_mode0 | |
36 extern piezo_config | |
37 extern compass_calibration_loop | |
38 extern option_reset_all | |
39 extern rtc_set_rtc | |
40 extern surfloop | |
41 extern oColorSetDive | |
42 | |
43 | |
44 gui CODE | |
45 | |
33 ;============================================================================= | 46 ;============================================================================= |
34 ; Main Menu | 47 ; Main Menu |
35 global do_main_menu,do_main_menu2 | 48 |
49 do_return_main_menu: | |
50 call menu_processor_double_pop ; drop exit line and back to last line | |
51 bra do_main_menu_common | |
52 | |
53 global do_main_menu | |
36 do_main_menu: | 54 do_main_menu: |
37 movff menupos3,customview_surfmode; save last customview | 55 movff menupos3,customview_surfmode ; save last customview |
38 do_main_menu2: | 56 |
39 call TFT_boot | 57 global do_main_menu2 |
40 bcf sleepmode ; for timeout | 58 do_main_menu2: ; entry point used by logbook.asm |
41 call menu_processor_reset ; restart from first icon. | 59 call TFT_boot |
42 | 60 bcf sleepmode ; for timeout |
43 do_continue_main_menu: | 61 call menu_processor_reset ; restart from first icon |
44 rcall menu_tree_double_pop ; drop exit line and back to last line | 62 |
45 | 63 do_main_menu_common: |
46 extern do_demo_divemode, restart | 64 MENU_BEGIN tMainMenu, .7 |
47 MENU_BEGIN tMainMenu, .7 | 65 MENU_CALL tLogbook, logbook |
48 MENU_CALL tLogbook, logbook | 66 MENU_CALL tGasSetup, do_gas_menu |
49 MENU_CALL tGasSetup, do_gas_menu | 67 MENU_CALL tCCRSetup, do_ccr_menu |
50 MENU_CALL tCCRSetup, do_ccr_menu | 68 MENU_CALL tPlan, do_planner_menu |
51 MENU_CALL tPlan, do_planner_menu_reset | 69 MENU_CALL tDiveModeMenu, do_divemode_menu |
52 MENU_CALL tDiveModeMenu, do_divemode_menu | 70 MENU_CALL tSystSets, do_settings_menu |
53 MENU_CALL tSystSets, do_settings_menu | 71 MENU_CALL tExit, restart |
54 MENU_CALL tExit, restart | 72 MENU_END |
55 MENU_END | 73 |
56 | |
57 do_info_menu: | |
58 MENU_BEGIN tInfoMenu, .6 | |
59 MENU_DYNAMIC info_menu_serial, 0 | |
60 MENU_DYNAMIC info_menu_firmware, 0 | |
61 MENU_DYNAMIC info_menu_battery_volts,0 | |
62 MENU_DYNAMIC info_menu_uptime, 0 | |
63 MENU_DYNAMIC info_menu_total_dives, 0 | |
64 MENU_CALL tExit, do_return_settings | |
65 MENU_END | |
66 | 74 |
67 ;============================================================================= | 75 ;============================================================================= |
68 ; CCR Setup | 76 ; CCR Setup |
69 | 77 |
70 return_ccr_menu: | 78 do_return_ccr_menu: |
71 rcall menu_tree_double_pop ; drop exit line and back to last line | 79 call menu_processor_double_pop ; drop exit line and back to last line |
72 | 80 |
73 do_ccr_menu: | 81 do_ccr_menu: |
74 bcf menu_show_sensors2 ; Clear flag | 82 bcf menu_show_sensors2 ; stop imprinting of live sensor values |
75 btfsc analog_o2_input | 83 |
76 bra do_ccr_menu_cR | 84 btfsc analog_o2_input |
77 | 85 bra do_ccr_menu_cR |
78 ; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu | 86 |
79 ; btfss optical_input | 87 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu |
80 ; bra do_ccr_menu_ostc2 | 88 ; btfss optical_input |
81 | 89 ; bra do_ccr_menu_ostc2 |
82 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu (and currently also the OSTC2 menu) | 90 |
83 MENU_OPTION tCCRMode, oCCRMode, 0 | 91 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu (and currently also the OSTC2 menu) |
84 MENU_CALL tDiluentSetup, do_diluent_setup | 92 MENU_OPTION tCCRMode, oCCRMode, 0 |
85 MENU_CALL tFixedSetpoints, do_fixed_setpoints | 93 MENU_CALL tDiluentSetup, do_diluent_setup |
86 MENU_CALL tPSCRMenu, do_PSCR_menu | 94 MENU_CALL tFixedSetpoints, do_fixed_setpoints |
87 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | 95 MENU_CALL tPSCRMenu, do_PSCR_menu |
88 MENU_CALL tExit, do_continue_main_menu | 96 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 |
89 MENU_END | 97 MENU_CALL tExit, do_return_main_menu |
90 | 98 MENU_END |
91 do_ccr_menu_cR: ; cR menu | 99 |
92 MENU_BEGIN tCCRSetup, .7 | 100 |
93 MENU_OPTION tCCRMode, oCCRMode, 0 | 101 do_ccr_menu_cR: ; cR menu |
94 MENU_CALL tCalibrateMenu, do_calibrate_menu | 102 MENU_BEGIN tCCRSetup, .7 |
95 MENU_CALL tDiluentSetup, do_diluent_setup | 103 MENU_OPTION tCCRMode, oCCRMode, 0 |
96 MENU_CALL tFixedSetpoints, do_fixed_setpoints | 104 MENU_CALL tCalibrateMenu, do_calibrate_menu |
97 MENU_CALL tPSCRMenu, do_PSCR_menu | 105 MENU_CALL tDiluentSetup, do_diluent_setup |
98 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | 106 MENU_CALL tFixedSetpoints, do_fixed_setpoints |
99 MENU_CALL tExit, do_continue_main_menu | 107 MENU_CALL tPSCRMenu, do_PSCR_menu |
100 MENU_END | 108 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 |
101 | 109 MENU_CALL tExit, do_return_main_menu |
102 ; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu | 110 MENU_END |
111 | |
112 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu | |
103 ;do_ccr_menu_ostc2: | 113 ;do_ccr_menu_ostc2: |
104 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu | 114 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu |
105 ; MENU_OPTION tCCRMode, oCCRMode, 0 | 115 ; MENU_OPTION tCCRMode, oCCRMode, 0 |
106 ; MENU_CALL tDiluentSetup, do_diluent_setup | 116 ; MENU_CALL tDiluentSetup, do_diluent_setup |
107 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints | 117 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints |
108 ; MENU_CALL tPSCRMenu, do_PSCR_menu | 118 ; MENU_CALL tPSCRMenu, do_PSCR_menu |
109 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | 119 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 |
110 ; MENU_CALL tExit, do_continue_main_menu | 120 ; MENU_CALL tExit, do_return_main_menu |
111 ; MENU_END | 121 ; MENU_END |
122 | |
123 | |
124 do_calibrate_menu: | |
125 call enable_ir_s8 ; Enable IR/S8-Port | |
126 bsf menu_show_sensors2 ; start imprinting of live sensor values | |
127 | |
128 do_calibrate_menu2: | |
129 MENU_BEGIN tCalibrateMenu, .6 | |
130 MENU_CALL tDiveHudMask1, 0 | |
131 MENU_CALL tDiveHudMask2, 0 | |
132 MENU_CALL tDiveHudMask3, 0 | |
133 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | |
134 MENU_CALL tCalibrate, do_calibrate_mix | |
135 MENU_CALL tExit, do_return_ccr_menu | |
136 MENU_END | |
137 | |
138 | |
139 do_calibrate_mix: | |
140 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected | |
141 WAITMS d'250' ; Wait for HUD v3 | |
142 movlw .9 | |
143 movff WREG,customview_surfmode ; show sensor mV custom view after restart | |
144 goto restart ; Restart into surface mode | |
145 | |
146 | |
147 do_diluent_setup: | |
148 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
149 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
150 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
151 | |
152 MENU_BEGIN tDiluentSetup, .6 | |
153 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
154 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
155 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
156 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
157 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
158 MENU_CALL tExit, do_return_ccr_menu | |
159 MENU_END | |
160 | |
161 | |
162 do_return_fixed_setpoints: | |
163 call menu_processor_double_pop ; drop exit line and back to last line | |
164 | |
165 do_fixed_setpoints: | |
166 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
167 | |
168 MENU_BEGIN tFixedSetpoints, .6 | |
169 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
170 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
171 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
172 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
173 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
174 MENU_CALL tExit, do_return_ccr_menu | |
175 MENU_END | |
176 | |
177 | |
178 do_edit_sp_menu: | |
179 call gaslist_setSP ; Save current item. | |
180 | |
181 MENU_BEGIN tFixedSetpoints, .5 | |
182 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 | |
183 MENU_CALL tSPPlus, gaslist_spplus | |
184 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
185 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
186 MENU_CALL tExit, do_return_fixed_setpoints | |
187 MENU_END | |
188 | |
112 | 189 |
113 do_PSCR_menu: | 190 do_PSCR_menu: |
114 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu | 191 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu |
115 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 | 192 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 |
116 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 | 193 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 |
117 MENU_CALL tExit, return_ccr_menu | 194 MENU_CALL tExit, do_return_ccr_menu |
118 MENU_END | 195 MENU_END |
119 | |
120 do_calibrate_menu: | |
121 call enable_ir_s8 ; Enable IR/S8-Port | |
122 bsf menu_show_sensors2 ; Set flag | |
123 do_calibrate_menu2: | |
124 MENU_BEGIN tCalibrateMenu, .6 | |
125 MENU_CALL tDiveHudMask1, 0 | |
126 MENU_CALL tDiveHudMask2, 0 | |
127 MENU_CALL tDiveHudMask3, 0 | |
128 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | |
129 MENU_CALL tCalibrate, do_calibrate_mix | |
130 MENU_CALL tExit, return_ccr_menu | |
131 MENU_END | |
132 | |
133 do_calibrate_mix: | |
134 extern calibrate_mix | |
135 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected | |
136 WAITMS d'250' ; Wait for HUD v3 | |
137 movlw .9 | |
138 movwf customview_surfmode ; show sensor mV custom view after restart | |
139 goto restart ; Restart into surface mode | |
140 | |
141 | |
142 do_diluent_setup: | |
143 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
144 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
145 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
146 MENU_BEGIN tDiluentSetup, .6 | |
147 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
148 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
149 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
150 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
151 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
152 MENU_CALL tExit, return_ccr_menu | |
153 MENU_END | |
154 | |
155 do_return_fixed_setpoints: | |
156 rcall menu_tree_double_pop ; drop exit line and back to last line | |
157 | |
158 do_fixed_setpoints: | |
159 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
160 MENU_BEGIN tFixedSetpoints, .6 | |
161 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
162 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
163 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
164 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
165 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
166 MENU_CALL tExit, return_ccr_menu | |
167 MENU_END | |
168 | |
169 do_edit_sp_menu: | |
170 call gaslist_setSP ; Save current item. | |
171 MENU_BEGIN tFixedSetpoints, .5 | |
172 MENU_DYNAMIC gaslist_strcat_setpoint_0,0 | |
173 MENU_CALL tSPPlus, gaslist_spplus | |
174 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
175 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
176 MENU_CALL tExit, do_return_fixed_setpoints | |
177 MENU_END | |
178 | 196 |
179 ;============================================================================= | 197 ;============================================================================= |
180 ; OC Gas Setup | 198 ; OC Gas Setup |
181 | 199 |
182 return_gas_menu: | 200 do_return_gas_menu: |
183 rcall menu_tree_double_pop ; drop exit line and back to last line | 201 call menu_processor_double_pop ; drop exit line and back to last line |
184 | 202 |
185 btfsc ccr_diluent_setup ; Return to CCR-Menu? | 203 btfsc ccr_diluent_setup ; Return to CCR-Menu? |
186 bra do_diluent_setup ; Yes. | 204 bra do_diluent_setup ; Yes. |
205 | |
187 do_gas_menu: | 206 do_gas_menu: |
188 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | 207 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
189 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | 208 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
190 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | 209 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
191 MENU_BEGIN tGaslist, .6 | 210 |
192 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | 211 MENU_BEGIN tGaslist, .6 |
193 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | 212 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu |
194 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | 213 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu |
195 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | 214 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu |
196 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | 215 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu |
197 MENU_CALL tExit, do_continue_main_menu | 216 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu |
198 MENU_END | 217 MENU_CALL tExit, do_return_main_menu |
199 | 218 MENU_END |
200 return_gas_depth: | 219 |
201 rcall menu_tree_double_pop ; drop exit line and back to last line | 220 |
202 bra do_edit_gas_menu_1 | 221 do_return_edit_gas_menu: |
222 call menu_processor_pop ; drop exit line and ... | |
223 do_abort_gas_depth_menu: | |
224 call menu_processor_pop ; back to last line | |
225 bra do_edit_gas_menu_common | |
203 | 226 |
204 do_edit_gas_menu: | 227 do_edit_gas_menu: |
205 call gaslist_setgas ; Save current item. | 228 call gaslist_setgas ; set gaslist_gas |
206 do_edit_gas_menu_1: ; Keep current gas. | 229 |
207 MENU_BEGIN tGasEdit, .6 | 230 do_edit_gas_menu_common: ; keep current gas |
208 MENU_DYNAMIC gaslist_gastitle, 0 | 231 MENU_BEGIN tGasEdit, .6 |
209 MENU_DYNAMIC gaslist_MOD_END, 0 | 232 MENU_DYNAMIC gaslist_gastitle, 0 |
210 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | 233 MENU_DYNAMIC gaslist_MOD_END, 0 |
211 MENU_CALL tSetup_mix, do_setup_mix | 234 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type |
212 MENU_CALL tGasDepth, do_gas_depth_menu | 235 MENU_CALL tSetup_mix, do_setup_mix |
213 MENU_CALL tExit, return_gas_menu | 236 MENU_CALL tGasDepth, do_gas_depth_menu |
214 MENU_END | 237 MENU_CALL tExit, do_return_gas_menu |
238 MENU_END | |
239 | |
215 | 240 |
216 do_setup_mix: | 241 do_setup_mix: |
217 MENU_BEGIN tGasEdit, .7 | 242 MENU_BEGIN tGasEdit, .7 |
218 MENU_DYNAMIC gaslist_gastitle, 0 | 243 MENU_DYNAMIC gaslist_gastitle, 0 |
219 MENU_DYNAMIC gaslist_MOD_END, 0 | 244 MENU_DYNAMIC gaslist_MOD_END, 0 |
220 MENU_CALL tO2Plus, gaslist_pO2 | 245 MENU_CALL tO2Plus, gaslist_pO2 |
221 MENU_CALL tO2Minus, gaslist_mO2 | 246 MENU_CALL tO2Minus, gaslist_mO2 |
222 MENU_CALL tHePlus, gaslist_pHe | 247 MENU_CALL tHePlus, gaslist_pHe |
223 MENU_CALL tHeMinus, gaslist_mHe | 248 MENU_CALL tHeMinus, gaslist_mHe |
224 MENU_CALL tExit, return_gas_depth | 249 MENU_CALL tExit, do_return_edit_gas_menu |
225 MENU_END | 250 MENU_END |
226 | 251 |
227 menu_tree_double_pop: | 252 |
228 call menu_processor_pop ; drop exit line. | |
229 goto menu_processor_pop ; back to last gas and return | |
230 | |
231 | |
232 global do_gas_depth_menu | |
233 do_gas_depth_menu: | 253 do_gas_depth_menu: |
234 movff gaslist_gas,WREG | 254 movff gaslist_gas,WREG |
235 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | 255 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] |
236 movff PLUSW1,lo ; Used as temp | 256 movff PLUSW1,lo ; Used as temp |
237 movlw .3 ; 3=Deco | 257 movlw .3 ; 3=Deco |
238 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | 258 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
239 movlw .2 ; 2=Normal | 259 movlw .2 ; 2=Normal |
240 cpfseq lo | 260 cpfseq lo |
241 bra return_gas_depth ; Non-Deco gas or "Normal" Diluent, Return! | 261 bra do_abort_gas_depth_menu ; Non-Deco gas or "Normal" Diluent, abort! |
242 | 262 |
243 MENU_BEGIN tGasEdit, .7 | 263 MENU_BEGIN tGasEdit, .7 |
244 MENU_DYNAMIC gaslist_gastitle, 0 | 264 MENU_DYNAMIC gaslist_gastitle, 0 |
245 MENU_DYNAMIC gaslist_MOD_END, 0 | 265 MENU_DYNAMIC gaslist_MOD_END, 0 |
246 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth | 266 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth |
247 MENU_CALL tDepthPlus, gaslist_pDepth | 267 MENU_CALL tDepthPlus, gaslist_pDepth |
248 MENU_CALL tDepthMinus, gaslist_mDepth | 268 MENU_CALL tDepthMinus, gaslist_mDepth |
249 MENU_DYNAMIC gaslist_reset_mod_title,gaslist_reset_mod | 269 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod |
250 MENU_CALL tExit, return_gas_depth | 270 MENU_CALL tExit, do_return_edit_gas_menu |
251 MENU_END | 271 MENU_END |
252 | 272 |
253 | 273 |
254 ;============================================================================= | 274 ;============================================================================= |
255 ; Simulator menus | 275 ; Simulator menus |
256 | 276 |
257 global do_planner_menu | 277 do_return_planner_menu: |
258 | 278 call menu_processor_pop ; drop exit line and ... |
259 do_planner_menu_reset: | 279 |
260 extern option_save_all | 280 global do_return_demo_planner |
281 do_return_demo_planner: | |
282 call menu_processor_pop ; back to last line | |
283 bra do_planner_common | |
284 | |
285 do_planner_menu: | |
286 ; to have correct simulator results after mode changes without prior excursion to surfacemode | |
261 call option_save_all | 287 call option_save_all |
262 call restart_set_modes_and_flags ; To have correct simulator results for mode changes without prior surfacemode call | 288 call restart_set_modes_and_flags |
263 ;---- Reset dive time/depth to default values | 289 ; Reset dive time/depth to default values |
264 extern option_reset | 290 lfsr FSR0,odiveInterval |
265 lfsr FSR0,odiveInterval | 291 call option_reset |
266 call option_reset | 292 lfsr FSR0,obottomTime |
267 lfsr FSR0,obottomTime | 293 call option_reset |
268 call option_reset | 294 lfsr FSR0,obottomDepth |
269 lfsr FSR0,obottomDepth | 295 call option_reset |
270 call option_reset | 296 |
271 | 297 do_planner_common: |
272 do_planner_menu: | 298 MENU_BEGIN tPlan, .7 |
273 extern do_demo_planner | 299 MENU_OPTION tIntvl, odiveInterval, 0 |
274 MENU_BEGIN tPlan, .7 | 300 MENU_OPTION tBtDep, obottomDepth, 0 |
275 MENU_OPTION tIntvl, odiveInterval, 0 | 301 MENU_CALL tInter, do_demo_divemode |
276 MENU_OPTION tBtDep, obottomDepth, 0 | 302 MENU_OPTION tBtTm, obottomTime, 0 |
277 MENU_CALL tInter, do_demo_divemode | 303 MENU_CALL tDecoSetup, do_planner_config |
278 MENU_OPTION tBtTm, obottomTime, 0 | 304 MENU_CALL tDeco, do_demo_planner |
279 MENU_CALL tDecoSetup, do_planner_config | 305 MENU_CALL tExit, do_return_main_menu |
280 MENU_CALL tDeco, do_demo_planner | 306 MENU_END |
281 MENU_CALL tExit, do_continue_main_menu | |
282 MENU_END | |
283 | 307 |
284 | 308 |
285 do_planner_config: | 309 do_planner_config: |
286 MENU_BEGIN tPlan, .3 | 310 MENU_BEGIN tPlan, .3 |
287 MENU_OPTION tSelectSetpoint,oSimSetpoint, 0 | 311 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 |
288 MENU_OPTION tuseAGF, oSimAGF, 0 | 312 MENU_OPTION tuseAGF, oSimAGF, 0 |
289 MENU_CALL tExit, do_planner_menu | 313 MENU_CALL tExit, do_return_planner_menu |
290 MENU_END | 314 MENU_END |
291 | 315 |
292 | 316 |
293 ;============================================================================= | 317 ;============================================================================= |
294 ; Divemode menu | 318 ; Divemode menu |
295 | 319 |
296 do_return_divemode_menu: | 320 do_return_divemode_menu: |
297 rcall menu_tree_double_pop ; drop exit line and back to last line | 321 call menu_processor_double_pop ; drop exit line and back to last line |
298 | 322 |
299 do_divemode_menu: | 323 do_divemode_menu: |
300 MENU_BEGIN tDiveModeMenu, .7 | 324 MENU_BEGIN tDiveModeMenu, .7 |
301 MENU_OPTION tDvMode, oDiveMode, 0 | 325 MENU_OPTION tDvMode, oDiveMode, 0 |
302 MENU_OPTION tDkMode, oDecoMode, 0 | 326 MENU_OPTION tDkMode, oDecoMode, 0 |
303 MENU_CALL tppO2settings, do_ppo2_menu | 327 MENU_CALL tppO2settings, do_ppo2_menu |
304 MENU_OPTION tsafetystopmenu,oSafetyStop, 0 | 328 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 |
305 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu | 329 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu |
306 MENU_CALL tDecoparameters, do_decoparameters_menu | 330 MENU_CALL tDecoparameters, do_decoparameters_menu |
307 MENU_CALL tExit, do_continue_main_menu | 331 MENU_CALL tExit, do_return_main_menu |
308 MENU_END | 332 MENU_END |
333 | |
309 | 334 |
310 do_ppo2_menu: | 335 do_ppo2_menu: |
311 MENU_BEGIN tppO2settings, .6 | 336 MENU_BEGIN tppO2settings, .6 |
312 | 337 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max |
313 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max | 338 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco |
314 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco | 339 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min |
315 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | 340 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc |
316 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc | 341 MENU_OPTION tShowppO2, oShowppO2, 0 |
317 MENU_OPTION tShowppO2, oShowppO2, 0 | 342 MENU_CALL tExit, do_return_divemode_menu |
318 MENU_CALL tExit, do_return_divemode_menu | 343 MENU_END |
319 MENU_END | 344 |
320 | 345 |
321 do_return_decoparameters_menu: | 346 do_return_decoparameters_menu: |
322 rcall menu_tree_double_pop ; drop exit line and back to last line | 347 call menu_processor_double_pop ; drop exit line and back to last line |
323 do_decoparameters_menu: | 348 |
324 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF | 349 do_decoparameters_menu: |
325 tstfsz lo | 350 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF |
326 bra do_decoparameters_menugf ; <> 0 -> GF menu! | 351 tstfsz lo |
327 ; NON-GF menu | 352 bra do_decoparameters_menugf ; <> 0 -> GF menu! |
328 MENU_BEGIN tDecoparameters, .4 | 353 ; NON-GF menu |
329 MENU_OPTION tSaturationMult,osatmult, 0 | 354 MENU_BEGIN tDecoparameters, .4 |
330 MENU_OPTION tDesaturationMult,odesatmult,0 | 355 MENU_OPTION tSaturationMult, osatmult, 0 |
331 MENU_OPTION tLastDecostop,oLastDeco, 0 | 356 MENU_OPTION tDesaturationMult, odesatmult, 0 |
332 MENU_CALL tExit, do_return_divemode_menu | 357 MENU_OPTION tLastDecostop, oLastDeco, 0 |
333 MENU_END | 358 MENU_CALL tExit, do_return_divemode_menu |
334 | 359 MENU_END |
360 | |
335 do_decoparameters_menugf: | 361 do_decoparameters_menugf: |
336 ; GF menu | 362 ; GF menu |
337 MENU_BEGIN tDecoparameters, .7 | 363 MENU_BEGIN tDecoparameters, .7 |
338 MENU_OPTION tGF_low, oGF_low, 0 | 364 MENU_OPTION tGF_low, oGF_low, 0 |
339 MENU_OPTION tGF_high, oGF_high, 0 | 365 MENU_OPTION tGF_high, oGF_high, 0 |
340 MENU_CALL taGFMenu, do_aGF_menu | 366 MENU_CALL taGFMenu, do_aGF_menu |
341 MENU_OPTION tSaturationMult,osatmultgf, 0 | 367 MENU_OPTION tSaturationMult, osatmultgf, 0 |
342 MENU_OPTION tDesaturationMult,odesatmultgf,0 | 368 MENU_OPTION tDesaturationMult, odesatmultgf, 0 |
343 MENU_OPTION tLastDecostop,oLastDeco, 0 | 369 MENU_OPTION tLastDecostop, oLastDeco, 0 |
344 MENU_CALL tExit, do_return_divemode_menu | 370 MENU_CALL tExit, do_return_divemode_menu |
345 MENU_END | 371 MENU_END |
346 | 372 |
347 | |
348 | |
349 | 373 |
350 do_return_2nd_deco_plan_menu: | 374 do_return_2nd_deco_plan_menu: |
351 rcall menu_tree_double_pop ; drop exit line and back to last line | 375 call menu_processor_double_pop ; drop exit line and back to last line |
352 | |
353 | 376 |
354 do_2nd_deco_plan_menu | 377 do_2nd_deco_plan_menu |
355 MENU_BEGIN t2ndDecoPlanMenu, .7 | 378 MENU_BEGIN t2ndDecoPlanMenu, .7 |
356 MENU_OPTION tFTTSMenu, oExtraTime, 0 | 379 MENU_OPTION tFTTSMenu, oExtraTime, 0 |
357 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 | 380 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 |
358 MENU_OPTION tSetBotUse, obottom_usage, 0 | 381 MENU_OPTION tSetBotUse, obottom_usage, 0 |
359 MENU_OPTION tSetDecoUse, odeco_usage, 0 | 382 MENU_OPTION tSetDecoUse, odeco_usage, 0 |
360 MENU_CALL tTankSizes, do_tank_sizes_menu | 383 MENU_CALL tTankSizes, do_tank_sizes_menu |
361 MENU_CALL tTankFillPress, do_tank_fill_press_menu | 384 MENU_CALL tTankFillPress, do_tank_fill_press_menu |
362 MENU_CALL tExit, do_return_divemode_menu | 385 MENU_CALL tExit, do_return_divemode_menu |
363 MENU_END | 386 MENU_END |
364 | 387 |
365 | |
366 | 388 |
367 do_tank_sizes_menu: | 389 do_tank_sizes_menu: |
368 MENU_BEGIN tTankSizes, .6 | 390 MENU_BEGIN tTankSizes, .6 |
369 MENU_OPTION tGas1, oTankSize1, 0 | 391 MENU_OPTION tGas1, oTankSize1, 0 |
370 MENU_OPTION tGas2, oTankSize2, 0 | 392 MENU_OPTION tGas2, oTankSize2, 0 |
371 MENU_OPTION tGas3, oTankSize3, 0 | 393 MENU_OPTION tGas3, oTankSize3, 0 |
372 MENU_OPTION tGas4, oTankSize4, 0 | 394 MENU_OPTION tGas4, oTankSize4, 0 |
373 MENU_OPTION tGas5, oTankSize5, 0 | 395 MENU_OPTION tGas5, oTankSize5, 0 |
374 MENU_CALL tExit, do_return_2nd_deco_plan_menu | 396 MENU_CALL tExit, do_return_2nd_deco_plan_menu |
375 MENU_END | 397 MENU_END |
376 | 398 |
377 | |
378 | 399 |
379 do_tank_fill_press_menu: | 400 do_tank_fill_press_menu: |
380 MENU_BEGIN tTankFillPress, .6 | 401 MENU_BEGIN tTankFillPress, .6 |
381 MENU_OPTION tGas1, oTankFillPres1, 0 | 402 MENU_OPTION tGas1, oTankFillPres1, 0 |
382 MENU_OPTION tGas2, oTankFillPres2, 0 | 403 MENU_OPTION tGas2, oTankFillPres2, 0 |
383 MENU_OPTION tGas3, oTankFillPres3, 0 | 404 MENU_OPTION tGas3, oTankFillPres3, 0 |
384 MENU_OPTION tGas4, oTankFillPres4, 0 | 405 MENU_OPTION tGas4, oTankFillPres4, 0 |
385 MENU_OPTION tGas5, oTankFillPres5, 0 | 406 MENU_OPTION tGas5, oTankFillPres5, 0 |
386 MENU_CALL tExit, do_return_2nd_deco_plan_menu | 407 MENU_CALL tExit, do_return_2nd_deco_plan_menu |
387 MENU_END | 408 MENU_END |
388 | 409 |
389 | 410 |
390 do_aGF_menu: | 411 do_aGF_menu: |
391 MENU_BEGIN taGFMenu, .4 | 412 MENU_BEGIN taGFMenu, .4 |
392 MENU_OPTION taGF_enable,oEnable_aGF, 0 | 413 MENU_OPTION taGF_enable, oEnable_aGF, 0 |
393 MENU_OPTION taGF_low, oaGF_low, 0 | 414 MENU_OPTION taGF_low, oaGF_low, 0 |
394 MENU_OPTION taGF_high, oaGF_high, 0 | 415 MENU_OPTION taGF_high, oaGF_high, 0 |
395 MENU_CALL tExit, do_return_decoparameters_menu | 416 MENU_CALL tExit, do_return_decoparameters_menu |
396 MENU_END | 417 MENU_END |
397 | 418 |
398 | 419 |
399 ;============================================================================= | 420 ;============================================================================= |
400 ; Setup Menu | 421 ; Setup Menu |
401 | 422 |
423 do_return_settings_deeper: ; entry point for return from set time/date sub-menu | |
424 bcf settime_setdate ; clear flag | |
425 call menu_processor_pop ; drop one more stack entry | |
426 | |
402 do_return_settings: | 427 do_return_settings: |
403 bcf settime_setdate ; Clear flag | 428 call menu_processor_double_pop ; drop exit line and back to last line |
404 rcall menu_tree_double_pop ; drop exit line and back to last line | 429 |
405 | |
406 extern compass_calibration_loop | |
407 do_settings_menu: | 430 do_settings_menu: |
408 btfsc ble_available ; ble available | 431 btfsc ble_available ; ble available? |
409 bra do_settings_menu_ble ; Yes. | 432 bra do_settings_menu_ble ; YES |
410 MENU_BEGIN tSystSets, .6 | 433 |
411 MENU_CALL tInfoMenu, do_info_menu | 434 MENU_BEGIN tSystSets, .6 |
412 MENU_CALL tSetTimeDate, do_date_time_menu | 435 MENU_CALL tInfoMenu, do_info_menu |
413 MENU_CALL tDispSets, do_dispsets_menu | 436 MENU_CALL tSetTimeDate, do_date_time_menu |
414 MENU_OPTION tLanguage, oLanguage, 0 | 437 MENU_CALL tDispSets, do_dispsets_menu |
415 MENU_CALL tMore, do_settings_menu_more | 438 MENU_OPTION tLanguage, oLanguage, 0 |
416 MENU_CALL tExit, do_continue_main_menu | 439 MENU_CALL tMore, do_settings_menu_more |
417 MENU_END | 440 MENU_CALL tExit, do_return_main_menu |
441 MENU_END | |
418 | 442 |
419 do_settings_menu_ble: | 443 do_settings_menu_ble: |
420 MENU_BEGIN tSystSets, .7 | 444 MENU_BEGIN tSystSets, .7 |
421 MENU_CALL tInfoMenu, do_info_menu | 445 MENU_CALL tInfoMenu, do_info_menu |
422 MENU_CALL tBleTitle, comm_mode0 | 446 MENU_CALL tBleTitle, comm_mode0 |
423 MENU_CALL tSetTimeDate, do_date_time_menu | 447 MENU_CALL tSetTimeDate, do_date_time_menu |
424 MENU_CALL tDispSets, do_dispsets_menu | 448 MENU_CALL tDispSets, do_dispsets_menu |
425 MENU_OPTION tLanguage, oLanguage, 0 | 449 MENU_OPTION tLanguage, oLanguage, 0 |
426 MENU_CALL tMore, do_settings_menu_more | 450 MENU_CALL tMore, do_settings_menu_more |
427 MENU_CALL tExit, do_continue_main_menu | 451 MENU_CALL tExit, do_return_main_menu |
428 MENU_END | 452 MENU_END |
453 | |
454 do_info_menu: | |
455 MENU_BEGIN tInfoMenu, .6 | |
456 MENU_DYNAMIC info_menu_serial, 0 | |
457 MENU_DYNAMIC info_menu_firmware, 0 | |
458 MENU_DYNAMIC info_menu_battery_volts, 0 | |
459 MENU_DYNAMIC info_menu_uptime, 0 | |
460 MENU_DYNAMIC info_menu_total_dives, 0 | |
461 MENU_CALL tExit, do_return_settings | |
462 MENU_END | |
463 | |
464 | |
465 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu | |
466 call menu_processor_pop ; drop one more stack entry | |
429 | 467 |
430 do_return_settings_more: | 468 do_return_settings_more: |
431 rcall menu_tree_double_pop ; drop exit line and back to last line | 469 call menu_processor_double_pop ; drop exit line and back to last line |
432 | 470 |
433 do_settings_menu_more: | 471 do_settings_menu_more: |
434 btfsc battery_gauge_available ; piezo buttons available | 472 btfsc battery_gauge_available ; piezo buttons available |
435 bra do_settings_menu_more_piezo | 473 bra do_settings_menu_more_piezo |
436 btfsc ble_available ; ble available | 474 btfsc ble_available ; ble available |
437 bra do_settings_menu_more_ostc3p | 475 bra do_settings_menu_more_ostc3p |
438 MENU_BEGIN tSystSets, .7 | 476 ; All MENU_CALLs that are |
439 MENU_CALL tCompassMenu, do_compass_menu | 477 MENU_BEGIN tSystSets, .6 ; in all of this 3 menus |
440 MENU_CALL tLogOffset, do_log_offset_menu | 478 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together |
441 MENU_OPTION tUnits, oUnits, 0 | 479 MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in |
442 MENU_OPTION tAltMode, oAltMode, 0 | 480 MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mass up the |
443 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | 481 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the |
444 MENU_CALL tResetMenu, do_reset_menu | 482 MENU_CALL tResetMenu, do_reset_menu ; do_return_settings ! |
445 MENU_CALL tExit, do_return_settings | 483 MENU_CALL tExit, do_return_settings |
446 MENU_END | 484 MENU_END |
447 | 485 |
448 do_settings_menu_more_piezo_exit: | 486 |
487 do_return_settings_menu_more_pz: | |
449 call TFT_ClearScreen | 488 call TFT_ClearScreen |
450 extern piezo_config | 489 call piezo_config ; Configure buttons |
451 call piezo_config ; Configure buttons | 490 call menu_processor_double_pop ; drop exit line and back to last line |
452 | 491 |
453 do_settings_menu_more_piezo: | 492 do_settings_menu_more_piezo: |
454 MENU_BEGIN tSystSets, .7 | 493 MENU_BEGIN tSystSets, .7 |
455 MENU_CALL tCompassMenu, do_compass_menu | 494 MENU_CALL tCompassMenu, do_compass_menu |
456 MENU_CALL tLogOffset, do_log_offset_menu | 495 MENU_CALL tLogOffset, do_log_offset_menu |
457 MENU_OPTION tUnits, oUnits, 0 | 496 MENU_OPTION tAltMode, oAltMode, 0 |
458 MENU_OPTION tAltMode, oAltMode, 0 | 497 MENU_OPTION tDvSalinity, oDiveSalinity, 0 |
459 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | 498 MENU_CALL tResetMenu, do_reset_menu |
460 MENU_CALL tMore, do_settings_piezo_menu | 499 MENU_CALL tMore, do_settings_piezo_menu |
461 MENU_CALL tExit, do_return_settings | 500 MENU_CALL tExit, do_return_settings |
462 MENU_END | 501 MENU_END |
463 | 502 |
464 extern comm_mode0 | 503 do_settings_menu_more_ostc3p: ; Menu with BLE feature |
504 MENU_BEGIN tSystSets, .6 | |
505 MENU_CALL tCompassMenu, do_compass_menu | |
506 MENU_CALL tLogOffset, do_log_offset_menu | |
507 MENU_OPTION tAltMode, oAltMode, 0 | |
508 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
509 MENU_CALL tResetMenu, do_reset_menu | |
510 MENU_CALL tExit, do_return_settings | |
511 MENU_END | |
512 | |
465 | 513 |
466 do_settings_piezo_menu: | 514 do_settings_piezo_menu: |
467 ; Menu with features only available in piezo button hardware | 515 ; Menu with features only available in piezo button hardware |
468 MENU_BEGIN tSystSets, .4 | 516 MENU_BEGIN tSystSets, .3 |
469 MENU_CALL tResetMenu, do_reset_menu | 517 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity |
470 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity | 518 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity |
471 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity | 519 MENU_CALL tExit, do_return_settings_menu_more_pz |
472 MENU_CALL tExit, do_settings_menu_more_piezo_exit | 520 MENU_END |
473 MENU_END | 521 |
474 | |
475 do_settings_menu_more_ostc3p: ; Menu with BLE feature | |
476 MENU_BEGIN tSystSets, .7 | |
477 MENU_CALL tCompassMenu, do_compass_menu | |
478 MENU_CALL tLogOffset, do_log_offset_menu | |
479 MENU_OPTION tUnits, oUnits, 0 | |
480 MENU_OPTION tAltMode, oAltMode, 0 | |
481 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
482 MENU_CALL tResetMenu, do_reset_menu | |
483 MENU_CALL tExit, do_return_settings | |
484 MENU_END | |
485 | 522 |
486 do_compass_menu: | 523 do_compass_menu: |
487 MENU_BEGIN tSystSets, .5 | 524 MENU_BEGIN tSystSets, .5 |
488 MENU_CALL tCompassMenu, compass_calibration_loop | 525 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surfloop |
489 ; MENU_OPTION tCompassGain, oCompassGain, 0 | 526 ; MENU_OPTION tCompassGain, oCompassGain, 0 |
490 MENU_DYNAMIC menu_cal_x, 0 | 527 MENU_DYNAMIC menu_cal_x, 0 |
491 MENU_DYNAMIC menu_cal_y, 0 | 528 MENU_DYNAMIC menu_cal_y, 0 |
492 MENU_DYNAMIC menu_cal_z, 0 | 529 MENU_DYNAMIC menu_cal_z, 0 |
493 MENU_CALL tExit, do_return_settings_more | 530 MENU_CALL tExit, do_return_settings_more |
494 MENU_END | 531 MENU_END |
532 | |
495 | 533 |
496 ;============================================================================= | 534 ;============================================================================= |
497 ; Reset and confirmation menu. | 535 ; Reset and confirmation menu. |
498 | 536 |
499 do_reset_menu: | 537 do_reset_menu: |
500 MENU_BEGIN tResetMenu, .6 | 538 MENU_BEGIN tResetMenu, .6 |
501 MENU_CALL tExit, do_return_settings | 539 MENU_CALL tExit, do_return_settings_more |
502 MENU_CALL tReboot, do_reset_menu2 ; Confirm | 540 MENU_CALL tReboot, do_reset_menu2 ; Confirm |
503 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm | 541 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm |
504 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm | 542 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm |
505 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm | 543 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm |
506 MENU_CALL tResetBattery, new_battery_menu ; New Battery sub menu | 544 MENU_CALL tResetBattery, do_new_battery_menu ; Confirm |
507 MENU_END | 545 MENU_END |
508 | 546 |
509 do_reset_menu2: | 547 do_reset_menu2: |
510 MENU_BEGIN tResetMenu2, .2 | 548 MENU_BEGIN tResetMenu2, .2 |
511 MENU_CALL tAbort, do_continue_menu_3stack | 549 MENU_CALL tAbort, do_return_settings_more_deeper |
512 MENU_CALL tReboot, do_reboot ; Reboot | 550 MENU_CALL tReboot, do_reboot ; Reboot |
513 MENU_END | 551 MENU_END |
514 | 552 |
515 do_reset_menu3: | 553 do_reset_menu3: |
516 MENU_BEGIN tResetMenu2, .2 | 554 MENU_BEGIN tResetMenu2, .2 |
517 MENU_CALL tAbort, do_continue_menu_3stack | 555 MENU_CALL tAbort, do_return_settings_more_deeper |
518 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | 556 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco |
519 MENU_END | 557 MENU_END |
520 | 558 |
521 do_reset_menu4: | 559 do_reset_menu4: |
522 MENU_BEGIN tResetMenu2, .2 | 560 MENU_BEGIN tResetMenu2, .2 |
523 MENU_CALL tAbort, do_continue_menu_3stack | 561 MENU_CALL tAbort, do_return_settings_more_deeper |
524 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | 562 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings |
525 MENU_END | 563 MENU_END |
526 | 564 |
527 do_reset_menu5: | 565 do_reset_menu5: |
528 MENU_BEGIN tResetMenu2, .2 | 566 MENU_BEGIN tResetMenu2, .2 |
529 MENU_CALL tAbort, do_continue_menu_3stack | 567 MENU_CALL tAbort, do_return_settings_more_deeper |
530 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook | 568 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook |
531 MENU_END | 569 MENU_END |
570 | |
532 | 571 |
533 do_reset_logbook: | 572 do_reset_logbook: |
534 clrf EEADRH ; Make sure to select eeprom bank 0 | 573 clrf EEADRH ; Make sure to select EEPROM bank 0 |
535 clrf EEDATA | 574 clrf EEDATA |
536 read_int_eeprom .2 | 575 read_int_eeprom .2 |
537 write_int_eeprom .16 | 576 write_int_eeprom .16 |
538 read_int_eeprom .3 | 577 read_int_eeprom .3 |
539 write_int_eeprom .17 ; Copy number of dives | 578 write_int_eeprom .17 ; Copy number of dives |
540 clrf EEDATA | 579 clrf EEDATA |
541 write_int_eeprom .2 | 580 write_int_eeprom .2 |
542 write_int_eeprom .3 ; Clear total dives | 581 write_int_eeprom .3 ; Clear total dives |
543 write_int_eeprom .4 | 582 write_int_eeprom .4 |
544 write_int_eeprom .5 | 583 write_int_eeprom .5 |
545 write_int_eeprom .6 ; Reset logbook pointers | 584 write_int_eeprom .6 ; Reset logbook pointers |
546 call ext_flash_erase_logbook ; And complete logbook (!) | 585 call ext_flash_erase_logbook ; And complete logbook (!) |
547 goto do_continue_main_menu ; back to menu | 586 |
587 goto do_return_settings_more_deeper | |
548 | 588 |
549 | 589 |
550 do_reset_deco: | 590 do_reset_deco: |
551 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine | 591 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine |
552 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine | 592 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine |
553 | 593 |
554 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) | 594 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) |
555 banksel common ; back to bank 1, needed after every return from C code | 595 call deco_calc_dive_interval_1min; calculate deco in surface mode |
556 | 596 call deco_calc_desaturation_time ; calculate desaturation and no-fly time |
557 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | 597 banksel common |
558 call deco_calc_desaturation_time ; calculate desaturation and no-fly time | 598 |
559 banksel common | 599 goto do_return_settings_more_deeper |
560 | 600 |
561 goto do_return_settings ; back to menu | |
562 | 601 |
563 do_reset_settings: | 602 do_reset_settings: |
564 call TFT_ClearScreen ; Clear screen | 603 call TFT_ClearScreen ; Clear screen |
565 banksel common | 604 banksel common ; (probably not needed) |
566 extern option_reset_all | 605 call option_reset_all ; Reset all options to factory default. |
567 call option_reset_all ; Reset all options to factory default. | 606 goto restart ; Restart into surfacemode |
568 goto restart ; Restart into surfacemode | |
569 | |
570 do_continue_menu_3stack: ; Return three levels deep | |
571 call menu_processor_pop | |
572 goto do_return_settings | |
573 | 607 |
574 do_reboot: | 608 do_reboot: |
575 call ext_flash_enable_protection ; Enables write protection | 609 call ext_flash_enable_protection ; Enables write protection |
576 reset | 610 reset |
577 | 611 |
578 | 612 |
579 do_date_time_menu: | 613 do_date_time_menu: |
580 MENU_BEGIN tSetTimeDate, .4 | 614 MENU_BEGIN tSetTimeDate, .4 |
581 MENU_CALL tSetTime, do_time_menu | 615 MENU_CALL tSetTime, do_time_menu |
582 MENU_CALL tSetDate, do_date_menu | 616 MENU_CALL tSetDate, do_date_menu |
583 MENU_OPTION tDateFormat,oDateFormat, 0 | 617 MENU_OPTION tDateFormat,oDateFormat, 0 |
584 MENU_CALL tExit, do_return_settings | 618 MENU_CALL tExit, do_return_settings |
585 MENU_END | 619 MENU_END |
620 | |
586 | 621 |
587 do_date_menu: | 622 do_date_menu: |
588 bsf settime_setdate | 623 bsf settime_setdate |
589 MENU_BEGIN tSetDate, .4 | 624 |
590 MENU_OPTION tSetDay, oSetDay, 0 | 625 MENU_BEGIN tSetDate, .4 |
591 MENU_OPTION tSetMonth, oSetMonth, 0 | 626 MENU_OPTION tSetDay, oSetDay, 0 |
592 MENU_OPTION tSetYear, oSetYear, 0 | 627 MENU_OPTION tSetMonth, oSetMonth, 0 |
593 MENU_CALL tExit, do_continue_menu_3stack | 628 MENU_OPTION tSetYear, oSetYear, 0 |
594 MENU_END | 629 MENU_CALL tExit, do_return_settings_deeper |
630 MENU_END | |
595 | 631 |
596 | 632 |
597 do_reset_seconds: | 633 do_reset_seconds: |
598 clrf secs | 634 clrf secs |
599 extern rtc_set_rtc | 635 call rtc_set_rtc ; writes mins, sec, hours, day, month and year to RTC module |
600 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | 636 call menu_processor_pop ; clear the MENU_CALL for do_reset_seconds from the stack |
637 ;bra do_time_menu ; direct jump-back into the menu | |
638 | |
601 do_time_menu: | 639 do_time_menu: |
602 bsf settime_setdate | 640 bsf settime_setdate |
603 MENU_BEGIN tSetTime, .4 | 641 |
604 MENU_OPTION tSetHours, oSetHours, 0 | 642 MENU_BEGIN tSetTime, .4 |
605 MENU_OPTION tSetMinutes,oSetMinutes, 0 | 643 MENU_OPTION tSetHours, oSetHours, 0 |
606 MENU_CALL tSetSeconds, do_reset_seconds | 644 MENU_OPTION tSetMinutes, oSetMinutes, 0 |
607 MENU_CALL tExit, do_continue_menu_3stack | 645 MENU_CALL tSetSeconds, do_reset_seconds |
608 MENU_END | 646 MENU_CALL tExit, do_return_settings_deeper |
609 | 647 MENU_END |
610 | 648 |
611 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. | 649 |
612 movff char_I_ppO2_max,lo ; banksafe | 650 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. |
613 movlw .10 | 651 movff char_I_ppO2_max,lo ; banksafe |
652 movlw .10 | |
614 addwf lo,F | 653 addwf lo,F |
615 movlw ppo2_highest_setting | 654 movlw ppo2_warning_high_highest |
616 cpfsgt lo | 655 cpfsgt lo |
617 bra do_toggle_ppo2_max2 | 656 bra do_toggle_ppo2_max2 |
618 movlw .120 | 657 movlw ppo2_warning_high_lowest |
619 movwf lo | 658 movwf lo |
620 do_toggle_ppo2_max2: | 659 do_toggle_ppo2_max2: |
621 movff lo,char_I_ppO2_max | 660 movff lo,char_I_ppO2_max |
622 return | 661 return |
623 | 662 |
624 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. | 663 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. |
625 movff char_I_ppO2_max_deco,lo ; banksafe | 664 movff char_I_ppO2_max_deco,lo ; banksafe |
626 movlw .10 | 665 movlw .10 |
627 addwf lo,F | 666 addwf lo,F |
628 movlw ppo2_highest_setting_deco | 667 movlw ppo2_warning_deco_highest |
629 cpfsgt lo | 668 cpfsgt lo |
630 bra do_toggle_ppo2_max_deco2 | 669 bra do_toggle_ppo2_max_deco2 |
631 movlw .120 | 670 movlw ppo2_warning_deco_lowest |
632 movwf lo | 671 movwf lo |
633 do_toggle_ppo2_max_deco2: | 672 do_toggle_ppo2_max_deco2: |
634 movff lo,char_I_ppO2_max_deco | 673 movff lo,char_I_ppO2_max_deco |
635 return | 674 return |
636 | 675 |
637 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | 676 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. |
638 movff char_I_ppO2_min,lo ; banksafe | 677 movff char_I_ppO2_min,lo ; banksafe |
639 incf lo,F | 678 incf lo,F |
640 movlw .21 | 679 movlw ppo2_warning_low_highest |
641 cpfsgt lo | 680 cpfsgt lo |
642 bra do_toggle_ppo2_min2 | 681 bra do_toggle_ppo2_min2 |
643 movlw ppo2_lowest_setting | 682 movlw ppo2_warning_low_lowest |
644 movwf lo | 683 movwf lo |
645 do_toggle_ppo2_min2: | 684 do_toggle_ppo2_min2: |
646 movff lo,char_I_ppO2_min | 685 movff lo,char_I_ppO2_min |
647 return | 686 return |
648 | 687 |
649 do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. | 688 do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. |
650 movff char_I_ppO2_min_loop,lo ; banksafe | 689 movff char_I_ppO2_min_loop,lo ; banksafe |
651 incf lo,F | 690 incf lo,F |
652 movlw ppo2_warning_low_cc_max | 691 movlw ppo2_warning_loop_highest |
653 cpfsgt lo | 692 cpfsgt lo |
654 bra do_toggle_ppo2_min_cc2 | 693 bra do_toggle_ppo2_min_cc2 |
655 movlw ppo2_warning_low_cc_min | 694 movlw ppo2_warning_loop_lowest |
656 movwf lo | 695 movwf lo |
657 do_toggle_ppo2_min_cc2: | 696 do_toggle_ppo2_min_cc2: |
658 movff lo,char_I_ppO2_min_loop | 697 movff lo,char_I_ppO2_min_loop |
659 return | 698 return |
660 | 699 |
661 | 700 |
662 ; Logbook offset sub-menu | 701 ; Logbook offset sub-menu |
663 do_log_offset_menu: | 702 do_log_offset_menu: |
664 MENU_BEGIN tLogOffset, .6 | 703 MENU_BEGIN tLogOffset, .6 |
665 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | 704 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 |
666 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | 705 MENU_CALL tLogOffsetp1, do_logoffset_plus1 |
667 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | 706 MENU_CALL tLogOffsetp10, do_logoffset_plus10 |
668 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | 707 MENU_CALL tLogOffsetm1, do_logoffset_minus1 |
669 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | 708 MENU_CALL tLogOffsetm10, do_logoffset_minus10 |
670 MENU_CALL tExit, do_return_settings_more | 709 MENU_CALL tExit, do_return_settings_more |
671 MENU_END | 710 MENU_END |
672 | 711 |
673 | 712 |
674 do_logoffset_minus1: | 713 do_logoffset_minus1: |
675 call do_logoffset_common_read ; Read into lo:hi | 714 call do_logoffset_common_read ; Read into lo:hi |
676 movlw d'1' | 715 movlw .1 |
677 subwf lo | 716 subwf lo |
678 movlw d'0' | 717 movlw .0 |
679 subwfb hi | 718 subwfb hi |
680 btfss hi,7 ; <0? | 719 btfss hi,7 ; <0? |
681 goto do_logoffset_common_write ; Store and return | 720 goto do_logoffset_common_write ; Store and return |
682 clrf lo | 721 clrf lo |
683 clrf hi | 722 clrf hi |
684 goto do_logoffset_common_write ; Store and return | 723 goto do_logoffset_common_write ; Store and return |
685 | 724 |
686 do_logoffset_minus10: | 725 do_logoffset_minus10: |
687 call do_logoffset_common_read ; Read into lo:hi | 726 call do_logoffset_common_read ; Read into lo:hi |
688 movlw d'10' | 727 movlw .10 |
689 subwf lo | 728 subwf lo |
690 movlw d'0' | 729 movlw .0 |
691 subwfb hi | 730 subwfb hi |
692 btfss hi,7 ; <0? | 731 btfss hi,7 ; <0? |
693 goto do_logoffset_common_write ; Store and return | 732 goto do_logoffset_common_write ; Store and return |
694 clrf lo | 733 clrf lo |
695 clrf hi | 734 clrf hi |
696 goto do_logoffset_common_write ; Store and return | 735 goto do_logoffset_common_write ; Store and return |
697 | 736 |
698 do_logoffset_plus1: | 737 do_logoffset_plus1: |
699 call do_logoffset_common_read ; Read into lo:hi | 738 call do_logoffset_common_read ; Read into lo:hi |
700 infsnz lo,F | 739 infsnz lo,F |
701 incf hi,F | 740 incf hi,F |
702 goto do_logoffset_common_write ; Store and return | 741 goto do_logoffset_common_write ; Store and return |
703 | 742 |
704 do_logoffset_plus10: | 743 do_logoffset_plus10: |
705 call do_logoffset_common_read ; Read into lo:hi | 744 call do_logoffset_common_read ; Read into lo:hi |
706 movlw d'10' | 745 movlw .10 |
707 addwf lo | 746 addwf lo |
708 movlw d'0' | 747 movlw .0 |
709 addwfc hi | 748 addwfc hi |
710 goto do_logoffset_common_write ; Store and return | 749 goto do_logoffset_common_write ; Store and return |
711 | 750 |
712 do_dispsets_menu_3stack: | 751 do_return_dispsets_menu: |
713 bcf in_color_menu | 752 bcf in_color_menu |
714 call menu_tree_double_pop ; drop exit line and back to last line | 753 call menu_processor_double_pop ; drop exit line and back to last line |
715 | 754 |
716 do_dispsets_menu: | 755 do_dispsets_menu: |
717 MENU_BEGIN tDispSets, .5 | 756 MENU_BEGIN tDispSets, .5 |
718 MENU_OPTION tBright, oBrightness, 0 | 757 MENU_OPTION tBright, oBrightness, 0 |
719 MENU_CALL tColorScheme, do_color_scheme | 758 MENU_CALL tColorScheme, do_color_scheme |
720 MENU_OPTION tFlip, oFlipScreen, 0 | 759 MENU_OPTION tFlip, oFlipScreen, 0 |
721 MENU_CALL tMore, do_dispsets_menu_more | 760 MENU_CALL tMore, do_dispsets_menu_more |
722 MENU_CALL tExit, do_return_settings | 761 MENU_CALL tExit, do_return_settings |
723 MENU_END | 762 MENU_END |
763 | |
724 | 764 |
725 do_dispsets_menu_more: | 765 do_dispsets_menu_more: |
726 MENU_BEGIN tDispSets, .6 | 766 MENU_BEGIN tDispSets, .7 |
727 MENU_OPTION tMODwarning, oMODwarning, 0 | 767 MENU_OPTION tMODwarning, oMODwarning, 0 |
728 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 | 768 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 |
729 MENU_OPTION tVSItext2, oVSItextv2, 0 | 769 MENU_OPTION tVSItext2, oVSItextv2, 0 |
730 MENU_OPTION tVSIgraph, oVSIgraph, 0 | 770 MENU_OPTION tVSIgraph, oVSIgraph, 0 |
731 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | 771 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 |
732 MENU_CALL tExit, do_dispsets_menu_3stack | 772 MENU_OPTION tUnits, oUnits, 0 |
733 MENU_END | 773 MENU_CALL tExit, do_return_dispsets_menu |
734 | 774 MENU_END |
735 extern oColorSetDive | 775 |
776 | |
736 do_color_scheme: | 777 do_color_scheme: |
737 bsf in_color_menu | 778 bsf in_color_menu |
738 MENU_BEGIN tColorScheme, .2 | 779 |
739 MENU_OPTION tColorSetDive,oColorSetDive, 0 | 780 MENU_BEGIN tColorScheme, .2 |
740 MENU_CALL tExit, do_dispsets_menu_3stack | 781 MENU_OPTION tColorSetDive, oColorSetDive, 0 |
741 MENU_END | 782 MENU_CALL tExit, do_return_dispsets_menu |
783 MENU_END | |
742 | 784 |
743 | 785 |
744 ;============================================================================= | 786 ;============================================================================= |
745 | 787 |
746 global new_battery_menu | 788 do_new_battery_menu: |
747 extern surfloop | 789 MENU_BEGIN tNewBattTitle, .2 |
748 new_battery_menu: | 790 MENU_CALL tAbort, do_return_settings_more_deeper |
749 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | 791 MENU_CALL tYes, do_new_battery_select |
750 call TFT_boot ; Initialize TFT (includes clear screen) | 792 MENU_END |
751 call TFT_Display_FadeIn ; Show splash | 793 |
752 movlw .100 | 794 global do_new_battery_select |
753 movwf batt_percent ; make sure to reset batt_percent | 795 do_new_battery_select: |
754 | 796 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately |
755 ; Default (In cases of timeout or USB): Use old battery | 797 call TFT_boot ; Initialize TFT (includes clear screen) |
798 call TFT_Display_FadeIn ; Show splash | |
799 movlw .100 | |
800 movwf batt_percent ; make sure to reset batt_percent | |
801 | |
802 ; Default (In cases of timeout or USB): Use old battery | |
756 clrf EEADRH | 803 clrf EEADRH |
757 read_int_eeprom 0x07 | 804 read_int_eeprom 0x07 |
758 movff EEDATA,battery_gauge+0 | 805 movff EEDATA,battery_gauge+0 |
759 read_int_eeprom 0x08 | 806 read_int_eeprom 0x08 |
760 movff EEDATA,battery_gauge+1 | 807 movff EEDATA,battery_gauge+1 |
765 read_int_eeprom 0x0B | 812 read_int_eeprom 0x0B |
766 movff EEDATA,battery_gauge+4 | 813 movff EEDATA,battery_gauge+4 |
767 read_int_eeprom 0x0C | 814 read_int_eeprom 0x0C |
768 movff EEDATA,battery_gauge+5 | 815 movff EEDATA,battery_gauge+5 |
769 | 816 |
770 call menu_processor_reset ; restart from first icon. | 817 call menu_processor_reset ; restart from first icon. |
771 | 818 |
772 MENU_BEGIN tNewBattTitle, .1 | 819 ; hardware_flag: |
773 MENU_CALL tEnter, new_battery_menu2 | 820 ; 3: 0x0A or 0x13 (2016) |
774 MENU_END | 821 ; cR: 0x05 |
775 | 822 ; 2 with BLE: 0x11 |
776 new_battery_menu2: | 823 ; Sport: 0x12 |
777 ; hardware_flag: | 824 ; 3 with BLE: 0x1A |
778 ; 3: 0x0A or 0x13 (2016) | 825 |
779 ; cR: 0x05 | 826 movlw 0x0A |
780 ; 2 with BLE: 0x11 | 827 cpfseq hardware_flag |
781 ; Sport: 0x12 | 828 bra $+4 |
782 ; 3 with BLE: 0x1A | 829 bra menu_new_battery_AA |
783 | 830 movlw 0x13 |
784 movlw 0x0A | 831 cpfseq hardware_flag |
785 cpfseq hardware_flag | 832 bra $+4 |
786 bra $+4 | 833 bra menu_new_battery_AA_16650 |
787 bra menu_new_battery_AA | 834 movlw 0x12 |
788 movlw 0x13 | 835 cpfseq hardware_flag |
789 cpfseq hardware_flag | 836 bra $+4 |
790 bra $+4 | 837 bra menu_new_battery_AA |
791 bra menu_new_battery_AA_16650 | 838 movlw 0x1A |
792 movlw 0x12 | 839 cpfseq hardware_flag |
793 cpfseq hardware_flag | 840 bra $+4 |
794 bra $+4 | 841 bra menu_new_battery_AA |
795 bra menu_new_battery_AA | 842 movlw 0x11 |
796 movlw 0x1A | 843 cpfseq hardware_flag |
797 cpfseq hardware_flag | 844 bra $+4 |
798 bra $+4 | 845 bra menu_new_battery_18650 |
799 bra menu_new_battery_AA | 846 movlw 0x05 |
800 movlw 0x11 | 847 cpfseq hardware_flag |
801 cpfseq hardware_flag | 848 bra $+4 |
802 bra $+4 | 849 bra menu_new_battery_18650 |
803 bra menu_new_battery_18650 | 850 bra use_old_batteries ; any unsupported value |
804 movlw 0x05 | 851 |
805 cpfseq hardware_flag | 852 |
806 bra $+4 | |
807 bra menu_new_battery_18650 | |
808 bra use_old_batteries ; any unsupported value | |
809 | |
810 menu_new_battery_AA_16650: | 853 menu_new_battery_AA_16650: |
811 MENU_BEGIN tNewBattTitle, .5 | 854 MENU_BEGIN tNewBattTitle, .5 |
812 MENU_CALL tNewBattOld, use_old_batteries | 855 MENU_CALL tNewBattOld, use_old_batteries |
813 MENU_CALL tNewBattNew36, use_new_36V_batteries | 856 MENU_CALL tNewBattNew36, use_new_36V_batteries |
814 MENU_CALL tNewBattNew15, use_new_15V_batteries | 857 MENU_CALL tNewBattNew15, use_new_15V_batteries |
815 MENU_CALL tNewBattAccu, use_36V_rechargeable | 858 MENU_CALL tNewBattAccu, use_36V_rechargeable |
816 MENU_CALL tNew16650, use_16650_battery | 859 MENU_CALL tNew16650, use_16650_battery |
817 MENU_END | 860 MENU_END |
818 | 861 |
862 | |
819 menu_new_battery_AA: | 863 menu_new_battery_AA: |
820 MENU_BEGIN tNewBattTitle, .4 | 864 MENU_BEGIN tNewBattTitle, .4 |
821 MENU_CALL tNewBattOld, use_old_batteries | 865 MENU_CALL tNewBattOld, use_old_batteries |
822 MENU_CALL tNewBattNew36, use_new_36V_batteries | 866 MENU_CALL tNewBattNew36, use_new_36V_batteries |
823 MENU_CALL tNewBattNew15, use_new_15V_batteries | 867 MENU_CALL tNewBattNew15, use_new_15V_batteries |
824 MENU_CALL tNewBattAccu, use_36V_rechargeable | 868 MENU_CALL tNewBattAccu, use_36V_rechargeable |
825 MENU_END | 869 MENU_END |
870 | |
826 | 871 |
827 menu_new_battery_18650: | 872 menu_new_battery_18650: |
828 MENU_BEGIN tNewBattTitle, .2 | 873 MENU_BEGIN tNewBattTitle, .2 |
829 MENU_CALL tNewBattOld, use_old_batteries | 874 MENU_CALL tNewBattOld, use_old_batteries |
830 MENU_CALL tNew18650, use_18650_battery | 875 MENU_CALL tNew18650, use_18650_battery |
831 MENU_END | 876 MENU_END |
832 | 877 |
833 | 878 |
834 global use_old_prior_209 | 879 global use_old_prior_209 |
835 use_old_prior_209: | 880 use_old_prior_209: |
836 clrf EEADRH | 881 clrf EEADRH |
837 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 | 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 |
838 incfsz EEDATA,F ; Was 0xFF? | 883 incfsz EEDATA,F ; Was 0xFF? |
839 return ; No, done. | 884 return ; No, done. |
840 | 885 |
841 call lt2942_get_status ; Check for gauge IC | 886 call lt2942_get_status ; Check for gauge IC |
842 movlw .3 ; Assume a 18650 | 887 movlw .3 ; Assume a 18650 |
843 btfss battery_gauge_available ; cR/2 hardware? | 888 btfss battery_gauge_available ; cR/2 hardware? |
844 movlw .1 ; Assume a Saft | 889 movlw .1 ; Assume a Saft |
845 movwf EEDATA | 890 movwf EEDATA |
846 write_int_eeprom 0x0F ; Store the new battery type into EEPROM | 891 write_int_eeprom 0x0F ; Store the new battery type into EEPROM |
847 return | 892 return |
848 | 893 |
894 | |
849 global use_old_batteries | 895 global use_old_batteries |
850 use_old_batteries: | 896 use_old_batteries: |
851 clrf EEADRH | 897 clrf EEADRH |
852 read_int_eeprom 0x07 | 898 read_int_eeprom 0x07 |
853 movff EEDATA,battery_gauge+0 | 899 movff EEDATA,battery_gauge+0 |
860 read_int_eeprom 0x0B | 906 read_int_eeprom 0x0B |
861 movff EEDATA,battery_gauge+4 | 907 movff EEDATA,battery_gauge+4 |
862 read_int_eeprom 0x0C | 908 read_int_eeprom 0x0C |
863 movff EEDATA,battery_gauge+5 | 909 movff EEDATA,battery_gauge+5 |
864 read_int_eeprom 0x0F | 910 read_int_eeprom 0x0F |
865 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 | 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 |
866 | 912 |
867 rcall setup_new_saft ; Any other value | 913 rcall setup_new_saft ; Any other value |
868 incf EEDATA,F ; 1 ... 5 | 914 incf EEDATA,F ; 1 ... 5 |
869 dcfsnz EEDATA,F | 915 dcfsnz EEDATA,F |
870 rcall setup_new_15v ;=0 | 916 rcall setup_new_15v ;=0 |
871 dcfsnz EEDATA,F | 917 dcfsnz EEDATA,F |
872 rcall setup_new_saft ;=1 | 918 rcall setup_new_saft ;=1 |
873 dcfsnz EEDATA,F | 919 dcfsnz EEDATA,F |
874 rcall setup_new_panasonic ;=2 | 920 rcall setup_new_panasonic ;=2 |
875 dcfsnz EEDATA,F | 921 dcfsnz EEDATA,F |
876 rcall setup_new_18650 ;=3 | 922 rcall setup_new_18650 ;=3 |
877 dcfsnz EEDATA,F | 923 dcfsnz EEDATA,F |
878 rcall setup_new_16650 ;=4 | 924 rcall setup_new_16650 ;=4 |
879 | 925 |
880 bcf use_old_batt_flag ; clear flag | 926 bcf use_old_batt_flag ; clear flag |
881 goto surfloop ; Jump to Surfaceloop! | 927 goto surfloop ; Jump to Surfaceloop! |
928 | |
882 | 929 |
883 setup_new_15v: | 930 setup_new_15v: |
884 bsf charge_disable | 931 bsf charge_disable |
885 bcf TRISE,2 | 932 bcf TRISE,2 |
886 movlw .100 | 933 movlw .100 |
887 movwf batt_percent ; To have 1,5V batteries right after firmware update | 934 movwf batt_percent ; To have 1,5V batteries right after firmware update |
888 movlw .0 | 935 movlw .0 |
889 movff WREG,battery_type | 936 movff WREG,battery_type |
890 return | 937 return |
891 | 938 |
939 | |
892 setup_new_saft: | 940 setup_new_saft: |
893 banksel battery_capacity | 941 banksel battery_capacity |
894 movlw LOW internal_saft_capacity | 942 movlw LOW internal_saft_capacity |
895 movwf internal_battery_capacity+0 | 943 movwf internal_battery_capacity+0 |
896 movlw HIGH internal_saft_capacity | 944 movlw HIGH internal_saft_capacity |
897 movwf internal_battery_capacity+1 | 945 movwf internal_battery_capacity+1 |
898 movlw LOW saft_capacity | 946 movlw LOW saft_capacity |
899 movwf battery_capacity+0 | 947 movwf battery_capacity+0 |
900 movlw HIGH saft_capacity | 948 movlw HIGH saft_capacity |
901 movwf battery_capacity+1 | 949 movwf battery_capacity+1 |
902 movlw LOW saft_offset | 950 movlw LOW saft_offset |
903 movwf battery_offset+0 | 951 movwf battery_offset+0 |
904 movlw HIGH saft_offset | 952 movlw HIGH saft_offset |
905 movwf battery_offset+1 | 953 movwf battery_offset+1 |
906 banksel common | 954 banksel common |
907 bsf charge_disable | 955 bsf charge_disable |
908 bcf TRISE,2 | 956 bcf TRISE,2 |
909 movlw .1 | 957 movlw .1 |
910 movff WREG,battery_type | 958 movff WREG,battery_type |
911 return | 959 return |
912 | 960 |
913 setup_new_panasonic: | 961 |
914 banksel battery_capacity | 962 setup_new_panasonic: |
915 movlw LOW internal_panasonic_capacity | 963 banksel battery_capacity |
916 movwf internal_battery_capacity+0 | 964 movlw LOW internal_panasonic_capacity |
917 movlw HIGH internal_panasonic_capacity | 965 movwf internal_battery_capacity+0 |
918 movwf internal_battery_capacity+1 | 966 movlw HIGH internal_panasonic_capacity |
919 movlw LOW panasonic_capacity | 967 movwf internal_battery_capacity+1 |
920 movwf battery_capacity+0 | 968 movlw LOW panasonic_capacity |
921 movlw HIGH panasonic_capacity | 969 movwf battery_capacity+0 |
922 movwf battery_capacity+1 | 970 movlw HIGH panasonic_capacity |
923 movlw LOW panasonic_offset | 971 movwf battery_capacity+1 |
924 movwf battery_offset+0 | 972 movlw LOW panasonic_offset |
925 movlw HIGH panasonic_offset | 973 movwf battery_offset+0 |
926 movwf battery_offset+1 | 974 movlw HIGH panasonic_offset |
927 banksel common | 975 movwf battery_offset+1 |
928 bcf charge_disable | 976 banksel common |
929 bsf TRISE,2 | 977 bcf charge_disable |
930 movlw .2 | 978 bsf TRISE,2 |
931 movff WREG,battery_type | 979 movlw .2 |
932 return | 980 movff WREG,battery_type |
933 | 981 return |
934 setup_new_18650: | 982 |
935 banksel battery_capacity | 983 |
936 clrf internal_battery_capacity+0 | 984 setup_new_18650: |
937 clrf internal_battery_capacity+1 | 985 banksel battery_capacity |
938 movlw LOW ncr18650_capacity | 986 clrf internal_battery_capacity+0 |
939 movwf battery_capacity+0 | 987 clrf internal_battery_capacity+1 |
940 movlw HIGH ncr18650_capacity | 988 movlw LOW ncr18650_capacity |
941 movwf battery_capacity+1 | 989 movwf battery_capacity+0 |
942 movlw LOW ncr18650_offset | 990 movlw HIGH ncr18650_capacity |
943 movwf battery_offset+0 | 991 movwf battery_capacity+1 |
944 movlw HIGH ncr18650_offset | 992 movlw LOW ncr18650_offset |
945 movwf battery_offset+1 | 993 movwf battery_offset+0 |
946 banksel common | 994 movlw HIGH ncr18650_offset |
947 bcf charge_disable | 995 movwf battery_offset+1 |
948 bsf TRISE,2 | 996 banksel common |
949 movlw .3 | 997 bcf charge_disable |
950 movff WREG,battery_type | 998 bsf TRISE,2 |
951 return | 999 movlw .3 |
1000 movff WREG,battery_type | |
1001 return | |
1002 | |
952 | 1003 |
953 setup_new_16650: | 1004 setup_new_16650: |
954 banksel battery_capacity | 1005 banksel battery_capacity |
955 clrf internal_battery_capacity+0 | 1006 clrf internal_battery_capacity+0 |
956 clrf internal_battery_capacity+1 | 1007 clrf internal_battery_capacity+1 |
957 movlw LOW ur16650_capacity | 1008 movlw LOW ur16650_capacity |
958 movwf battery_capacity+0 | 1009 movwf battery_capacity+0 |
959 movlw HIGH ur16650_capacity | 1010 movlw HIGH ur16650_capacity |
960 movwf battery_capacity+1 | 1011 movwf battery_capacity+1 |
961 movlw LOW ur16650_offset | 1012 movlw LOW ur16650_offset |
962 movwf battery_offset+0 | 1013 movwf battery_offset+0 |
963 movlw HIGH ur16650_offset | 1014 movlw HIGH ur16650_offset |
964 movwf battery_offset+1 | 1015 movwf battery_offset+1 |
965 banksel common | 1016 banksel common |
966 bcf charge_disable | 1017 bcf charge_disable |
967 bsf TRISE,2 | 1018 bsf TRISE,2 |
968 movlw .4 | 1019 movlw .4 |
969 movff WREG,battery_type | 1020 movff WREG,battery_type |
970 return | 1021 return |
1022 | |
971 | 1023 |
972 use_16650_battery: | 1024 use_16650_battery: |
973 rcall setup_new_16650 | 1025 rcall setup_new_16650 |
974 bra use_new_36V_2 | 1026 bra use_new_36V_2 |
975 use_18650_battery: | 1027 use_18650_battery: |
976 rcall setup_new_18650 | 1028 rcall setup_new_18650 |
977 bra use_new_36V_2 | 1029 bra use_new_36V_2 |
978 use_new_36V_batteries: | 1030 use_new_36V_batteries: |
979 rcall setup_new_saft | 1031 rcall setup_new_saft |
980 bra use_new_36V_2 | 1032 bra use_new_36V_2 |
981 use_new_15V_batteries: | 1033 use_new_15V_batteries: |
982 rcall setup_new_15v | 1034 rcall setup_new_15v |
983 use_new_36V_2: | 1035 use_new_36V_2: |
984 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | 1036 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 |
985 goto surfloop ; Jump to Surface loop! | 1037 goto surfloop ; Jump to Surface loop! |
986 use_36V_rechargeable: | 1038 use_36V_rechargeable: |
987 rcall setup_new_panasonic | 1039 rcall setup_new_panasonic |
988 call reset_battery_internal_only | 1040 call reset_battery_internal_only |
989 goto surfloop ; Jump to Surface loop! | 1041 goto surfloop ; Jump to Surface loop! |
990 | 1042 |
991 END | 1043 END |