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