Mercurial > public > hwos_code
annotate src/customview.asm @ 623:c40025d8e750
3.03 beta released
| author | heinrichsweikamp |
|---|---|
| date | Mon, 03 Jun 2019 14:01:48 +0200 |
| parents | d866684249bd |
| children | cd58f7fc86db |
| rev | line source |
|---|---|
| 0 | 1 ;============================================================================= |
| 2 ; | |
| 623 | 3 ; File customview.asm combined next generation V3.03.2 |
| 0 | 4 ; |
| 604 | 5 ; Custom Views in Surface and Dive Mode |
| 0 | 6 ; |
| 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
| 8 ;============================================================================= | |
| 9 ; HISTORY | |
| 10 ; 2011-08-10 : [mH] moving from OSTC code | |
| 11 | |
| 12 ;============================================================================= | |
| 13 | |
| 604 | 14 #include "hwos.inc" ; mandatory header |
| 582 | 15 #include "tft_outputs.inc" |
| 16 #include "strings.inc" | |
| 17 #include "tft.inc" | |
| 18 #include "wait.inc" | |
| 19 #include "surfmode.inc" | |
| 20 #include "convert.inc" | |
| 21 #include "divemode.inc" | |
| 22 #include "i2c.inc" | |
| 23 #include "start.inc" | |
| 0 | 24 |
| 582 | 25 |
| 604 | 26 extern gaslist_strcat_gas_cd |
| 582 | 27 extern char_I_deco_model |
| 623 | 28 |
| 29 IFDEF _compass | |
| 582 | 30 extern TFT_surface_compass_mask |
| 31 extern TFT_dive_compass_mask | |
| 623 | 32 ENDIF |
| 33 | |
| 582 | 34 |
| 604 | 35 custview CODE |
| 0 | 36 |
| 623 | 37 ;----------------------------------------------------------------------------- |
| 38 | |
| 39 | |
| 0 | 40 ;============================================================================= |
| 604 | 41 ; Jump table for the every-second tasks for the custom view area (dive mode) |
| 42 ; | |
| 43 ; Attention: the ordering must be in line with the init jump table and the | |
| 44 ; index numbers defined in hwos.inc! | |
| 0 | 45 |
| 623 | 46 global dive_customview_second |
| 47 dive_customview_second: | |
| 48 movf active_customview,W ; get current view | |
| 604 | 49 dcfsnz WREG,F ; 1: |
| 50 goto TFT_avr_stopwatch ; average depth and stopwatch | |
| 51 dcfsnz WREG,F ; 2: | |
| 623 | 52 return ; compass - will be updated separately (faster) in dive mode |
| 604 | 53 dcfsnz WREG,F ; 3: |
| 623 | 54 IFDEF _external_sensor |
| 604 | 55 goto TFT_ppo2_sensors ; ppO2 sensors |
| 623 | 56 ELSE |
| 57 return ; not available without external sensors | |
| 58 ENDIF | |
| 604 | 59 dcfsnz WREG,F ; 4: |
| 623 | 60 IFDEF _ccr_pscr |
| 604 | 61 goto TFT_sensor_check ; sensor check |
| 623 | 62 ELSE |
| 63 return ; not available without CCR / pSCR mode | |
| 64 ENDIF | |
| 604 | 65 dcfsnz WREG,F ; 5; |
| 623 | 66 IFDEF _ccr_pscr |
| 604 | 67 goto TFT_pscr_info ; pSCR data |
| 623 | 68 ELSE |
| 69 return ; not available without CCR / pSCR mode | |
| 70 ENDIF | |
| 604 | 71 dcfsnz WREG,F ; 6: |
| 72 IFDEF _rx_functions | |
| 73 goto TFT_pressures_SAC ; tank pressure and SAC rate | |
| 74 ELSE | |
| 75 return ; not available without RX functions | |
| 76 ENDIF | |
| 77 dcfsnz WREG,F ; 7: | |
| 78 goto TFT_gas_needs_ascent ; gas needs for ascent / cave return | |
| 79 dcfsnz WREG,F ; 8: | |
| 80 goto TFT_decoplan ; deco plan | |
| 81 dcfsnz WREG,F ; 9: | |
| 82 goto TFT_ceiling_GF_tissue ; ceiling, current GF and tissues | |
| 83 dcfsnz WREG,F ; 10: | |
| 84 goto TFT_CNS ; CNS values | |
| 85 dcfsnz WREG,F ; 11: | |
| 86 goto TFT_ppo2_ead_end_cns ; ppO2, END/EAD and CNS | |
| 87 dcfsnz WREG,F ; 12: | |
| 623 | 88 return ; GF factors - static only |
| 604 | 89 dcfsnz WREG,F ; 13: |
| 90 goto TFT_clock_batt_surfpress ; clock, battery and surface pressure | |
| 623 | 91 return ; active_customview = 0 -> do nothing |
| 0 | 92 |
| 623 | 93 ;----------------------------------------------------------------------------- |
| 0 | 94 |
| 582 | 95 global surf_customview_toggle |
| 0 | 96 surf_customview_toggle: |
| 623 | 97 bcf switch_right ; clear button event |
| 98 incf active_customview,F ; number of custom view to show | |
| 604 | 99 |
| 623 | 100 IFDEF _compass |
| 604 | 101 movlw .6 ; index of surface custom view compass |
| 623 | 102 cpfseq active_customview ; will compass be shown in custom view? |
| 604 | 103 call I2C_sleep_accelerometer ; NO - stop accelerometer |
| 623 | 104 movlw .6 ; index of surface custom view compass |
| 105 cpfseq active_customview ; will compass be shown in custom view? | |
| 604 | 106 call I2C_sleep_compass ; NO - stop compass |
| 623 | 107 ENDIF |
| 604 | 108 |
| 109 movlw d'10' ; max number of custom views in surface mode | |
| 623 | 110 cpfsgt active_customview ; max reached? |
| 111 bra surf_customview_mask ; NO - show | |
| 112 movlw .1 ; YES - wrap around to 1st view | |
| 113 movwf active_customview ; - ... | |
| 114 ;bra surf_customview_mask ; - show | |
| 115 | |
| 0 | 116 |
| 582 | 117 global surf_customview_mask |
| 0 | 118 surf_customview_mask: |
| 582 | 119 WIN_BOX_BLACK .50,surf_warning1_row-1, .0, surf_decotype_column-.1 ; top, bottom, left, right |
| 623 | 120 WIN_TINY surf_customview_title_column,surf_customview_title_row ; set title position |
| 121 WIN_COLOR color_greenish ; set title color | |
| 122 | |
| 123 movf active_customview,W ; get custom view to show | |
| 124 movff WREG,customview_surfmode ; save number for later recall | |
| 604 | 125 dcfsnz WREG,F ; 1: |
| 126 bra surf_customview_init_view1 ; OC gas list | |
| 127 dcfsnz WREG,F ; 2: | |
| 128 bra surf_customview_init_view2 ; CC dil list | |
| 129 dcfsnz WREG,F ; 3: | |
| 582 | 130 bra surf_customview_init_view3 ; CC SP list |
| 604 | 131 dcfsnz WREG,F ; 4: |
| 132 bra surf_customview_init_view4 ; custom text | |
| 133 dcfsnz WREG,F ; 5: | |
| 134 bra surf_customview_init_view5 ; tissue diagram | |
| 135 dcfsnz WREG,F ; 6: | |
| 136 bra surf_customview_init_view6 ; compass | |
| 137 dcfsnz WREG,F ; 7: | |
| 138 bra surf_customview_init_view7 ; deco settings | |
| 139 dcfsnz WREG,F ; 8: | |
| 140 bra surf_customview_init_view8 ; last dive info | |
| 141 dcfsnz WREG,F ; 9: | |
| 142 bra surf_customview_init_view9 ; sensor mV readings | |
| 143 dcfsnz WREG,F ; 10: | |
| 144 bra surf_customview_init_view10 ; tank data | |
| 623 | 145 bra surf_customview_init_view4 ; default view after restart and loading of new firmware |
| 146 | |
| 0 | 147 |
| 604 | 148 surf_customview_init_view1: ; view 1: OC Gas list |
| 623 | 149 btfsc FLAG_gauge_mode ; in gauge mode? |
| 150 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
| 151 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 152 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
| 153 IFDEF _ccr_pscr | |
| 154 btfss FLAG_oc_mode ; in OC mode? | |
| 155 bra surf_customview_init_view1a ; NO - (1) | |
| 156 ENDIF | |
| 157 STRCPY_TEXT_PRINT tGaslist ; YES - title of custom view / OC mode | |
| 158 IFDEF _ccr_pscr | |
| 159 bra surf_customview_init_view1b ; - continue with common part | |
| 604 | 160 surf_customview_init_view1a: |
| 623 | 161 STRCPY_TEXT_PRINT tDiveBailout ; (1) - title of custom view / CCR & pSCR mode |
| 162 ENDIF | |
| 163 surf_customview_init_view1b: | |
| 164 call TFT_standard_color ; set color | |
| 604 | 165 call TFT_gaslist_surfmode ; show gas list |
| 166 bra customview_toggle_exit ; done | |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
184
diff
changeset
|
167 |
| 623 | 168 |
| 604 | 169 surf_customview_init_view2: ; view 2: CCR / pSCR diluent list |
| 623 | 170 IFDEF _ccr_pscr |
| 171 btfsc FLAG_ccr_mode ; in CCR mode? | |
| 172 bra surf_customview_init_view2a ; YES - (1) | |
| 173 btfsc FLAG_pscr_mode ; in pSCR mode? | |
| 174 bra surf_customview_init_view2a ; YES - (1) | |
| 175 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
| 604 | 176 surf_customview_init_view2a: |
| 623 | 177 STRCPY_TEXT_PRINT tGaslistCC ; (1) - title of custom view |
| 178 call TFT_standard_color ; - set color | |
| 179 call TFT_dillist_surfmode ; - show diluent list | |
| 180 bra customview_toggle_exit ; - done | |
| 181 ELSE | |
| 182 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
| 183 ENDIF | |
| 184 | |
| 582 | 185 |
| 604 | 186 surf_customview_init_view3: ; view 3: CC SP list |
| 623 | 187 IFDEF _ccr_pscr |
| 188 btfss FLAG_ccr_mode ; in CCR mode? | |
| 189 bra surf_customview_toggle ; NO - not available if not in CCR mode, goto next view | |
| 190 STRCPY_TEXT_PRINT tFixedSetpoints ; YES - title of custom view | |
| 191 call TFT_standard_color ; - set color | |
| 192 call TFT_splist_surfmode ; - show setpoint list | |
| 193 bra customview_toggle_exit ; - done | |
| 194 ELSE | |
| 195 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
| 196 ENDIF | |
| 197 | |
| 0 | 198 |
| 604 | 199 surf_customview_init_view9: ; view 9: sensor mV at the surface |
| 623 | 200 IFDEF _external_sensor |
| 201 btfsc FLAG_ccr_mode ; in CCR mode? | |
| 202 bra surf_customview_init_view9a ; YES - (1) | |
| 203 btfsc FLAG_pscr_mode ; in pSCR mode? | |
| 204 bra surf_customview_init_view9a ; YES - (1) | |
| 205 bra surf_customview_toggle ; NO - not available if not in CCR or pSCR mode, goto next view | |
| 604 | 206 surf_customview_init_view9a: |
| 623 | 207 movff opt_ccr_mode,WREG ; (1) - get SP mode (0: fixed SP, 1: Sensor, 2: auto SP) |
| 208 sublw .1 ; - opt_ccr_mode = 1 (sensor)? | |
| 209 bnz surf_customview_toggle ; NO - goto next view | |
| 210 STRCPY_TEXT_PRINT tSensorMilliVolt ; YES - title of custom view | |
| 211 call TFT_standard_color ; - set color | |
| 212 call TFT_sensor_mV ; - write sensor mV readings to screen | |
| 213 bra customview_toggle_exit ; - done | |
| 214 ELSE | |
| 215 bra surf_customview_toggle ; not available without CCR/pSCR mode compiled in, goto next view | |
| 216 ENDIF | |
| 217 | |
| 0 | 218 |
| 604 | 219 surf_customview_init_view4: ; view 4: custom text |
| 623 | 220 call TFT_standard_color ; set color |
| 604 | 221 call TFT_custom_text ; show the custom text |
| 222 bra customview_toggle_exit ; done | |
| 0 | 223 |
| 623 | 224 |
| 604 | 225 surf_customview_init_view5: ; view 5: tissue diagram |
| 623 | 226 btfsc FLAG_gauge_mode ; in gauge mode? |
| 227 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
| 228 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 229 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
| 230 call TFT_standard_color ; set color | |
| 604 | 231 call TFT_surface_tissues ; show tissue diagram |
| 232 bra customview_toggle_exit ; done | |
| 0 | 233 |
| 623 | 234 |
| 604 | 235 surf_customview_init_view6: ; view 6: compass |
| 623 | 236 IFDEF _compass |
| 604 | 237 call I2C_init_accelerometer ; start accelerometer |
| 238 call I2C_init_compass ; start compass | |
| 239 call TFT_surface_compass_mask ; show compass mask | |
| 240 bra customview_toggle_exit ; done | |
| 241 ELSE | |
| 623 | 242 bra surf_customview_toggle ; not available without compass compiled in, goto next view |
| 604 | 243 ENDIF |
| 244 | |
| 245 | |
| 623 | 246 surf_customview_init_view7: ; view 7: deco settings |
| 247 btfsc FLAG_gauge_mode ; in gauge mode? | |
| 248 bra surf_customview_toggle ; YES - not available in gauge mode, goto next view | |
| 249 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 250 bra surf_customview_toggle ; YES - not available in apnoe mode, goto next view | |
| 251 call TFT_surface_decosettings ; show all deco settings | |
| 252 bra customview_toggle_exit ; done | |
| 253 | |
| 254 | |
| 255 surf_customview_init_view8: ; view 8: last dive info | |
| 256 call TFT_standard_color ; set color | |
| 257 call TFT_surface_lastdive ; show last dive info | |
| 258 bra customview_toggle_exit ; done | |
| 582 | 259 |
| 0 | 260 |
| 623 | 261 surf_customview_init_view10: ; view 10: transmitter data / debug |
| 262 IFDEF _rx_functions | |
| 263 btfss tr_functions_activated ; TR functions activated? | |
| 264 bra surf_customview_toggle ; NO - show next view in list | |
| 265 STRCAT_PRINT "ID bar Volt" ; YES - title of custom view (none language-dependent) | |
| 266 call TFT_surface_tankdata ; - show received data | |
| 267 bra customview_toggle_exit ; - done | |
| 268 ELSE | |
| 269 bra surf_customview_toggle ; not available without RX functions compiled in, goto next view | |
| 270 ENDIF | |
| 271 | |
| 272 ;----------------------------------------------------------------------------- | |
| 273 | |
| 582 | 274 global menuview_toggle |
| 623 | 275 menuview_toggle: ; show main menu or the pre-menu |
| 276 bcf switch_left ; clear button event | |
| 277 movlw divemode_timeout_premenu ; get timeout for dive mode pre-menu | |
| 278 call reset_timeout_time ; reset timeout | |
| 279 bsf dive_options_menu ; flag that the dive options menu is shown | |
| 280 incf active_premenu,F ; current number of pre-menu item | |
| 281 movlw d'10' ; max number of pre-menu items | |
| 282 cpfsgt active_premenu ; max reached? | |
| 283 bra menuview_mask ; NO - show item | |
| 284 ;bra menuview_toggle_reset ; YES - reset selector | |
| 582 | 285 |
| 286 global menuview_toggle_reset | |
| 604 | 287 menuview_toggle_reset: ; timeout occurred, beyond max number of options, or item executed |
| 623 | 288 clrf active_premenu ; reset pre-menu selector |
| 289 bcf dive_options_menu ; the dive options menu is not shown anymore | |
| 0 | 290 menuview_mask: |
| 623 | 291 WIN_BOX_BLACK dm_premenu_row, dm_premenu_bot, dm_premenu_col, dm_premenu_rgt ; top, bottom, left, right |
| 292 tstfsz active_premenu ; any pre-menu selected? | |
| 293 bra menuview_items ; YES - display menu item | |
| 294 bcf win_invert ; NO - end inverse printing | |
| 295 btfss FLAG_apnoe_mode ; - in apnoe mode? | |
| 296 goto TFT_show_temp_divemode ; YES - restore temperature and done | |
| 297 goto TFT_standard_color ; NO - done | |
| 298 menuview_items: | |
| 299 call TFT_attention_color ; set color | |
| 300 bsf win_invert ; set inverse printing | |
| 301 WIN_SMALL dm_premenu_col,dm_premenu_row | |
| 302 movf active_premenu,W ; get active pre-menu item | |
| 0 | 303 dcfsnz WREG,F |
| 604 | 304 bra menuview_view_gaschange ; check if a better gas/diluent is advised and prompt for switching if yes |
| 137 | 305 dcfsnz WREG,F |
| 623 | 306 bra menuview_view1 ; "Menu?" (skipped in gauge and apnoe modes) |
|
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
307 dcfsnz WREG,F |
| 623 | 308 bra menuview_view2 ; "Quit?" (in simulation mode only) |
| 0 | 309 dcfsnz WREG,F |
| 623 | 310 bra menuview_view3 ; "Sim-1m" (in simulation mode only) |
| 0 | 311 dcfsnz WREG,F |
| 623 | 312 bra menuview_view4 ; "Sim+1m" (in simulation mode only) |
| 0 | 313 dcfsnz WREG,F |
| 623 | 314 bra menuview_view5 ; "Quit?" (in apnoe mode only) |
| 0 | 315 dcfsnz WREG,F |
| 623 | 316 bra menuview_view6 ; "Reset Avr" (in gauge mode only) |
| 0 | 317 dcfsnz WREG,F |
| 623 | 318 bra menuview_view7 ; "Sim+5'" (in simulation mode only) |
|
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
319 dcfsnz WREG,F |
| 623 | 320 bra menuview_view8 ; "Course" (only when compass is shown) |
| 560 | 321 dcfsnz WREG,F |
| 623 | 322 bra menuview_view9 ; "Layout" (offer alternative layout, aka blind mode) |
| 582 | 323 |
| 0 | 324 menuview_exit: |
| 582 | 325 call TFT_standard_color |
| 604 | 326 bcf win_invert ; reset invert flag |
| 623 | 327 return ; active pre-menu = 0, i.e. show nothing |
| 137 | 328 |
| 329 | |
| 330 menuview_view_gaschange: | |
| 623 | 331 btfsc request_gaschange ; last gas change request executed yet? |
| 604 | 332 bra menuview_toggle ; NO - call next option |
| 623 | 333 IFDEF _ccr_pscr |
| 604 | 334 btfsc FLAG_oc_mode ; in OC mode? |
| 335 bra menuview_view_gaschange_OC ; YES | |
| 623 | 336 btfsc bailout_mode ; in bailout? |
| 604 | 337 bra menuview_view_gaschange_OC ; YES |
| 338 menuview_view_gaschange_DIL: | |
| 339 btfss better_dil_available ; is the better diluent still available? | |
| 340 bra menuview_toggle ; NO - call next option | |
| 341 movff best_dil_number,PRODL ; number (1-5) of the "best diluent" | |
| 623 | 342 bsf is_diluent_menu ; setting up diluents |
| 604 | 343 bra menuview_view_gaschange_com |
| 623 | 344 ENDIF |
| 604 | 345 menuview_view_gaschange_OC: |
| 346 btfss better_gas_available ; is the better gas still available? | |
| 347 bra menuview_toggle ; NO - call next option | |
| 348 movff best_gas_number,PRODL ; number (1-5) of the "best gas" | |
| 623 | 349 bcf is_diluent_menu ; setting up OC gases |
| 604 | 350 menuview_view_gaschange_com: |
| 351 decf PRODL,F ; (1-5) -> (0-4) | |
| 623 | 352 bsf short_gas_descriptions ; use short version of gaslist_strcat_gas_cd and gaslist_strcat_setpoint |
| 604 | 353 bsf better_gas_hint ; color-code as best gas/diluent |
| 354 call gaslist_strcat_gas_cd ; append gas description of gas #PRODL (0-4) to current string | |
| 582 | 355 movlw .5 |
| 604 | 356 movwf FSR2L ; point to 6th character (5 chars are used for the gas/dil description) |
| 582 | 357 STRCAT_PRINT "?" |
| 604 | 358 bra menuview_exit ; done |
| 359 | |
| 0 | 360 menuview_view1: |
| 623 | 361 btfsc FLAG_apnoe_mode ; in apnoe mode? |
| 604 | 362 bra menuview_toggle ; YES - goto next option |
| 623 | 363 btfsc FLAG_gauge_mode ; NO - in gauge mode? |
| 364 bra menuview_toggle ; YES - goto next option | |
| 365 PUTC "\xb7" ; NO - print '->' symbol | |
| 366 STRCAT_TEXT_PRINT tDivePreMenu ; - print "Menu?" | |
| 367 bra menuview_exit ; - done | |
| 604 | 368 |
| 0 | 369 menuview_view2: |
| 623 | 370 btfss simulatormode ; in simulator mode? |
| 371 bra menuview_toggle ; NO - goto next option | |
| 372 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Simulation?" | |
| 373 bra menuview_exit ; - done | |
| 604 | 374 |
| 0 | 375 menuview_view3: |
| 623 | 376 btfss simulatormode ; in simulator mode? |
| 604 | 377 bra menuview_toggle ; NO - goto next option |
| 378 STRCPY_PRINT "Sim\xb8" ; print down arrow for going down | |
| 379 bra menuview_exit ; done | |
| 380 | |
| 0 | 381 menuview_view4: |
| 623 | 382 btfss simulatormode ; in simulator mode? |
| 383 bra menuview_toggle ; NO - goto next option | |
| 384 STRCPY_PRINT "Sim\xb9" ; YES - print up arrow for going up | |
| 385 bra menuview_exit ; - done | |
| 604 | 386 |
| 0 | 387 menuview_view5: |
| 623 | 388 btfss FLAG_apnoe_mode ; in apnoe mode? |
| 389 bra menuview_toggle ; NO - goto next option | |
| 390 btfss apnoe_at_surface ; YES - at the surface? | |
| 391 bra menuview_toggle ; NO - goto next option | |
| 392 STRCPY_TEXT_PRINT tQuitSim ; YES - print "Quit Apnea mode?" | |
| 393 bra menuview_exit ; - done | |
| 604 | 394 |
| 0 | 395 menuview_view6: |
| 623 | 396 btfss FLAG_gauge_mode ; in gauge mode? |
| 397 bra menuview_toggle ; NO - goto next option | |
| 398 STRCPY_TEXT_PRINT tResetAvg ; YES - print "Reset Avg." | |
| 399 bra menuview_exit ; - done | |
| 604 | 400 |
|
216
973a0969e0ac
NEW: On-board simulator can increase divetime in 5min steps
heinrichsweikamp
parents:
192
diff
changeset
|
401 menuview_view7: |
| 623 | 402 btfss simulatormode ; in simulator mode? |
| 403 bra menuview_toggle ; NO - goto next option | |
| 404 btfsc FLAG_gauge_mode ; YES - in gauge mode? | |
| 405 bra menuview_toggle ; YES - goto next option | |
| 406 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? | |
| 407 bra menuview_toggle ; YES - goto next option | |
| 408 STRCPY_PRINT "Sim+5'" ; NO - print "Sim+5'" | |
| 409 bra menuview_exit ; - done | |
| 604 | 410 |
|
254
5fe7aff622f3
preparations to set a course for the compass display
heinrichsweikamp
parents:
249
diff
changeset
|
411 menuview_view8: |
| 623 | 412 IFDEF _compass |
| 604 | 413 movlw index_compass_dm ; index of compass view |
| 623 | 414 cpfseq active_customview ; in compass view? |
| 415 bra menuview_toggle ; NO - goto next option | |
| 416 STRCPY_TEXT_PRINT tSetHeading ; YES - print "Heading" | |
| 417 bra menuview_exit ; - done | |
| 418 ELSE | |
| 419 bra menuview_toggle ; not available without compass compiled in, goto next option | |
| 420 ENDIF | |
| 604 | 421 |
| 560 | 422 menuview_view9: |
| 623 | 423 btfsc FLAG_apnoe_mode ; in apnoe mode? |
| 604 | 424 bra menuview_toggle ; YES - goto next option |
| 623 | 425 STRCPY_PRINT "Layout" ; NO - print "Layout" |
| 426 bra menuview_exit ; - done | |
| 582 | 427 |
| 623 | 428 ;----------------------------------------------------------------------------- |
| 604 | 429 |
| 430 ; Show next dive mode custom view (and delete this flag) | |
| 623 | 431 global dive_customview_toggle |
| 432 dive_customview_toggle: | |
| 433 incf active_customview,F ; increment number of custom view to show | |
| 582 | 434 |
| 604 | 435 movlw index_compass_dm ; index of custom view compass |
| 623 | 436 cpfseq active_customview ; will compass be shown in custom view? |
| 604 | 437 call I2C_sleep_accelerometer ; NO - stop accelerometer |
| 623 | 438 movlw index_compass_dm ; index of custom view compass |
| 439 cpfseq active_customview ; will compass be shown in custom view? | |
| 604 | 440 call I2C_sleep_compass ; NO - stop compass |
| 560 | 441 |
| 604 | 442 movlw index_cv_dm_max ; highest index in use in dive mode custom view |
| 623 | 443 cpfsgt active_customview ; max reached? |
| 444 bra dive_customview_mask ; NO - show | |
| 445 clrf active_customview ; YES - reset to zero (zero = no custom view) | |
| 446 ;bra dive_customview_mask ; - show | |
| 582 | 447 |
| 604 | 448 ;---------------------------------------------------------------------------------- |
| 449 ; Jump table for initialization of the every-second tasks in custom view area (dive mode) | |
| 450 ; | |
| 451 ; Attention: the ordering must be in line with the every-second update jump table | |
| 452 ; and the index numbers defined in hwos.inc! | |
| 453 ; | |
| 623 | 454 global dive_customview_mask |
| 455 dive_customview_mask: | |
| 456 ; clear custom view area in dive mode | |
| 604 | 457 WIN_BOX_BLACK dm_customview_row, dm_customview_bot-.2, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
| 623 | 458 movf active_customview,W ; get custom view to show |
| 604 | 459 dcfsnz WREG,F ; 1: |
| 460 bra init_avr_stopwatch ; average depth and stopwatch | |
| 461 dcfsnz WREG,F ; 2: | |
| 462 bra init_TFT_dive_compass ; compass | |
| 463 dcfsnz WREG,F ; 3: | |
| 464 bra init_ppo2_sensors ; ppO2 sensors | |
| 465 dcfsnz WREG,F ; 4: | |
| 466 bra init_sensor_check ; sensor check | |
| 467 dcfsnz WREG,F ; 5: | |
| 468 bra init_pscr_info ; pSCR data | |
| 469 dcfsnz WREG,F ; 6: | |
| 470 bra init_pressures_SAC ; tank pressure and SAC rate | |
| 471 dcfsnz WREG,F ; 7: | |
| 472 bra init_gas_needs_ascent ; gas needs for ascent / cave return | |
| 473 dcfsnz WREG,F ; 8: | |
| 474 bra init_decoplan ; deco plan | |
| 475 dcfsnz WREG,F ; 9: | |
| 476 bra init_ceiling_GF_tissue ; ceiling, current GF and tissues | |
| 477 dcfsnz WREG,F ; 10: | |
| 478 bra init_CNS ; CNS values | |
| 479 dcfsnz WREG,F ; 11: | |
| 480 bra init_ppo2_ead_end_cns ; ppO2, END/EAD and CNS | |
| 481 dcfsnz WREG,F ; 12: | |
| 482 bra init_gf_factors ; GF factors | |
| 483 dcfsnz WREG,F ; 13: | |
| 484 bra init_clock_batt_surfpress ; clock, battery and surface pressure | |
| 485 bra customview_toggle_exit ; no view (blank screen in custom view area) | |
| 582 | 486 |
| 0 | 487 |
| 604 | 488 init_ppo2_sensors: |
| 623 | 489 IFDEF _external_sensor |
| 490 bsf trigger_temp_changed ; fake a change of the temperature to have the resettable dive time overwritten which was shown with the compass view | |
| 604 | 491 btfsc FLAG_ccr_mode ; in CC mode? |
| 623 | 492 bra customview_init_view1a ; YES - (1) |
| 493 btfsc FLAG_pscr_mode ; in pSCR mode? | |
| 494 bra customview_init_view1a ; YES - (1) | |
| 495 bra dive_customview_toggle ; NO to both, goto next view | |
| 582 | 496 customview_init_view1a: |
| 623 | 497 btfsc analog_o2_input ; (1) - do we have an analog input? |
| 498 bra customview_init_view1b ; YES - (2) | |
| 499 btfsc s8_digital_avail ; NO - do we have a digital S8 interface? | |
| 500 bra customview_init_view1b ; YES - (2) | |
| 501 btfss optical_input ; NO - do we have an optical input? | |
| 502 bra dive_customview_toggle ; NO - goto next view | |
| 503 ; YES - (2) | |
| 582 | 504 customview_init_view1b: |
| 623 | 505 call TFT_ppo2_sensors_mask ; (2) - mask for ppO2 sensors |
| 506 call TFT_ppo2_sensors ; - data for ppO2 sensors | |
| 507 bra customview_toggle_exit ; - done | |
| 508 ELSE | |
| 509 bra dive_customview_toggle ; not available without external sensors, got next view | |
| 510 ENDIF | |
| 0 | 511 |
| 604 | 512 init_avr_stopwatch: |
| 513 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 514 bra dive_customview_toggle ; YES - goto next view |
| 515 call TFT_avr_stopwatch_mask ; NO - mask for average depth and stopwatch | |
| 516 call TFT_avr_stopwatch ; - data for average depth and stopwatch | |
| 517 bra customview_toggle_exit ; - done | |
| 0 | 518 |
| 604 | 519 init_decoplan: |
| 520 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 521 bra dive_customview_toggle ; YES - goto next view |
| 522 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
| 523 bra dive_customview_toggle ; YES - goto next view | |
| 524 call TFT_decoplan_mask ; NO - mask for deco plan | |
| 525 call TFT_decoplan ; - data for deco plan | |
| 526 bra customview_toggle_exit ; - done | |
| 0 | 527 |
| 604 | 528 init_clock_batt_surfpress: |
| 529 call TFT_clock_batt_surfpress_mask ; mask for clock, battery and surface pressure | |
| 530 call TFT_clock_batt_surfpress ; data for clock, battery and surface pressure | |
| 623 | 531 bra customview_toggle_exit ; done |
| 0 | 532 |
| 604 | 533 init_gf_factors: |
| 534 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 535 bra dive_customview_toggle ; YES - goto next view |
| 536 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
| 537 bra dive_customview_toggle ; YES - call next view | |
| 538 TSTOSS char_I_deco_model ; NO - in GF mode (0 = ZH-L16, 1 = ZH-L16-GF)? | |
| 539 bra dive_customview_toggle ; NO - no GF info for non-GF modes | |
| 540 call TFT_gf_factors_mask ; YES - mask for GF factors (static only) | |
| 541 bra customview_toggle_exit ; - done | |
| 0 | 542 |
| 604 | 543 init_TFT_dive_compass: ; compass |
| 623 | 544 IFDEF _compass |
| 604 | 545 call I2C_init_accelerometer ; start accelerometer |
| 546 call I2C_init_compass ; start compass | |
| 547 call TFT_dive_compass_mask ; show compass mask | |
| 623 | 548 bra customview_toggle_exit ; done |
| 549 ELSE | |
| 550 bra dive_customview_toggle ; not available without compass compiled in, goto next view | |
| 551 ENDIF | |
|
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
48
diff
changeset
|
552 |
| 604 | 553 init_pressures_SAC: ; tank pressure and SAC rate |
| 554 IFDEF _rx_functions | |
| 623 | 555 btfss tr_functions_activated ; TR functions activated? |
| 556 bra dive_customview_toggle ; NO - goto next view | |
| 557 call TFT_pressures_SAC_mask ; YES - mask for pressures and SAC | |
| 558 call TFT_pressures_SAC ; - data for pressures and SAC | |
| 559 bra customview_toggle_exit ; - done | |
| 604 | 560 ELSE |
| 623 | 561 bra dive_customview_toggle ; not available without RX functions, got next view |
| 604 | 562 ENDIF |
|
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
53
diff
changeset
|
563 |
| 604 | 564 init_CNS: ; CNS at end of dive |
| 623 | 565 btfsc FLAG_gauge_mode ; in gauge mode? |
| 566 bra dive_customview_toggle ; YES - call next view | |
| 567 btfsc FLAG_apnoe_mode ; NO - in apnoe mode? | |
| 568 bra dive_customview_toggle ; YES - call next view | |
| 569 call TFT_CNS_mask ; NO - mask for CNS values | |
| 570 call TFT_CNS ; - data for CNS values | |
| 571 bra customview_toggle_exit ; - done | |
|
333
14b466f66a7f
Extend the Ceiling custom-view with ppO2 and current GF
Janos Kovacs <kovjanos@gmail.com>
parents:
327
diff
changeset
|
572 |
| 604 | 573 init_ceiling_GF_tissue: ; ceiling, tissues and current GF |
| 574 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 575 bra dive_customview_toggle ; YES - goto next view |
| 576 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
| 577 bra dive_customview_toggle ; YES - call next view | |
| 578 call TFT_ceiling_GF_tissue_mask ; NO - mask for ceiling, current GF and tissues | |
| 579 call TFT_ceiling_GF_tissue ; - data for ceiling, current GF and tissues | |
| 580 bra customview_toggle_exit ; - done | |
|
525
00df86a5ac01
BUGFIX: Do not show GF in divemode for non-GF deco mode
heinrichsweikamp
parents:
517
diff
changeset
|
581 |
| 604 | 582 init_sensor_check: ; sensor check |
| 623 | 583 IFDEF _ccr_pscr |
| 584 btfss FLAG_ccr_mode ; in CCR mode? | |
| 585 bra dive_customview_toggle ; NO - goto next view | |
| 586 call TFT_sensor_check_mask ; YES - mask for sensor check | |
| 587 call TFT_sensor_check ; - data for sensor check | |
| 588 bra customview_toggle_exit ; - done | |
| 589 ELSE | |
| 590 bra dive_customview_toggle ; not available without CCR mode compiled in, goto next view | |
| 591 ENDIF | |
| 123 | 592 |
| 604 | 593 init_ppo2_ead_end_cns: ; ppO2, END/EAD and CNS |
| 594 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 595 bra dive_customview_toggle ; YES - goto next view |
| 596 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
| 597 bra dive_customview_toggle ; YES - goto next view | |
| 598 call TFT_ppo2_ead_end_cns_mask ; NO - mask for ppO2, END/EAD and CNS | |
| 599 call TFT_ppo2_ead_end_cns ; - data for ppO2, END/EAD and CNS | |
| 600 bra customview_toggle_exit ; - done | |
| 560 | 601 |
| 604 | 602 init_pscr_info: ; pSCR information |
| 623 | 603 IFDEF _ccr_pscr |
| 604 | 604 btfss FLAG_pscr_mode ; in pSCR mode? |
| 623 | 605 bra dive_customview_toggle ; NO - goto next view |
| 606 call TFT_pscr_info_mask ; YES - mask for pSCR info | |
| 607 call TFT_pscr_info ; - data for pSCR info | |
| 608 bra customview_toggle_exit ; - done | |
| 609 ELSE | |
| 610 bra dive_customview_toggle ; not available without CCR / pSCR mode, goto next view | |
| 611 ENDIF | |
| 604 | 612 |
| 613 init_gas_needs_ascent: ; gas needs for ascent | |
| 614 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
| 623 | 615 bra dive_customview_toggle ; YES - goto next view |
| 616 btfsc FLAG_gauge_mode ; NO - in gauge mode? | |
| 617 bra dive_customview_toggle ; YES - goto next view | |
| 618 TSTOSS opt_calc_asc_gasvolume ; NO - check if gas volume calculation is switched on | |
| 619 bra dive_customview_toggle ; NO - goto next view | |
| 620 call TFT_gas_needs_ascent_mask ; YES - mask for gas needs ascent | |
| 621 call TFT_gas_needs_ascent ; - data for gas needs ascent | |
| 622 bra customview_toggle_exit ; - done | |
| 582 | 623 |
| 0 | 624 customview_toggle_exit: |
| 623 | 625 bcf request_next_custview ; clear request flag |
| 626 return ; done | |
| 0 | 627 |
| 623 | 628 ;----------------------------------------------------------------------------- |
| 0 | 629 |
| 623 | 630 END |
