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