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