annotate src/logbook.asm @ 569:fea63a20c1c5

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