annotate src/surfmode.asm @ 630:4cd81bdbf15c

3.08 stable release
author heinrichsweikamp
date Fri, 21 Feb 2020 10:51:36 +0100
parents 237931377539
children 185ba2f91f59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
3 ; File surfmode.asm next combined generation V3.04.3
0
heinrichsweikamp
parents:
diff changeset
4 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
5 ; Surface Mode
0
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 "adc_lightsensor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
18 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
19 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
20 #include "sleepmode.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
21 #include "wait.inc"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
22 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
23 #include "customview.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
24 #include "divemode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
25 #include "mcp.inc" ; RX
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
26 #include "i2c.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
27 #include "comm.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
28 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
29 #include "calibrate.inc"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
30 #include "rx_ops.inc"
0
heinrichsweikamp
parents:
diff changeset
31
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
32
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
33 extern do_main_menu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
34 extern check_cns_violation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
35 extern check_warn_battery
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
36 extern check_and_store_sat_violation
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
37 extern check_mbubbles
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
38
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
39 IFDEF _osct_logo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
40 extern ostc_logo_block
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
41 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
42
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
43 IFDEF _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
44 extern TFT_surface_compass_heading
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
45 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
46
213
3b5df65d53fc layout changes
heinrichsweikamp
parents: 205
diff changeset
47
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
48 ;---- Private local variables ------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
49
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
50 CBLOCK local1 ; max size is 16 byte !!!
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
51 ; currently not used
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
52 ENDC ; used: 0 byte, remaining: 16 byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
53
0
heinrichsweikamp
parents:
diff changeset
54
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
55 #DEFINE menu_pos_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
56 #DEFINE menu_pos_column .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
57 #DEFINE view_row .215
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
58 #DEFINE view_column .124
0
heinrichsweikamp
parents:
diff changeset
59
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
60
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
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
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
65 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
66 ; called after restart via the battery selection, after compass calibration,
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
67 ; and via ghostwriter at the end of a dive
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
68 ;
0
heinrichsweikamp
parents:
diff changeset
69 global surfloop
heinrichsweikamp
parents:
diff changeset
70 surfloop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
71 clrf STKPTR ; clear return addresses stack
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
72 ; clrf CCP1CON ; stop PWM
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
73 ; bcf PORTC,2 ; pull PWM output to GND
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
74 ; clrf CCPR1L ; backlight off
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
75 call TFT_boot ; initialize TFT (includes clear screen)
245
416723c8ccd8 use single-byte hardware flag (again)
heinrichsweikamp
parents: 235
diff changeset
76
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
77 btfsc restart_fast ; shall make a fast restart?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
78 bra surfloop_1 ; YES
0
heinrichsweikamp
parents:
diff changeset
79
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
80 ; show heinrichsweikamp logo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
81 WIN_TOP .40
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
82 WIN_LEFT .10
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
83 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block
0
heinrichsweikamp
parents:
diff changeset
84
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
85 ; show textual OSTC logo
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
86 WIN_COLOR color_white
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
87 WIN_STD .30,.90 ; column, row
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
88 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
89 WIN_STD .20,.130 ; column, row
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
90 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
91
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
92 WIN_COLOR color_white
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
93 WIN_SMALL .35,.180
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
94 PUTC "v" ; print v
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
95 call TFT_cat_firmware ; print x.y
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
96 PUTC " " ; print _
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
97 call TFT_cat_beta_release ; print BetaZ or Release
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
98 STRCAT_PRINT "" ; finalize output
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
99 bcf win_invert ; clean up eventual color-coding
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
100 call TFT_standard_color ; ditto
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
101 call TFT_Display_FadeIn ; dim up the display
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
102
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
103 surfloop_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
104 ;---- Do all useful initializations that take time -----------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
105
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
106 ; set deco mode flags
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
107 call restart_set_modes_and_flags
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
108
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
109 bsf trigger_pres_cur_changed; set flag to have pressure written to display on first round of surface loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
110 bsf trigger_temp_changed ; set flag to have temperature written to display on first round of surface loop
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
111
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
112 call I2C_sleep_compass ; shut down compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
113
0
heinrichsweikamp
parents:
diff changeset
114 clrf ext_flash_address+0
heinrichsweikamp
parents:
diff changeset
115 clrf ext_flash_address+1
heinrichsweikamp
parents:
diff changeset
116 clrf ext_flash_address+2
heinrichsweikamp
parents:
diff changeset
117
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
118 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
119 movlw surface_sp ; load default surface setpoint (in cbar)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
120 movff WREG,char_I_const_ppO2 ; store it as current setpoint
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
121 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
122
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
123 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
124 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
125 ENDIF
221
90923a081ae7 minor: configure buttons during splash screen
heinrichsweikamp
parents: 213
diff changeset
126
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
127 bcf surfmode_menu ; not in surface menu (any more)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
128 bcf compass_menu ; not in "set bearing" selection (any more)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
129 bcf bailout_mode ; not in bailout menu (any more)
0
heinrichsweikamp
parents:
diff changeset
130
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
131 bcf switch_left ; clear intermediate button event since start/restart
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
132 bcf switch_right ; clear intermediate button event since start/restart
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
133
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
134 btfsc restart_fast ; shall make a fast restart?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
135 bra surfloop_2 ; YES
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
136
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
137 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code)
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
138 banksel common ; back to bank common
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
139
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
140 call wait_1s ; wait <= 1 second
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
141 call wait_1s ; wait 1 second
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
142 call wait_1s ; wait 1 second
0
heinrichsweikamp
parents:
diff changeset
143
heinrichsweikamp
parents:
diff changeset
144 ;---- Fade to standard surface view --------------------------------------
heinrichsweikamp
parents:
diff changeset
145
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
146 call TFT_Display_FadeOut ; dim down display to black screen
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
147 call TFT_ClearScreen ; clear screen
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
148
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
149 surfloop_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
150 WIN_TOP .0
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
151 WIN_LEFT .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
152 WIN_FONT FT_SMALL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
153 bcf win_invert ; clear flag for inverted text
0
heinrichsweikamp
parents:
diff changeset
154
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
155 ; show button functionalities
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
156 WIN_COLOR color_lightblue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
157 WIN_SMALL menu_pos_column,menu_pos_row
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
158 STRCPY_TEXT_PRINT tMenu ; show "<Menu"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
159 WIN_SMALL view_column,view_row
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
160 STRCPY_TEXT_PRINT tView ; show "View>"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
161 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
162
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
163
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
164 ;---- Logo in upper right corner -----------------------------------------
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
165
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
166 ; show textual OSTC logo
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
167 WIN_COLOR color_white ; set text color to white
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
168 WIN_STD .100,.2 ; set output position
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
169 STRCPY_PRINT "OSTC" ; show "OSTC"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
170 WIN_COLOR color_cyan ; set text color to cyan
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
171 WIN_TINY .138,.2 ; set output position
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
172 STRCPY_PRINT "hwOS" ; show "hwOS"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
173 WIN_TINY .137,.14 ; set output position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
174 IFDEF _hwos_sport
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
175 STRCPY_PRINT "sport" ; show "sport"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
176 ELSE
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
177 STRCPY_PRINT "tech" ; show "tech"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
178 ENDIF
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
179 WIN_TINY .100,.32 ; set output position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
180 call TFT_show_firmware ; show firmware version
0
heinrichsweikamp
parents:
diff changeset
181
heinrichsweikamp
parents:
diff changeset
182
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
183 ;---- fill screen --------------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
184 call get_battery_voltage ; get battery voltage
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
185 call TFT_batt_surfmode ; display battery voltage
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
186 call TFT_time_surfmode ; display time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
187 call TFT_date_surfmode ; display date
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
188 call TFT_pres_surfmode ; display surface pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
189 call TFT_temp_surfmode ; display temperature
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
190 call TFT_decotype_surface ; display deco mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
191
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
192 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
193 call TFT_show_OC_startgas_surface ; YES - show first gas and "OSTC2-like" active gases
0
heinrichsweikamp
parents:
diff changeset
194
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
195 movff customview_surfmode,active_customview ; reload last custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
196 call surf_customview_mask ; redraw last custom view
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
197
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
198 call TFT_Display_FadeIn ; display resulting surface screen
0
heinrichsweikamp
parents:
diff changeset
199
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
200 IFDEF _screendump
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
201 btfsc screen_dump_avail ; screen dump function enabled?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
202 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
203 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
204
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
205 bcf restart_fast ; clear flag for fast restart
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
206 bsf imprint_surfmode_data ; start imprinting surface mode data
0
heinrichsweikamp
parents:
diff changeset
207
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
208 bcf switch_left ; clear pending left button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
209 bcf switch_right ; clear pending right button event
0
heinrichsweikamp
parents:
diff changeset
210
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
211 rcall reset_timeout_surfmode ; reset timeout
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
212
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
213 surfloop_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
214 ; call TFT_debug_output ; optional debug output
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
215
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
216 call test_switches_surfmode ; check switches
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
217
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
218 btfsc request_next_custview ; shall show next custom view?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
219 call surf_customview_toggle ; YES - show next custom view (and clear this flag)
0
heinrichsweikamp
parents:
diff changeset
220
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
221 btfss surfmode_menu ; shall enter surface menu?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
222 bra surfloop_loop_1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
223 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
224 goto do_main_menu ; - goto surface menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
225
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
226 surfloop_loop_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
227 rcall housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
228 bra surfloop_loop ; loop in surface mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
229
0
heinrichsweikamp
parents:
diff changeset
230
heinrichsweikamp
parents:
diff changeset
231 surfmode_check_for_warnings:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
232 clrf message_counter ; clear message counter
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
233
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
234 ; warnings for all modes
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
235 call check_warn_battery ; check if the battery level should be displayed/warned
0
heinrichsweikamp
parents:
diff changeset
236
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
237 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
238 bra surfmode_check_for_warnings2
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
239 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
240 bra surfmode_check_for_warnings2
0
heinrichsweikamp
parents:
diff changeset
241
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
242 ; warnings only in deco modes
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
243 call check_and_store_sat_violation ; check/show tissue saturation
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
244 call check_cns_violation ; check/show CNS value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
245 call check_mbubbles ; check/show micro bubbles warning
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
246 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
247 btfsc WREG,int_warning_flag ; check if the warning flag is set
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
248 bra surfmode_check_for_warnings2 ; YES - outside model
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
249 rcall surfmode_check_for_desat ; NO - check/display desaturation time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
250 rcall surfmode_check_for_nofly ; NO - check/display no-fly time
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
251
0
heinrichsweikamp
parents:
diff changeset
252 surfmode_check_for_warnings2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
253 ; setup message page number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
254 incf message_page,F ; increment page number
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
255 bcf STATUS,C ; clear carry bit
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
256 rlcf message_page,W ; each page can take two messages
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
257 cpfsgt message_counter ; number of actual messages > message capacity ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
258 clrf message_page ; NO - all messages could be shown, restart from first page next time
0
heinrichsweikamp
parents:
diff changeset
259
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
260 ; clear both rows if there is nothing to show at all
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
261 tstfsz message_counter ; any message to show?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
262 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
263 goto TFT_clear_message_window ; NO - clear complete message area and return
0
heinrichsweikamp
parents:
diff changeset
264
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
265 surfmode_check_for_warnings3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
266 ; clear 2nd row of messages if there is nothing to show (on this page)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
267 btfss message_2nd_row_used ; does the 2nd row contain a message?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
268 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
269 return ; YES - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
270
0
heinrichsweikamp
parents:
diff changeset
271
heinrichsweikamp
parents:
diff changeset
272 surfmode_check_for_desat:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
273 banksel int_O_desaturation_time
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
274 movf int_O_desaturation_time+0,W
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
275 iorwf int_O_desaturation_time+1,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
276 banksel common ; back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
277 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
278 return ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
279 surfmode_check_for_desat_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
280 incf message_counter,F ; YES - increase counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
281 call TFT_desaturation_time ; - show desaturation time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
282 return ; - done
0
heinrichsweikamp
parents:
diff changeset
283
heinrichsweikamp
parents:
diff changeset
284 surfmode_check_for_nofly:
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
285 banksel int_O_nofly_time
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
286 movf int_O_nofly_time+0,W
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
287 iorwf int_O_nofly_time+1,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
288 banksel common ; back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
289 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
290 return ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
291 surfmode_check_for_nofly_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
292 incf message_counter,F ; YES - increase counter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
293 call TFT_nofly_time ; - show nofly-time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
294 return ; - done
0
heinrichsweikamp
parents:
diff changeset
295
heinrichsweikamp
parents:
diff changeset
296
heinrichsweikamp
parents:
diff changeset
297 ;=============================================================================
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 535
diff changeset
298
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
299 test_switches_surfmode: ; check buttons in surface mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
300 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
301 bra test_switches_surfmode2 ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
302 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
303 bra test_switches_surfmode3 ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
304 return ; NO to both - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
305
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
306 test_switches_surfmode2: ; right button pressed
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
307 bcf switch_right ; clear button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
308 rcall reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
309 IFDEF _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
310 movlw .6 ; coding for surface custom compass view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
311 cpfseq active_customview ; in compass view?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
312 bra test_switches_surfmode2a ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
313 btfss compass_menu ; "set course" selection shown?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
314 bra test_switches_surfmode2a ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
315 bsf compass_bearing_set ; YES - set new course
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
316 MOVII compass_heading_shown,compass_bearing
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
317 bra test_switches_surfmode3b ; - clear "Course" label and return
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
318 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
319 test_switches_surfmode2a:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
320 bsf request_next_custview ; request next custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
321 bcf compass_menu ; "set course" selection not shown anymore
0
heinrichsweikamp
parents:
diff changeset
322 return
heinrichsweikamp
parents:
diff changeset
323
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
324 test_switches_surfmode3: ; left button pressed
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
325 bcf switch_left ; clear button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
326 rcall reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
327 IFDEF _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
328 movlw .6 ; coding for surface custom view compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
329 cpfseq active_customview ; in compass view?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
330 bra test_switches_surfmode3a ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
331 btfsc compass_menu ; YES - "set course" selection already shown?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
332 bra test_switches_surfmode3b ; YES - remove it
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
333 call TFT_surf_set_bearing ; NO - show it
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
334 return ; - done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
335 ENDIF
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
336 test_switches_surfmode3a:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
337 bcf compass_bearing_set ; clear course on entering menu
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
338 bsf surfmode_menu ; flag that the surface menu shall be entered
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
339 return
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
340
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
341 IFDEF _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
342 test_switches_surfmode3b:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
343 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
344 bcf compass_menu ; clear flag for "set course" selection
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 564
diff changeset
345 return
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
346 ENDIF
382
6f3530eb48f9 allow compass bearing on surface
heinrichsweikamp
parents: 375
diff changeset
347
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
348
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
349 ; handle data imprinting, screen dump request, timeout and entering dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
350 global housekeeping
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
351 housekeeping:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
352 btfss trigger_full_second ; new 1/1 second begun?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
353 bra housekeeping_1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
354
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
355 ; tasks any new second
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
356 bcf trigger_full_second ; YES - clear flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
357 call get_battery_voltage ; - get battery voltage
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
358
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
359 btfsc imprint_time_date ; - shall imprint the current time & date?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
360 call TFT_show_time_date_menu ; YES - imprint time and date on display (copies running time to latch registers)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
361
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
362 IFDEF _rx_functions
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
363 btfsc tr_functions_activated ; - TR functions activated?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
364 call I2C_get_tankdata ; YES - get new transmitter data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
365
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
366 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
367 call TFT_menu_tank_pres ; YES - imprint transmitter ID and pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
368 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
369
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
370 btfss imprint_surfmode_data ; - shall imprint all surface mode data?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
371 bra housekeeping_0 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
372 call TFT_time_surfmode ; YES - update displayed time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
373 call TFT_batt_surfmode ; - update displayed battery voltage
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
374 btfss timebase_1sec,0 ; - on even second?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
375 call surfmode_check_for_warnings ; YES - check for warnings and display/update them
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
376
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
377 IFDEF _rx_functions
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
378 btfss tr_functions_activated ; - TR functions activated?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
379 bra housekeeping_0 ; NO - skip tank pressure part
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
380
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
381 call get_pressure_readings ; YES - get pressure readings
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
382 call TFT_surface_tank_pres ; - update first gas/diluent pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
383
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
384 movf active_customview,W ; - get current custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
385 xorlw .10 ; - coding of tank data custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
386 btfsc STATUS,Z ; - equal?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
387 call TFT_surface_tankdata ; YES - update tank data custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
388 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
389
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
390 housekeeping_0:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
391 bsf restart_fast ; default to doing a fast restart (no logos)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
392 call set_dive_modes ; check if dive mode needs to be entered, will set dive mode flag if yes
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
393 btfsc simulatormode ; in simulator mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
394 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
395 btfsc divemode ; NO - need to enter dive mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
396 goto restart ; YES - restart, will proceed to dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
397 btfss trigger_timeout ; NO - timeout?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
398 bra housekeeping_1 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
399 btfsc surfmode_menu ; YES - in surface menus?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
400 goto restart ; YES - goto restart, will proceed to surface mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
401 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
402 goto sleeploop ; - goto sleep mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
403
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
404 housekeeping_1:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
405 btfss trigger_quarter_second ; new 1/4 second begun?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
406 bra housekeeping_2 ; NO
0
heinrichsweikamp
parents:
diff changeset
407
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
408 ; tasks any new 1/4 second
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
409 bcf trigger_quarter_second ; YES - clear flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
410 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
411 btfsc imprint_sensor_mv ; - shall imprint sensor mV data?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
412 call TFT_menu_calibrate ; YES - imprint sensor mV data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
413 ENDIF ; _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
414 btfss imprint_surfmode_data ; - shall imprint all surface mode data?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
415 bra housekeeping_2 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
416 btfsc trigger_pres_cur_changed ; YES - pressure changed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
417 call TFT_pres_surfmode ; YES - display surface pressure
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
418 bcf trigger_pres_cur_changed ; - clear flag (anyhow)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
419 IFDEF _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
420 movf active_customview,W ; - get current custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
421 xorlw .6 ; - coding of compass custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
422 btfsc STATUS,Z ; - equal?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
423 call TFT_surface_compass_heading ; YES - update compass view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
424 ENDIF ; _compass
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
425 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
426 btfsc FLAG_ccr_mode ; - in CCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
427 bra housekeeping_1a ; - YES - handle sensors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
428 btfsc FLAG_pscr_mode ; - in pSCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
429 bra housekeeping_1a ; YES - handle sensors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
430 bra housekeeping_2 ; NO to both
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
431 housekeeping_1a: ; handle sensors
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
432 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
433 decfsz WREG ; opt_ccr_mode = 1 (sensor)?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
434 bra housekeeping_2 ; NO - skip sensor readings
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
435 call calc_deko_divemode_sensor ; YES - read & calculate sensor data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
436 call TFT_surface_sensor ; - update displayed sensor data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
437 call TFT_sensor_surface_warning ; - show a down-arrow behind sensor readings when sensor is at end-of-life
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
438 movf active_customview,W ; - get current custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
439 xorlw .9 ; - coding of sensor mV readings custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
440 btfsc STATUS,Z ; - equal?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
441 call TFT_sensor_mV ; YES - update mV readings
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
442 ENDIF ; _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
443 housekeeping_2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
444 btfss trigger_full_minute ; new 1/1 minute begun?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
445 bra housekeeping_3 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
446
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
447 ; tasks any new minute
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
448 bcf trigger_full_minute ; YES - clear flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
449 btfsc simulatormode ; - in simulator mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
450 bra housekeeping_2a ; YES - real tissues are in the vault, skip desaturation calculations
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
451 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
452 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
453 banksel common ; - back to bank common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
454 housekeeping_2a:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
455 btfss imprint_surfmode_data ; - shall imprint all surface mode data?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
456 bra housekeeping_3 ; NO
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
457 call TFT_date_surfmode ; YES - update displayed date
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
458
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
459 btfsc trigger_temp_changed ; - temperature changed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
460 call TFT_temp_surfmode ; YES - display temperature
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
461 bcf trigger_temp_changed ; - clear flag (anyhow)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
462
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
463 movf active_customview,W ; - get current custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
464 xorlw .5 ; - coding of tissue custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
465 btfsc STATUS,Z ; - equal?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
466 call TFT_surface_tissues ; YES - update tissue diagram
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
467
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
468 movf active_customview,W ; - get current custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
469 xorlw .8 ; - coding of last dive info custom view
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
470 btfsc STATUS,Z ; - equal?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
471 call TFT_surface_lastdive ; YES - update last dive infos
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
472
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
473 housekeeping_3:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
474 ; tasks any round
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
475 IFDEF _screendump
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
476 btfsc screen_dump_avail ; screen dump function enabled?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
477 call TFT_dump_screen_check ; YES - check if requested and do it
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
478 ELSE
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
479 btfsc comm_mode_disabled ; COMM mode disabled?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
480 return ; YES - done
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 587
diff changeset
481 ENDIF
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
482 btfss surfmode_menu ; in surface menus?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
483 return ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
484
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
485 btfsc simulatormode ; currently in simulator (deco calculator) mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
486 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
487
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
488 btfss vusb_in ; USB plugged in?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
489 return ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
490 IFDEF _screendump
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
491 btfsc screen_dump_avail ; YES - screen dump enabled?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
492 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
493 ENDIF
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
494 btfss ble_available ; Skip "USB" check in all Bluetooth models (Required for very old OSTC sport)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
495 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
496 return
188
ebc28381f17d NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents: 187
diff changeset
497
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
498 global reset_timeout_surfmode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
499 reset_timeout_surfmode:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
500 movlw surfmode_timeout_default ; load default timeout value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
501 btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
502 movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
503 btfsc simulatormode ; currently in simulator (deco calculator) mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
504 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
505 IFDEF _rx_functions
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
506 btfsc imprint_xmitter_ID ; currently selecting pressure transmitter?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
507 movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
508 ENDIF ; _rx_functions
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
509 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
510 btfsc surfmode_menu ; in surface menu?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
511 bra reset_timeout_time ; YES - keep timeout value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
512 btfsc FLAG_ccr_mode ; NO - in CCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
513 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
514 btfsc FLAG_ccr_mode ; NO - in pSCR mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
515 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
516 bra reset_timeout_time ; NO - keep timeout value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
517 reset_timeout_surfmode_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
518 movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
519 decfsz lo,f ; in sensor mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
520 bra reset_timeout_time ; NO - keep timeout value
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
521 movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
522 ENDIF ; _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
523 ;bra reset_timeout_time ; - set timeout value
0
heinrichsweikamp
parents:
diff changeset
524
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
525
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
526 global reset_timeout_time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
527 reset_timeout_time: ; entry point with timeout value in WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
528 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
529 bsf reset_timeout ; request ISR to reset the timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
530 bcf trigger_timeout ; clear any pending timeout trigger
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
531 return ; done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
532
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
533 ;-----------------------------------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
534
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 621
diff changeset
535 END