Mercurial > public > hwos_code
annotate src/logbook.asm @ 492:336bfbbeb2b5
2.15 rc
author | heinrichsweikamp |
---|---|
date | Thu, 30 Mar 2017 11:28:40 +0200 |
parents | 8dfb93e80338 |
children | 2b1239e6ea85 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File logbook.asm | |
4 ; | |
5 ; Logbook | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-11-12 : [mH] moving from OSTC code | |
11 | |
12 ;============================================================================= | |
13 ; Temp data, local to this module, moved to ACCES0 area. | |
14 ; | |
15 | |
275 | 16 #include "hwos.inc" ; Mandatory header |
0 | 17 #include "tft.inc" |
18 #include "external_flash.inc" | |
19 #include "math.inc" | |
20 #include "strings.inc" | |
21 #include "convert.inc" | |
22 #include "tft_outputs.inc" | |
23 #include "eeprom_rs232.inc" | |
24 #include "menu_processor.inc" | |
25 #include "wait.inc" | |
26 #include "start.inc" | |
27 #include "surfmode.inc" | |
28 #include "divemode.inc" | |
29 #include "ghostwriter.inc" | |
30 | |
66
00636132cca6
BUGFIX: Maintain last selected customview in surface mode
heinrichsweikamp
parents:
50
diff
changeset
|
31 extern do_main_menu2,comm_mode |
0 | 32 |
418 | 33 CBLOCK tmp+0x36 ; Keep space for menu processor. |
0 | 34 count_temperature ; Current sample count for temperature divisor |
35 count_deco ; Current sample count for deco (ceiling) divisor | |
36 logbook_cur_depth:2 ; Current depth, for drawing profile. | |
37 logbook_cur_tp:2 ; Current temperature, for drawing profile. | |
38 logbook_last_tp ; Y of the last item in Tp° curve. | |
39 logbook_min_tp:2 ; Min temperature, for drawing profile. | |
40 logbook_max_tp:2 ; Maximum temperature, for drawing profile. | |
41 logbook_ceiling ; Current ceiling, for drawing profile. | |
418 | 42 logbook_flags ; Flags only used in logbook.asm |
43 logbook_page_number ; Page# in logbook | |
44 logbook_divenumber ; # of dive in list during search | |
45 logbook_divenumber_temp ; # of dive in list during search | |
46 logbook_menupos_temp ; Last position of cursor | |
47 profile_temp:2 ; Temp for profile display | |
48 profile_temp2:2 ; Temp for profile display | |
49 logbook_max_dive_counter ; Counts dive# to zero | |
50 logbook_max_dive_counter_temp; Counts dive# to zero | |
51 logbook_sample_counter:2; Amount of read samples | |
52 divemins_backup ; Backup of divemins+0 | |
53 y_scale:2 ; y-scale (The horizontal lines) | |
54 x_scale:2 ; x-scale (The vertical lines) | |
55 logbook_pixel_x_pos ; x2 position of current pixel in X-direction | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
56 logbook_min_temp_pos ; lowest row in the temp graph |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
57 logbook_max_temp_pos ; lowest row in the temp graph |
418 | 58 ;+.33, reserved to tmp+0x57 |
0 | 59 ENDC |
60 | |
61 #DEFINE return_from_profileview logbook_flags,0 | |
62 #DEFINE all_dives_shown logbook_flags,1 | |
63 #DEFINE logbook_page_not_empty logbook_flags,2 | |
64 #DEFINE end_of_profile logbook_flags,3 | |
169
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
65 #DEFINE keep_cursor_new_page logbook_flags,4 |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
66 #DEFINE log_marker_found logbook_flags,5 |
0 | 67 |
68 | |
69 ; Logbook Coordinates | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
70 #DEFINE logbook_list_left .10 ; Column of dive# in list |
0 | 71 #DEFINE logbook_row_offset .28 ; Distance between rows of list |
72 #DEFINE logbook_row_number .6 ; Amount of rows in the list | |
73 | |
74 ; Profile display | |
75 #DEFINE profile_height_pixels .157 ; Amount of pixels height for profile display | |
76 #DEFINE profile_width_pixels .156 ; Amount of pixels width for profile display | |
77 #DEFINE profile_left .1 ; Left border | |
78 #DEFINE profile_top .65 ; Top border | |
79 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
80 ; "Bailout" |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
81 #DEFINE logbook_bailout_column .124 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
82 #DEFINE logbook_bailout_row .207 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
83 |
0 | 84 ; Dive number |
85 #DEFINE logbook_divenumer_column .1 | |
86 #DEFINE logbook_divenumer_row .1 | |
87 ; Date and Time | |
88 #DEFINE logbook_date_column .100 | |
89 #DEFINE logbook_date_row .7 | |
90 #DEFINE logbook_time_column .120 | |
389
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
91 #DEFINE logbook_time_row .38 |
0 | 92 ; Max. Depth |
93 #DEFINE log_max_value_row .38 | |
94 #DEFINE log_max_value_column .1 | |
95 ; Divetime | |
96 #DEFINE log_divetime_value_row .38 | |
97 #DEFINE log_divetime_value_column .65 | |
98 ; Gaslist below profile | |
99 #DEFINE log_gas_row .225 | |
100 #DEFINE log_gas_column1 .0 | |
101 #DEFINE log_gas_column2 log_gas_column1+(.1*.32) | |
102 #DEFINE log_gas_column3 log_gas_column1+(.2*.32) | |
103 #DEFINE log_gas_column4 log_gas_column1+(.3*.32) | |
104 #DEFINE log_gas_column5 log_gas_column1+(.4*.32) | |
105 | |
106 ; Logbook Page2 | |
107 ; Gaslist | |
108 #DEFINE log2_title_row1 .20 | |
109 #DEFINE log2_title_column .90 | |
110 #DEFINE log2_gas_column log2_title_column | |
111 #DEFINE log2_gas_row1 .36 | |
112 #DEFINE log2_gas_row2 1*.16+log2_gas_row1 | |
113 #DEFINE log2_gas_row3 2*.16+log2_gas_row1 | |
114 #DEFINE log2_gas_row4 3*.16+log2_gas_row1 | |
115 #DEFINE log2_gas_row5 4*.16+log2_gas_row1 | |
116 | |
117 ; Setpoint List | |
118 #DEFINE log2_title_sp_row .130 | |
119 #DEFINE log2_sp_row1 .146 | |
120 #DEFINE log2_sp_row2 1*.16+log2_sp_row1 | |
121 #DEFINE log2_sp_row3 2*.16+log2_sp_row1 | |
122 #DEFINE log2_sp_row4 3*.16+log2_sp_row1 | |
123 #DEFINE log2_sp_row5 4*.16+log2_sp_row1 | |
124 | |
125 ; Details list | |
126 #DEFINE log2_salinity_row .55 | |
127 #DEFINE log2_salinity_column .2 | |
128 #DEFINE log2_cns_row .1*.16+log2_salinity_row | |
129 #DEFINE log2_cns_column log2_salinity_column | |
130 #DEFINE log2_avr_row .2*.16+log2_salinity_row | |
131 #DEFINE log2_avr_column log2_salinity_column | |
132 #DEFINE log2_decomodel2_row .3*.16+log2_salinity_row | |
133 #DEFINE log2_decomodel2_column log2_salinity_column | |
134 #DEFINE log2_decomodel3_row .4*.16+log2_salinity_row | |
135 #DEFINE log2_decomodel3_column log2_salinity_column | |
136 #DEFINE log2_decomodel_row .5*.16+log2_salinity_row | |
137 #DEFINE log2_decomodel_column log2_salinity_column | |
138 #DEFINE log2_firmware_row .6*.16+log2_salinity_row | |
139 #DEFINE log2_firmware_column log2_salinity_column | |
140 #DEFINE log2_battery_row .7*.16+log2_salinity_row | |
141 #DEFINE log2_battery_column log2_salinity_column | |
142 #DEFINE log2_divemode_row .8*.16+log2_salinity_row | |
143 #DEFINE log2_divemode_column log2_salinity_column | |
144 #DEFINE log2_lastdeco_row .9*.16+log2_salinity_row | |
145 #DEFINE log2_lastdeco_column log2_salinity_column | |
146 ; Air pressure | |
147 #DEFINE MBAR_row .10*.16+log2_salinity_row | |
148 #DEFINE MBAR_column log2_salinity_column | |
149 | |
150 | |
151 ; Header coordinates | |
389
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
152 #DEFINE log_profile_version .8 |
0 | 153 #DEFINE log_date .12 |
154 #DEFINE log_time .15 | |
155 #DEFINE log_max_depth .17 | |
156 #DEFINE log_divetime .19 | |
157 #DEFINE log_min_temp .22 | |
158 #DEFINE log_surface_press .24 | |
159 #DEFINE log_desattime .26 | |
160 #DEFINE log_gas1 .28 | |
161 #DEFINE log_gas2 .32 | |
162 #DEFINE log_gas3 .36 | |
163 #DEFINE log_gas4 .40 | |
164 #DEFINE log_gas5 .44 | |
165 #DEFINE log_firmware .48 | |
166 #DEFINE log_battery .50 | |
167 #DEFINE log_samplingrate .52 | |
168 #DEFINE log_cns_start .53 | |
169 #DEFINE log_gf_start .55 | |
170 #DEFINE log_gf_end .56 | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
171 #DEFINE log_batt_info .59 |
0 | 172 #DEFINE log_sp1 .60 |
173 #DEFINE log_sp2 .62 | |
174 #DEFINE log_sp3 .64 | |
175 #DEFINE log_sp4 .66 | |
176 #DEFINE log_sp5 .68 | |
177 #DEFINE log_salinity .70 | |
178 #DEFINE log_cns_end .71 | |
179 #DEFINE log_avr_depth .73 | |
180 #DEFINE log_total_seconds .75 | |
181 #DEFINE log_gf_lo .77 | |
182 #DEFINE log_sat_mult .77 | |
183 #DEFINE log_gf_hi .78 | |
184 #DEFINE log_desat_mult .78 | |
185 #DEFINE log_decomodel .79 | |
186 #DEFINE log_total_dives .80 | |
187 #DEFINE log_divemode .82 | |
188 #DEFINE log_last_stop .243 | |
189 | |
190 LOG_POINT_TO macro address | |
191 movlw address | |
192 movwf ext_flash_address+0 | |
193 endm | |
194 | |
195 ;============================================================================= | |
196 | |
197 logbook code | |
198 | |
199 TFT_logbook_cursor: | |
255 | 200 ; call speed_fastest |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
201 WIN_BOX_BLACK .0, .240-.16, logbook_list_left-.8, logbook_list_left-.1 ;top, bottom, left, right |
0 | 202 |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
203 WIN_LEFT logbook_list_left-.8 |
0 | 204 WIN_FONT FT_SMALL |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
205 ; bcf win_invert ; Reset invert flag |
0 | 206 call TFT_standard_color |
207 | |
208 movff menupos,temp1 | |
209 dcfsnz temp1,F | |
210 movlw d'0' | |
211 dcfsnz temp1,F | |
212 movlw logbook_row_offset | |
213 dcfsnz temp1,F | |
214 movlw .2*logbook_row_offset | |
215 dcfsnz temp1,F | |
216 movlw .3*logbook_row_offset | |
217 dcfsnz temp1,F | |
218 movlw .4*logbook_row_offset | |
219 dcfsnz temp1,F | |
220 movlw .5*logbook_row_offset | |
221 dcfsnz temp1,F | |
222 movlw .6*logbook_row_offset | |
223 dcfsnz temp1,F | |
224 movlw .7*logbook_row_offset | |
225 dcfsnz temp1,F | |
226 movlw .8*logbook_row_offset | |
227 | |
433 | 228 movwf win_top |
0 | 229 STRCPY_PRINT "\xB7" |
230 return | |
231 | |
232 global logbook | |
233 logbook: | |
234 clrf logbook_flags | |
235 clrf CCP1CON ; stop PWM | |
236 bcf PORTC,2 ; Pull PWM out to GND | |
237 call TFT_ClearScreen ; Clear screen | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
238 ; call TFT_standard_color |
0 | 239 clrf menupos3 ; Here: used rows on current logbook-page |
240 clrf logbook_page_number ; Here: # of current displayed page | |
241 clrf logbook_divenumber ; # of dive in list during search | |
242 clrf divemins+0 ; Here: used as temp variables | |
243 clrf divemins+1 | |
244 clrf timeout_counter2 ; For timeout | |
245 movlw logbook_row_number | |
246 movwf menupos ; Here: stores current position on display (logbook_row_number-x) | |
247 read_int_eeprom .2 ; Get low-byte of total dives | |
248 movff EEDATA,logbook_max_dive_counter | |
249 | |
250 ;----------------------------------------------------------------------------- | |
251 ; display dive headers backwards from read_int_eeprom .2 = lo-1 | |
252 ; 1st: 200000h-200FFFh -> lo=0 | |
253 ; 2nd: 201000h-201FFFh -> lo=1 | |
254 ; 3rd: 202000h-202FFFh -> lo=2 | |
255 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
256 ; Stop when | |
257 ; a) no dive is stored (no valid header found) | |
258 ; b) current dive has no valid header (Number of stored dives < 256) | |
259 ; c) when 255 dives are reached divemins+0 = 255 | |
260 | |
261 logbook2: | |
255 | 262 ; call speed_fastest |
0 | 263 incf divemins+0,F ; increase dive counter |
264 incf divemins+0,W ; = 0x..FF ? | |
265 bz logbook_reset ; Yes: FF --> loop. | |
266 | |
267 ; Set ext_flash_address:3 to TOC entry of this dive | |
268 ; 1st: 200000h-200FFFh -> logbook_max_dive_counter=0 | |
269 ; 2nd: 201000h-201FFFh -> logbook_max_dive_counter=1 | |
270 ; 3rd: 202000h-202FFFh -> logbook_max_dive_counter=2 | |
271 ; 256: 2FF000h-2FFFFFh -> logbook_max_dive_counter=255 (And hi>0...) | |
272 | |
273 decf logbook_max_dive_counter,F ; -1 | |
274 | |
275 clrf ext_flash_address+0 | |
276 clrf ext_flash_address+1 | |
277 movlw 0x20 | |
278 movwf ext_flash_address+2 | |
279 movlw .16 | |
280 mulwf logbook_max_dive_counter; logbook_max_dive_counter*16 = offset to 0x2000 (up:hi) | |
281 movf PRODL,W | |
282 addwf ext_flash_address+1,F | |
283 movf PRODH,W | |
284 addwfc ext_flash_address+2,F | |
285 ; pointer at the first 0xFA of header | |
286 | |
287 call ext_flash_byte_read ; Reads one byte@ext_flash_address:3 into WREG and temp1 | |
288 movwf temp1 | |
289 movlw 0xFA | |
290 cpfseq temp1 ; 0xFA found? | |
291 bra logbook3b ; No, abort | |
292 | |
293 incf logbook_divenumber,F ; new header found, increase logbook_divenumber | |
294 bra logbook4 ; Done with searching, display the header! | |
295 | |
296 logbook3b: | |
297 btfss logbook_page_not_empty ; Was there at least one dive? | |
372 | 298 bra exit_logbook ; Not a single header was found, leave logbook. |
0 | 299 bra logbook_display_loop2 |
300 | |
301 logbook_reset: | |
302 tstfsz logbook_divenumber ; Was there at least one dive? | |
303 bra logbook_reset2 | |
304 bra logbook3b ; No, Nothing to do | |
305 | |
306 logbook_reset2: | |
307 bsf all_dives_shown ; Yes | |
308 bra logbook_display_loop2 ; Continue | |
309 | |
310 logbook4: | |
311 btfsc all_dives_shown ; All dives displayed? | |
312 bra logbook_display_loop2 ; Yes, but display first page again. | |
313 | |
314 call display_listdive ; display short header for list on current list position | |
315 | |
316 movlw logbook_row_number | |
317 cpfseq menupos ; first dive on list (top place)? | |
318 bra logbook_display_loop1 ; no, so skip saving of address | |
319 | |
320 ; store all registered required to rebuilt the current logbookpage after the detail/profile view | |
321 movff logbook_divenumber,logbook_divenumber_temp ; # of dive in list of the current page | |
322 movff divemins+0,divemins_backup ; amount of dives drawn until now | |
323 movff logbook_max_dive_counter,logbook_max_dive_counter_temp ; backup Counter | |
324 | |
325 logbook_display_loop1: | |
326 decfsz menupos,F ; List full? | |
327 bra logbook2 ; no, search another dive for our current logbook page | |
328 | |
329 logbook_display_loop2: | |
330 btfss logbook_page_not_empty ; Was there one dive at all? | |
331 bra logbook ; Yes, so reload the first page | |
332 | |
333 ; TFT_mask... | |
334 | |
335 WIN_LEFT logbook_list_left | |
336 WIN_TOP logbook_row_offset*logbook_row_number | |
337 STRCPY_TEXT_PRINT tNextLog ; "Next Page" | |
338 WIN_LEFT logbook_list_left | |
339 WIN_TOP logbook_row_offset*(logbook_row_number+.1) | |
276
e4cb495aed3d
Increase byte timeout in PC download mode, faster response to "Exit" in main menu
heinrichsweikamp
parents:
275
diff
changeset
|
340 STRCPY_TEXT_PRINT tExit ; "Exit" |
0 | 341 |
342 movlw d'1' ; Set cursor to position 1... | |
343 btfsc return_from_profileview ; .. unless we are returning from a detail/profile view | |
344 movf logbook_menupos_temp,W ; load last cursor position again | |
345 movwf menupos ; and set menupos byte | |
346 bcf return_from_profileview ; Do this only once while the page is loaded again! | |
347 | |
348 bcf logbook_page_not_empty ; Obviously the current page is NOT empty | |
169
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
349 |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
350 movlw d'7' ; Set cursor to position 7... |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
351 btfsc keep_cursor_new_page ; ... if we came from the "new Page" line |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
352 movwf menupos ; and set menupos byte |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
353 bcf keep_cursor_new_page |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
354 |
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
355 call TFT_logbook_cursor ; Show the cursor |
0 | 356 |
357 call logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
169
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
358 call menu_processor_bottom_line ; Show bottom line |
0 | 359 logbook_loop: |
360 btfsc switch_left ; SET/MENU? | |
361 goto next_logbook3 ; adjust cursor or create new page | |
362 btfsc switch_right ; ENTER? | |
363 bra display_profile_or_exit ; view details/profile or exit logbook | |
364 | |
365 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
366 btfsc sleepmode ; Timeout? | |
372 | 367 bra exit_logbook ; Yes |
0 | 368 |
369 bra logbook_loop ; Wait for something to do | |
370 | |
371 display_profile_or_exit: | |
372 movlw logbook_row_number+.2 ; exit? | |
373 cpfseq menupos | |
374 bra display_profile_or_exit2 ; No, check for "Next Page" | |
371 | 375 |
372 | 376 exit_logbook: |
436 | 377 ; call TFT_DisplayOff |
378 ; call TFT_boot | |
66
00636132cca6
BUGFIX: Maintain last selected customview in surface mode
heinrichsweikamp
parents:
50
diff
changeset
|
379 goto do_main_menu2 |
0 | 380 |
381 display_profile_or_exit2: | |
382 movlw logbook_row_number+.1 ; Next page? | |
383 cpfseq menupos | |
384 bra display_profile ; No, show details/profile | |
385 goto next_logbook2 ; Next page! | |
386 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
387 display_profile: |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
388 bcf is_bailout |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
389 bcf gas6_changed ; Clear event flags |
255 | 390 ; call speed_fastest |
0 | 391 movff menupos,logbook_menupos_temp; store current cursor position |
392 bsf return_from_profileview ; tweak search routine to exit after found | |
393 | |
394 movf logbook_page_number,W ; Number of page | |
395 mullw logbook_row_number | |
396 movf PRODL,W | |
397 addwf menupos,W ; page*logbook_row_number+menupos= | |
398 movwf divesecs ; # of dive to show | |
399 | |
400 display_profile2: | |
255 | 401 ; call speed_fastest |
0 | 402 clrf CCP1CON ; stop PWM |
403 bcf PORTC,2 ; Pull PWM out to GND | |
404 call TFT_ClearScreen ; Clear screen | |
405 ; Set ext_flash pointer to "#divesecs-oldest" dive | |
406 ; compute read_int_eeprom .2 - divesecs | |
407 ; Read required header data for profile display | |
408 ; look in header for pointer to begin of diveprofile (Byte 2-4) | |
409 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | |
410 | |
411 decf divesecs,F ;-1 | |
412 read_int_eeprom .2 | |
413 movf EEDATA,W | |
414 bcf STATUS,C | |
415 subfwb divesecs,W ; max. dives (low value) - divesecs | |
416 movwf lo ; result | |
417 incf divesecs,F ;+1 | |
418 ; Set ext_flash_address:3 to TOC entry of this dive | |
419 ; 1st: 200000h-200FFFh -> lo=0 | |
420 ; 2nd: 201000h-201FFFh -> lo=1 | |
421 ; 3rd: 202000h-202FFFh -> lo=2 | |
422 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
423 clrf ext_flash_address+0 | |
424 clrf ext_flash_address+1 | |
425 movlw 0x20 | |
426 movwf ext_flash_address+2 | |
427 movlw .16 | |
428 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
429 movf PRODL,W | |
430 addwf ext_flash_address+1,F | |
431 movf PRODH,W | |
432 addwfc ext_flash_address+2,F | |
433 ; pointer at the first 0xFA of header | |
434 | |
435 ; Now, show profile | |
436 LOG_POINT_TO log_samplingrate | |
437 call ext_flash_byte_read ; Read sampling rate | |
438 movff temp1,samplesecs_value ; needed later... | |
439 | |
440 LOG_POINT_TO .2 | |
441 call ext_flash_byte_read_plus ; Read start address of profile | |
442 movff temp1,ext_flash_log_pointer+0 | |
443 call ext_flash_byte_read_plus ; Read start address of profile | |
444 movff temp1,ext_flash_log_pointer+1 | |
445 call ext_flash_byte_read_plus ; Read start address of profile | |
446 movff temp1,ext_flash_log_pointer+2 | |
447 | |
448 | |
449 clrf logbook_sample_counter+0 | |
450 clrf logbook_sample_counter+1 ; holds amount of read samples | |
451 | |
452 call TFT_standard_color | |
453 call logbook_show_divenumber ; Show the dive number in medium font | |
454 | |
455 WIN_SMALL logbook_date_column, logbook_date_row | |
456 LOG_POINT_TO log_date | |
457 call ext_flash_byte_read_plus | |
458 movff temp1,convert_value_temp+2 ; Year | |
459 call ext_flash_byte_read_plus | |
460 movff temp1,convert_value_temp+0 ; Month | |
461 call ext_flash_byte_read_plus | |
462 movff temp1,convert_value_temp+1 ; Day | |
463 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
464 STRCAT_PRINT "" | |
465 | |
466 WIN_SMALL logbook_time_column, logbook_time_row | |
467 call ext_flash_byte_read_plus ; hour | |
468 movff temp1,lo | |
469 call ext_flash_byte_read_plus ; Minutes | |
470 movff temp1,hi | |
471 output_99x ; hour | |
472 PUTC ':' | |
389
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
473 movff hi,lo |
0 | 474 output_99x ; minute |
475 STRCAT_PRINT "" ; Display 1st row of details | |
476 | |
389
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
477 LOG_POINT_TO log_profile_version |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
478 call ext_flash_byte_read_plus ; Profile version |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
479 movlw 0x24 |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
480 cpfslt temp1 ; <0x24? |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
481 bra log_skip_extra_icon ; Yes, skip |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
482 |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
483 WIN_SMALL logbook_time_column-.8, logbook_time_row |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
484 STRCPY_PRINT 0x94 ; "End of dive" icon |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
485 |
9175429bdeba
CHANGE: Logbook now shows end-of-dive date and time for dives made with firmware <1.92 indicated by an icon in the logbook
heinrichsweikamp
parents:
376
diff
changeset
|
486 log_skip_extra_icon: |
0 | 487 LOG_POINT_TO log_max_depth |
488 call ext_flash_byte_read_plus ; read max depth | |
489 movff temp1,lo | |
490 call ext_flash_byte_read_plus ; read max depth | |
491 movff temp1,hi | |
492 movff lo,xA+0 ; calculate y-scale for profile display | |
493 movff hi,xA+1 | |
494 movlw profile_height_pixels ; pixel height available for profile | |
495 movwf xB+0 | |
496 clrf xB+1 | |
497 call div16x16 ; does xA/xB=xC | |
498 movff xC+0,y_scale+0 ; holds LOW byte of y-scale (mbar/pixel!) | |
499 movff xC+1,y_scale+1 ; holds HIGH byte of y-scale (mbar/pixel!) | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
500 infsnz y_scale+0,F ; increase one, because there may be a remainder |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
501 incf y_scale+1,F |
0 | 502 |
417 | 503 movlw LOW ((profile_height_pixels+1)*.1000) |
0 | 504 movwf xC+0 |
505 movlw HIGH (((profile_height_pixels+1)*.1000) & h'FFFF') | |
506 movwf xC+1 | |
507 movlw UPPER ((profile_height_pixels+1)*.1000) | |
508 movwf xC+2 | |
509 clrf xC+3 | |
510 | |
511 movff lo,xB+0 ; Max. Depth in mbar | |
512 movff hi,xB+1 ; Max. Depth in mbar | |
513 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
514 | |
515 movff xC+0,x_scale+0 ; | |
516 movff xC+1,x_scale+1 ; = Pixels/10m (For scale, draw any xx rows a scale-line) | |
517 | |
518 movf x_scale+0,W | |
519 iorwf x_scale+1,W ; x_scale:2 = Null? | |
520 bnz display_profile_offset4 ; No, continue | |
521 incf x_scale+1,F ; Yes, make x_scale+1>1 to make "display_profile2e" working | |
522 | |
523 display_profile_offset4: | |
524 WIN_SMALL log_max_value_column,log_max_value_row | |
525 | |
526 TSTOSS opt_units ; 0=Meters, 1=Feets | |
527 bra display_profile_offset4_metric | |
528 ;display_profile_offset4_imperial: | |
529 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
530 PUTC ' ' | |
25 | 531 bcf leftbind |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
532 output_16_3 ; limit to 999 and display only (0-999) |
0 | 533 STRCAT_TEXT_PRINT tFeets |
534 bra display_profile_offset4_common | |
535 | |
536 display_profile_offset4_metric: | |
537 bsf leftbind | |
538 output_16dp d'3' ; max. depth | |
539 STRCAT_TEXT_PRINT tMeters | |
540 | |
541 display_profile_offset4_common: | |
542 call ext_flash_byte_read_plus ; divetime in minutes | |
543 movff temp1,lo | |
544 call ext_flash_byte_read_plus | |
545 movff temp1,hi ; divetime in minutes | |
546 | |
547 movff lo,xA+0 ; calculate x-scale for profile display | |
548 movff hi,xA+1 ; calculate total diveseconds first | |
549 movlw d'60' ; 60seconds are one minute... | |
550 movwf xB+0 | |
551 clrf xB+1 | |
552 call mult16x16 ; result is in xC:2 ! | |
553 | |
554 WIN_SMALL log_divetime_value_column,log_divetime_value_row | |
555 bsf leftbind | |
556 output_16 ; divetime minutes | |
557 movlw LOW d'600' | |
558 movwf xA+0 | |
559 movlw HIGH d'600' | |
560 movwf xA+1 ; A vertical line every 600 seconds | |
561 movff samplesecs_value,xB+0 ; Copy sampling rate | |
562 clrf xB+1 | |
563 call div16x16 ; xA/xB=xC with xA as remainder | |
564 movff xC+0,average_depth_hold_total+0 | |
565 movff xC+1,average_depth_hold_total+1 | |
566 ;average_depth_hold_total:2 holds interval of samples for vertical 10min line | |
567 | |
568 ; Restore divetime in minutes: | |
569 ; get real sample time | |
570 LOG_POINT_TO log_total_seconds | |
571 call ext_flash_byte_read_plus ; Total sample time in seconds | |
572 movff temp1,xC+0 | |
573 call ext_flash_byte_read_plus ; Total sample time in seconds | |
574 movff temp1,xC+1 | |
575 | |
576 PUTC ':' | |
577 LOG_POINT_TO log_divetime+.2 | |
578 call ext_flash_byte_read_plus ; read divetime seconds | |
579 movff temp1,lo | |
580 movff xC+0,xA+0 ; now calculate x-scale value | |
581 movff xC+1,xA+1 | |
582 movlw profile_width_pixels ; pix width available | |
583 movwf xB+0 | |
584 clrf xB+1 | |
585 call div16x16 ; xA/xB=xC | |
586 movff xC+0,xA+0 | |
587 movff xC+1,xA+1 | |
588 movf samplesecs_value,W ; devide through sample interval! | |
589 movwf xB+0 | |
590 clrf xB+1 | |
591 call div16x16 ; xA/xB=xC | |
592 movff xC+0,profile_temp+0 ; store value (use any #xC sample, skip xC-1) into temp registers | |
593 movff xC+1,profile_temp+1 ; store value (use any #xC sample, skip xC-1) into temp registers | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
594 infsnz profile_temp+0,F ; Increase by one, there might be a remainder |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
595 incf profile_temp+1,F |
0 | 596 |
597 bsf leftbind | |
598 output_99x ; divetime seconds | |
599 call TFT_standard_color | |
600 STRCAT_PRINT "" | |
601 | |
602 call ext_flash_byte_read_plus ; Read min. Temperature | |
603 movff temp1,logbook_min_tp+0 | |
604 call ext_flash_byte_read_plus ; Read min. Temperature | |
605 movff temp1,logbook_min_tp+1 | |
606 | |
607 ; Set pointer to Gas 1 Type. | |
608 LOG_POINT_TO log_gas1+.3 | |
609 call ext_flash_byte_read_plus ; read Gas Type | |
610 decfsz temp1,W ; =1 (="First")? | |
611 bra logbook_find_first_gas2 ; No. | |
612 movlw .1 | |
613 movwf temp1 | |
614 bra logbook_find_first_gas_done | |
615 logbook_find_first_gas2: | |
616 ; Set pointer to Gas 2 Type. | |
617 LOG_POINT_TO log_gas2+.3 | |
618 call ext_flash_byte_read_plus ; read Gas Type | |
619 decfsz temp1,W ; =1 (="First")? | |
620 bra logbook_find_first_gas3 ; No. | |
621 movlw .2 | |
622 movwf temp1 | |
623 bra logbook_find_first_gas_done | |
624 logbook_find_first_gas3: | |
625 ; Set pointer to Gas 3 Type. | |
626 LOG_POINT_TO log_gas3+.3 | |
627 call ext_flash_byte_read_plus ; read Gas Type | |
628 decfsz temp1,W ; =1 (="First")? | |
629 bra logbook_find_first_gas4 ; No. | |
630 movlw .3 | |
631 movwf temp1 | |
632 bra logbook_find_first_gas_done | |
633 logbook_find_first_gas4: | |
634 ; Set pointer to Gas 4 Type. | |
635 LOG_POINT_TO log_gas4+.3 | |
636 call ext_flash_byte_read_plus ; read Gas Type | |
637 decfsz temp1,W ; =1 (="First")? | |
638 bra logbook_find_first_gas5 ; No. | |
639 movlw .4 | |
640 movwf temp1 | |
641 bra logbook_find_first_gas_done | |
642 logbook_find_first_gas5: | |
643 movlw .5 ; Must be Gas5 | |
644 movwf temp1 | |
645 logbook_find_first_gas_done: | |
646 movff temp1,average_depth_hold_total+3; keep copy to restore color | |
647 rcall profile_display_color ; Back to normal profile color. | |
648 ; Pointer is now trashed! | |
649 | |
650 ; Point to profile portion of this dive | |
651 movff ext_flash_log_pointer+0,ext_flash_address+0 | |
652 movff ext_flash_log_pointer+1,ext_flash_address+1 | |
653 movff ext_flash_log_pointer+2,ext_flash_address+2 | |
654 | |
655 incf_ext_flash_address_0x20 d'2' ; Skip 0xFA 0xFA | |
656 call ext_flash_byte_read_plus_0x20 ; Read low byte of total dives into temp1 (at the time the dive was made) | |
657 | |
658 ; Load total number of dives (low byte only) | |
659 read_int_eeprom .2 | |
660 incf EEDATA,W ; +1 | |
661 bsf STATUS,C ; Set borrow | |
662 subfwb divesecs,W ; total dives - dive# to show - 1 = low byte of total dives (at the time the dive was made) | |
663 cpfseq temp1 ; # of dive in logbook (Must be equal with low byte in short header) | |
664 bra display_profile_no_profile ; Not equal, no profile for this dive available! | |
665 | |
666 ; Skip rest of short header: 3 Bytes | |
667 ; Skip length of profile data: 3 Bytes | |
668 ; Skip sampling rate in profile section: 1Byte | |
669 ; Skip number of divisors: 1Byte | |
670 incf_ext_flash_address_0x20 d'8' | |
671 | |
672 ; Divisor temp | |
673 incf_ext_flash_address_0x20 d'2' | |
674 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
675 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
676 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
677 movf temp1,W | |
678 movwf divisor_temperature ; Store divisor | |
679 movwf count_temperature ; Store to tp° counter too. | |
680 ; Divisor Deco | |
681 incf_ext_flash_address_0x20 d'2' | |
682 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
683 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
684 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
685 movf temp1,W | |
686 movwf divisor_deco ; Store divisor | |
687 movwf count_deco ; Store as temp, too | |
688 ; Divisor GF | |
689 incf_ext_flash_address_0x20 d'2' | |
690 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
691 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
692 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
693 movff temp1,divisor_gf ; Store divisor | |
694 ; Divisor ppO2 Sensors | |
695 incf_ext_flash_address_0x20 d'2' | |
696 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
697 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
698 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
699 movff temp1,divisor_ppo2_sensors ; Store divisor | |
700 ; Divisor decoplan | |
701 incf_ext_flash_address_0x20 d'2' | |
702 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
703 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
704 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
705 movff temp1,divisor_decoplan ; Store divisor | |
706 ; Divisor CNS | |
707 incf_ext_flash_address_0x20 d'2' | |
708 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
709 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
710 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
711 movff temp1,divisor_cns ; Store divisor | |
712 ; Divisor Tank data | |
713 incf_ext_flash_address_0x20 d'2' | |
714 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
715 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
716 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
717 movff temp1,divisor_tank ; Store divisor | |
718 | |
719 ; Start Profile display | |
720 movlw color_deepblue | |
721 call TFT_set_color ; Make this configurable? | |
722 ; Draw a frame around profile area | |
723 WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1 | |
724 | |
725 movlw profile_top | |
432 | 726 movwf win_top |
0 | 727 movlw profile_left |
432 | 728 movwf win_leftx2 ; Left border (0-159) |
0 | 729 movlw d'1' |
432 | 730 movwf win_height |
0 | 731 movlw profile_width_pixels+.1 |
432 | 732 movwf win_width+0 ; Right border (0-159) |
433 | 733 clrf win_width+1 |
432 | 734 bra display_profile2f ; No 0m line |
0 | 735 display_profile2e: |
736 call TFT_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
737 display_profile2f: | |
432 | 738 movf win_top,W ; Get row |
0 | 739 addwf x_scale+0,W ; Add line interval distance to win_top |
740 tstfsz x_scale+1 ; >255? | |
741 movlw d'255' ; Yes, make win_top>239 -> Abort here | |
742 btfsc STATUS,C ; A Cary from the addwf above? | |
743 movlw d'255' ; Yes, make win_top>239 -> Abort here | |
432 | 744 movwf win_top ; Result in win_top again |
0 | 745 movlw profile_top+profile_height_pixels+.1 ; Limit |
432 | 746 cpfsgt win_top ; >239? |
0 | 747 bra display_profile2e ; No, draw another line |
748 | |
749 clrf timeout_counter2 ; here: used as counter for depth readings | |
750 movlw profile_width_pixels+profile_left-.1 | |
751 movwf ignore_digits ; here: used as counter for x-pixels | |
752 bcf end_of_profile ; clear flag | |
372 | 753 |
754 movlw profile_left+.1 | |
0 | 755 movwf logbook_pixel_x_pos ; here: used as colum x2 (Start at Colum 5) |
372 | 756 |
757 movlw profile_top+.1 ; Zero-m row | |
0 | 758 movwf apnoe_mins ; here: used for fill between rows |
759 movwf logbook_last_tp ; Initialise for Tp° curve too. | |
760 | |
761 movlw LOW(-.100) ; Initialize max tp° to -10.0 °C. | |
762 movwf logbook_max_tp+0 | |
763 movlw HIGH 0xFFFF & (-.100) | |
764 movwf logbook_max_tp+1 | |
765 | |
766 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point. | |
767 setf logbook_cur_tp+1 | |
768 clrf logbook_last_tp ; Also reset previous Y for Tp° | |
769 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling. | |
372 | 770 movlw profile_top+.1 |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
771 movwf logbook_min_temp_pos ; Initialize for displaying the lowest temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
772 movlw profile_top+profile_height_pixels |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
773 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature |
0 | 774 |
371 | 775 movlw profile_left |
432 | 776 movwf win_leftx2 |
371 | 777 movlw profile_top |
432 | 778 movwf win_top |
371 | 779 movlw profile_height_pixels |
432 | 780 movwf win_height |
371 | 781 movlw LOW (profile_width_pixels*.2) |
432 | 782 movwf win_width+0 |
371 | 783 movlw HIGH (profile_width_pixels*.2) |
432 | 784 movwf win_width+1 |
371 | 785 call TFT_box_write ; open box for d1 |
786 | |
434 | 787 ; INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) |
0 | 788 |
789 profile_display_loop: | |
434 | 790 ; Init pixel write |
791 movf logbook_pixel_x_pos,W | |
792 mullw 2 | |
793 call pixel_write_col320 | |
794 | |
0 | 795 movff profile_temp+0,profile_temp2+0 |
796 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler | |
797 incf profile_temp2+1,F | |
798 tstfsz profile_temp2+0 ; Must not be Zero | |
799 bra profile_display_loop2 ; Not Zero! | |
800 incf profile_temp2+0,F ; Zero, Increase! | |
801 | |
802 profile_display_loop2: | |
803 rcall profile_view_get_depth ; reads depth, temp and profile data | |
804 | |
805 btfsc end_of_profile ; end-of profile reached? | |
806 bra profile_display_loop_done ; Yes, skip all remaining pixels | |
807 | |
808 | |
809 ;---- Draw Ceiling curve, if any --------------------------------------------- | |
810 movf divisor_deco,W | |
811 bz profile_display_skip_deco | |
812 | |
813 movf logbook_ceiling,W ; Any deco ceiling ? | |
814 bz profile_display_skip_deco | |
815 | |
816 mullw .100 ; Yes: convert to mbar | |
817 movff PRODL,sub_a+0 | |
818 movff PRODH,sub_a+1 | |
819 movff logbook_cur_depth+0,sub_b+0 ; Compare with UNSIGNED current depth (16bits) | |
820 movff logbook_cur_depth+1,sub_b+1 | |
821 call subU16 ; set (or not) neg_flag | |
822 | |
823 movlw color_dark_green ; Dark green if Ok, | |
824 btfss neg_flag | |
825 movlw color_dark_red ; Or dark red if ceiling overflown. | |
826 call TFT_set_color | |
827 | |
828 movff PRODL,xA+0 | |
829 movff PRODH,xA+1 | |
830 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett | |
831 movff y_scale+1,xB+1 | |
832 call div16x16 ; xA/xB=xC | |
833 | |
372 | 834 movlw profile_top+.1 ; Starts right after the top line. |
432 | 835 movwf win_top |
0 | 836 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159) |
837 movff xC+0,win_height | |
838 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2 | |
839 | |
840 profile_display_skip_deco: | |
841 ;---- Draw Tp° curve, if any --------------------------------------------- | |
842 movf divisor_temperature,W | |
843 bz profile_display_skip_temp | |
844 | |
845 movf logbook_cur_tp+0,W ; Did we had already a valid Tp°C record ? | |
846 andwf logbook_cur_tp+1,W | |
847 incf WREG | |
848 bz profile_display_skip_temp ; No: just skip drawing. | |
849 | |
850 movlw LOW(((profile_height_pixels-.10)*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix | |
851 movwf xB+0 | |
852 movlw HIGH(((profile_height_pixels-.10)*.256)/.370) | |
853 movwf xB+1 | |
854 | |
855 movf logbook_cur_tp+0,W ; Current Tp° - (-2.0°C) == Tp° + 20. | |
856 addlw LOW(.20) ; Low byte. | |
857 movwf xA+0 | |
858 movf logbook_cur_tp+1,W | |
859 btfsc STATUS,C ; Propagate carry, if any | |
860 incf WREG | |
861 movwf xA+1 | |
862 call mult16x16 ; xA*xB=xC | |
863 | |
864 ; scale: divide by 256, ie. take just high byte. | |
865 movf xC+1,W | |
866 sublw profile_top+profile_height_pixels-.10 ; Upside-down: Y = .75 + (.153 - result) | |
867 movwf xC+0 | |
868 | |
869 ; Check limits | |
372 | 870 movlw profile_top+.1 |
0 | 871 movwf xC+1 |
872 cpfsgt xC+0 | |
873 movff xC+1,xC+0 | |
874 | |
875 movlw color_orange | |
876 call TFT_set_color | |
877 | |
878 movf logbook_last_tp,W ; do we have a valid previous value ? | |
879 bz profile_display_temp_1 ; No: skip the vertical line. | |
880 movwf xC+1 | |
881 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1) | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
882 profile_display_temp_1: |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
883 movf xC+0,W ; current row |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
884 cpfsgt logbook_min_temp_pos ; check limit |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
885 movwf logbook_min_temp_pos ; lowest row in the temp graph |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
886 cpfslt logbook_max_temp_pos ; check limit |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
887 movwf logbook_max_temp_pos ; lowest row in the temp graph |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
888 |
0 | 889 movff xC+0,logbook_last_tp |
890 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a current color pixel. | |
891 | |
892 profile_display_skip_temp: | |
893 ;---- Draw depth curve --------------------------------------------------- | |
894 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett | |
895 movff y_scale+1,xB+1 | |
896 movff logbook_cur_depth+0,xA+0 | |
897 movff logbook_cur_depth+1,xA+1 | |
898 call div16x16 ; xA/xB=xC | |
372 | 899 movlw profile_top+.1 |
0 | 900 addwf xC+0,F ; add 75 pixel offset to result |
901 | |
902 btfsc STATUS,C ; Ignore potential profile errors | |
903 movff apnoe_mins,xC+0 | |
904 | |
905 rcall profile_display_color ; Back to normal profile color. | |
906 | |
907 movff apnoe_mins,xC+1 | |
908 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1) | |
909 movff xC+0,apnoe_mins ; Store last row for fill routine | |
910 | |
372 | 911 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a std color pixel. |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
912 incf logbook_pixel_x_pos,F ; Next column |
0 | 913 |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
914 ;---- Draw Marker square , if any ---------------------------------------- |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
915 btfss log_marker_found ; Any marker to draw? |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
916 bra profile_display_skip_marker ; No |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
917 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
918 ; tiny "m" |
430 | 919 incf apnoe_mins,W ; increase row (Y) |
432 | 920 movwf win_top |
492 | 921 ; limit win_top to 220 |
922 movlw .220 | |
923 cpfslt win_top | |
924 movwf win_top | |
430 | 925 decf logbook_pixel_x_pos,W ; decrease column (X) |
432 | 926 movwf win_leftx2 |
492 | 927 ; limit win_leftx2 to 151 |
928 movlw .151 | |
929 cpfslt win_leftx2 | |
930 movwf win_leftx2 | |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
931 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
932 movlw color_orange |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
933 call TFT_set_color |
492 | 934 WIN_FONT FT_TINY |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
935 lfsr FSR2,buffer |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
936 STRCPY_PRINT "m" |
492 | 937 bcf log_marker_found ; Clear flag |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
938 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
939 profile_display_skip_marker: |
0 | 940 ;---- Draw CNS curve, if any --------------------------------------------- |
941 movf divisor_cns,W | |
942 bz profile_display_skip_cns | |
943 ; | |
944 ; TODO HERE | |
945 ; | |
946 profile_display_skip_cns: | |
947 | |
948 ;---- Draw GF curve, if any ---------------------------------------------- | |
949 movf divisor_gf,W | |
950 bz profile_display_skip_gf | |
951 ; | |
952 ; TODO HERE | |
953 ; | |
954 profile_display_skip_gf: | |
955 | |
956 ;---- All curves done. | |
957 | |
958 profile_display_skip_loop1: ; skips readings! | |
959 dcfsnz profile_temp2+0,F | |
960 bra profile_display_loop3 ; check 16bit.... | |
961 | |
962 rcall profile_view_get_depth ; reads depth, temp and profile data | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
963 |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
964 btfsc end_of_profile ; end-of profile reached? |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
965 bra profile_display_loop_done ; Yes, skip all remaining pixels |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
966 |
0 | 967 bra profile_display_skip_loop1 |
968 | |
969 profile_display_loop3: | |
970 decfsz profile_temp2+1,F ; 16 bit x-scaler test | |
971 bra profile_display_skip_loop1 ; skips readings! | |
972 | |
973 decfsz ignore_digits,F ; counts drawn x-pixels to zero | |
974 bra profile_display_loop ; Not ready yet | |
975 ; Done. | |
976 | |
977 display_profile_no_profile: ; No profile available for this dive! | |
978 | |
979 profile_display_loop_done: | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
980 btfss is_bailout ; Bailout during the dive? |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
981 bra profile_display_loop_done_nobail ; No |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
982 ; Yes, show "Bailout" |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
983 movlw color_pink |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
984 call TFT_set_color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
985 WIN_TINY logbook_bailout_column,logbook_bailout_row |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
986 STRCPY_TEXT_PRINT tDiveBailout ; Bailout |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
987 profile_display_loop_done_nobail: |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
988 btfss gas6_changed ; Gas6 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
989 bra profile_display_loop_done_nogas6 ; No |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
990 ; Yes, show "Gas 6!" |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
991 movlw color_pink |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
992 call TFT_set_color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
993 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
994 STRCPY_TEXT tGas ; Gas |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
995 STRCAT_PRINT " 6!" |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
996 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
997 profile_display_loop_done_nogas6: |
0 | 998 decf divesecs,F ;-1 |
999 read_int_eeprom .2 | |
1000 movf EEDATA,W | |
1001 bcf STATUS,C | |
1002 subfwb divesecs,W ; max. dives (low value) - divesecs | |
1003 movwf lo ; result | |
1004 incf divesecs,F ;+1 | |
1005 ; Set ext_flash_address:3 to TOC entry of this dive | |
1006 ; 1st: 200000h-200FFFh -> lo=0 | |
1007 ; 2nd: 201000h-201FFFh -> lo=1 | |
1008 ; 3rd: 202000h-202FFFh -> lo=2 | |
1009 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
1010 clrf ext_flash_address+0 | |
1011 clrf ext_flash_address+1 | |
1012 movlw 0x20 | |
1013 movwf ext_flash_address+2 | |
1014 movlw .16 | |
1015 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
1016 movf PRODL,W | |
1017 addwf ext_flash_address+1,F | |
1018 movf PRODH,W | |
1019 addwfc ext_flash_address+2,F | |
1020 ; pointer at the first 0xFA of header | |
1021 | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1022 movff logbook_min_temp_pos,win_top ; Y position at lowest temperature |
432 | 1023 movff logbook_pixel_x_pos,win_leftx2 |
0 | 1024 movlw .130 |
432 | 1025 cpfslt win_leftx2 ; limit left border to 130 |
1026 movwf win_leftx2 | |
0 | 1027 WIN_FONT FT_TINY |
1028 movlw color_orange ; Use same color as tp° curve | |
1029 call TFT_set_color | |
1030 | |
1031 movff logbook_min_tp+0,lo | |
1032 movff logbook_min_tp+1,hi | |
1033 lfsr FSR2,buffer | |
1034 | |
1035 TSTOSS opt_units ; 0=°C, 1=°F | |
1036 bra logbook_show_temp_metric | |
1037 ;logbook_show_temp_imperial: | |
1038 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1039 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
1040 lfsr FSR2,buffer ; Overwrite "-" | |
1041 bsf ignore_digit5 ; Full degrees only | |
1042 output_16 | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1043 STRCAT_TEXT_PRINT tLogTunitF |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1044 ; Now, the max. temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1045 movlw .15 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1046 subwf logbook_max_temp_pos,W |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1047 movff WREG,win_top ; Y position at max temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1048 movff logbook_max_tp+0,lo |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1049 movff logbook_max_tp+1,hi |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1050 lfsr FSR2,buffer |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1051 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1052 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1053 output_16 |
0 | 1054 bcf ignore_digit5 |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1055 STRCAT_TEXT_PRINT tLogTunitF |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1056 |
0 | 1057 bra logbook_show_temp_common |
1058 | |
1059 logbook_show_temp_metric: | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1060 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1061 movlw d'3' |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1062 movwf ignore_digits |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1063 bsf leftbind |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1064 output_16dp d'2' ; temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1065 STRCAT_TEXT_PRINT tLogTunitC |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1066 ; Now, the max. temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1067 movlw .15 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1068 subwf logbook_max_temp_pos,W |
432 | 1069 movwf win_top ; Y position at max temperature |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1070 movff logbook_max_tp+0,lo |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1071 movff logbook_max_tp+1,hi |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1072 lfsr FSR2,buffer |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1073 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1074 movlw d'3' |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1075 movwf ignore_digits |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1076 bsf leftbind |
0 | 1077 output_16dp d'2' ; temperature |
1078 STRCAT_TEXT_PRINT tLogTunitC | |
1079 | |
1080 logbook_show_temp_common: | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1081 |
50 | 1082 bcf leftbind |
1083 call TFT_standard_color | |
0 | 1084 |
1085 ; Get pointer to Gaslist | |
1086 LOG_POINT_TO log_gas1 | |
1087 | |
1088 movlw color_white ; Color for Gas 1 | |
1089 call TFT_set_color ; Set Color... | |
1090 bsf leftbind | |
1091 WIN_TINY log_gas_column1, log_gas_row | |
1092 rcall log_show_gas_common | |
1093 | |
1094 movlw color_green ; Color for Gas 2 | |
1095 call TFT_set_color ; Set Color... | |
1096 WIN_TINY log_gas_column2, log_gas_row | |
1097 rcall log_show_gas_common | |
1098 | |
1099 movlw color_red ; Color for Gas 3 | |
1100 call TFT_set_color ; Set Color... | |
1101 WIN_TINY log_gas_column3, log_gas_row | |
1102 rcall log_show_gas_common | |
1103 | |
1104 movlw color_yellow ; Color for Gas 4 | |
1105 call TFT_set_color ; Set Color... | |
1106 WIN_TINY log_gas_column4, log_gas_row | |
1107 rcall log_show_gas_common | |
1108 | |
1109 movlw color_cyan ; Color for Gas 5 | |
1110 call TFT_set_color ; Set Color... | |
1111 WIN_TINY log_gas_column5, log_gas_row | |
1112 rcall log_show_gas_common | |
1113 | |
1114 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
1115 display_profile_loop: | |
1116 btfsc switch_left ; SET/MENU? | |
1117 bra logbook_page2 ; Show more information | |
1118 btfsc switch_right ; ENTER? | |
1119 bra exit_profileview ; back to list | |
1120 | |
1121 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
1122 btfsc sleepmode ; Timeout? | |
1123 bra exit_profileview ; back to list | |
1124 bra display_profile_loop ; wait for something to do | |
1125 | |
1126 global log_screendump_and_onesecond | |
1127 log_screendump_and_onesecond: ; Check if we need to make a screenshot and check for new second | |
1128 btfsc onesecupdate | |
1129 call timeout_surfmode ; Timeout | |
1130 btfsc onesecupdate | |
1131 call set_dive_modes ; Check, if divemode must be entered | |
1132 bcf onesecupdate ; one second update | |
1133 btfsc divemode | |
1134 goto restart ; Enter Divemode if required | |
1135 | |
1136 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
1137 bra log_screendump_and_onesecond2 | |
1138 btfsc vusb_in ; USB plugged in? | |
113 | 1139 call comm_mode ; Start COMM mode |
0 | 1140 return |
1141 log_screendump_and_onesecond2: | |
1142 btfss vusb_in ; USB (still) plugged in? | |
1143 bcf enable_screen_dumps ; No, clear flag | |
1144 call rs232_get_byte | |
1145 btfsc rs232_recieve_overflow | |
1146 return | |
1147 movlw "l" | |
1148 cpfseq RCREG1 | |
1149 return | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1150 goto TFT_dump_screen ; Dump the screen contents and return |
0 | 1151 |
1152 log_show_gas_common: | |
1153 extern customview_show_mix | |
1154 lfsr FSR2,buffer | |
1155 call ext_flash_byte_read_plus ; Gas2 current O2 | |
1156 movff temp1,lo | |
1157 call ext_flash_byte_read_plus ; Gas2 current He | |
1158 movff temp1,hi | |
1159 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1160 STRCAT_PRINT "" | |
1161 call ext_flash_byte_read_plus ; Gas2 change depth | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1162 goto ext_flash_byte_read_plus ; Gas2 Type and return |
0 | 1163 |
1164 ;============================================================================= | |
1165 profile_display_color: | |
1166 movff average_depth_hold_total+3,active_gas ; Restore gas color. | |
1167 movlw color_white ; Default color | |
1168 dcfsnz active_gas,F | |
1169 movlw color_white ; Color for Gas 1 | |
1170 dcfsnz active_gas,F | |
1171 movlw color_green ; Color for Gas 2 | |
1172 dcfsnz active_gas,F | |
1173 movlw color_red ; Color for Gas 3 | |
1174 dcfsnz active_gas,F | |
1175 movlw color_yellow ; Color for Gas 4 | |
1176 dcfsnz active_gas,F | |
1177 movlw color_cyan ; Color for Gas 5 | |
1178 dcfsnz active_gas,F | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1179 movlw color_pink ; Color for Gas 6 |
0 | 1180 goto TFT_set_color ; Set Color... |
1181 | |
1182 ;============================================================================= | |
1183 ; Draw a vertical line between xC+1 and xC+0, at current X position. | |
1184 ; | |
1185 ; Note: should keep xC+0 | |
1186 ; Note: ascending or descending ! | |
1187 ; | |
1188 profile_display_fill: | |
1189 ; First, check if xC+0>apnoe_mins or xC+0<aponoe_mins | |
1190 movf xC+0,W | |
1191 cpfseq xC+1 ; xC+0 = apone_mins? | |
1192 bra profile_display_fill2 ; No! | |
1193 return | |
1194 | |
1195 profile_display_fill2: | |
1196 ; Make sure to init X position. | |
1197 movf logbook_pixel_x_pos,W | |
1198 mullw 2 | |
1199 decf PRODL,F | |
1200 movlw 0 | |
1201 subwfb PRODH,F | |
1202 call pixel_write_col320 | |
1203 | |
1204 movf xC+0,W | |
1205 cpfsgt xC+1 ; apnoe_mins>xC+0? | |
1206 bra profile_display_fill_up ; Yes! | |
1207 | |
1208 profile_display_fill_down2: ; Loop | |
1209 decf xC+1,F | |
1210 | |
1211 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | |
1212 | |
1213 movf xC+0,W | |
1214 cpfseq xC+1 ; Loop until xC+1=xC+0 | |
1215 bra profile_display_fill_down2 | |
1216 return ; apnoe_mins and xC+0 are untouched | |
1217 | |
1218 profile_display_fill_up: ; Fill upwards from xC+0 to apone_mins! | |
1219 incf xC+1,F | |
1220 | |
1221 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | |
1222 | |
1223 movf xC+0,W | |
1224 cpfseq xC+1 ; Loop until xC+1=apnoe_mins | |
1225 bra profile_display_fill_up | |
1226 return ; apnoe_mins and xC+0 are untouched | |
1227 | |
1228 ;============================================================================= | |
1229 | |
1230 | |
1231 profile_view_get_depth: | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1232 infsnz logbook_sample_counter+0,F |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1233 incf logbook_sample_counter+1,F ; Count read pixels |
0 | 1234 |
1235 movf logbook_sample_counter+0,W | |
1236 cpfseq average_depth_hold_total+0 | |
1237 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue | |
1238 movf logbook_sample_counter+1,W | |
1239 cpfseq average_depth_hold_total+1 | |
1240 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue | |
1241 ; draw a new 10min line here... | |
1242 clrf logbook_sample_counter+0 | |
1243 clrf logbook_sample_counter+1 ; clear counting registers for next line | |
1244 | |
1245 ; Vertical lines... | |
1246 movlw color_deepblue | |
1247 call TFT_set_color ; Make this configurable? | |
1248 movlw profile_top+.1 | |
432 | 1249 movwf win_top |
0 | 1250 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile |
432 | 1251 movwf win_leftx2 ; Left border (0-159) |
0 | 1252 movlw profile_height_pixels |
432 | 1253 movwf win_height |
0 | 1254 movlw profile_height_pixels |
432 | 1255 movwf win_width ; "Window" height |
0 | 1256 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2 |
1257 | |
1258 profile_view_get_depth_no_line: | |
1259 call ext_flash_byte_read_plus_0x20 ; read depth first | |
1260 movff temp1,logbook_cur_depth+0 ; low value | |
1261 call ext_flash_byte_read_plus_0x20 ; read depth first | |
1262 movff temp1,logbook_cur_depth+1 ; high value | |
1263 call ext_flash_byte_read_plus_0x20 ; read Profile Flag Byte | |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1264 movff temp1,timeout_counter2 ; store Profile Flag Byte |
0 | 1265 |
1266 bcf event_occured ; clear flag | |
1267 btfsc timeout_counter2,7 | |
1268 bsf event_occured ; We also have an Event byte! | |
1269 bcf timeout_counter2,7 ; Clear Event Byte Flag (If any) | |
1270 ; timeout_counter2 now holds the number of additional bytes to ignore (0-127) | |
1271 movlw 0xFD ; end of profile bytes? | |
1272 cpfseq logbook_cur_depth+0 | |
1273 bra profile_view_get_depth_new1 ; no 1st. 0xFD | |
1274 cpfseq logbook_cur_depth+1 | |
1275 bra profile_view_get_depth_new1 ; no 2nd. 0xFD | |
1276 bsf end_of_profile ; End found! Set Flag! Skip remaining pixels! | |
1277 return | |
1278 | |
1279 profile_view_get_depth_new1: | |
1280 btfsc event_occured ; Was there an event attached to this sample? | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1281 rcall profile_view_get_depth_events ; Yes, get information about this event(s) |
0 | 1282 |
1283 ;---- Read Tp°, if any AND divisor reached AND bytes available ----------- | |
1284 movf divisor_temperature,W ; Is Tp° divisor null ? | |
1285 bz profile_view_get_depth_no_tp; Yes: no Tp° curve. | |
1286 decf count_temperature,F ; Decrement tp° counter | |
1287 bnz profile_view_get_depth_no_tp; No temperature this time | |
1288 | |
1289 call ext_flash_byte_read_plus_0x20 ; Tp° low | |
1290 decf timeout_counter2,F | |
1291 movff temp1,logbook_cur_tp+0 | |
1292 call ext_flash_byte_read_plus_0x20 ; Tp° high | |
1293 decf timeout_counter2,F | |
1294 movff temp1,logbook_cur_tp+1 | |
1295 movff divisor_temperature,count_temperature ; Restart counter. | |
1296 | |
1297 ; Compute Tp° max on the fly... | |
1298 movff logbook_cur_tp+0,sub_a+0 ; Compare cur_tp > max_tp ? | |
1299 movff logbook_cur_tp+1,sub_a+1 | |
1300 movff logbook_max_tp+0,sub_b+0 | |
1301 movff logbook_max_tp+1,sub_b+1 | |
1302 call sub16 ; SIGNED sub_a - sub_b | |
1303 btfsc neg_flag | |
1304 bra profile_view_get_depth_no_tp | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1305 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1306 ; store max. temp only below start_dive_threshold (1,0m) |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1307 tstfsz logbook_cur_depth+1 ; > 2,56m? |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1308 bra profile_view_compute_max_temp ; Yes, include in max. temp measurement |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1309 movlw start_dive_threshold ; 1,0m |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1310 cpfsgt logbook_cur_depth+0 ; low value |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1311 bra profile_view_get_depth_no_tp ; above 1,0m, ignore temp |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1312 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1313 profile_view_compute_max_temp: |
0 | 1314 movff logbook_cur_tp+0,logbook_max_tp+0 |
1315 movff logbook_cur_tp+1,logbook_max_tp+1 | |
1316 | |
1317 ;---- Read deco, if any AND divisor=0 AND bytes available ---------------- | |
1318 profile_view_get_depth_no_tp: | |
1319 movf divisor_deco,W | |
1320 bz profile_view_get_depth_no_deco | |
1321 decf count_deco,F | |
1322 bnz profile_view_get_depth_no_deco | |
1323 | |
1324 call ext_flash_byte_read_plus_0x20 | |
1325 decf timeout_counter2,F | |
1326 movff temp1,logbook_ceiling | |
1327 movff divisor_deco,count_deco ; Restart counter. | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1328 call ext_flash_byte_read_plus_0x20 ; Skip stop length |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1329 decf timeout_counter2,F |
0 | 1330 |
1331 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ | |
1332 profile_view_get_depth_no_deco: | |
1333 ; Then skip remaining bytes... | |
1334 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) | |
167 | 1335 tstfsz timeout_counter2 ; Anything to skip? |
1336 call incf_ext_flash_address0_0x20; Yes, increases bytes in ext_flash_address:3 with 0x200000 bank switching | |
0 | 1337 return |
1338 | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1339 profile_view_get_depth_events: |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1340 clrf EventByte2 ; Clear EventByte2 |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1341 call ext_flash_byte_read_plus_0x20 ; Read Event byte |
0 | 1342 movff temp1,EventByte ; store EventByte |
1343 decf timeout_counter2,F ; reduce counter | |
98 | 1344 |
1345 btfss EventByte,7 ; Another Event byte? | |
1346 bra profile_no_second_eventbyte ; No | |
1347 call ext_flash_byte_read_plus_0x20; Read Event byte2 | |
1348 movff temp1,EventByte2 ; store EventByte2 | |
1349 decf timeout_counter2,F ; reduce counter | |
1350 bcf EventByte,7 ; Clear flag | |
1351 | |
1352 profile_no_second_eventbyte: | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1353 ; Check event flags in the EventBytes |
167 | 1354 btfsc EventByte,4 ; Manual Gas Changed? |
1355 rcall logbook_event1 ; Yes! | |
1356 btfsc EventByte,5 ; Stored Gas Changed? | |
1357 rcall logbook_event4 ; Yes! | |
1358 btfsc EventByte,6 ; Setpoint Change? | |
1359 rcall logbook_event3 ; Yes! | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1360 btfsc EventByte2,0 ; Bailout? |
167 | 1361 rcall logbook_event2 ; Yes! |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1362 ; Any Alarm? |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1363 bcf EventByte,4 ; Clear bits already tested |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1364 bcf EventByte,5 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1365 bcf EventByte,6 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1366 movlw .6 ; manual marker? |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1367 cpfseq EventByte |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1368 return ; No, return |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1369 bsf log_marker_found ; Manual marker! Draw small yellow rectancle here |
163
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1370 return |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1371 |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1372 logbook_event4: ; Stored Gas changed! |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1373 call ext_flash_byte_read_plus_0x20 ; Read Gas# |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1374 decf timeout_counter2,F ; reduce counter |
0 | 1375 movff temp1,average_depth_hold_total+3 |
163
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1376 rcall profile_display_color ; Change profile color according to gas number |
0 | 1377 return |
1378 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1379 logbook_event1: ; Gas6 changed |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1380 bsf gas6_changed |
0 | 1381 movlw 6 ; Just color backup to 6 |
1382 movwf average_depth_hold_total+3 | |
1383 rcall profile_display_color ; Back to normal profile color. | |
167 | 1384 incf_ext_flash_address_0x20 .2 ; Skip two bytes |
1385 decf timeout_counter2,F ; reduce counter | |
1386 decf timeout_counter2,F ; reduce counter | |
1387 return | |
0 | 1388 |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1389 logbook_event2: ; Bailout |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1390 bsf is_bailout ; Set flag |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1391 movff average_depth_hold_total+3,total_divetime_seconds+0 ; Backup last gas color in case we return to CCR |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1392 movlw 6 ; Use Gas6 color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1393 movwf average_depth_hold_total+3 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1394 rcall profile_display_color ; Back to normal profile color. |
167 | 1395 incf_ext_flash_address_0x20 .2 ; Skip two bytes |
1396 decf timeout_counter2,F ; reduce counter | |
1397 decf timeout_counter2,F ; reduce counter | |
1398 return | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1399 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1400 logbook_event3: ; Setpoint change |
167 | 1401 incf_ext_flash_address_0x20 .1 ; Skip one byte |
1402 decf timeout_counter2,F ; reduce counter | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1403 btfss is_bailout ; Are we in bailout? |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1404 return ; No, return |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1405 ; We were in bailout before, restore profile color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1406 movff total_divetime_seconds+0,average_depth_hold_total+3 ; Restore color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1407 rcall profile_display_color ; Back to normal profile color. |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1408 return |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1409 |
0 | 1410 exit_profileview: |
255 | 1411 ; call speed_fastest |
0 | 1412 bcf sleepmode |
1413 clrf timeout_counter2 ; restore all registers to build same page again | |
1414 movff divemins_backup,divemins+0 | |
1415 movff logbook_divenumber_temp, logbook_divenumber | |
1416 movff logbook_max_dive_counter_temp,logbook_max_dive_counter | |
1417 incf logbook_max_dive_counter,F | |
1418 decf logbook_divenumber,F | |
1419 bcf all_dives_shown | |
1420 clrf menupos3 ; here: used row on current page | |
1421 movlw logbook_row_number | |
1422 movwf menupos ; here: active row on current page | |
372 | 1423 ; call TFT_DisplayOff |
1424 ; call TFT_boot | |
0 | 1425 clrf CCP1CON ; stop PWM |
1426 bcf PORTC,2 ; Pull PWM out to GND | |
1427 call TFT_ClearScreen ; clear details/profile | |
1428 goto logbook2 ; start search | |
1429 | |
1430 next_logbook2: | |
1431 btfsc all_dives_shown ; all shown | |
1432 goto logbook ; all reset | |
1433 clrf menupos3 | |
1434 movlw logbook_row_number | |
1435 movwf menupos | |
1436 incf logbook_page_number,F ; start new screen | |
169
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
1437 bsf keep_cursor_new_page ; Keep cursor on "next page" |
0 | 1438 clrf CCP1CON ; stop PWM |
1439 bcf PORTC,2 ; Pull PWM out to GND | |
1440 call TFT_ClearScreen | |
1441 goto logbook2 ; start search | |
1442 | |
1443 next_logbook3: | |
1444 incf menupos,F ; +1 | |
1445 movlw logbook_row_number+.2 | |
1446 cpfsgt menupos ; =logbook_row_number+.3? | |
1447 bra next_logbook3a ; No | |
1448 movlw .1 | |
1449 movwf menupos | |
1450 bra next_logbook3b | |
1451 | |
1452 next_logbook3a: | |
1453 incf menupos3,W ; last entry in current page +1 | |
1454 cpfseq menupos ; same as cursor pos.? | |
1455 bra next_logbook3b ; No | |
1456 movlw logbook_row_number+.1 ; Yes, ... | |
1457 movwf menupos ; ... jump directly to "next page" if page is not full | |
1458 | |
1459 movlw logbook_row_number | |
1460 cpfseq menupos3 ; Last dive was row logbook_row_number? | |
1461 bsf all_dives_shown ; No, set flag to load first page again (full reset) | |
1462 | |
1463 next_logbook3b: | |
1464 clrf timeout_counter2 | |
1465 call TFT_logbook_cursor | |
1466 | |
1467 bcf switch_left | |
1468 goto logbook_loop | |
1469 | |
1470 display_listdive: | |
1471 bsf logbook_page_not_empty ; Page not empty | |
1472 incf menupos3,F | |
1473 | |
1474 bsf leftbind | |
1475 WIN_FONT FT_SMALL | |
1476 WIN_LEFT logbook_list_left | |
1477 | |
1478 decf menupos3,W ; -1 into wreg | |
1479 mullw logbook_row_offset | |
1480 movff PRODL,win_top | |
1481 | |
1482 lfsr FSR2,buffer | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1483 call do_logoffset_common_read ; Read into lo:hi |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1484 tstfsz lo ; lo=0? |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1485 bra display_listdive1 ; No, adjust offset |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1486 tstfsz hi ; hi=0? |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1487 bra display_listdive1 ; No, adjust offset |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1488 bra display_listdive1b ; Display now |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1489 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1490 display_listdive1: |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1491 ; Check limit (lo:hi must be <1000) |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1492 movlw LOW d'1000' ; Compare to 1000 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1493 subwf lo,W |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1494 movlw HIGH d'1000' |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1495 subwfb hi,W |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1496 bc display_listdive1b ; carry = no-borrow = > 1000, skip! |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1497 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1498 infsnz lo,F |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1499 incf hi,F ; hi:lo = hi:lo + 1 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1500 movff lo,sub_a+0 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1501 movff hi,sub_a+1 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1502 movff logbook_divenumber,sub_b+0 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1503 clrf sub_b+1 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1504 call subU16 ; sub_c = sub_a - sub_b |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1505 movff sub_c+0,lo |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1506 movff sub_c+1,hi |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1507 bra display_listdive1a |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1508 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1509 display_listdive1b: |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1510 clrf hi |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1511 movff logbook_divenumber,lo ; lo=0 and hi=0 -> show without applied offset |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1512 display_listdive1a: |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1513 output_16_3 ; displays only last three figures from a 16Bit value (0-999), # of dive |
0 | 1514 PUTC ' ' |
1515 LOG_POINT_TO log_date+1 ; Point to month | |
1516 call ext_flash_byte_read_plus | |
1517 movff temp1,lo ; read month | |
1518 | |
1519 display_listdive2: | |
1520 movff lo,convert_value_temp+0 ; Month (in lo, see above) | |
1521 call ext_flash_byte_read_plus ; Day | |
1522 movff temp1,convert_value_temp+1 | |
1523 call TFT_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" into buffer | |
1524 PUTC ' ' | |
1525 | |
1526 LOG_POINT_TO log_max_depth ; Point to max. depth | |
1527 call ext_flash_byte_read_plus ; max. Depth | |
1528 movff temp1,lo | |
1529 call ext_flash_byte_read_plus | |
1530 movff temp1,hi | |
1531 | |
1532 TSTOSS opt_units ; 0=Meters, 1=Feets | |
1533 bra display_listdive2_metric | |
1534 ;display_listdive2_imperial: | |
1535 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1536 PUTC ' ' | |
25 | 1537 bcf leftbind |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
1538 output_16_3 ; limit to 999 and display only (0-999) |
0 | 1539 STRCAT_TEXT tFeets1 |
1540 bra display_listdive3 | |
1541 | |
1542 display_listdive2_metric: | |
1543 bsf ignore_digit5 ; no cm... | |
1544 movlw d'1' ; +1 | |
1545 movff WREG,ignore_digits ; no 1000m | |
1546 bcf leftbind | |
1547 output_16dp .3 ; xxx.y | |
1548 STRCAT_TEXT tMeters | |
1549 PUTC ' ' | |
1550 | |
1551 display_listdive3: | |
1552 call ext_flash_byte_read_plus | |
1553 movff temp1,lo ; read divetime minutes | |
1554 call ext_flash_byte_read_plus | |
1555 movff temp1,hi | |
1556 output_16_3 ; Divetime minutes (0-999min) | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1557 STRCAT_TEXT tMinutes |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1558 clrf WREG |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1559 movff WREG,buffer+.21 ; limit to 21 chars |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1560 STRCAT_PRINT "" ; Display header-row in list |
0 | 1561 return |
1562 | |
1563 logbook_show_divenumber: | |
1564 call do_logoffset_common_read ; Read into lo:hi | |
1565 tstfsz lo ; lo=0? | |
1566 bra logbook_show_divenumber2 ; No, adjust offset | |
1567 tstfsz hi ; hi=0? | |
1568 bra logbook_show_divenumber2 ; No, adjust offset | |
1569 movff divesecs,lo ; lo=0 and hi=0 -> skip Offset routine | |
1570 bra logbook_show_divenumber3 ; Display now | |
1571 | |
1572 logbook_show_divenumber2: | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1573 infsnz lo,F |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1574 incf hi,F ; hi:lo = hi:lo + 1 |
0 | 1575 movff lo,sub_a+0 |
1576 movff hi,sub_a+1 | |
1577 movff divesecs,sub_b+0 | |
1578 clrf sub_b+1 | |
1579 call subU16 ; sub_c = sub_a - sub_b | |
1580 movff sub_c+0,lo | |
1581 movff sub_c+1,hi | |
1582 | |
1583 logbook_show_divenumber3: | |
1584 WIN_MEDIUM logbook_divenumer_column, logbook_divenumer_row | |
1585 bsf leftbind | |
1586 output_16 ; # of dive in logbook | |
1587 bcf leftbind | |
1588 STRCAT_PRINT "" | |
1589 return | |
1590 | |
1591 | |
1592 logbook_page2: ; Show more info | |
255 | 1593 ; call speed_fastest |
0 | 1594 clrf CCP1CON ; stop PWM |
1595 bcf PORTC,2 ; Pull PWM out to GND | |
1596 call TFT_ClearScreen ; Clear screen | |
1597 | |
1598 ; Set ext_flash pointer to "#divesecs-oldest" dive | |
1599 ; compute read_int_eeprom .2 - divesecs | |
1600 ; Read required header data for profile display | |
1601 ; look in header for pointer to begin of diveprofile (Byte 2-4) | |
1602 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | |
1603 | |
1604 decf divesecs,F ;-1 | |
1605 read_int_eeprom .2 | |
1606 movf EEDATA,W | |
1607 bcf STATUS,C | |
1608 subfwb divesecs,W ; max. dives (low value) - divesecs | |
1609 movwf lo ; result | |
1610 incf divesecs,F ;+1 | |
1611 ; Set ext_flash_address:3 to TOC entry of this dive | |
1612 ; 1st: 200000h-200FFFh -> lo=0 | |
1613 ; 2nd: 201000h-201FFFh -> lo=1 | |
1614 ; 3rd: 202000h-202FFFh -> lo=2 | |
1615 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
1616 clrf ext_flash_address+0 | |
1617 clrf ext_flash_address+1 | |
1618 movlw 0x20 | |
1619 movwf ext_flash_address+2 | |
1620 movlw .16 | |
1621 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
1622 movf PRODL,W | |
1623 addwf ext_flash_address+1,F | |
1624 movf PRODH,W | |
1625 addwfc ext_flash_address+2,F | |
1626 ; pointer at the first 0xFA of header | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1627 rcall logbook_show_divenumber ; Show the dive number in medium font |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1628 ; Show date and time in first row |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1629 WIN_SMALL .59,.10 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1630 LOG_POINT_TO log_date |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1631 call ext_flash_byte_read_plus |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1632 movff temp1,convert_value_temp+2 ; Year |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1633 call ext_flash_byte_read_plus |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1634 movff temp1,convert_value_temp+0 ; Month |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1635 call ext_flash_byte_read_plus |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1636 movff temp1,convert_value_temp+1 ; Day |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1637 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1638 PUTC "-" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1639 call ext_flash_byte_read_plus ; hour |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1640 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1641 call ext_flash_byte_read_plus ; Minutes |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1642 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1643 output_99x ; hour |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1644 PUTC ':' |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1645 movff hi,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1646 output_99x ; minute |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1647 STRCAT_PRINT "" ; Display 1st row of details |
0 | 1648 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1649 ; Show max depth and dive time |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1650 WIN_SMALL .5,.35 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1651 STRCAT "Max:" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1652 LOG_POINT_TO log_max_depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1653 call ext_flash_byte_read_plus ; read max depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1654 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1655 call ext_flash_byte_read_plus ; read max depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1656 movff temp1,hi |
0 | 1657 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1658 TSTOSS opt_units ; 0=Meters, 1=Feets |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1659 bra logbook_page2_depth_metric |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1660 ; imperial |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1661 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1662 PUTC ' ' |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1663 bcf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1664 output_16_3 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1665 STRCAT_TEXT tFeets |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1666 bra logbook_page2_depth_common |
0 | 1667 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1668 logbook_page2_depth_metric: |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1669 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1670 output_16dp d'3' ; max. depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1671 STRCAT_TEXT tMeters |
0 | 1672 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1673 logbook_page2_depth_common: |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1674 STRCAT " - " |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1675 call ext_flash_byte_read_plus ; divetime in minutes |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1676 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1677 call ext_flash_byte_read_plus |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1678 movff temp1,hi ; divetime in minutes |
0 | 1679 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1680 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1681 output_16 ; divetime minutes |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1682 PUTC "m" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1683 LOG_POINT_TO log_divetime+.2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1684 call ext_flash_byte_read_plus ; read divetime seconds |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1685 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1686 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1687 output_99x ; divetime seconds |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1688 call TFT_standard_color |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1689 STRCAT_PRINT "s" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1690 ; ; Dive mode |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1691 ; LOG_POINT_TO log_divemode |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1692 ; call ext_flash_byte_read_plus ; Read divemode |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1693 ; movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1694 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) |
0 | 1695 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1696 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1697 ; Deco model |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1698 WIN_SMALL .5,.65 |
0 | 1699 LOG_POINT_TO log_decomodel |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1700 call ext_flash_byte_read_plus ; read deco model |
0 | 1701 movff temp1,lo |
1702 decfsz temp1,F | |
1703 bra logbook_decomodel1 | |
1704 ; Deco model GF Version | |
1705 STRCAT_TEXT_PRINT tZHL16GF | |
1706 LOG_POINT_TO log_gf_lo | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1707 WIN_SMALL .5,.90 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1708 STRCPY_TEXT tGF |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1709 call ext_flash_byte_read_plus ; Read GF lo |
0 | 1710 movff temp1,lo |
1711 output_8 | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1712 STRCAT "%/" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1713 bra logbook_decomodel_common |
0 | 1714 logbook_decomodel1: |
1715 ; Deco model NON-GF Version | |
1716 STRCAT_TEXT_PRINT tZHL16 | |
1717 LOG_POINT_TO log_sat_mult | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1718 WIN_SMALL .5,.90 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1719 call ext_flash_byte_read_plus ; Read sat_mult |
0 | 1720 movff temp1,lo |
1721 output_8 | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1722 STRCAT "%/" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1723 logbook_decomodel_common: |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1724 call ext_flash_byte_read_plus ; Read desat_mult or GF_hi |
0 | 1725 movff temp1,lo |
1726 output_8 | |
1727 STRCAT_PRINT "%" | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1728 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1729 ; CNS |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1730 LOG_POINT_TO log_cns_start |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1731 WIN_SMALL .5,.115 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1732 STRCPY_TEXT tCNS2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1733 call ext_flash_byte_read_plus ; read cns low |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1734 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1735 call ext_flash_byte_read_plus ; read cns high |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1736 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1737 output_16 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1738 LOG_POINT_TO log_cns_end |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1739 STRCAT "->" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1740 call ext_flash_byte_read_plus ; read CNS low |
0 | 1741 movff temp1,lo |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1742 call ext_flash_byte_read_plus ; read CNS high |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1743 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1744 output_16 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1745 STRCAT_PRINT "%" |
0 | 1746 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1747 ; Salinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1748 WIN_SMALL .5,.140 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1749 LOG_POINT_TO log_salinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1750 STRCPY_TEXT tDvSalinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1751 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1752 call ext_flash_byte_read_plus ; read salinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1753 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1754 movff temp1,total_divetime_seconds+1 ; backup for average depth display |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1755 output_8 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1756 STRCAT_PRINT "%" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1757 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1758 ; Average depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1759 WIN_SMALL .5,.165 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1760 STRCPY_TEXT tAVG |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1761 LOG_POINT_TO log_avr_depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1762 call ext_flash_byte_read_plus ; read avr low |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1763 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1764 call ext_flash_byte_read_plus ; read avr high |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1765 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1766 movf total_divetime_seconds+1,W ; salinity for this dive |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1767 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1768 output_16dp .3 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1769 STRCAT_PRINT "m" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1770 |
0 | 1771 ; Last deco |
1772 LOG_POINT_TO log_last_stop | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1773 WIN_SMALL .5,.190 |
0 | 1774 STRCPY_TEXT tLastDecostop |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1775 call ext_flash_byte_read_plus ; Read last stop |
0 | 1776 movff temp1,lo |
1777 output_8 | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1778 STRCAT_PRINT "m" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1779 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1780 movlw color_lightblue |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1781 call TFT_set_color |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1782 WIN_FRAME_COLOR16 .63,.220,.2,.105; Top, Bottom, Left, Right |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1783 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1784 ; Firmware |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1785 call TFT_standard_color |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1786 WIN_SMALL .110,.65 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1787 STRCAT "V:" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1788 LOG_POINT_TO log_firmware |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1789 call ext_flash_byte_read_plus ; read firmware xx |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1790 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1791 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1792 output_8 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1793 PUTC "." |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1794 call ext_flash_byte_read_plus ; read firmware yy |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1795 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1796 output_99x |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1797 STRCAT_PRINT "" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1798 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1799 ; Battery voltage |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1800 WIN_SMALL .110,.90 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1801 STRCAT_PRINT "Batt:" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1802 WIN_SMALL .110,.115 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1803 LOG_POINT_TO log_battery ; Battery voltage... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1804 call ext_flash_byte_read_plus ; read battery low |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1805 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1806 call ext_flash_byte_read_plus ; read battery high |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1807 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1808 output_16dp .2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1809 STRCAT_PRINT "V" |
0 | 1810 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1811 ; surface pressure in mbar |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1812 LOG_POINT_TO log_surface_press |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1813 call ext_flash_byte_read_plus ; read surface pressure |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1814 movff temp1,lo |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1815 call ext_flash_byte_read_plus ; read surface pressure |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1816 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1817 WIN_SMALL .110,.140 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1818 lfsr FSR2,buffer |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1819 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1820 output_16 ; Air pressure before dive |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1821 STRCAT_TEXT tMBAR |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1822 clrf WREG |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1823 movff WREG,buffer+7 ; limit to 7 chars |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1824 STRCAT_PRINT "" |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1825 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1826 movlw color_greenish |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1827 call TFT_set_color |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1828 WIN_FRAME_COLOR16 .63,.220,.107,.159; Top, Bottom, Left, Right |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1829 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1830 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1831 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1832 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1833 ; ; OC/CC Gas List |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1834 ; LOG_POINT_TO log_divemode |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1835 ; call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1836 ; WIN_TINY log2_title_column,log2_title_row1 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1837 ; WIN_COLOR color_greenish |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1838 ; STRCPY_TEXT_PRINT tGaslist |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1839 ; WIN_FRAME_STD log2_title_row1-2, log2_gas_row3+.15, log2_title_column-2, .159 ; Top, Bottom, Left, Right |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1840 ; bcf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1841 ; LOG_POINT_TO log_gas1 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1842 ; movlw color_white ; Color for Gas 1 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1843 ; call TFT_set_color ; Set Color... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1844 ; WIN_TINY log2_gas_column, log2_gas_row1 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1845 ; rcall log_show_gas_common2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1846 ; movlw color_green ; Color for Gas 2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1847 ; call TFT_set_color ; Set Color... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1848 ; WIN_TINY log2_gas_column, log2_gas_row2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1849 ; rcall log_show_gas_common2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1850 ; movlw color_red ; Color for Gas 3 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1851 ; call TFT_set_color ; Set Color... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1852 ; WIN_TINY log2_gas_column, log2_gas_row3 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1853 ; rcall log_show_gas_common2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1854 ;; movlw color_yellow ; Color for Gas 4 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1855 ;; call TFT_set_color ; Set Color... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1856 ;; WIN_TINY log2_gas_column, log2_gas_row4 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1857 ;; rcall log_show_gas_common2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1858 ;; movlw color_cyan ; Color for Gas 5 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1859 ;; call TFT_set_color ; Set Color... |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1860 ;; WIN_TINY log2_gas_column, log2_gas_row5 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1861 ;; rcall log_show_gas_common2 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1862 ; |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1863 ; |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1864 ; |
0 | 1865 |
1866 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
1867 display_details_loop: | |
1868 btfsc switch_left ; SET/MENU? | |
1869 goto display_profile2 ; Show the profile view again | |
1870 btfsc switch_right ; ENTER? | |
1871 bra exit_profileview ; back to list | |
1872 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
1873 btfsc sleepmode ; Timeout? | |
1874 bra exit_profileview ; back to list | |
1875 | |
1876 bra display_details_loop ; wait for something to do | |
1877 | |
1878 global logbook_preloop_tasks | |
1879 logbook_preloop_tasks: | |
275 | 1880 movlw CCP1CON_VALUE ; See hwos.inc |
0 | 1881 movwf CCP1CON ; Power-on backlight |
1882 call TFT_standard_color | |
1883 bcf sleepmode ; clear some flags | |
1884 bcf switch_right | |
1885 bcf switch_left | |
1886 clrf timeout_counter2 | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1887 goto speed_normal ; and return |
0 | 1888 |
1889 log_show_sp_common: | |
1890 lfsr FSR2,buffer | |
1891 call ext_flash_byte_read_plus ; Read setpoint | |
1892 movff temp1,lo | |
1893 clrf hi | |
1894 bsf leftbind | |
1895 output_16dp d'3' | |
1896 bcf leftbind | |
1897 STRCAT_TEXT tbar | |
1898 PUTC " " | |
1899 call ext_flash_byte_read_plus ; change depth | |
1900 movff temp1,lo | |
1901 | |
1902 TSTOSS opt_units ; 0=Meters, 1=Feets | |
1903 bra log_show_sp_common_metric | |
1904 movf lo,W | |
1905 mullw .100 ; convert meters to mbar | |
1906 movff PRODL,lo | |
1907 movff PRODH,hi | |
1908 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1909 output_16 | |
1910 STRCAT_TEXT tFeets ; "ft" | |
1911 bra log_show_sp_common_common | |
1912 log_show_sp_common_metric: | |
1913 output_8 | |
1914 STRCAT_TEXT tMeters ; "m" | |
1915 log_show_sp_common_common: | |
1916 STRCAT_PRINT "" | |
1917 return | |
1918 | |
1919 log_show_gas_common2: ; as log_show_gas_common but with change depth | |
1920 lfsr FSR2,buffer | |
1921 call ext_flash_byte_read_plus ; current O2 | |
1922 movff temp1,lo | |
1923 call ext_flash_byte_read_plus ; current He | |
1924 movff temp1,hi | |
1925 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1926 call ext_flash_byte_read_plus ; change depth | |
1927 movff temp1,lo | |
1928 | |
1929 TSTOSS opt_units ; 0=Meters, 1=Feets | |
1930 bra log_show_gas_common2_metric | |
1931 movf lo,W | |
1932 mullw .100 ; convert meters to mbar | |
1933 movff PRODL,lo | |
1934 movff PRODH,hi | |
1935 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1936 output_16 | |
1937 STRCAT_TEXT tFeets ; "ft" | |
1938 bra log_show_gas_common2_common | |
1939 log_show_gas_common2_metric: | |
1940 output_8 | |
1941 STRCAT_TEXT tMeters ; "m" | |
1942 log_show_gas_common2_common: | |
1943 bcf leftbind | |
1944 call ext_flash_byte_read_plus ; Gas Type | |
1945 STRCAT_PRINT "" | |
1946 return | |
1947 | |
1948 END |