annotate src/surfmode.asm @ 622:02d1386429a6

0x60 added for (future) option to change logbook offset via PC/Bluetooth
author heinrichsweikamp
date Wed, 10 Apr 2019 10:51:07 +0200
parents 1ad0531e9078
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
3 ; File surfmode.asm REFACTORED VERSION V2.99e
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Surfacemode
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
10 ; 2011-08-07 : [mH] moving from OSTC code
0
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
14 #include "start.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
15 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
16 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
17 #include "isr.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
18 #include "adc_lightsensor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
19 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
20 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
21 #include "sleepmode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
22 #include "wait.inc" ; speed_*
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
23 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
24 #include "customview.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
25 #include "divemode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
26 #include "mcp.inc" ; RX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
27 #include "i2c.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
28 #include "comm.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
29 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
30 #include "calibrate.inc"
0
heinrichsweikamp
parents:
diff changeset
31
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
32 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
33 #include "rx_ops.inc"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
34 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
35
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
36 extern do_main_menu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
37 extern TFT_sensor_mV
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
38 extern TFT_surface_compass_heading
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
39 extern check_cns_violation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
40 extern check_warn_battery
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
41 extern check_and_store_gf_violation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
42 extern check_mbubbles
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
43
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
44 IFDEF _osct_logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
45 extern ostc_logo_block
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
46 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
47
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
48
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
49 ;---- Private local variables -------------------------------------------------
213
3b5df65d53fc layout changes
heinrichsweikamp
parents: 205
diff changeset
50
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
51 CBLOCK local1 ; max size is 16 Byte !!!
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
52 ; currently not used
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
53 ENDC ; used: 0 byte, remaining: 16 byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
54
0
heinrichsweikamp
parents:
diff changeset
55
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
56 #DEFINE menu_pos_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
57 #DEFINE menu_pos_column .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
58 #DEFINE view_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
59 #DEFINE view_column .124
0
heinrichsweikamp
parents:
diff changeset
60
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
61 sfmode CODE
0
heinrichsweikamp
parents:
diff changeset
62
heinrichsweikamp
parents:
diff changeset
63 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
64 ; Boot tasks for all modes
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
65
0
heinrichsweikamp
parents:
diff changeset
66 global surfloop
heinrichsweikamp
parents:
diff changeset
67 surfloop:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
68 call speed_normal
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
69 bcf no_sensor_int ; normal pressure mode
0
heinrichsweikamp
parents:
diff changeset
70
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
71 bcf LEDr
245
416723c8ccd8 use single-byte hardware flag (again)
heinrichsweikamp
parents: 235
diff changeset
72
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
73 clrf CCP1CON ; stop PWM
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
74 bcf PORTC,2 ; pull PWM output to GND
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
75 call TFT_boot ; initialize TFT (includes clear screen)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
76 bcf restore_deco_data
0
heinrichsweikamp
parents:
diff changeset
77
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
78 WIN_TOP .40
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
79 WIN_LEFT .10
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
80 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block ; show heinrichsweikamp logo
0
heinrichsweikamp
parents:
diff changeset
81
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
82 IFDEF _ostc_logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
83 WIN_TOP .100
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
84 WIN_LEFT .34
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
85 TFT_WRITE_PROM_IMAGE_BY_LABEL ostc_logo_block ; show OSTC logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
86 ELSE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
87 WIN_COLOR color_white
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
88 WIN_STD .30,.90 ; column, row
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
89 STRCPY_PRINT "Open Source" ; show OSTC banner text, line 1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
90 WIN_STD .20,.130 ; column, row
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
91 STRCPY_PRINT "Tauch-Computer" ; show OSTC banner text, line 2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
92 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
93
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
94 WIN_COLOR color_white
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
95 WIN_SMALL .35,.180
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
96 PUTC "v" ; print v
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
97 call TFT_cat_firmware ; print x.y
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
98 PUTC " " ; print _
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
99 call TFT_cat_beta_release ; print BetaZ or Release
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
100 STRCAT_PRINT "" ; finalize output
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
101 bcf win_invert ; clean up eventual color-coding
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
102 call TFT_standard_color ; ditto
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
103
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
104 call TFT_Display_FadeIn ; show splash
0
heinrichsweikamp
parents:
diff changeset
105
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
106 ;---- Do any useful initializes that takes time -------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
107
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
108 call restart_set_modes_and_flags ; sets deco mode flags
0
heinrichsweikamp
parents:
diff changeset
109 bcf pressure_refresh
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
110 call I2C_sleep_compass
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
111 call I2C_sleep_accelerometer
0
heinrichsweikamp
parents:
diff changeset
112 clrf ext_flash_address+0
heinrichsweikamp
parents:
diff changeset
113 clrf ext_flash_address+1
heinrichsweikamp
parents:
diff changeset
114 clrf ext_flash_address+2
heinrichsweikamp
parents:
diff changeset
115
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
116 movlw surface_sp ; in cbar
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
117 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics
221
90923a081ae7 minor: configure buttons during splash screen
heinrichsweikamp
parents: 213
diff changeset
118
0
heinrichsweikamp
parents:
diff changeset
119 clrf timeout_counter2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
120 ; clrf timeout_counter3 ; not used / required [rl]
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
121 bcf menubit ; clear menu flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
122 bcf premenu
621
1ad0531e9078 3.01 release
heinrichsweikamp
parents: 604
diff changeset
123 ; clrf last_pressure+0
1ad0531e9078 3.01 release
heinrichsweikamp
parents: 604
diff changeset
124 ; clrf last_pressure+1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
125 bcf FLAG_bailout_mode ; =1: Bailout
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
126 bcf FLAG_diluent_setup ; use OC gases for gaslist routine
0
heinrichsweikamp
parents:
diff changeset
127
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
128 bcf simulatormode_active ; quit simulator mode (if active)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
129
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
130 call wait_1s ; wait <= 1 second
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
131 call wait_1s ; wait 1 second
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
132 call wait_1s ; wait 1 second
0
heinrichsweikamp
parents:
diff changeset
133
heinrichsweikamp
parents:
diff changeset
134 ;---- Fade to standard surface view --------------------------------------
heinrichsweikamp
parents:
diff changeset
135
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
136 call TFT_Display_FadeOut ; go to black screen
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
137 call TFT_ClearScreen ; then change everything
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
138 WIN_TOP .0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
139 WIN_LEFT .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
140 WIN_FONT FT_SMALL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
141 bcf win_invert ; reset invert flag
0
heinrichsweikamp
parents:
diff changeset
142
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
143 WIN_COLOR color_lightblue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
144 WIN_SMALL menu_pos_column,menu_pos_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
145 STRCPY_TEXT_PRINT tMenu ;"<Menu"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
146 WIN_SMALL view_column,view_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
147 STRCPY_TEXT_PRINT tView ;"View>"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
148 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
149
48
7c7d7644ca37 Time and Date in normal (Not tiny) font
heinrichsweikamp
parents: 39
diff changeset
150 ; Logo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
151 IFDEF _ostc_logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
152 WIN_TOP .0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
153 WIN_LEFT .70
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
154 TFT_WRITE_PROM_IMAGE_BY_LABEL ostc_logo_block ; show OSTC logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
155 ELSE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
156 WIN_COLOR color_white
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
157 WIN_STD .100,.0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
158 STRCPY_PRINT "OSTC" ; show "OSTC"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
159 WIN_COLOR color_cyan
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
160 WIN_TINY .140,.0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
161 STRCPY_PRINT "hwOS" ; show "hwOS"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
162 WIN_TINY .139,.12
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
163 STRCPY_PRINT "tech" ; show "tech"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
164 ENDIF
0
heinrichsweikamp
parents:
diff changeset
165
158
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
166 call TFT_clock ; display time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
167 call update_surfloop60
158
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
168 call get_battery_voltage ; get battery voltage
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
169 call TFT_update_batt_voltage ; display battery voltage
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
170 call TFT_update_surf_press ; display surface pressure
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
171 call TFT_temp_surfmode ; display temperature
158
683321c09cfa nicer boot into surfacemode
heinrichsweikamp
parents: 145
diff changeset
172 call TFT_display_decotype_surface
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
173 call calc_deko_divemode_sensor
234
57155164faad Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents: 233
diff changeset
174
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
175 TSTOSS opt_dive_mode ; in OC ? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
176 call TFT_show_OC_startgas_surface; YES - show first gas and "OSTC2-like" active gases
0
heinrichsweikamp
parents:
diff changeset
177
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
178 movff customview_surfmode,menupos3; reload last custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
179 call surf_customview_mask ; redraw last custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
180
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
181 call TFT_Display_FadeIn ; display resulting surface screen
0
heinrichsweikamp
parents:
diff changeset
182
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
183 bcf switch_left
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
184 bcf switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
185
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
186 ;---- Late initializations -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
187 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
188 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values
0
heinrichsweikamp
parents:
diff changeset
189 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
190 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
191 movff last_surfpressure_30min+0,last_surfpressure+0 ; use 30min old air pressure
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
192 movff last_surfpressure_30min+1,last_surfpressure+1 ; use 30min old air pressure
0
heinrichsweikamp
parents:
diff changeset
193
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
194 movff opt_GF_low,char_I_GF_Low_percentage
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
195 movff opt_GF_high,char_I_GF_High_percentage
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
196
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
197 ; Startup tasks for all modes
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
198 ; Desaturation time needs:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
199 ; int_I_pres_surface
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
200 ; char_I_desaturation_multiplier
0
heinrichsweikamp
parents:
diff changeset
201 call deco_calc_desaturation_time ; calculate desaturation time
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
202 banksel common
0
heinrichsweikamp
parents:
diff changeset
203
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
204 IFDEF _screendump
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
205 btfsc enable_screen_dumps ; =1: ignore vin_usb, wait for "l" command (Screen dump)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
206 call enable_rs232 ; also sets to speed_normal
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
207 ENDIF
0
heinrichsweikamp
parents:
diff changeset
208
heinrichsweikamp
parents:
diff changeset
209 surfloop_loop:
heinrichsweikamp
parents:
diff changeset
210 btfss onesecupdate ; do every second tasks?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
211 bra surfloop_loop2 ; NO - loop
0
heinrichsweikamp
parents:
diff changeset
212
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
213 ; one second tasks for all modes
0
heinrichsweikamp
parents:
diff changeset
214 call speed_normal
487
heinrichsweikamp
parents: 485
diff changeset
215 ;call TFT_debug_output
0
heinrichsweikamp
parents:
diff changeset
216 call TFT_clock ; update clock
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
217 call timeout_surfmode ; check timeout
0
heinrichsweikamp
parents:
diff changeset
218 call get_battery_voltage ; get battery voltage
heinrichsweikamp
parents:
diff changeset
219 call TFT_update_batt_voltage ; display battery voltage
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
220 call set_dive_modes ; tests if depth > threshold
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
221 btfss secs,0 ; every two seconds...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
222 call TFT_temp_surfmode ; ... displays temperature
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
223 btfss secs,0 ; every two seconds...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
224 call surfmode_check_for_warnings ; ... check for warnings (and display/update) them
0
heinrichsweikamp
parents:
diff changeset
225 bcf onesecupdate ; every second tasks done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
226
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
227 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
228 btfss FLAG_tr_enabled ; YES - TR functions enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
229 bra surfloop_loop2 ; NO - skip tank pressure part
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
230 call get_pressure_readings ; YES - get pressure readings
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
231 call TFT_surface_tank_pres ; - update first gas/diluent pressure
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
232 movlw .10 ; - number of tank data custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
233 cpfseq menupos3 ; - in tank data custom view?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
234 bra surfloop_loop2 ; NO - skip
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
235 call TFT_surface_tankdata ; YES - update tank data custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
236 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
237
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
238 surfloop_loop2:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
239 ; tasks approx. every 50 ms for all modes
0
heinrichsweikamp
parents:
diff changeset
240 call test_switches_surfmode ; check switches
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
241 ;call TFT_debug_output
0
heinrichsweikamp
parents:
diff changeset
242
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
243 ; one minute tasks for all modes
0
heinrichsweikamp
parents:
diff changeset
244 btfsc oneminupdate ; do every minute tasks
heinrichsweikamp
parents:
diff changeset
245 call update_surfloop60 ; yes, e.g. update time and date
heinrichsweikamp
parents:
diff changeset
246
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
247 ; mode tasks
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
248 btfsc divemode ; divemode active?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
249 goto diveloop ; YES - switch into divemode!
230
f6548e8f06f5 Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents: 226
diff changeset
250
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
251 btfsc menubit ; shall enter menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
252 goto do_main_menu ; YES - enter menu
0
heinrichsweikamp
parents:
diff changeset
253
heinrichsweikamp
parents:
diff changeset
254 btfsc pressure_refresh ; new pressure available?
heinrichsweikamp
parents:
diff changeset
255 call TFT_update_surf_press ; display surface pressure
heinrichsweikamp
parents:
diff changeset
256 bcf pressure_refresh ; until new pressure is available
heinrichsweikamp
parents:
diff changeset
257
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
258 ; updates every 1/4 second
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
259 btfss quarter_second_update
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
260 bra surfloop_loop2b
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
261
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
262 bcf quarter_second_update
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
263
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
264 ; update sensors
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
265 call calc_deko_divemode_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
266
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
267 btfsc FLAG_ccr_mode ; in CCR mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
268 bra surfloop_loop2a1 ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
269 btfsc FLAG_pscr_mode ; in pSCR mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
270 bra surfloop_loop2a1 ; YES
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
271 bra surfloop_loop2a ; NO to both
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
272
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
273 surfloop_loop2a1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
274 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: auto SP
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
275 decfsz WREG ; opt_ccr_mode = 1 (sensor)?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
276 bra surfloop_loop2a ; NO - skip sensor readings
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
277
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
278 call TFT_surface_sensor ; ...update sensor data in surface mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
279 call TFT_sensor_surface_warning ; show a warning arrow-down behind sensor readings when sensor is end-of-life
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
280 movlw .9
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
281 cpfseq menupos3 ; in sensor mV surface custom view?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
282 bra surfloop_loop2a ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
283 call TFT_sensor_mV ; YES - update mV readings (Each 1/4 second and not each second as in customview.asm)
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
284
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
285 surfloop_loop2a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
286 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
287 cpfseq menupos3 ; in compass view?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
288 bra surfloop_loop2b ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
289 call TFT_surface_compass_heading ; YES - update compass heading value
0
heinrichsweikamp
parents:
diff changeset
290
476
7c10557c248e no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents: 382
diff changeset
291 surfloop_loop2b:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
292 btfsc toggle_customview ; next view?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
293 call surf_customview_toggle ; YES - show next customview (and delete this flag)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
294
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
295 IFDEF _screendump
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
296 btfsc enable_screen_dumps ; screendump enabled?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
297 call TFT_dump_screen_check ; YES - check if requested and do it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
298 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
299
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
300 ;btfsc vusb_in ; USB plugged in? | commented out - do not start COMM mode when charging in surface mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
301 ;call comm_mode ; YES - start COMM mode |
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
302
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
303 btfss sleepmode ; shall we go into sleep mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
304 bra surfloop_loop ; NO - loop in surface mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
305 movff menupos3,customview_surfmode; YES - save last custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
306 goto sleeploop ; switch into sleep mode
0
heinrichsweikamp
parents:
diff changeset
307
heinrichsweikamp
parents:
diff changeset
308 update_surfloop60:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
309 ; one minute tasks for all modes
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
310 call TFT_date ; update date
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
311
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
312 call deco_calc_dive_interval_1min; calculate deco in surface mode. int_I_pres_surface gets updated by
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
313 call deco_calc_desaturation_time ; TFT_update_surf_press when amb_pressure has changed by >= 10 mbar
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
314 banksel common
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
315
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
316 ; update tissue diagram if it is on display
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
317 movlw .5 ; number of tissue custom view
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
318 cpfseq menupos3 ; is this the current custom view?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
319 bra update_surfloop60_1 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
320 call TFT_standard_color ; YES - set standard color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
321 call TFT_surface_tissues ; show tissue diagram
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
322
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
323 update_surfloop60_1:
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
324 ; update last dive info if it is on display
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
325 movlw .8 ; number of the last dive info custom view
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
326 cpfseq menupos3 ; is this the current custom view?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
327 bra update_surfloop60_2 ; NO
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
328 call TFT_standard_color ; YES - set standard color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
329 call TFT_surface_lastdive ; show last dive infos
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
330
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
331 update_surfloop60_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
332 bcf oneminupdate
0
heinrichsweikamp
parents:
diff changeset
333 return
heinrichsweikamp
parents:
diff changeset
334
heinrichsweikamp
parents:
diff changeset
335 surfmode_check_for_warnings:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
336 bcf message_attention ; clear flag for messages of level attention
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
337 bcf message_warning ; clear flag for messages of level warning
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
338 clrf message_counter ; clear message counter
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
339
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
340 ; warnings for all modes
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
341 call check_warn_battery ; check if the battery level should be displayed/warned
0
heinrichsweikamp
parents:
diff changeset
342
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
343 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
344 bra surfmode_check_for_warnings2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
345 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
346 bra surfmode_check_for_warnings2
0
heinrichsweikamp
parents:
diff changeset
347
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
348 ; warnings only in deco modes
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
349 rcall surfmode_check_for_desat ; check if desat time should be shown
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
350 rcall surfmode_check_for_nofly ; check if nofly time should be shown
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
351 call check_cns_violation ; check CNS value and display it, if required
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
352 call check_and_store_gf_violation; check GF value and display it, if required
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
353 call check_mbubbles ; check for micro bubbles
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
354
0
heinrichsweikamp
parents:
diff changeset
355 surfmode_check_for_warnings2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
356 ; setup message page number
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
357 incf message_page,F
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
358 bcf STATUS,C
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
359 rlcf message_page,W ; *2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
360 cpfsgt message_counter ; > message_counter?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
361 clrf message_page ; NO - clear
0
heinrichsweikamp
parents:
diff changeset
362
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
363 ; clear both rows of warnings if there is nothing to show at all
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
364 tstfsz message_counter ; any warnings?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
365 bra surfmode_check_for_warnings3; YES - look if second row needs to be cleared
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
366 call TFT_clear_warning_text ; NO - clear complete warnings area
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
367 return
0
heinrichsweikamp
parents:
diff changeset
368
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
369 surfmode_check_for_warnings3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
370 ; clear 2nd row of warnings if there is nothing to show (on this page)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
371 btfss second_row_warning ; =1: The second row contains a warning
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
372 call TFT_clear_warning_text_2nd_row ; NO - clear this row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
373 return ; Done.
0
heinrichsweikamp
parents:
diff changeset
374
heinrichsweikamp
parents:
diff changeset
375 surfmode_check_for_desat:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
376 banksel int_O_desaturation_time
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
377 movf int_O_desaturation_time+0,W
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
378 iorwf int_O_desaturation_time+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
379 banksel common
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
380 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
381 return ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
382 surfmode_check_for_desat_1: ; YES
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
383 incf message_counter,F ; increase counter
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
384 call TFT_desaturation_time ; show desaturation time
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
385 return
0
heinrichsweikamp
parents:
diff changeset
386
heinrichsweikamp
parents:
diff changeset
387 surfmode_check_for_nofly:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
388 banksel int_O_nofly_time
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
389 movf int_O_nofly_time+0,W
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
390 iorwf int_O_nofly_time+1,W
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
391 banksel common
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
392 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
393 return ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
394 surfmode_check_for_nofly_1: ; YES
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
395 incf message_counter,F ; increase counter
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
396 call TFT_nofly_time ; show nofly-time
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
397 return
0
heinrichsweikamp
parents:
diff changeset
398
heinrichsweikamp
parents:
diff changeset
399
heinrichsweikamp
parents:
diff changeset
400 ;=============================================================================
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
401
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
402 test_switches_surfmode: ; check switches in surfacemode
0
heinrichsweikamp
parents:
diff changeset
403 btfsc switch_right
heinrichsweikamp
parents:
diff changeset
404 bra test_switches_surfmode2
heinrichsweikamp
parents:
diff changeset
405 btfsc switch_left
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
406 bra test_switches_surfmode3
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
407 ; no button pressed
0
heinrichsweikamp
parents:
diff changeset
408 return
heinrichsweikamp
parents:
diff changeset
409
heinrichsweikamp
parents:
diff changeset
410 test_switches_surfmode3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
411 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
412 cpfseq menupos3 ; in compass view?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
413 bra test_switches_surfmode3a ; NO
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
414
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
415 btfsc premenu ; "Bearing" already shown?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
416 bra test_switches_surfmode3b ; YES - remove it
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
417 call TFT_surf_set_bearing ; NO - show it
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
418 bcf switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
419 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
420
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
421 test_switches_surfmode3a:
0
heinrichsweikamp
parents:
diff changeset
422 bcf switch_left
587
e81cf407261a V2.97 SP1
heinrichsweikamp
parents: 582
diff changeset
423 bcf compass_bearing_set ; clear bearing on entering menu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
424 bsf menubit ; enter the main menu
0
heinrichsweikamp
parents:
diff changeset
425 return
heinrichsweikamp
parents:
diff changeset
426
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
427 test_switches_surfmode3b:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
428 ; clear "Bearing"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
429 WIN_BOX_BLACK .158,.190, .15, .99 ; top, bottom, left, right
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
430 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
431 bcf switch_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
432 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
433
0
heinrichsweikamp
parents:
diff changeset
434 test_switches_surfmode2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
435 movlw .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
436 cpfseq menupos3 ; in compass view?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
437 bra test_switches_surfmode2a ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
438 btfss premenu ; "Heading?" shown?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
439 bra test_switches_surfmode2a ; NO
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
440 ; set new heading
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
441 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
442 bsf compass_bearing_set
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
443 movff compass_heading_shown+0,compass_bearing+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
444 movff compass_heading_shown+1,compass_bearing+1
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
445 bcf switch_right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
446 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
447
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
448 test_switches_surfmode2a:
0
heinrichsweikamp
parents:
diff changeset
449 bcf switch_right
heinrichsweikamp
parents:
diff changeset
450 bsf toggle_customview
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
451 bcf premenu
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
452 clrf timeout_counter2 ; and reset timeout
0
heinrichsweikamp
parents:
diff changeset
453 return
heinrichsweikamp
parents:
diff changeset
454
heinrichsweikamp
parents:
diff changeset
455 global timeout_surfmode
heinrichsweikamp
parents:
diff changeset
456 timeout_surfmode:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
457 movlw timeout_surfacemode ; load default timeout
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
458 btfsc menu_update_sensor_mv ; in the "Calibrate" menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
459 movlw timeout_calibrate_menu ; YES - replace with CCR Calibrate Menu timeout
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
460 IFDEF _rx_functions
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
461 btfsc FLAG_pairing_mode ; in the "Setup Tank" menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
462 movlw timeout_tanksetup_menu ; YES - replace with Tank Setup Menu timeout
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
463 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
464 btfsc menubit ; in menu?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
465 bra timeout_testmode ; NO - done
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
466 ; must be in surface mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
467 btfss FLAG_ccr_mode ; in CCR mode? (fixed ppO2 or sensor)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
468 bra timeout_testmode ; NO - not CCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
469 movlw timeout_ccr_surface ; YES - replace with CCR surface mode timeout
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
470
0
heinrichsweikamp
parents:
diff changeset
471 global timeout_testmode
heinrichsweikamp
parents:
diff changeset
472 timeout_testmode:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
473 incf timeout_counter2,F ; increase timeout counter
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
474 cpfsgt timeout_counter2 ; compare with timeout limit
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
475 return ; return, no timeout
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
476 bsf sleepmode ; set flag
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
477 return ; return
0
heinrichsweikamp
parents:
diff changeset
478
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
479 END