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