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