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