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