Mercurial > public > hwos_code
annotate src/logbook.asm @ 577:bfb87b4cf2ca
Italian update
author | heinrichsweikamp |
---|---|
date | Sun, 18 Feb 2018 19:18:46 +0100 |
parents | 0039f057b90f |
children | b455b31ce022 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
560 | 3 ; File logbook.asm REFACTORED VERSION V2.91 |
0 | 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 | |
560 | 97 #DEFINE log_divetime_value_column .60 ; UPDATED, old value was .65 |
0 | 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 | |
560 | 237 call TFT_boot |
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 | |
502
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
404 call TFT_boot |
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
405 ;call TFT_ClearScreen ; Clear screen |
0 | 406 ; Set ext_flash pointer to "#divesecs-oldest" dive |
407 ; compute read_int_eeprom .2 - divesecs | |
408 ; Read required header data for profile display | |
409 ; look in header for pointer to begin of diveprofile (Byte 2-4) | |
410 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing | |
411 | |
412 decf divesecs,F ;-1 | |
413 read_int_eeprom .2 | |
414 movf EEDATA,W | |
415 bcf STATUS,C | |
416 subfwb divesecs,W ; max. dives (low value) - divesecs | |
417 movwf lo ; result | |
418 incf divesecs,F ;+1 | |
419 ; Set ext_flash_address:3 to TOC entry of this dive | |
420 ; 1st: 200000h-200FFFh -> lo=0 | |
421 ; 2nd: 201000h-201FFFh -> lo=1 | |
422 ; 3rd: 202000h-202FFFh -> lo=2 | |
423 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
424 clrf ext_flash_address+0 | |
425 clrf ext_flash_address+1 | |
426 movlw 0x20 | |
427 movwf ext_flash_address+2 | |
428 movlw .16 | |
429 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
430 movf PRODL,W | |
431 addwf ext_flash_address+1,F | |
432 movf PRODH,W | |
433 addwfc ext_flash_address+2,F | |
434 ; pointer at the first 0xFA of header | |
435 | |
436 ; Now, show profile | |
437 LOG_POINT_TO log_samplingrate | |
438 call ext_flash_byte_read ; Read sampling rate | |
439 movff temp1,samplesecs_value ; needed later... | |
440 | |
441 LOG_POINT_TO .2 | |
442 call ext_flash_byte_read_plus ; Read start address of profile | |
443 movff temp1,ext_flash_log_pointer+0 | |
444 call ext_flash_byte_read_plus ; Read start address of profile | |
445 movff temp1,ext_flash_log_pointer+1 | |
446 call ext_flash_byte_read_plus ; Read start address of profile | |
447 movff temp1,ext_flash_log_pointer+2 | |
448 | |
449 | |
450 clrf logbook_sample_counter+0 | |
451 clrf logbook_sample_counter+1 ; holds amount of read samples | |
452 | |
453 call TFT_standard_color | |
454 call logbook_show_divenumber ; Show the dive number in medium font | |
455 | |
456 WIN_SMALL logbook_date_column, logbook_date_row | |
457 LOG_POINT_TO log_date | |
458 call ext_flash_byte_read_plus | |
459 movff temp1,convert_value_temp+2 ; Year | |
460 call ext_flash_byte_read_plus | |
461 movff temp1,convert_value_temp+0 ; Month | |
462 call ext_flash_byte_read_plus | |
463 movff temp1,convert_value_temp+1 ; Day | |
464 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
465 STRCAT_PRINT "" | |
466 | |
560 | 467 ; NEW code block ## logbook look and feel |
468 WIN_SMALL log_divetime_value_column,logbook_date_row ; align with surrounding data | |
469 LOG_POINT_TO log_divemode | |
470 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
471 movff temp1,lo | |
472 call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) | |
473 | |
0 | 474 WIN_SMALL logbook_time_column, logbook_time_row |
572 | 475 LOG_POINT_TO log_time |
0 | 476 call ext_flash_byte_read_plus ; hour |
477 movff temp1,lo | |
478 call ext_flash_byte_read_plus ; Minutes | |
479 movff temp1,hi | |
560 | 480 output_99x ; hour |
0 | 481 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
|
482 movff hi,lo |
560 | 483 output_99x ; minute |
484 STRCAT_PRINT "" ; Display 1st row of details | |
0 | 485 |
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
|
486 LOG_POINT_TO log_profile_version |
560 | 487 call ext_flash_byte_read_plus ; Profile version |
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
|
488 movlw 0x24 |
560 | 489 cpfslt temp1 ; <0x24? |
490 bra log_skip_extra_icon ; Yes, skip | |
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
|
491 |
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
|
492 WIN_SMALL logbook_time_column-.8, logbook_time_row |
560 | 493 STRCPY_PRINT 0x94 ; "End of dive" icon |
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
|
494 |
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
|
495 log_skip_extra_icon: |
0 | 496 LOG_POINT_TO log_max_depth |
560 | 497 call ext_flash_byte_read_plus ; read max depth |
0 | 498 movff temp1,lo |
560 | 499 call ext_flash_byte_read_plus ; read max depth |
0 | 500 movff temp1,hi |
560 | 501 movff lo,xA+0 ; calculate y-scale for profile display |
0 | 502 movff hi,xA+1 |
560 | 503 movlw profile_height_pixels ; pixel height available for profile |
0 | 504 movwf xB+0 |
505 clrf xB+1 | |
560 | 506 call div16x16 ; does xA/xB=xC |
507 movff xC+0,y_scale+0 ; holds LOW byte of y-scale (mbar/pixel!) | |
508 movff xC+1,y_scale+1 ; holds HIGH byte of y-scale (mbar/pixel!) | |
509 infsnz y_scale+0,F ; increase one, because there may be a remainder | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
510 incf y_scale+1,F |
0 | 511 |
417 | 512 movlw LOW ((profile_height_pixels+1)*.1000) |
0 | 513 movwf xC+0 |
514 movlw HIGH (((profile_height_pixels+1)*.1000) & h'FFFF') | |
515 movwf xC+1 | |
516 movlw UPPER ((profile_height_pixels+1)*.1000) | |
517 movwf xC+2 | |
518 clrf xC+3 | |
519 | |
520 movff lo,xB+0 ; Max. Depth in mbar | |
521 movff hi,xB+1 ; Max. Depth in mbar | |
522 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
523 | |
524 movff xC+0,x_scale+0 ; | |
525 movff xC+1,x_scale+1 ; = Pixels/10m (For scale, draw any xx rows a scale-line) | |
526 | |
527 movf x_scale+0,W | |
528 iorwf x_scale+1,W ; x_scale:2 = Null? | |
529 bnz display_profile_offset4 ; No, continue | |
530 incf x_scale+1,F ; Yes, make x_scale+1>1 to make "display_profile2e" working | |
531 | |
532 display_profile_offset4: | |
533 WIN_SMALL log_max_value_column,log_max_value_row | |
534 | |
535 TSTOSS opt_units ; 0=Meters, 1=Feets | |
536 bra display_profile_offset4_metric | |
537 ;display_profile_offset4_imperial: | |
538 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
539 PUTC ' ' | |
25 | 540 bcf leftbind |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
189
diff
changeset
|
541 output_16_3 ; limit to 999 and display only (0-999) |
0 | 542 STRCAT_TEXT_PRINT tFeets |
543 bra display_profile_offset4_common | |
544 | |
545 display_profile_offset4_metric: | |
546 bsf leftbind | |
547 output_16dp d'3' ; max. depth | |
548 STRCAT_TEXT_PRINT tMeters | |
549 | |
550 display_profile_offset4_common: | |
551 call ext_flash_byte_read_plus ; divetime in minutes | |
552 movff temp1,lo | |
553 call ext_flash_byte_read_plus | |
554 movff temp1,hi ; divetime in minutes | |
555 | |
556 movff lo,xA+0 ; calculate x-scale for profile display | |
557 movff hi,xA+1 ; calculate total diveseconds first | |
558 movlw d'60' ; 60seconds are one minute... | |
559 movwf xB+0 | |
560 clrf xB+1 | |
561 call mult16x16 ; result is in xC:2 ! | |
562 | |
563 WIN_SMALL log_divetime_value_column,log_divetime_value_row | |
564 bsf leftbind | |
565 output_16 ; divetime minutes | |
566 movlw LOW d'600' | |
567 movwf xA+0 | |
568 movlw HIGH d'600' | |
569 movwf xA+1 ; A vertical line every 600 seconds | |
570 movff samplesecs_value,xB+0 ; Copy sampling rate | |
571 clrf xB+1 | |
572 call div16x16 ; xA/xB=xC with xA as remainder | |
573 movff xC+0,average_depth_hold_total+0 | |
574 movff xC+1,average_depth_hold_total+1 | |
575 ;average_depth_hold_total:2 holds interval of samples for vertical 10min line | |
576 | |
577 ; Restore divetime in minutes: | |
578 ; get real sample time | |
579 LOG_POINT_TO log_total_seconds | |
580 call ext_flash_byte_read_plus ; Total sample time in seconds | |
581 movff temp1,xC+0 | |
582 call ext_flash_byte_read_plus ; Total sample time in seconds | |
583 movff temp1,xC+1 | |
584 | |
585 PUTC ':' | |
586 LOG_POINT_TO log_divetime+.2 | |
587 call ext_flash_byte_read_plus ; read divetime seconds | |
588 movff temp1,lo | |
589 movff xC+0,xA+0 ; now calculate x-scale value | |
590 movff xC+1,xA+1 | |
591 movlw profile_width_pixels ; pix width available | |
592 movwf xB+0 | |
593 clrf xB+1 | |
594 call div16x16 ; xA/xB=xC | |
595 movff xC+0,xA+0 | |
596 movff xC+1,xA+1 | |
597 movf samplesecs_value,W ; devide through sample interval! | |
598 movwf xB+0 | |
599 clrf xB+1 | |
600 call div16x16 ; xA/xB=xC | |
601 movff xC+0,profile_temp+0 ; store value (use any #xC sample, skip xC-1) into temp registers | |
602 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
|
603 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
|
604 incf profile_temp+1,F |
0 | 605 |
606 bsf leftbind | |
607 output_99x ; divetime seconds | |
608 call TFT_standard_color | |
609 STRCAT_PRINT "" | |
610 | |
611 call ext_flash_byte_read_plus ; Read min. Temperature | |
612 movff temp1,logbook_min_tp+0 | |
613 call ext_flash_byte_read_plus ; Read min. Temperature | |
614 movff temp1,logbook_min_tp+1 | |
615 | |
616 ; Set pointer to Gas 1 Type. | |
617 LOG_POINT_TO log_gas1+.3 | |
618 call ext_flash_byte_read_plus ; read Gas Type | |
619 decfsz temp1,W ; =1 (="First")? | |
620 bra logbook_find_first_gas2 ; No. | |
621 movlw .1 | |
622 movwf temp1 | |
623 bra logbook_find_first_gas_done | |
624 logbook_find_first_gas2: | |
625 ; Set pointer to Gas 2 Type. | |
626 LOG_POINT_TO log_gas2+.3 | |
627 call ext_flash_byte_read_plus ; read Gas Type | |
628 decfsz temp1,W ; =1 (="First")? | |
629 bra logbook_find_first_gas3 ; No. | |
630 movlw .2 | |
631 movwf temp1 | |
632 bra logbook_find_first_gas_done | |
633 logbook_find_first_gas3: | |
634 ; Set pointer to Gas 3 Type. | |
635 LOG_POINT_TO log_gas3+.3 | |
636 call ext_flash_byte_read_plus ; read Gas Type | |
637 decfsz temp1,W ; =1 (="First")? | |
638 bra logbook_find_first_gas4 ; No. | |
639 movlw .3 | |
640 movwf temp1 | |
641 bra logbook_find_first_gas_done | |
642 logbook_find_first_gas4: | |
643 ; Set pointer to Gas 4 Type. | |
644 LOG_POINT_TO log_gas4+.3 | |
645 call ext_flash_byte_read_plus ; read Gas Type | |
646 decfsz temp1,W ; =1 (="First")? | |
647 bra logbook_find_first_gas5 ; No. | |
648 movlw .4 | |
649 movwf temp1 | |
650 bra logbook_find_first_gas_done | |
651 logbook_find_first_gas5: | |
652 movlw .5 ; Must be Gas5 | |
653 movwf temp1 | |
654 logbook_find_first_gas_done: | |
655 movff temp1,average_depth_hold_total+3; keep copy to restore color | |
656 rcall profile_display_color ; Back to normal profile color. | |
657 ; Pointer is now trashed! | |
658 | |
659 ; Point to profile portion of this dive | |
660 movff ext_flash_log_pointer+0,ext_flash_address+0 | |
661 movff ext_flash_log_pointer+1,ext_flash_address+1 | |
662 movff ext_flash_log_pointer+2,ext_flash_address+2 | |
663 | |
664 incf_ext_flash_address_0x20 d'2' ; Skip 0xFA 0xFA | |
665 call ext_flash_byte_read_plus_0x20 ; Read low byte of total dives into temp1 (at the time the dive was made) | |
666 | |
667 ; Load total number of dives (low byte only) | |
668 read_int_eeprom .2 | |
669 incf EEDATA,W ; +1 | |
670 bsf STATUS,C ; Set borrow | |
671 subfwb divesecs,W ; total dives - dive# to show - 1 = low byte of total dives (at the time the dive was made) | |
672 cpfseq temp1 ; # of dive in logbook (Must be equal with low byte in short header) | |
673 bra display_profile_no_profile ; Not equal, no profile for this dive available! | |
674 | |
675 ; Skip rest of short header: 3 Bytes | |
676 ; Skip length of profile data: 3 Bytes | |
677 ; Skip sampling rate in profile section: 1Byte | |
678 ; Skip number of divisors: 1Byte | |
679 incf_ext_flash_address_0x20 d'8' | |
680 | |
681 ; Divisor temp | |
682 incf_ext_flash_address_0x20 d'2' | |
683 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
684 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
685 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
686 movf temp1,W | |
687 movwf divisor_temperature ; Store divisor | |
688 movwf count_temperature ; Store to tp° counter too. | |
689 ; Divisor Deco | |
690 incf_ext_flash_address_0x20 d'2' | |
691 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
692 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
693 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
694 movf temp1,W | |
695 movwf divisor_deco ; Store divisor | |
696 movwf count_deco ; Store as temp, too | |
697 ; Divisor GF | |
698 incf_ext_flash_address_0x20 d'2' | |
699 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
700 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
701 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
702 movff temp1,divisor_gf ; Store divisor | |
703 ; Divisor ppO2 Sensors | |
704 incf_ext_flash_address_0x20 d'2' | |
705 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
706 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
707 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
708 movff temp1,divisor_ppo2_sensors ; Store divisor | |
709 ; Divisor decoplan | |
710 incf_ext_flash_address_0x20 d'2' | |
711 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
712 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
713 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
714 movff temp1,divisor_decoplan ; Store divisor | |
715 ; Divisor CNS | |
716 incf_ext_flash_address_0x20 d'2' | |
717 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
718 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
719 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
720 movff temp1,divisor_cns ; Store divisor | |
721 ; Divisor Tank data | |
722 incf_ext_flash_address_0x20 d'2' | |
723 ; call ext_flash_byte_read_plus_0x20 ; Read information type | |
724 ; call ext_flash_byte_read_plus_0x20 ; Read information Length | |
725 call ext_flash_byte_read_plus_0x20 ; Read information Divisor | |
726 movff temp1,divisor_tank ; Store divisor | |
727 | |
728 ; Start Profile display | |
729 movlw color_deepblue | |
730 call TFT_set_color ; Make this configurable? | |
731 ; Draw a frame around profile area | |
732 WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1 | |
733 | |
734 movlw profile_top | |
432 | 735 movwf win_top |
0 | 736 movlw profile_left |
432 | 737 movwf win_leftx2 ; Left border (0-159) |
0 | 738 movlw d'1' |
432 | 739 movwf win_height |
0 | 740 movlw profile_width_pixels+.1 |
432 | 741 movwf win_width+0 ; Right border (0-159) |
433 | 742 clrf win_width+1 |
432 | 743 bra display_profile2f ; No 0m line |
0 | 744 display_profile2e: |
745 call TFT_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
746 display_profile2f: | |
432 | 747 movf win_top,W ; Get row |
0 | 748 addwf x_scale+0,W ; Add line interval distance to win_top |
749 tstfsz x_scale+1 ; >255? | |
750 movlw d'255' ; Yes, make win_top>239 -> Abort here | |
751 btfsc STATUS,C ; A Cary from the addwf above? | |
752 movlw d'255' ; Yes, make win_top>239 -> Abort here | |
432 | 753 movwf win_top ; Result in win_top again |
0 | 754 movlw profile_top+profile_height_pixels+.1 ; Limit |
432 | 755 cpfsgt win_top ; >239? |
0 | 756 bra display_profile2e ; No, draw another line |
757 | |
758 clrf timeout_counter2 ; here: used as counter for depth readings | |
759 movlw profile_width_pixels+profile_left-.1 | |
760 movwf ignore_digits ; here: used as counter for x-pixels | |
761 bcf end_of_profile ; clear flag | |
372 | 762 |
763 movlw profile_left+.1 | |
0 | 764 movwf logbook_pixel_x_pos ; here: used as colum x2 (Start at Colum 5) |
372 | 765 |
766 movlw profile_top+.1 ; Zero-m row | |
0 | 767 movwf apnoe_mins ; here: used for fill between rows |
768 movwf logbook_last_tp ; Initialise for Tp° curve too. | |
769 | |
770 movlw LOW(-.100) ; Initialize max tp° to -10.0 °C. | |
771 movwf logbook_max_tp+0 | |
772 movlw HIGH 0xFFFF & (-.100) | |
773 movwf logbook_max_tp+1 | |
774 | |
775 setf logbook_cur_tp+0 ; Initialize Tp°, before the first recorded point. | |
776 setf logbook_cur_tp+1 | |
777 clrf logbook_last_tp ; Also reset previous Y for Tp° | |
778 clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling. | |
372 | 779 movlw profile_top+.1 |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
780 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
|
781 movlw profile_top+profile_height_pixels |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
782 movwf logbook_max_temp_pos ; Initialize for displaying the highest temperature |
0 | 783 |
371 | 784 movlw profile_left |
432 | 785 movwf win_leftx2 |
371 | 786 movlw profile_top |
432 | 787 movwf win_top |
371 | 788 movlw profile_height_pixels |
432 | 789 movwf win_height |
371 | 790 movlw LOW (profile_width_pixels*.2) |
432 | 791 movwf win_width+0 |
371 | 792 movlw HIGH (profile_width_pixels*.2) |
432 | 793 movwf win_width+1 |
371 | 794 call TFT_box_write ; open box for d1 |
795 | |
434 | 796 ; INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (Also sets standard Color!) |
0 | 797 |
798 profile_display_loop: | |
434 | 799 ; Init pixel write |
560 | 800 movf logbook_pixel_x_pos,W |
801 mullw 2 | |
802 call pixel_write_col320 | |
434 | 803 |
0 | 804 movff profile_temp+0,profile_temp2+0 |
805 movff profile_temp+1,profile_temp2+1 ; 16Bit x-scaler | |
806 incf profile_temp2+1,F | |
807 tstfsz profile_temp2+0 ; Must not be Zero | |
808 bra profile_display_loop2 ; Not Zero! | |
809 incf profile_temp2+0,F ; Zero, Increase! | |
810 | |
811 profile_display_loop2: | |
812 rcall profile_view_get_depth ; reads depth, temp and profile data | |
813 | |
814 btfsc end_of_profile ; end-of profile reached? | |
815 bra profile_display_loop_done ; Yes, skip all remaining pixels | |
816 | |
817 | |
818 ;---- Draw Ceiling curve, if any --------------------------------------------- | |
819 movf divisor_deco,W | |
820 bz profile_display_skip_deco | |
821 | |
822 movf logbook_ceiling,W ; Any deco ceiling ? | |
823 bz profile_display_skip_deco | |
824 | |
825 mullw .100 ; Yes: convert to mbar | |
826 movff PRODL,sub_a+0 | |
827 movff PRODH,sub_a+1 | |
828 movff logbook_cur_depth+0,sub_b+0 ; Compare with UNSIGNED current depth (16bits) | |
829 movff logbook_cur_depth+1,sub_b+1 | |
830 call subU16 ; set (or not) neg_flag | |
831 | |
832 movlw color_dark_green ; Dark green if Ok, | |
833 btfss neg_flag | |
834 movlw color_dark_red ; Or dark red if ceiling overflown. | |
835 call TFT_set_color | |
836 | |
837 movff PRODL,xA+0 | |
838 movff PRODH,xA+1 | |
839 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett | |
840 movff y_scale+1,xB+1 | |
841 call div16x16 ; xA/xB=xC | |
842 | |
372 | 843 movlw profile_top+.1 ; Starts right after the top line. |
432 | 844 movwf win_top |
0 | 845 movff logbook_pixel_x_pos,win_leftx2 ; Left border (0-159) |
846 movff xC+0,win_height | |
847 call half_vertical_line ; Inputs: win_top, win_leftx2, win_height, win_color1, win_color2 | |
848 | |
849 profile_display_skip_deco: | |
850 ;---- Draw Tp° curve, if any --------------------------------------------- | |
851 movf divisor_temperature,W | |
852 bz profile_display_skip_temp | |
853 | |
854 movf logbook_cur_tp+0,W ; Did we had already a valid Tp°C record ? | |
855 andwf logbook_cur_tp+1,W | |
856 incf WREG | |
857 bz profile_display_skip_temp ; No: just skip drawing. | |
858 | |
859 movlw LOW(((profile_height_pixels-.10)*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix | |
860 movwf xB+0 | |
861 movlw HIGH(((profile_height_pixels-.10)*.256)/.370) | |
862 movwf xB+1 | |
863 | |
864 movf logbook_cur_tp+0,W ; Current Tp° - (-2.0°C) == Tp° + 20. | |
865 addlw LOW(.20) ; Low byte. | |
866 movwf xA+0 | |
867 movf logbook_cur_tp+1,W | |
868 btfsc STATUS,C ; Propagate carry, if any | |
869 incf WREG | |
870 movwf xA+1 | |
871 call mult16x16 ; xA*xB=xC | |
872 | |
873 ; scale: divide by 256, ie. take just high byte. | |
874 movf xC+1,W | |
875 sublw profile_top+profile_height_pixels-.10 ; Upside-down: Y = .75 + (.153 - result) | |
876 movwf xC+0 | |
877 | |
878 ; Check limits | |
372 | 879 movlw profile_top+.1 |
0 | 880 movwf xC+1 |
881 cpfsgt xC+0 | |
882 movff xC+1,xC+0 | |
883 | |
884 movlw color_orange | |
885 call TFT_set_color | |
886 | |
887 movf logbook_last_tp,W ; do we have a valid previous value ? | |
888 bz profile_display_temp_1 ; No: skip the vertical line. | |
889 movwf xC+1 | |
890 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
|
891 profile_display_temp_1: |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
892 movf xC+0,W ; current row |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
893 cpfsgt logbook_min_temp_pos ; check limit |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
894 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
|
895 cpfslt logbook_max_temp_pos ; check limit |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
896 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
|
897 |
0 | 898 movff xC+0,logbook_last_tp |
899 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; Set col(0..159) x row (0..239), put a current color pixel. | |
900 | |
901 profile_display_skip_temp: | |
902 ;---- Draw depth curve --------------------------------------------------- | |
903 movff y_scale+0,xB+0 ; devide pressure in mbar/quant for row offsett | |
904 movff y_scale+1,xB+1 | |
905 movff logbook_cur_depth+0,xA+0 | |
906 movff logbook_cur_depth+1,xA+1 | |
907 call div16x16 ; xA/xB=xC | |
372 | 908 movlw profile_top+.1 |
0 | 909 addwf xC+0,F ; add 75 pixel offset to result |
910 | |
911 btfsc STATUS,C ; Ignore potential profile errors | |
912 movff apnoe_mins,xC+0 | |
913 | |
914 rcall profile_display_color ; Back to normal profile color. | |
915 | |
916 movff apnoe_mins,xC+1 | |
917 call profile_display_fill ; In this column between this row (xC+0) and the last row (xC+1) | |
918 movff xC+0,apnoe_mins ; Store last row for fill routine | |
919 | |
372 | 920 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
|
921 incf logbook_pixel_x_pos,F ; Next column |
0 | 922 |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
923 ;---- 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
|
924 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
|
925 bra profile_display_skip_marker ; No |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
926 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
927 ; tiny "m" |
430 | 928 incf apnoe_mins,W ; increase row (Y) |
432 | 929 movwf win_top |
492 | 930 ; limit win_top to 220 |
560 | 931 movlw .220 |
932 cpfslt win_top | |
933 movwf win_top | |
430 | 934 decf logbook_pixel_x_pos,W ; decrease column (X) |
432 | 935 movwf win_leftx2 |
492 | 936 ; limit win_leftx2 to 151 |
560 | 937 movlw .151 |
938 cpfslt win_leftx2 | |
939 movwf win_leftx2 | |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
940 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
941 movlw color_orange |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
942 call TFT_set_color |
492 | 943 WIN_FONT FT_TINY |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
944 lfsr FSR2,buffer |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
945 STRCPY_PRINT "m" |
492 | 946 bcf log_marker_found ; Clear flag |
495
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
947 |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
948 movlw profile_left |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
949 movwf win_leftx2 |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
950 movlw profile_top |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
951 movwf win_top |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
952 movlw profile_height_pixels |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
953 movwf win_height |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
954 movlw LOW (profile_width_pixels*.2) |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
955 movwf win_width+0 |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
956 movlw HIGH (profile_width_pixels*.2) |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
957 movwf win_width+1 |
2b1239e6ea85
Bugfix: More then one marker shown deleted profile
heinrichsweikamp
parents:
492
diff
changeset
|
958 call TFT_box_write ; re-open box for d1 |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
959 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
960 profile_display_skip_marker: |
0 | 961 ;---- Draw CNS curve, if any --------------------------------------------- |
962 movf divisor_cns,W | |
963 bz profile_display_skip_cns | |
964 ; | |
965 ; TODO HERE | |
966 ; | |
967 profile_display_skip_cns: | |
968 | |
969 ;---- Draw GF curve, if any ---------------------------------------------- | |
970 movf divisor_gf,W | |
971 bz profile_display_skip_gf | |
972 ; | |
973 ; TODO HERE | |
974 ; | |
975 profile_display_skip_gf: | |
976 | |
977 ;---- All curves done. | |
978 | |
979 profile_display_skip_loop1: ; skips readings! | |
980 dcfsnz profile_temp2+0,F | |
981 bra profile_display_loop3 ; check 16bit.... | |
982 | |
983 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
|
984 |
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
985 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
|
986 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
|
987 |
0 | 988 bra profile_display_skip_loop1 |
989 | |
990 profile_display_loop3: | |
991 decfsz profile_temp2+1,F ; 16 bit x-scaler test | |
992 bra profile_display_skip_loop1 ; skips readings! | |
993 | |
994 decfsz ignore_digits,F ; counts drawn x-pixels to zero | |
995 bra profile_display_loop ; Not ready yet | |
996 ; Done. | |
997 | |
998 display_profile_no_profile: ; No profile available for this dive! | |
999 | |
1000 profile_display_loop_done: | |
560 | 1001 btfss is_bailout ; Bailout during the dive? |
1002 bra profile_display_loop_done_nobail ; No | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1003 ; Yes, show "Bailout" |
560 | 1004 movlw color_pink |
1005 call TFT_set_color | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1006 WIN_TINY logbook_bailout_column,logbook_bailout_row |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1007 STRCPY_TEXT_PRINT tDiveBailout ; Bailout |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1008 profile_display_loop_done_nobail: |
560 | 1009 btfss gas6_changed ; Gas6 |
1010 bra profile_display_loop_done_nogas6 ; No | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1011 ; Yes, show "Gas 6!" |
560 | 1012 movlw color_pink |
1013 call TFT_set_color | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1014 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15 |
560 | 1015 STRCPY_TEXT tGas ; Gas |
1016 STRCAT_PRINT " 6!" | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1017 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1018 profile_display_loop_done_nogas6: |
560 | 1019 decf divesecs,F ;-1 |
0 | 1020 read_int_eeprom .2 |
560 | 1021 movf EEDATA,W |
1022 bcf STATUS,C | |
1023 subfwb divesecs,W ; max. dives (low value) - divesecs | |
1024 movwf lo ; result | |
1025 incf divesecs,F ;+1 | |
0 | 1026 ; Set ext_flash_address:3 to TOC entry of this dive |
1027 ; 1st: 200000h-200FFFh -> lo=0 | |
1028 ; 2nd: 201000h-201FFFh -> lo=1 | |
1029 ; 3rd: 202000h-202FFFh -> lo=2 | |
1030 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) | |
1031 clrf ext_flash_address+0 | |
1032 clrf ext_flash_address+1 | |
1033 movlw 0x20 | |
1034 movwf ext_flash_address+2 | |
1035 movlw .16 | |
1036 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
1037 movf PRODL,W | |
1038 addwf ext_flash_address+1,F | |
1039 movf PRODH,W | |
1040 addwfc ext_flash_address+2,F | |
1041 ; pointer at the first 0xFA of header | |
1042 | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1043 movff logbook_min_temp_pos,win_top ; Y position at lowest temperature |
432 | 1044 movff logbook_pixel_x_pos,win_leftx2 |
0 | 1045 movlw .130 |
432 | 1046 cpfslt win_leftx2 ; limit left border to 130 |
1047 movwf win_leftx2 | |
0 | 1048 WIN_FONT FT_TINY |
1049 movlw color_orange ; Use same color as tp° curve | |
1050 call TFT_set_color | |
1051 | |
1052 movff logbook_min_tp+0,lo | |
1053 movff logbook_min_tp+1,hi | |
1054 lfsr FSR2,buffer | |
1055 | |
1056 TSTOSS opt_units ; 0=°C, 1=°F | |
1057 bra logbook_show_temp_metric | |
1058 ;logbook_show_temp_imperial: | |
1059 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1060 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
1061 lfsr FSR2,buffer ; Overwrite "-" | |
1062 bsf ignore_digit5 ; Full degrees only | |
1063 output_16 | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1064 STRCAT_TEXT_PRINT tLogTunitF |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1065 ; Now, the max. temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1066 movlw .15 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1067 subwf logbook_max_temp_pos,W |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1068 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
|
1069 movff logbook_max_tp+0,lo |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1070 movff logbook_max_tp+1,hi |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1071 lfsr FSR2,buffer |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1072 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
|
1073 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
|
1074 output_16 |
0 | 1075 bcf ignore_digit5 |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1076 STRCAT_TEXT_PRINT tLogTunitF |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1077 |
0 | 1078 bra logbook_show_temp_common |
1079 | |
1080 logbook_show_temp_metric: | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1081 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
|
1082 movlw d'3' |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1083 movwf ignore_digits |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1084 bsf leftbind |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1085 output_16dp d'2' ; temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1086 STRCAT_TEXT_PRINT tLogTunitC |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1087 ; Now, the max. temperature |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1088 movlw .15 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1089 subwf logbook_max_temp_pos,W |
432 | 1090 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
|
1091 movff logbook_max_tp+0,lo |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1092 movff logbook_max_tp+1,hi |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1093 lfsr FSR2,buffer |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1094 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
|
1095 movlw d'3' |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1096 movwf ignore_digits |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1097 bsf leftbind |
0 | 1098 output_16dp d'2' ; temperature |
1099 STRCAT_TEXT_PRINT tLogTunitC | |
1100 | |
1101 logbook_show_temp_common: | |
50 | 1102 bcf leftbind |
1103 call TFT_standard_color | |
0 | 1104 |
1105 ; Get pointer to Gaslist | |
1106 LOG_POINT_TO log_gas1 | |
1107 | |
1108 movlw color_white ; Color for Gas 1 | |
1109 call TFT_set_color ; Set Color... | |
1110 bsf leftbind | |
1111 WIN_TINY log_gas_column1, log_gas_row | |
1112 rcall log_show_gas_common | |
1113 | |
1114 movlw color_green ; Color for Gas 2 | |
1115 call TFT_set_color ; Set Color... | |
1116 WIN_TINY log_gas_column2, log_gas_row | |
1117 rcall log_show_gas_common | |
1118 | |
1119 movlw color_red ; Color for Gas 3 | |
1120 call TFT_set_color ; Set Color... | |
1121 WIN_TINY log_gas_column3, log_gas_row | |
1122 rcall log_show_gas_common | |
1123 | |
1124 movlw color_yellow ; Color for Gas 4 | |
1125 call TFT_set_color ; Set Color... | |
1126 WIN_TINY log_gas_column4, log_gas_row | |
1127 rcall log_show_gas_common | |
1128 | |
1129 movlw color_cyan ; Color for Gas 5 | |
1130 call TFT_set_color ; Set Color... | |
1131 WIN_TINY log_gas_column5, log_gas_row | |
1132 rcall log_show_gas_common | |
1133 | |
1134 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco | |
1135 display_profile_loop: | |
560 | 1136 ; REPLACE ## logbook look and feel |
1137 ; btfsc switch_left ; SET/MENU? | |
1138 ; BY | |
1139 btfsc switch_right | |
0 | 1140 bra logbook_page2 ; Show more information |
560 | 1141 ; REPLACE ## logbook look and feel |
1142 ; btfsc switch_right ; ENTER? | |
1143 ; BY | |
1144 btfsc switch_left | |
0 | 1145 bra exit_profileview ; back to list |
1146 | |
1147 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second | |
1148 btfsc sleepmode ; Timeout? | |
1149 bra exit_profileview ; back to list | |
1150 bra display_profile_loop ; wait for something to do | |
1151 | |
1152 global log_screendump_and_onesecond | |
560 | 1153 log_screendump_and_onesecond: ; Check if we need to make a screenshot and check for new second |
0 | 1154 btfsc onesecupdate |
1155 call timeout_surfmode ; Timeout | |
1156 btfsc onesecupdate | |
1157 call set_dive_modes ; Check, if divemode must be entered | |
1158 bcf onesecupdate ; one second update | |
1159 btfsc divemode | |
1160 goto restart ; Enter Divemode if required | |
1161 | |
1162 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
1163 bra log_screendump_and_onesecond2 | |
1164 btfsc vusb_in ; USB plugged in? | |
113 | 1165 call comm_mode ; Start COMM mode |
0 | 1166 return |
1167 log_screendump_and_onesecond2: | |
1168 btfss vusb_in ; USB (still) plugged in? | |
1169 bcf enable_screen_dumps ; No, clear flag | |
1170 call rs232_get_byte | |
1171 btfsc rs232_recieve_overflow | |
1172 return | |
1173 movlw "l" | |
1174 cpfseq RCREG1 | |
1175 return | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1176 goto TFT_dump_screen ; Dump the screen contents and return |
0 | 1177 |
1178 log_show_gas_common: | |
1179 extern customview_show_mix | |
1180 lfsr FSR2,buffer | |
1181 call ext_flash_byte_read_plus ; Gas2 current O2 | |
1182 movff temp1,lo | |
1183 call ext_flash_byte_read_plus ; Gas2 current He | |
1184 movff temp1,hi | |
1185 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1186 STRCAT_PRINT "" | |
1187 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
|
1188 goto ext_flash_byte_read_plus ; Gas2 Type and return |
0 | 1189 |
1190 ;============================================================================= | |
1191 profile_display_color: | |
1192 movff average_depth_hold_total+3,active_gas ; Restore gas color. | |
1193 movlw color_white ; Default color | |
1194 dcfsnz active_gas,F | |
1195 movlw color_white ; Color for Gas 1 | |
1196 dcfsnz active_gas,F | |
1197 movlw color_green ; Color for Gas 2 | |
1198 dcfsnz active_gas,F | |
1199 movlw color_red ; Color for Gas 3 | |
1200 dcfsnz active_gas,F | |
1201 movlw color_yellow ; Color for Gas 4 | |
1202 dcfsnz active_gas,F | |
1203 movlw color_cyan ; Color for Gas 5 | |
1204 dcfsnz active_gas,F | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1205 movlw color_pink ; Color for Gas 6 |
0 | 1206 goto TFT_set_color ; Set Color... |
1207 | |
1208 ;============================================================================= | |
1209 ; Draw a vertical line between xC+1 and xC+0, at current X position. | |
1210 ; | |
1211 ; Note: should keep xC+0 | |
1212 ; Note: ascending or descending ! | |
1213 ; | |
1214 profile_display_fill: | |
1215 ; First, check if xC+0>apnoe_mins or xC+0<aponoe_mins | |
1216 movf xC+0,W | |
1217 cpfseq xC+1 ; xC+0 = apone_mins? | |
1218 bra profile_display_fill2 ; No! | |
1219 return | |
1220 | |
1221 profile_display_fill2: | |
1222 ; Make sure to init X position. | |
1223 movf logbook_pixel_x_pos,W | |
1224 mullw 2 | |
1225 decf PRODL,F | |
1226 movlw 0 | |
1227 subwfb PRODH,F | |
1228 call pixel_write_col320 | |
1229 | |
1230 movf xC+0,W | |
1231 cpfsgt xC+1 ; apnoe_mins>xC+0? | |
1232 bra profile_display_fill_up ; Yes! | |
1233 | |
1234 profile_display_fill_down2: ; Loop | |
560 | 1235 decf xC+1,F |
0 | 1236 |
1237 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | |
1238 | |
560 | 1239 movf xC+0,W |
1240 cpfseq xC+1 ; Loop until xC+1=xC+0 | |
1241 bra profile_display_fill_down2 | |
0 | 1242 return ; apnoe_mins and xC+0 are untouched |
1243 | |
1244 profile_display_fill_up: ; Fill upwards from xC+0 to apone_mins! | |
560 | 1245 incf xC+1,F |
0 | 1246 |
1247 HALF_PIXEL_WRITE xC+1 ; Updates just row (0..239) | |
1248 | |
560 | 1249 movf xC+0,W |
1250 cpfseq xC+1 ; Loop until xC+1=apnoe_mins | |
1251 bra profile_display_fill_up | |
0 | 1252 return ; apnoe_mins and xC+0 are untouched |
1253 | |
1254 ;============================================================================= | |
1255 | |
1256 | |
1257 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
|
1258 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
|
1259 incf logbook_sample_counter+1,F ; Count read pixels |
0 | 1260 |
1261 movf logbook_sample_counter+0,W | |
1262 cpfseq average_depth_hold_total+0 | |
560 | 1263 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue |
0 | 1264 movf logbook_sample_counter+1,W |
1265 cpfseq average_depth_hold_total+1 | |
560 | 1266 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue |
1267 ; draw a new 10min line here... | |
0 | 1268 clrf logbook_sample_counter+0 |
560 | 1269 clrf logbook_sample_counter+1 ; clear counting registers for next line |
0 | 1270 |
1271 ; Vertical lines... | |
1272 movlw color_deepblue | |
560 | 1273 call TFT_set_color ; Make this configurable? |
0 | 1274 movlw profile_top+.1 |
432 | 1275 movwf win_top |
560 | 1276 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile |
1277 movwf win_leftx2 ; Left border (0-159) | |
0 | 1278 movlw profile_height_pixels |
432 | 1279 movwf win_height |
0 | 1280 movlw profile_height_pixels |
560 | 1281 movwf win_width ; "Window" height |
1282 call half_horizontal_line ; Inputs: win_top, win_leftx2, win_width, win_color1, win_color2 | |
0 | 1283 |
1284 profile_view_get_depth_no_line: | |
1285 call ext_flash_byte_read_plus_0x20 ; read depth first | |
1286 movff temp1,logbook_cur_depth+0 ; low value | |
1287 call ext_flash_byte_read_plus_0x20 ; read depth first | |
1288 movff temp1,logbook_cur_depth+1 ; high value | |
1289 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
|
1290 movff temp1,timeout_counter2 ; store Profile Flag Byte |
0 | 1291 |
560 | 1292 bcf event_occured ; clear flag |
0 | 1293 btfsc timeout_counter2,7 |
560 | 1294 bsf event_occured ; We also have an Event byte! |
1295 bcf timeout_counter2,7 ; Clear Event Byte Flag (If any) | |
0 | 1296 ; timeout_counter2 now holds the number of additional bytes to ignore (0-127) |
560 | 1297 movlw 0xFD ; end of profile bytes? |
0 | 1298 cpfseq logbook_cur_depth+0 |
560 | 1299 bra profile_view_get_depth_new1 ; no 1st. 0xFD |
0 | 1300 cpfseq logbook_cur_depth+1 |
560 | 1301 bra profile_view_get_depth_new1 ; no 2nd. 0xFD |
1302 bsf end_of_profile ; End found! Set Flag! Skip remaining pixels! | |
0 | 1303 return |
1304 | |
1305 profile_view_get_depth_new1: | |
560 | 1306 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
|
1307 rcall profile_view_get_depth_events ; Yes, get information about this event(s) |
0 | 1308 |
1309 ;---- Read Tp°, if any AND divisor reached AND bytes available ----------- | |
560 | 1310 movf divisor_temperature,W ; Is Tp° divisor null ? |
1311 bz profile_view_get_depth_no_tp ; Yes: no Tp° curve. | |
1312 decf count_temperature,F ; Decrement tp° counter | |
1313 bnz profile_view_get_depth_no_tp ; No temperature this time | |
0 | 1314 |
560 | 1315 call ext_flash_byte_read_plus_0x20 ; Tp° low |
0 | 1316 decf timeout_counter2,F |
1317 movff temp1,logbook_cur_tp+0 | |
560 | 1318 call ext_flash_byte_read_plus_0x20 ; Tp° high |
0 | 1319 decf timeout_counter2,F |
1320 movff temp1,logbook_cur_tp+1 | |
1321 movff divisor_temperature,count_temperature ; Restart counter. | |
1322 | |
1323 ; Compute Tp° max on the fly... | |
560 | 1324 movff logbook_cur_tp+0,sub_a+0 ; Compare cur_tp > max_tp ? |
0 | 1325 movff logbook_cur_tp+1,sub_a+1 |
1326 movff logbook_max_tp+0,sub_b+0 | |
1327 movff logbook_max_tp+1,sub_b+1 | |
560 | 1328 call sub16 ; SIGNED sub_a - sub_b |
0 | 1329 btfsc neg_flag |
1330 bra profile_view_get_depth_no_tp | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1331 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1332 ; 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
|
1333 tstfsz logbook_cur_depth+1 ; > 2,56m? |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1334 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
|
1335 movlw start_dive_threshold ; 1,0m |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1336 cpfsgt logbook_cur_depth+0 ; low value |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1337 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
|
1338 |
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
124
diff
changeset
|
1339 profile_view_compute_max_temp: |
0 | 1340 movff logbook_cur_tp+0,logbook_max_tp+0 |
1341 movff logbook_cur_tp+1,logbook_max_tp+1 | |
1342 | |
1343 ;---- Read deco, if any AND divisor=0 AND bytes available ---------------- | |
1344 profile_view_get_depth_no_tp: | |
1345 movf divisor_deco,W | |
1346 bz profile_view_get_depth_no_deco | |
1347 decf count_deco,F | |
1348 bnz profile_view_get_depth_no_deco | |
1349 | |
1350 call ext_flash_byte_read_plus_0x20 | |
1351 decf timeout_counter2,F | |
1352 movff temp1,logbook_ceiling | |
560 | 1353 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
|
1354 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
|
1355 decf timeout_counter2,F |
0 | 1356 |
1357 ;---- Read GF, if any AND divisor=0 AND bytes available ------------------ | |
1358 profile_view_get_depth_no_deco: | |
1359 ; Then skip remaining bytes... | |
560 | 1360 movf timeout_counter2,W ; number of additional bytes to ignore (0-127) |
1361 tstfsz timeout_counter2 ; Anything to skip? | |
1362 call incf_ext_flash_address0_0x20 ; Yes, increases bytes in ext_flash_address:3 with 0x200000 bank switching | |
0 | 1363 return |
1364 | |
168
1784ab9362ca
BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents:
167
diff
changeset
|
1365 profile_view_get_depth_events: |
560 | 1366 clrf EventByte2 ; Clear EventByte2 |
1367 call ext_flash_byte_read_plus_0x20 ; Read Event byte | |
1368 movff temp1,EventByte ; store EventByte | |
1369 decf timeout_counter2,F ; reduce counter | |
98 | 1370 |
560 | 1371 btfss EventByte,7 ; Another Event byte? |
1372 bra profile_no_second_eventbyte ; No | |
1373 call ext_flash_byte_read_plus_0x20 ; Read Event byte2 | |
1374 movff temp1,EventByte2 ; store EventByte2 | |
1375 decf timeout_counter2,F ; reduce counter | |
1376 bcf EventByte,7 ; Clear flag | |
98 | 1377 |
1378 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
|
1379 ; Check event flags in the EventBytes |
167 | 1380 btfsc EventByte,4 ; Manual Gas Changed? |
1381 rcall logbook_event1 ; Yes! | |
1382 btfsc EventByte,5 ; Stored Gas Changed? | |
1383 rcall logbook_event4 ; Yes! | |
1384 btfsc EventByte,6 ; Setpoint Change? | |
1385 rcall logbook_event3 ; Yes! | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1386 btfsc EventByte2,0 ; Bailout? |
167 | 1387 rcall logbook_event2 ; Yes! |
402
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1388 ; Any Alarm? |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1389 bcf EventByte,4 ; Clear bits already tested |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1390 bcf EventByte,5 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1391 bcf EventByte,6 |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1392 movlw .6 ; manual marker? |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1393 cpfseq EventByte |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1394 return ; No, return |
a3a0f1fd7fc4
NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents:
392
diff
changeset
|
1395 bsf log_marker_found ; Manual marker! Draw small yellow rectancle here |
163
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1396 return |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1397 |
4d71549dcf6c
clarify diluent change in the documentation
heinrichsweikamp
parents:
162
diff
changeset
|
1398 logbook_event4: ; Stored Gas changed! |
560 | 1399 call ext_flash_byte_read_plus_0x20 ; Read Gas# |
1400 decf timeout_counter2,F ; reduce counter | |
0 | 1401 movff temp1,average_depth_hold_total+3 |
560 | 1402 rcall profile_display_color ; Change profile color according to gas number |
0 | 1403 return |
1404 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1405 logbook_event1: ; Gas6 changed |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1406 bsf gas6_changed |
0 | 1407 movlw 6 ; Just color backup to 6 |
1408 movwf average_depth_hold_total+3 | |
1409 rcall profile_display_color ; Back to normal profile color. | |
167 | 1410 incf_ext_flash_address_0x20 .2 ; Skip two bytes |
1411 decf timeout_counter2,F ; reduce counter | |
1412 decf timeout_counter2,F ; reduce counter | |
1413 return | |
0 | 1414 |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1415 logbook_event2: ; Bailout |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1416 bsf is_bailout ; Set flag |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1417 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
|
1418 movlw 6 ; Use Gas6 color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1419 movwf average_depth_hold_total+3 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1420 rcall profile_display_color ; Back to normal profile color. |
167 | 1421 incf_ext_flash_address_0x20 .2 ; Skip two bytes |
1422 decf timeout_counter2,F ; reduce counter | |
1423 decf timeout_counter2,F ; reduce counter | |
1424 return | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1425 |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1426 logbook_event3: ; Setpoint change |
167 | 1427 incf_ext_flash_address_0x20 .1 ; Skip one byte |
1428 decf timeout_counter2,F ; reduce counter | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1429 btfss is_bailout ; Are we in bailout? |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1430 return ; No, return |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1431 ; We were in bailout before, restore profile color |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1432 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
|
1433 rcall profile_display_color ; Back to normal profile color. |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1434 return |
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
1435 |
0 | 1436 exit_profileview: |
255 | 1437 ; call speed_fastest |
0 | 1438 bcf sleepmode |
560 | 1439 clrf timeout_counter2 ; restore all registers to build same page again |
0 | 1440 movff divemins_backup,divemins+0 |
1441 movff logbook_divenumber_temp, logbook_divenumber | |
1442 movff logbook_max_dive_counter_temp,logbook_max_dive_counter | |
1443 incf logbook_max_dive_counter,F | |
1444 decf logbook_divenumber,F | |
1445 bcf all_dives_shown | |
1446 clrf menupos3 ; here: used row on current page | |
1447 movlw logbook_row_number | |
1448 movwf menupos ; here: active row on current page | |
372 | 1449 ; call TFT_DisplayOff |
502
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
1450 call TFT_boot |
0 | 1451 clrf CCP1CON ; stop PWM |
1452 bcf PORTC,2 ; Pull PWM out to GND | |
560 | 1453 call TFT_boot |
502
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
1454 ; call TFT_ClearScreen ; clear details/profile |
0 | 1455 goto logbook2 ; start search |
1456 | |
1457 next_logbook2: | |
1458 btfsc all_dives_shown ; all shown | |
1459 goto logbook ; all reset | |
1460 clrf menupos3 | |
1461 movlw logbook_row_number | |
1462 movwf menupos | |
1463 incf logbook_page_number,F ; start new screen | |
169
dcf3e08f31ac
CHANGE: Improve internal logbook usability
heinrichsweikamp
parents:
168
diff
changeset
|
1464 bsf keep_cursor_new_page ; Keep cursor on "next page" |
0 | 1465 clrf CCP1CON ; stop PWM |
1466 bcf PORTC,2 ; Pull PWM out to GND | |
502
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
1467 call TFT_boot |
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
1468 ;call TFT_ClearScreen |
0 | 1469 goto logbook2 ; start search |
1470 | |
1471 next_logbook3: | |
560 | 1472 incf menupos,F ; +1 |
0 | 1473 movlw logbook_row_number+.2 |
560 | 1474 cpfsgt menupos ; =logbook_row_number+.3? |
1475 bra next_logbook3a ; No | |
0 | 1476 movlw .1 |
1477 movwf menupos | |
1478 bra next_logbook3b | |
1479 | |
1480 next_logbook3a: | |
560 | 1481 incf menupos3,W ; last entry in current page +1 |
1482 cpfseq menupos ; same as cursor pos.? | |
1483 bra next_logbook3b ; No | |
1484 movlw logbook_row_number+.1 ; Yes, ... | |
1485 movwf menupos ; ... jump directly to "next page" if page is not full | |
0 | 1486 |
1487 movlw logbook_row_number | |
560 | 1488 cpfseq menupos3 ; Last dive was row logbook_row_number? |
1489 bsf all_dives_shown ; No, set flag to load first page again (full reset) | |
0 | 1490 |
1491 next_logbook3b: | |
1492 clrf timeout_counter2 | |
1493 call TFT_logbook_cursor | |
1494 | |
1495 bcf switch_left | |
1496 goto logbook_loop | |
1497 | |
1498 display_listdive: | |
1499 bsf logbook_page_not_empty ; Page not empty | |
1500 incf menupos3,F | |
1501 | |
1502 bsf leftbind | |
1503 WIN_FONT FT_SMALL | |
1504 WIN_LEFT logbook_list_left | |
1505 | |
1506 decf menupos3,W ; -1 into wreg | |
1507 mullw logbook_row_offset | |
1508 movff PRODL,win_top | |
1509 | |
1510 lfsr FSR2,buffer | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1511 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
|
1512 tstfsz lo ; lo=0? |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1513 bra display_listdive1 ; No, adjust offset |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1514 tstfsz hi ; hi=0? |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1515 bra display_listdive1 ; No, adjust offset |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1516 bra display_listdive1b ; Display now |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1517 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1518 display_listdive1: |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1519 ; Check limit (lo:hi must be <1000) |
560 | 1520 movlw LOW d'1000' ; Compare to 1000 |
1521 subwf lo,W | |
1522 movlw HIGH d'1000' | |
1523 subwfb hi,W | |
1524 bc display_listdive1b ; carry = no-borrow = > 1000, skip! | |
392
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1525 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1526 infsnz lo,F |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1527 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
|
1528 movff lo,sub_a+0 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1529 movff hi,sub_a+1 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1530 movff logbook_divenumber,sub_b+0 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1531 clrf sub_b+1 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1532 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
|
1533 movff sub_c+0,lo |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1534 movff sub_c+1,hi |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1535 bra display_listdive1a |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1536 |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1537 display_listdive1b: |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1538 clrf hi |
32780516c8c6
NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents:
389
diff
changeset
|
1539 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
|
1540 display_listdive1a: |
560 | 1541 output_16_3 ; displays only last three figures from a 16Bit value (0-999), # of dive |
0 | 1542 PUTC ' ' |
1543 LOG_POINT_TO log_date+1 ; Point to month | |
1544 call ext_flash_byte_read_plus | |
1545 movff temp1,lo ; read month | |
1546 | |
1547 display_listdive2: | |
1548 movff lo,convert_value_temp+0 ; Month (in lo, see above) | |
1549 call ext_flash_byte_read_plus ; Day | |
1550 movff temp1,convert_value_temp+1 | |
1551 call TFT_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" into buffer | |
1552 PUTC ' ' | |
1553 | |
1554 LOG_POINT_TO log_max_depth ; Point to max. depth | |
1555 call ext_flash_byte_read_plus ; max. Depth | |
1556 movff temp1,lo | |
1557 call ext_flash_byte_read_plus | |
1558 movff temp1,hi | |
1559 | |
560 | 1560 TSTOSS opt_units ; 0=Meters, 1=Feets |
0 | 1561 bra display_listdive2_metric |
1562 ;display_listdive2_imperial: | |
560 | 1563 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
0 | 1564 PUTC ' ' |
25 | 1565 bcf leftbind |
560 | 1566 output_16_3 ; limit to 999 and display only (0-999) |
0 | 1567 STRCAT_TEXT tFeets1 |
1568 bra display_listdive3 | |
1569 | |
1570 display_listdive2_metric: | |
560 | 1571 bsf ignore_digit5 ; no cm... |
1572 movlw d'1' ; +1 | |
1573 movff WREG,ignore_digits ; no 1000m | |
0 | 1574 bcf leftbind |
560 | 1575 output_16dp .3 ; xxx.y |
0 | 1576 STRCAT_TEXT tMeters |
1577 PUTC ' ' | |
1578 | |
1579 display_listdive3: | |
1580 call ext_flash_byte_read_plus | |
1581 movff temp1,lo ; read divetime minutes | |
1582 call ext_flash_byte_read_plus | |
1583 movff temp1,hi | |
1584 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
|
1585 STRCAT_TEXT tMinutes |
560 | 1586 clrf WREG |
1587 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
|
1588 STRCAT_PRINT "" ; Display header-row in list |
0 | 1589 return |
1590 | |
1591 logbook_show_divenumber: | |
1592 call do_logoffset_common_read ; Read into lo:hi | |
1593 tstfsz lo ; lo=0? | |
1594 bra logbook_show_divenumber2 ; No, adjust offset | |
1595 tstfsz hi ; hi=0? | |
1596 bra logbook_show_divenumber2 ; No, adjust offset | |
1597 movff divesecs,lo ; lo=0 and hi=0 -> skip Offset routine | |
1598 bra logbook_show_divenumber3 ; Display now | |
1599 | |
1600 logbook_show_divenumber2: | |
376
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1601 infsnz lo,F |
e99bb91f6f92
CHANGE: Do not show ppO2 in warning area if already shown in custom view
heinrichsweikamp
parents:
372
diff
changeset
|
1602 incf hi,F ; hi:lo = hi:lo + 1 |
0 | 1603 movff lo,sub_a+0 |
1604 movff hi,sub_a+1 | |
1605 movff divesecs,sub_b+0 | |
1606 clrf sub_b+1 | |
560 | 1607 call subU16 ; sub_c = sub_a - sub_b |
0 | 1608 movff sub_c+0,lo |
1609 movff sub_c+1,hi | |
1610 | |
1611 logbook_show_divenumber3: | |
1612 WIN_MEDIUM logbook_divenumer_column, logbook_divenumer_row | |
1613 bsf leftbind | |
560 | 1614 output_16 ; # of dive in logbook |
0 | 1615 bcf leftbind |
560 | 1616 STRCAT_PRINT "" |
0 | 1617 return |
1618 | |
1619 | |
1620 logbook_page2: ; Show more info | |
560 | 1621 rcall log_details_header ; Shows number, time/date and basic dive info |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1622 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1623 ; Deco model |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1624 WIN_SMALL .5,.65 |
560 | 1625 LOG_POINT_TO log_decomodel |
1626 call ext_flash_byte_read_plus ; read deco model | |
0 | 1627 movff temp1,lo |
1628 decfsz temp1,F | |
1629 bra logbook_decomodel1 | |
1630 ; Deco model GF Version | |
560 | 1631 STRCAT_PRINT "ZH-L16+GF" |
1632 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
|
1633 WIN_SMALL .5,.90 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1634 STRCPY_TEXT tGF |
560 | 1635 call ext_flash_byte_read_plus ; Read GF lo |
0 | 1636 movff temp1,lo |
1637 output_8 | |
560 | 1638 STRCAT "%/" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1639 bra logbook_decomodel_common |
0 | 1640 logbook_decomodel1: |
1641 ; Deco model NON-GF Version | |
560 | 1642 STRCAT_PRINT "ZH-L16" |
1643 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
|
1644 WIN_SMALL .5,.90 |
560 | 1645 call ext_flash_byte_read_plus ; Read sat_mult |
0 | 1646 movff temp1,lo |
1647 output_8 | |
560 | 1648 STRCAT "%/" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1649 logbook_decomodel_common: |
560 | 1650 call ext_flash_byte_read_plus ; Read desat_mult or GF_hi |
0 | 1651 movff temp1,lo |
1652 output_8 | |
560 | 1653 STRCAT_PRINT "%" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1654 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1655 ; CNS |
560 | 1656 LOG_POINT_TO log_cns_start |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1657 WIN_SMALL .5,.115 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1658 STRCPY_TEXT tCNS2 |
560 | 1659 call ext_flash_byte_read_plus ; read cns low |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1660 movff temp1,lo |
560 | 1661 call ext_flash_byte_read_plus ; read cns high |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1662 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1663 output_16 |
560 | 1664 LOG_POINT_TO log_cns_end |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1665 STRCAT "->" |
560 | 1666 call ext_flash_byte_read_plus ; read CNS low |
0 | 1667 movff temp1,lo |
560 | 1668 call ext_flash_byte_read_plus ; read CNS high |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1669 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1670 output_16 |
560 | 1671 STRCAT_PRINT "%" |
0 | 1672 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1673 ; Salinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1674 WIN_SMALL .5,.140 |
560 | 1675 LOG_POINT_TO log_salinity |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1676 STRCPY_TEXT tDvSalinity |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1677 bsf leftbind |
560 | 1678 call ext_flash_byte_read_plus ; read salinity |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1679 movff temp1,lo |
560 | 1680 movff temp1,total_divetime_seconds+1 ; backup for average depth display |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1681 output_8 |
560 | 1682 STRCAT_PRINT "%" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1683 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1684 ; Average depth |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1685 WIN_SMALL .5,.165 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1686 STRCPY_TEXT tAVG |
560 | 1687 LOG_POINT_TO log_avr_depth |
1688 call ext_flash_byte_read_plus ; read avr low | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1689 movff temp1,lo |
560 | 1690 call ext_flash_byte_read_plus ; read avr high |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1691 movff temp1,hi |
560 | 1692 movf total_divetime_seconds+1,W ; salinity for this dive |
1693 call adjust_depth_with_salinity_log ; computes salinity setting (FROM WREG!) into lo:hi [mbar] | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1694 output_16dp .3 |
560 | 1695 STRCAT_PRINT "m" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1696 |
0 | 1697 ; Last deco |
560 | 1698 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
|
1699 WIN_SMALL .5,.190 |
0 | 1700 STRCPY_TEXT tLastDecostop |
560 | 1701 call ext_flash_byte_read_plus ; Read last stop |
0 | 1702 movff temp1,lo |
1703 output_8 | |
560 | 1704 STRCAT_PRINT "m" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1705 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1706 movlw color_lightblue |
560 | 1707 call TFT_set_color |
1708 WIN_FRAME_COLOR16 .63,.220,.2,.105 ; Top, Bottom, Left, Right | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1709 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1710 ; Firmware |
560 | 1711 call TFT_standard_color |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1712 WIN_SMALL .110,.65 |
560 | 1713 STRCAT "V:" |
1714 LOG_POINT_TO log_firmware | |
1715 call ext_flash_byte_read_plus ; read firmware xx | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1716 movff temp1,lo |
560 | 1717 bsf neg_flag ; set flag for 2.15 or newer |
1718 movlw .1 | |
1719 cpfsgt lo ; >1? | |
1720 bcf neg_flag ; No, clear flag | |
1721 movlw .9 | |
1722 cpfslt lo ; <9? | |
1723 bcf neg_flag ; No, clear flag (When unit was updgraded from hwOS Sport (10.xx)) | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1724 bsf leftbind |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1725 output_8 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1726 PUTC "." |
560 | 1727 call ext_flash_byte_read_plus ; read firmware yy |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1728 movff temp1,lo |
560 | 1729 movlw .14 |
1730 cpfsgt lo ; >14? | |
1731 bcf neg_flag ; No, clear flag | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1732 output_99x |
560 | 1733 STRCAT_PRINT "" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1734 |
560 | 1735 btfss neg_flag ; set flag for 2.15 or newer |
1736 bra logbook_no_batt_info | |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1737 |
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1738 ; Battery percent (for dives with 2.15 or newer) |
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1739 WIN_SMALL .110,.140 |
560 | 1740 LOG_POINT_TO log_batt_info ; Battery percent |
1741 call ext_flash_byte_read_plus ; read battery low | |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1742 movff temp1,lo |
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1743 output_8 |
560 | 1744 STRCAT_PRINT "%" |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1745 |
560 | 1746 logbook_no_batt_info: ; dives with firmware <2.15 |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1747 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1748 ; Battery voltage |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1749 WIN_SMALL .110,.90 |
560 | 1750 STRCAT_PRINT "Batt:" |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1751 WIN_SMALL .110,.115 |
560 | 1752 LOG_POINT_TO log_battery ; Battery voltage... |
1753 call ext_flash_byte_read_plus ; read battery low | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1754 movff temp1,lo |
560 | 1755 call ext_flash_byte_read_plus ; read battery high |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1756 movff temp1,hi |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1757 output_16dp .2 |
560 | 1758 STRCAT_PRINT "V" |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1759 |
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1760 ; surface pressure in mbar |
560 | 1761 LOG_POINT_TO log_surface_press |
1762 call ext_flash_byte_read_plus ; read surface pressure | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1763 movff temp1,lo |
560 | 1764 call ext_flash_byte_read_plus ; read surface pressure |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1765 movff temp1,hi |
496
a0247e9f71d0
show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents:
495
diff
changeset
|
1766 WIN_SMALL .110,.165 |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1767 lfsr FSR2,buffer |
560 | 1768 bsf leftbind |
1769 output_16 ; Air pressure before dive | |
1770 STRCAT_TEXT tMBAR | |
1771 clrf WREG | |
1772 movff WREG,buffer+7 ; limit to 7 chars | |
1773 STRCAT_PRINT "" | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1774 |
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1775 movlw color_greenish |
560 | 1776 call TFT_set_color |
1777 WIN_FRAME_COLOR16 .63,.220,.107,.159 ; Top, Bottom, Left, Right | |
490
8dfb93e80338
NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents:
437
diff
changeset
|
1778 |
560 | 1779 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
0 | 1780 display_details_loop: |
560 | 1781 ; REPLACE ## logbook look and feel |
1782 ; btfsc switch_left ; SET/MENU? | |
1783 ; BY | |
1784 btfsc switch_right | |
1785 bra logbook_page3 ; Details, 2nd page | |
1786 ; REPLACE ## logbook look and feel | |
1787 ; btfsc switch_right ; ENTER? | |
1788 btfsc switch_left | |
1789 bra exit_profileview ; back to list | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1790 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
560 | 1791 btfsc sleepmode ; Timeout? |
1792 bra exit_profileview ; back to list | |
1793 bra display_details_loop ; wait for something to do | |
0 | 1794 |
1795 global logbook_preloop_tasks | |
1796 logbook_preloop_tasks: | |
560 | 1797 movlw CCP1CON_VALUE ; See hwos.inc |
1798 movwf CCP1CON ; Power-on backlight | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1799 call TFT_standard_color |
560 | 1800 bcf sleepmode ; clear some flags |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1801 bcf switch_right |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1802 bcf switch_left |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1803 clrf timeout_counter2 |
560 | 1804 goto speed_normal ; and return |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1805 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1806 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1807 logbook_page3: ; Show even more info |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1808 rcall log_details_header ; Shows number, time/date and basic dive info |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1809 |
560 | 1810 ; REPLACE ## logbook look and feel |
1811 ; ; OC/CC Gas List | |
1812 ; LOG_POINT_TO log_divemode | |
1813 ; call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
1814 ; WIN_SMALL .5,.65 | |
1815 ; WIN_COLOR color_greenish | |
1816 ; STRCPY_TEXT_PRINT tGaslist ; "OC Gas List" / tGaslistCC | |
1817 ; BY | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1818 bcf leftbind |
560 | 1819 LOG_POINT_TO log_gas1 |
1820 movlw color_white ; Color for Gas 1 | |
1821 call TFT_set_color ; Set Color... | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1822 WIN_SMALL .5,.90 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1823 rcall log_show_gas_common2 |
560 | 1824 movlw color_green ; Color for Gas 2 |
1825 call TFT_set_color ; Set Color... | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1826 WIN_SMALL .5,.115 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1827 rcall log_show_gas_common2 |
560 | 1828 movlw color_red ; Color for Gas 3 |
1829 call TFT_set_color ; Set Color... | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1830 WIN_SMALL .5,.140 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1831 rcall log_show_gas_common2 |
560 | 1832 movlw color_yellow ; Color for Gas 4 |
1833 call TFT_set_color ; Set Color... | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1834 WIN_SMALL .5,.165 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1835 rcall log_show_gas_common2 |
560 | 1836 movlw color_cyan ; Color for Gas 5 |
1837 call TFT_set_color ; Set Color... | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1838 WIN_SMALL .5,.190 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1839 rcall log_show_gas_common2 |
560 | 1840 ; OC/CC Gas List |
1841 WIN_SMALL .5,.65 | |
1842 WIN_COLOR color_greenish | |
1843 LOG_POINT_TO log_divemode | |
1844 call ext_flash_byte_read_plus ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into temp1 | |
1845 decfsz temp1,w ; =1 (CC)? | |
1846 bra logbook_page3a | |
1847 STRCPY_TEXT_PRINT tGaslistCC | |
1848 bra logbook_page3b | |
1849 logbook_page3a: | |
1850 STRCPY_TEXT_PRINT tGaslist | |
1851 logbook_page3b: | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1852 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1853 movlw color_lightblue |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1854 call TFT_set_color |
560 | 1855 WIN_FRAME_COLOR16 .63,.220,.2,.90 ; Top, Bottom, Left, Right |
530 | 1856 |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1857 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1858 display_details2_loop: |
560 | 1859 ; REPLACE ## logbook look and feel |
1860 ; btfsc switch_left ; SET/MENU? | |
1861 ; BY | |
1862 btfsc switch_right | |
1863 goto logbook_page4 ; Show more info | |
1864 ; REPLACE ## logbook look and feel | |
1865 ; btfsc switch_right ; ENTER? | |
1866 ; BY | |
1867 btfsc switch_left | |
1868 bra exit_profileview ; back to list | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1869 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
560 | 1870 btfsc sleepmode ; Timeout? |
1871 bra exit_profileview ; back to list | |
1872 bra display_details2_loop ; wait for something to do | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1873 |
530 | 1874 logbook_page4: ; Show even more info in CC mode |
1875 LOG_POINT_TO log_divemode | |
560 | 1876 call ext_flash_byte_read ; 0=OC, 1=CC, 2=Gauge, 3=Apnea into WREG and temp1 |
1877 decfsz temp1,w ; =1 (CC)? | |
1878 goto display_profile2 ; no | |
530 | 1879 |
560 | 1880 rcall log_details_header ; Shows number, time/date and basic dive info |
1881 ; Setpoint list | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1882 LOG_POINT_TO log_sp1 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1883 WIN_SMALL .5,.65 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1884 WIN_COLOR color_greenish |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1885 STRCPY_TEXT_PRINT tFixedSetpoints |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1886 call TFT_standard_color |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1887 WIN_SMALL .5,.90 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1888 rcall log_show_sp_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1889 WIN_SMALL .5,.115 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1890 rcall log_show_sp_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1891 WIN_SMALL .5,.140 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1892 rcall log_show_sp_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1893 WIN_SMALL .5,.165 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1894 rcall log_show_sp_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1895 WIN_SMALL .5,.190 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1896 rcall log_show_sp_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1897 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1898 movlw color_greenish |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1899 call TFT_set_color |
560 | 1900 WIN_FRAME_COLOR16 .63,.220,.2,.112 ; Top, Bottom, Left, Right |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1901 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1902 rcall logbook_preloop_tasks ; Clear some flags and set to Speed_eco |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1903 display_details3_loop: |
560 | 1904 ; REPLACE ## logbook look and feel |
1905 ; btfsc switch_left ; SET/MENU? | |
1906 ; BY | |
1907 btfsc switch_right | |
1908 goto display_profile2 ; Show the profile view again | |
1909 ; REPLACE ## logbook look and feel | |
1910 ; btfsc switch_right ; ENTER? | |
1911 ; BY | |
1912 btfsc switch_left | |
1913 bra exit_profileview ; back to list | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1914 rcall log_screendump_and_onesecond ; Check if we need to make a screenshot and check for new second |
560 | 1915 btfsc sleepmode ; Timeout? |
1916 bra exit_profileview ; back to list | |
1917 bra display_details3_loop ; wait for something to do | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1918 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1919 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1920 log_details_header: |
560 | 1921 clrf CCP1CON ; stop PWM |
1922 bcf PORTC,2 ; Pull PWM out to GND | |
502
0910c227018f
BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents:
500
diff
changeset
|
1923 call TFT_boot |
560 | 1924 ;call TFT_ClearScreen ; Clear screen |
0 | 1925 |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1926 ; Set ext_flash pointer to "#divesecs-oldest" dive |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1927 ; compute read_int_eeprom .2 - divesecs |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1928 ; Read required header data for profile display |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1929 ; look in header for pointer to begin of diveprofile (Byte 2-4) |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1930 ; Set pointer (ext_flash_log_pointer:3) to this address, start drawing |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1931 |
560 | 1932 decf divesecs,F ;-1 |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1933 read_int_eeprom .2 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1934 movf EEDATA,W |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1935 bcf STATUS,C |
560 | 1936 subfwb divesecs,W ; max. dives (low value) - divesecs |
1937 movwf lo ; result | |
1938 incf divesecs,F ;+1 | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1939 ; Set ext_flash_address:3 to TOC entry of this dive |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1940 ; 1st: 200000h-200FFFh -> lo=0 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1941 ; 2nd: 201000h-201FFFh -> lo=1 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1942 ; 3rd: 202000h-202FFFh -> lo=2 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1943 ; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...) |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1944 clrf ext_flash_address+0 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1945 clrf ext_flash_address+1 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1946 movlw 0x20 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1947 movwf ext_flash_address+2 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1948 movlw .16 |
560 | 1949 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1950 movf PRODL,W |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1951 addwf ext_flash_address+1,F |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1952 movf PRODH,W |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1953 addwfc ext_flash_address+2,F |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1954 ; pointer at the first 0xFA of header |
560 | 1955 rcall logbook_show_divenumber ; Show the dive number in medium font |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1956 ; Show date and time in first row |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1957 WIN_SMALL .59,.10 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1958 LOG_POINT_TO log_date |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1959 call ext_flash_byte_read_plus |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1960 movff temp1,convert_value_temp+2 ; Year |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1961 call ext_flash_byte_read_plus |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1962 movff temp1,convert_value_temp+0 ; Month |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1963 call ext_flash_byte_read_plus |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1964 movff temp1,convert_value_temp+1 ; Day |
560 | 1965 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1966 PUTC "-" |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1967 call ext_flash_byte_read_plus ; hour |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1968 movff temp1,lo |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1969 call ext_flash_byte_read_plus ; Minutes |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1970 movff temp1,hi |
560 | 1971 output_99x ; hour |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1972 PUTC ':' |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1973 movff hi,lo |
560 | 1974 output_99x ; minute |
1975 STRCAT_PRINT "" ; Display 1st row of details | |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1976 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1977 ; Show max depth and dive time |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1978 WIN_SMALL .5,.35 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1979 STRCAT "Max:" |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1980 LOG_POINT_TO log_max_depth |
560 | 1981 call ext_flash_byte_read_plus ; read max depth |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1982 movff temp1,lo |
560 | 1983 call ext_flash_byte_read_plus ; read max depth |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1984 movff temp1,hi |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1985 |
560 | 1986 TSTOSS opt_units ; 0=Meters, 1=Feets |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1987 bra logbook_page2_depth_metric |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1988 ; imperial |
560 | 1989 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1990 PUTC ' ' |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1991 bcf leftbind |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1992 output_16_3 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1993 STRCAT_TEXT tFeets |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1994 bra logbook_page2_depth_common |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1995 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1996 logbook_page2_depth_metric: |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1997 bsf leftbind |
560 | 1998 output_16dp d'3' ; max. depth |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
1999 STRCAT_TEXT tMeters |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2000 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2001 logbook_page2_depth_common: |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2002 STRCAT " - " |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2003 call ext_flash_byte_read_plus ; divetime in minutes |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2004 movff temp1,lo |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2005 call ext_flash_byte_read_plus |
560 | 2006 movff temp1,hi ; divetime in minutes |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2007 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2008 bsf leftbind |
560 | 2009 output_16 ; divetime minutes |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2010 PUTC "m" |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2011 LOG_POINT_TO log_divetime+.2 |
560 | 2012 call ext_flash_byte_read_plus ; read divetime seconds |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2013 movff temp1,lo |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2014 bsf leftbind |
560 | 2015 output_99x ; divetime seconds |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2016 call TFT_standard_color |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2017 STRCAT_PRINT "s" |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2018 ; ; Dive mode |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2019 ; LOG_POINT_TO log_divemode |
560 | 2020 ; call ext_flash_byte_read_plus ; Read divemode |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2021 ; movff temp1,lo |
560 | 2022 ; call TFT_display_decotype_surface1 ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE) |
500
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2023 return |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2024 |
989917fe2d9f
Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents:
496
diff
changeset
|
2025 |
0 | 2026 log_show_sp_common: |
2027 lfsr FSR2,buffer | |
560 | 2028 call ext_flash_byte_read_plus ; Read setpoint |
0 | 2029 movff temp1,lo |
2030 clrf hi | |
2031 bsf leftbind | |
2032 output_16dp d'3' | |
2033 bcf leftbind | |
2034 STRCAT_TEXT tbar | |
2035 PUTC " " | |
560 | 2036 call ext_flash_byte_read_plus ; change depth |
0 | 2037 movff temp1,lo |
2038 | |
560 | 2039 TSTOSS opt_units ; 0=Meters, 1=Feets |
0 | 2040 bra log_show_sp_common_metric |
2041 movf lo,W | |
560 | 2042 mullw .100 ; convert meters to mbar |
0 | 2043 movff PRODL,lo |
2044 movff PRODH,hi | |
560 | 2045 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
0 | 2046 output_16 |
560 | 2047 STRCAT_TEXT tFeets ; "ft" |
0 | 2048 bra log_show_sp_common_common |
2049 log_show_sp_common_metric: | |
2050 output_8 | |
560 | 2051 STRCAT_TEXT tMeters ; "m" |
0 | 2052 log_show_sp_common_common: |
2053 STRCAT_PRINT "" | |
2054 return | |
2055 | |
560 | 2056 log_show_gas_common2: ; as log_show_gas_common but with change depth |
0 | 2057 lfsr FSR2,buffer |
560 | 2058 call ext_flash_byte_read_plus ; current O2 |
0 | 2059 movff temp1,lo |
560 | 2060 call ext_flash_byte_read_plus ; current He |
0 | 2061 movff temp1,hi |
560 | 2062 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 |
2063 call ext_flash_byte_read_plus ; change depth | |
0 | 2064 movff temp1,lo |
2065 | |
560 | 2066 TSTOSS opt_units ; 0=Meters, 1=Feets |
0 | 2067 bra log_show_gas_common2_metric |
2068 movf lo,W | |
560 | 2069 mullw .100 ; convert meters to mbar |
0 | 2070 movff PRODL,lo |
2071 movff PRODH,hi | |
560 | 2072 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
0 | 2073 output_16 |
560 | 2074 STRCAT_TEXT tFeets ; "ft" |
0 | 2075 bra log_show_gas_common2_common |
2076 log_show_gas_common2_metric: | |
2077 output_8 | |
560 | 2078 STRCAT_TEXT tMeters ; "m" |
0 | 2079 log_show_gas_common2_common: |
2080 bcf leftbind | |
560 | 2081 call ext_flash_byte_read_plus ; Gas Type |
0 | 2082 STRCAT_PRINT "" |
2083 return | |
2084 | |
2085 END |