annotate src/logbook.asm @ 632:0347acdf6d8e

changelog updates
author heinrichsweikamp
date Sat, 29 Feb 2020 16:57:45 +0100
parents 185ba2f91f59
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
3 ; File logbook.asm combined next generation V3.08.8
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
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
11 ;
0
heinrichsweikamp
parents:
diff changeset
12 ;=============================================================================
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
13
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
14
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
15 #include "hwos.inc" ; mandatory header
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
16 #include "tft.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
17 #include "external_flash.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
18 #include "math.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
19 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
20 #include "convert.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
21 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
22 #include "eeprom_rs232.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
23 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
24 #include "start.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
25 #include "surfmode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
26 #include "divemode.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
27 #include "ghostwriter.inc"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
28 #include "rtc.inc"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
29
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
30 #DEFINE inside_loogbook
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
31 #include "logbook.inc"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
32
0
heinrichsweikamp
parents:
diff changeset
33
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
34 extern do_main_menu2
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
35 extern gaslist_show_mix
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
36
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
37
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
38 ;---- Private local variables ------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
39
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
40 CBLOCK local1 ; max size is 16 byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
41 count_temperature ; current sample count for temperature divisor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
42 count_deco ; current sample count for deco (ceiling) divisor
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
43 logbook_cur_depth:2 ; current depth, for drawing profile
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
44 logbook_cur_tp:2 ; current temperature, for drawing profile
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
45 logbook_last_tp ; Y of the last item in Tp° curve
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
46 logbook_min_tp:2 ; min temperature, for drawing profile
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
47 logbook_max_tp:2 ; maximum temperature, for drawing profile
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
48 logbook_ceiling ; current ceiling, for drawing profile
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
49 logbook_flags ; flags only used in logbook.asm
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
50 logbook_page_number ; page# in logbook
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
51 logbook_divenumber ; # of dive in list during search
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
52 logbook_max_dive_counter ; counts dive# to zero
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
53 ENDC ; used: 16 byte, remaining: 0 byte => FULL
0
heinrichsweikamp
parents:
diff changeset
54
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
55 CBLOCK local2 ; max size is 16 byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
56 profile_temp1:2 ; temp for profile display
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
57 profile_temp2:2 ; temp for profile display
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
58 logbook_sample_counter:2 ; amount of read samples
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
59 y_scale:2 ; y-scale (the horizontal lines)
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
60 x_scale:2 ; x-scale (the vertical lines)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
61 logbook_pixel_x_pos ; x2 position of current pixel in X-direction
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
62 logbook_min_temp_pos ; lowest row in the temp graph
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
63 logbook_max_temp_pos ; lowest row in the temp graph
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
64 logbook_menupos_temp ; last position of cursor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
65 logbook_divenumber_temp ; used to back-up dive number
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
66 logbook_max_dive_counter_temp ; used to back-up max_dive_counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
67 ENDC ; used: 16 byte, remaining: 0 byte => FULL
0
heinrichsweikamp
parents:
diff changeset
68
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
69 CBLOCK local3 ; max size is 16 byte !!!
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
70 divenumber ; used for accessing dives
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
71 vertical_interval:2 ; holds interval of samples for vertical 10min line
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
72 backup_color1 ; used for restoring drawing color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
73 backup_color2 ; used for restoring drawing color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
74 fill_between_rows ; used for fill between rows
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
75 logbook_temp ; used as temp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
76 logbook_temp_backup ; used as backup for temp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
77 divisor_temperature ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
78 divisor_deco ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
79 divisor_gf ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
80 divisor_ppo2_sensors ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
81 divisor_decoplan ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
82 divisor_cns ; divisor used while sampling of the dive data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
83 divisor_tank ; divisor used while sampling of the dive data
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
84 total_num_dives ; total number of dives (low byte on)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
85 ENDC ; used: 16 byte, remaining: 0 byte => full
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
86
0
heinrichsweikamp
parents:
diff changeset
87
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
88 ; Remarks: The variable gaslist_gas is "misused" here as a local variable,
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
89 ; because the storage space for local variables is fully used up.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
90 ;
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
91 ; This code includes decoding and displaying of log data for Trimix
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
92 ; and CCR/pSCR dives to make sure that if such dives are in the
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
93 ; logbook they will be displayed correctly.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
94
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
95 ;---- Defines ----------------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
96
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
97 ; Flags
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
98 #DEFINE return_from_profileview logbook_flags,0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
99 #DEFINE all_dives_shown logbook_flags,1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
100 #DEFINE logbook_page_not_empty logbook_flags,2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
101 #DEFINE end_of_profile logbook_flags,3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
102 #DEFINE keep_cursor_new_page logbook_flags,4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
103 #DEFINE log_marker_found logbook_flags,5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
104 #DEFINE log_show_gas_short logbook_flags,6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
105 ; logbook_flags,7 ; unused
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
106
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
107
0
heinrichsweikamp
parents:
diff changeset
108 ; Logbook Coordinates
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
109 #DEFINE logbook_list_left .10 ; column of dive# in list
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
110 #DEFINE logbook_row_offset .27 ; distance between rows of list
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
111 #DEFINE logbook_row_number .7 ; number of dive entry rows per list
0
heinrichsweikamp
parents:
diff changeset
112
heinrichsweikamp
parents:
diff changeset
113 ; Profile display
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
114 #DEFINE profile_height_pixels .157 ; amount of pixels height for profile display
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
115 #DEFINE profile_width_pixels .156 ; amount of pixels width for profile display
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
116 #DEFINE profile_left .1 ; left border
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
117 #DEFINE profile_top .65 ; top border
0
heinrichsweikamp
parents:
diff changeset
118
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
119 ; "Bailout"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
120 #DEFINE logbook_bailout_column .124
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
121 #DEFINE logbook_bailout_row .207
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
122
0
heinrichsweikamp
parents:
diff changeset
123 ; Dive number
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
124 #DEFINE logbook_divenumer_column .1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
125 #DEFINE logbook_divenumer_row .1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
126
0
heinrichsweikamp
parents:
diff changeset
127 ; Date and Time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
128 #DEFINE logbook_date_column .100
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
129 #DEFINE logbook_date_row .7
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
130 #DEFINE logbook_time_column .120
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
131 #DEFINE logbook_time_row .38
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
132
0
heinrichsweikamp
parents:
diff changeset
133 ; Max. Depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
134 #DEFINE log_max_value_row .38
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
135 #DEFINE log_max_value_column .1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
136
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
137 ; Divetime
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
138 #DEFINE log_divetime_mins_value_row .38
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
139 #DEFINE log_divetime_mins_value_column .60
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
140
0
heinrichsweikamp
parents:
diff changeset
141 ; Gaslist below profile
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
142 #DEFINE log_gas_row .225
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
143 #DEFINE log_gas_column1 .0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
144 #DEFINE log_gas_column2 log_gas_column1+(.1*.32)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
145 #DEFINE log_gas_column3 log_gas_column1+(.2*.32)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
146 #DEFINE log_gas_column4 log_gas_column1+(.3*.32)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
147 #DEFINE log_gas_column5 log_gas_column1+(.4*.32)
0
heinrichsweikamp
parents:
diff changeset
148
heinrichsweikamp
parents:
diff changeset
149 ; Logbook Page2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
150 ; Gaslist
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
151 #DEFINE log2_title_row1 .20
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
152 #DEFINE log2_title_column .90
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
153 #DEFINE log2_gas_column log2_title_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
154 #DEFINE log2_gas_row1 .36
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
155 #DEFINE log2_gas_row2 1*.16+log2_gas_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
156 #DEFINE log2_gas_row3 2*.16+log2_gas_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
157 #DEFINE log2_gas_row4 3*.16+log2_gas_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
158 #DEFINE log2_gas_row5 4*.16+log2_gas_row1
0
heinrichsweikamp
parents:
diff changeset
159
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
160 ; Setpoint List
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
161 #DEFINE log2_title_sp_row .130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
162 #DEFINE log2_sp_row1 .146
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
163 #DEFINE log2_sp_row2 1*.16+log2_sp_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
164 #DEFINE log2_sp_row3 2*.16+log2_sp_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
165 #DEFINE log2_sp_row4 3*.16+log2_sp_row1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
166 #DEFINE log2_sp_row5 4*.16+log2_sp_row1
0
heinrichsweikamp
parents:
diff changeset
167
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
168 ; Details list
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
169 #DEFINE log2_salinity_row .55
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
170 #DEFINE log2_salinity_column .2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
171 #DEFINE log2_cns_row .1*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
172 #DEFINE log2_cns_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
173 #DEFINE log2_avr_row .2*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
174 #DEFINE log2_avr_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
175 #DEFINE log2_decomodel2_row .3*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
176 #DEFINE log2_decomodel2_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
177 #DEFINE log2_decomodel3_row .4*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
178 #DEFINE log2_decomodel3_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
179 #DEFINE log2_decomodel_row .5*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
180 #DEFINE log2_decomodel_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
181 #DEFINE log2_firmware_row .6*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
182 #DEFINE log2_firmware_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
183 #DEFINE log2_battery_row .7*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
184 #DEFINE log2_battery_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
185 #DEFINE log2_divemode_row .8*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
186 #DEFINE log2_divemode_column log2_salinity_column
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
187 #DEFINE log2_lastdeco_row .9*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
188 #DEFINE log2_lastdeco_column log2_salinity_column
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
189
0
heinrichsweikamp
parents:
diff changeset
190 ; Air pressure
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
191 #DEFINE MBAR_row .10*.16+log2_salinity_row
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
192 #DEFINE MBAR_column log2_salinity_column
0
heinrichsweikamp
parents:
diff changeset
193
heinrichsweikamp
parents:
diff changeset
194
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
195 logbook CODE
0
heinrichsweikamp
parents:
diff changeset
196
heinrichsweikamp
parents:
diff changeset
197 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
198
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
199 TFT_logbook_cursor:
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
200 WIN_BOX_BLACK .0, .239, logbook_list_left-.8, logbook_list_left-.1 ; top, bottom, left, right
0
heinrichsweikamp
parents:
diff changeset
201
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
202 WIN_LEFT logbook_list_left-.8 ; set horizontal position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
203 WIN_FONT FT_SMALL ; select small font
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
204 call TFT_standard_color ; print in white color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
205 decf menu_pos_cur,W ; get row number -1 into WREG
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
206 mullw logbook_row_offset ; multiply with vertical offset between rows
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
207 movff PRODL,win_top ; set vertical position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
208 STRCPY_PRINT "\xB7" ; print cursor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
209 return ; done
0
heinrichsweikamp
parents:
diff changeset
210
heinrichsweikamp
parents:
diff changeset
211
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
212 global logbook ; entry point coming from menu_tree.asm
0
heinrichsweikamp
parents:
diff changeset
213 logbook:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
214 call TFT_boot
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
215 ; call TFT_standard_color
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
216
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
217 clrf logbook_flags ; clear all flags
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
218 clrf menu_pos_max ; clear number of used rows on current page
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
219 clrf logbook_page_number ; here: # of current displayed page
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
220 clrf logbook_divenumber ; # of dive in list during search
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
221 clrf logbook_temp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
222 clrf logbook_temp_backup
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
223
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
224 movlw logbook_row_number ; get number of dive entry rows per list
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
225 movwf menu_pos_cur ; initialize cursor position to last entry
0
heinrichsweikamp
parents:
diff changeset
226
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
227 call eeprom_total_dives_read ; read total number of dives
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
228 movf mpr+0,W ; extract low byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
229 movwf logbook_max_dive_counter ; copy to logbook_max_dive_counter
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
230 movwf total_num_dives ; copy to total_num_dives, too
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
231
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
232
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
233 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
234 ; display dive headers backwards from latest dive to first dive, stop when
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
235 ; - no dive is stored (no valid header found)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
236 ; - current dive has no valid header (past last dive, < 256 dives)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
237 ; - when 255 dives are reached (logbook display limit)
0
heinrichsweikamp
parents:
diff changeset
238
heinrichsweikamp
parents:
diff changeset
239 logbook2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
240 incf logbook_temp,F ; increase dive counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
241 incf logbook_temp,W ; = 0x..FF ?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
242 bz logbook_reset ; YES - loop
0
heinrichsweikamp
parents:
diff changeset
243
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
244 ; compute index for dive to show / goto previous dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
245 decf logbook_max_dive_counter,F
0
heinrichsweikamp
parents:
diff changeset
246
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
247 ; compute the start address of the header of the dive to show
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
248 movf logbook_max_dive_counter,W ; hand over index in WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
249 call log_header_addr_by_index ; compute address of header start
0
heinrichsweikamp
parents:
diff changeset
250
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
251 ; copy the first 22 byte of the header from FLASH to memory
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
252 FLASH_RR_READ mpr,header_buffer,.22
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
253
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
254 ; check if there is a header
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
255 MOVCC header_buffer+index_header_start,WREG ; read first byte of header
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
256 xorlw 0xFA ; header start code found?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
257 bnz logbook3b ; NO - abort
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
258 incf logbook_divenumber,F ; YES - new header found, increase logbook_divenumber
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
259 bra logbook4 ; - done with searching, display the header
0
heinrichsweikamp
parents:
diff changeset
260
heinrichsweikamp
parents:
diff changeset
261 logbook3b:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
262 btfss logbook_page_not_empty ; was there at least one dive?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
263 bra exit_logbook ; NO - not a single header was found, leave logbook
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
264 bra logbook_display_loop2 ; YES - can show something
0
heinrichsweikamp
parents:
diff changeset
265
heinrichsweikamp
parents:
diff changeset
266 logbook_reset:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
267 tstfsz logbook_divenumber ; was there at least one dive?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
268 bra logbook_reset2 ; YES - proceed
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
269 bra logbook3b ; NO - nothing to do
0
heinrichsweikamp
parents:
diff changeset
270
heinrichsweikamp
parents:
diff changeset
271 logbook_reset2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
272 bsf all_dives_shown ; flag all dives are shown
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
273 bra logbook_display_loop2 ; check number of dives on page and append navigation
0
heinrichsweikamp
parents:
diff changeset
274
heinrichsweikamp
parents:
diff changeset
275 logbook4:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
276 btfsc all_dives_shown ; all dives shown?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
277 bra logbook_display_loop2 ; YES - page done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
278 call display_listdive ; NO - display short header for list on current list position
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
279 movlw logbook_row_number ; - load max number of lines
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
280 cpfseq menu_pos_cur ; - cursor on last line (exit)?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
281 bra logbook_display_loop1 ; NO - skip saving of address
0
heinrichsweikamp
parents:
diff changeset
282
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
283 ; store all registers required to rebuilt the current logbook page after the detail/profile view
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
284 movff logbook_divenumber,logbook_divenumber_temp ; # of dive in list of the current page
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
285 movff logbook_max_dive_counter,logbook_max_dive_counter_temp ; backup counter
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
286 movff logbook_temp,logbook_temp_backup ; amount of dives drawn until now
0
heinrichsweikamp
parents:
diff changeset
287
heinrichsweikamp
parents:
diff changeset
288 logbook_display_loop1:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
289 decfsz menu_pos_cur,F ; all lines used up?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
290 bra logbook2 ; NO - loop to show another dive
0
heinrichsweikamp
parents:
diff changeset
291 logbook_display_loop2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
292 btfss logbook_page_not_empty ; YES - was there one dive at all?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
293 bra logbook ; NO - restart from the first page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
294 ;bra logbook_display_loop3 ; YES - complete page and start HMI
0
heinrichsweikamp
parents:
diff changeset
295
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
296 logbook_display_loop3:
0
heinrichsweikamp
parents:
diff changeset
297
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
298 ; print navigation lines
0
heinrichsweikamp
parents:
diff changeset
299 WIN_LEFT logbook_list_left
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
300 WIN_TOP logbook_row_offset*(logbook_row_number+.0)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
301 STRCPY_TEXT_PRINT tNextLog ; "Next Page"
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
302
0
heinrichsweikamp
parents:
diff changeset
303 WIN_LEFT logbook_list_left
heinrichsweikamp
parents:
diff changeset
304 WIN_TOP logbook_row_offset*(logbook_row_number+.1)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
305 STRCPY_TEXT_PRINT tExit ; "Exit"
0
heinrichsweikamp
parents:
diff changeset
306
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
307 movlw d'1' ; default cursor to position 1
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
308 btfsc return_from_profileview ; returning from a detail/profile view?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
309 movf logbook_menupos_temp,W ; YES - reload last cursor position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
310 movwf menu_pos_cur ; set cursor position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
311 movlw logbook_row_number+.1 ; get menu line where the next page item is
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
312 btfsc keep_cursor_new_page ; do we come from the "next page" line?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
313 movwf menu_pos_cur ; YES - set cursor to "next line" again
0
heinrichsweikamp
parents:
diff changeset
314
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
315 bcf return_from_profileview ; clear flag for returning from detail/profile view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
316 bcf keep_cursor_new_page ; clear flag for coming from "next page"
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
317 bcf logbook_page_not_empty ; obviously the current page is NOT empty
169
dcf3e08f31ac CHANGE: Improve internal logbook usability
heinrichsweikamp
parents: 168
diff changeset
318
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
319 call TFT_logbook_cursor ; show the cursor
0
heinrichsweikamp
parents:
diff changeset
320
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
321 logbook_loop_pre:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
322 call logbook_preloop_tasks ; clear timeout, some flags and switch on backlight
0
heinrichsweikamp
parents:
diff changeset
323 logbook_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
324 btfsc switch_left ; left button pressed?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
325 goto next_logbook3 ; YES - move cursor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
326 btfsc switch_right ; NO - right button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
327 bra display_profile_or_exit ; YES - view details/profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
328 call housekeeping ; NO - handle screen dump request, timeout and entering dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
329 bra logbook_loop ; - loop waiting for something to do
0
heinrichsweikamp
parents:
diff changeset
330
heinrichsweikamp
parents:
diff changeset
331 display_profile_or_exit:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
332 movlw logbook_row_number+.2 ; get menu line were the exit item is
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
333 cpfseq menu_pos_cur ; cursor on exit line?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
334 bra display_profile_or_next ; NO - show profile or next page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
335 ;bra exit_logbook ; YES - exit logbook
371
fec5eec4c8b7 fix some display issues with display1
heinrichsweikamp
parents: 343
diff changeset
336
372
f8adb2d5d328 logbook work
heinrichsweikamp
parents: 371
diff changeset
337 exit_logbook:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
338 bcf switch_right ; clear pending button events
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
339 bcf switch_left ; ...
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
340 goto do_main_menu2 ; jump-back to main menu (in menu_tree.asm)
0
heinrichsweikamp
parents:
diff changeset
341
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
342 display_profile_or_next:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
343 movlw logbook_row_number+.1 ; get menu line were the next page item is
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
344 cpfseq menu_pos_cur ; cursor on next page line?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
345 bra display_profile ; NO - show profile of selected dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
346 goto next_logbook2 ; YES - show next page
0
heinrichsweikamp
parents:
diff changeset
347
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
348 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
349 ; show graphical dive profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
350 ;
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
351 display_profile:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
352 bcf bailout_mode ; clear event flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
353 bcf event_gas_change_gas6 ; clear event flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
354 movff menu_pos_cur,logbook_menupos_temp ; store current cursor position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
355 bsf return_from_profileview ; tweak search routine to exit after found
0
heinrichsweikamp
parents:
diff changeset
356
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
357 ; compute the number of the dive to show
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
358 movf logbook_page_number,W ; get page number of page we are on
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
359 mullw logbook_row_number ; multiply with number of dives per page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
360 movf PRODL,W ; copy low byte to WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
361 addwf menu_pos_cur,W ; add number of selected dive on current page page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
362 movwf divenumber ; result is the number of the dive to show
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
363
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
364 ; compute the header address by the dive number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
365 call log_header_addr_by_divenumber
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
366
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
367 ; copy the complete header from FLASH to memory
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
368 FLASH_RR_READ mpr,header_buffer,.256
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
369
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
370 ; read the sampling rate
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
371 MOVCC header_buffer+index_samplingrate,sampling_rate
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
372
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
373 ; --- start drawing the dive profile page ---
0
heinrichsweikamp
parents:
diff changeset
374
heinrichsweikamp
parents:
diff changeset
375 display_profile2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
376 call TFT_boot
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
377 call TFT_standard_color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
378
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
379 ; show dive number
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
380 call logbook_show_divenumber ; show the dive number in medium font
0
heinrichsweikamp
parents:
diff changeset
381
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
382 ; show date
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
383 WIN_SMALL logbook_date_column, logbook_date_row
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
384 MOVTT header_buffer+index_date,mpr ; read date
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
385 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
386 STRCAT_PRINT ""
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
387
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
388 ; show dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
389 WIN_SMALL log_divetime_mins_value_column,logbook_date_row ; align with surrounding data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
390 MOVCC header_buffer+index_divemode,lo ; read dive type (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
391 call TFT_decotype_logbook ; "strcat_print"s dive mode (OC, CC, Gauge, Apnea or pSCR)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
392 ; also sets aux_flag in case the dive was done in a deco mode
0
heinrichsweikamp
parents:
diff changeset
393
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
394 ; show time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
395 WIN_SMALL logbook_time_column, logbook_time_row
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
396 MOVII header_buffer+index_time,mpr ; get time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
397 output_99x ; print hour
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
398 PUTC ':' ; print spacing ":"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
399 movff hi,lo ; print minute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
400 output_99x ; ...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
401 STRCAT_PRINT "" ; display 1st row of details
0
heinrichsweikamp
parents:
diff changeset
402
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
403 ; get log format version
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
404 MOVCC header_buffer+index_profile_version,lo ; read profile format version
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
405 movlw 0x24
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
406 cpfslt lo ; < 0x24 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
407 bra log_skip_extra_icon ; YES - skip end of dive icon
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
408
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
409 ; print end of dive icon
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
410 WIN_SMALL logbook_time_column-.8, logbook_time_row
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
411 STRCPY_PRINT 0x94
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
412
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
413 log_skip_extra_icon:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
414 MOVII header_buffer+index_max_depth,mpr ; get max depth in [mbar]
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
415
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
416 ; compute vertical scale (y-axis)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
417 MOVII mpr,xA
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
418 MOVLI profile_height_pixels,xB ; number of pixels available for plot
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
419 call div16x16 ; xC = xA / xB with xA as remainder
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
420 MOVII xC,y_scale ; y-scale (mbar/pixel)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
421 INCI y_scale ; increase by one to include potential remainder (round up)
0
heinrichsweikamp
parents:
diff changeset
422
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
423 ; compute number of pixels per each 10 m
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
424 movlw LOW ((profile_height_pixels+1)*.1000)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
425 movwf xC+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
426 movlw HIGH (((profile_height_pixels+1)*.1000) & h'FFFF')
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
427 movwf xC+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
428 movlw UPPER ((profile_height_pixels+1)*.1000)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
429 movwf xC+2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
430 clrf xC+3
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
431 MOVII mpr,xB ; get max. depth in mbar
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
432 call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
433 MOVII xC,x_scale ; pixels/10m (for scale, draw any xx rows a scale-line)
0
heinrichsweikamp
parents:
diff changeset
434
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
435 ; safeguard scale to become zero
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
436 movf x_scale+0,W ; get low byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
437 iorwf x_scale+1,W ; ior with high byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
438 btfsc STATUS,Z ; x_scale = zero ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
439 incf x_scale+1,F ; YES - set to 256 to make "display_profile2e" working
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
440
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
441 ; calculate vertical interval
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
442 MOVLI .600,xA ; a vertical line every 600 seconds (10 minutes)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
443 movff sampling_rate,xB+0 ; copy sampling rate to xB, low byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
444 clrf xB+1 ; clear xB, high byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
445 call div16x16 ; xC=xA/xB with xA as remainder
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
446 MOVII xC,vertical_interval ; vertical_interval:2 holds number of samples between each vertical 10 min lines
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
447
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
448 ; get total sample time in seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
449 MOVII header_buffer+index_total_seconds,xA
0
heinrichsweikamp
parents:
diff changeset
450
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
451 ; calculate x-scale value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
452 MOVLI profile_width_pixels,xB ; horizontal width of plot area in pixels
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
453 call div16x16 ; xC = xA / xB with xA as remainder: seconds per pixel
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
454 MOVII xC,xA ; copy seconds/pixel to xA
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
455 movff sampling_rate,xB+0 ; divide through sampling rate
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
456 clrf xB+1 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
457 call div16x16 ; xC = xA / xB with xA as remainder: samples per pixel
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
458 MOVII xC,profile_temp1 ; store samples/pixel
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
459 INCI profile_temp1 ; increment result by 1 to include potential remainder (round up)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
460
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
461 WIN_SMALL log_max_value_column,log_max_value_row
0
heinrichsweikamp
parents:
diff changeset
462
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
463 ; get max depth in [mbar]
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
464 MOVII header_buffer+index_max_depth,mpr
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
465
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
466 ; print depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
467 TSTOSS opt_units ; 0=Meters, 1=Feets
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
468 bra display_profile_offset4_metric ; 0 - do metric
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
469 ;bra display_profile_offset4_imperial ; 1 - do imperial
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
470
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
471 display_profile_offset4_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
472 call convert_cm_to_feet ; convert value in mpr from [cm] to [feet]
0
heinrichsweikamp
parents:
diff changeset
473 PUTC ' '
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
474 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
475 output_16_3 ; limit to 999 and display only (0-999)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
476 STRCAT_TEXT_PRINT tFeets
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
477 bra display_profile_offset4_common
0
heinrichsweikamp
parents:
diff changeset
478
heinrichsweikamp
parents:
diff changeset
479 display_profile_offset4_metric:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
480 bsf ignore_digit5 ; no cm...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
481 movlw d'1' ; no 1000 m
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
482 movwf ignore_digits ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
483 output_16dp d'3' ; xxx.y
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
484 STRCAT_TEXT_PRINT tMeters
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
485 ;bra display_profile_offset4_common
0
heinrichsweikamp
parents:
diff changeset
486
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
487 display_profile_offset4_common:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
488 WIN_SMALL log_divetime_mins_value_column,log_divetime_mins_value_row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
489 bsf leftbind
0
heinrichsweikamp
parents:
diff changeset
490
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
491 ; show dive time minutes : seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
492 MOVTT header_buffer+index_divetime,mpr ; get dive time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
493 output_16 ; print dive time minutes
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
494 PUTC 'm' ; print "m" (minutes)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
495 movff up,lo ; print dive time seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
496 output_99x ; dive time seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
497 STRCAT_PRINT "s" ; print "s" (seconds)
0
heinrichsweikamp
parents:
diff changeset
498
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
499 ; get minimum temperature (for later use)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
500 MOVII header_buffer+index_min_temp,logbook_min_tp
0
heinrichsweikamp
parents:
diff changeset
501
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
502 ; print gases
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
503 btfss aux_flag ; dive done in a deco mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
504 bra logbook_set_gas_color ; NO - always use gas 1 color (white) then
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
505
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
506 ; set pointer to gas 1 type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
507 MOVCC header_buffer+index_gas1+.3,WREG ; read gas type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
508 decfsz WREG,W ; = 1 (= "First") ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
509 bra logbook_find_first_gas2 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
510 logbook_set_gas_color:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
511 movlw .1 ; YES - select white color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
512 bra logbook_find_first_gas_done
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
513
0
heinrichsweikamp
parents:
diff changeset
514 logbook_find_first_gas2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
515 ; set pointer to gas 2 type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
516 MOVCC header_buffer+index_gas2+.3,WREG ; read gas type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
517 decfsz WREG,W ; = 1 (= "First") ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
518 bra logbook_find_first_gas3 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
519 movlw .2 ; YES - select green color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
520 bra logbook_find_first_gas_done
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
521
0
heinrichsweikamp
parents:
diff changeset
522 logbook_find_first_gas3:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
523 ; set pointer to gas 3 type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
524 MOVCC header_buffer+index_gas3+.3,WREG ; read gas type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
525 decfsz WREG,W ; = 1 (= "First") ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
526 bra logbook_find_first_gas4 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
527 movlw .3 ; YES - select red color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
528 bra logbook_find_first_gas_done
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
529
0
heinrichsweikamp
parents:
diff changeset
530 logbook_find_first_gas4:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
531 ; set pointer to gas 4 type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
532 MOVCC header_buffer+index_gas4+.3,WREG ; read gas type
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
533 decfsz WREG,W ; = 1 (= "First") ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
534 bra logbook_find_first_gas5 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
535 movlw .4 ; YES - select yellow color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
536 bra logbook_find_first_gas_done
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
537
0
heinrichsweikamp
parents:
diff changeset
538 logbook_find_first_gas5:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
539 ; must be gas 5 then
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
540 movlw .5 ; select cyan color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
541 ;bra logbook_find_first_gas_done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
542
0
heinrichsweikamp
parents:
diff changeset
543 logbook_find_first_gas_done:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
544 movwf backup_color1 ; keep copy of color for later restore
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
545 call TFT_color_code_gas ; set color
0
heinrichsweikamp
parents:
diff changeset
546
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
547 ; set ext_flash_address to the begin of the profile data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
548 MOVTT header_buffer+index_profile_start_address,ext_flash_address
0
heinrichsweikamp
parents:
diff changeset
549
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
550 ; skip the 0xFA 0xFA header of the profile data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
551 ext_flash_inc_address_0x20 d'2'
0
heinrichsweikamp
parents:
diff changeset
552
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
553 ; initialize flag for signaling when last sample set was read
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
554 bcf end_of_profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
555
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
556 ; check if the profile actually belongs to this dive (check done with low bytes only)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
557 FLASH_CC_READ_0x20 lo ; read dive number in profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
558 incf total_num_dives,W ; WREG = total number of dives + 1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
559 bsf STATUS,C ; set borrow
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
560 subfwb divenumber,W ; WREG = total number of dives - number of dive to show - 1
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
561 cpfseq lo ; number of dive in profile = number of dive to show?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
562 bra display_profile_no_profile ; NO - no profile data for this dive available
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
563 ;bra display_profile_show_profile ; YES - show profile
0
heinrichsweikamp
parents:
diff changeset
564
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
565 display_profile_show_profile:
0
heinrichsweikamp
parents:
diff changeset
566
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
567 ; skip high byte of dive number 1 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
568 ; skip second header code 2 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
569 ; skip length of profile data 3 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
570 ; skip sampling rate in profile section 1 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
571 ; skip number of divisors 1 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
572 ; ======
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
573 ; total number of bytes to skip = 8 byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
574 ext_flash_inc_address_0x20 d'8'
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
575
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
576 ; read divisor temp
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
577 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
578 FLASH_CW_READ_0x20 ; read temperature divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
579 movwf divisor_temperature ; store temperature divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
580 movwf count_temperature ; store to temperature counter, too
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
581
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
582 ; read divisor deco
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
583 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
584 FLASH_CW_READ_0x20 ; read deco divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
585 movwf divisor_deco ; store deco divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
586 movwf count_deco ; store to deco status counter, too
0
heinrichsweikamp
parents:
diff changeset
587
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
588 ; read divisor GF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
589 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
590 FLASH_CC_READ_0x20 divisor_gf ; store saturation divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
591
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
592 ; read divisor ppO2 sensors
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
593 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
594 FLASH_CC_READ_0x20 divisor_ppo2_sensors ; store ppO2 divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
595
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
596 ; read divisor deco plan
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
597 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
598 FLASH_CC_READ_0x20 divisor_decoplan ; store deco plan divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
599
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
600 ; read divisor CNS
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
601 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
602 FLASH_CC_READ_0x20 divisor_cns ; store CNS divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
603
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
604 ; read divisor tank data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
605 ext_flash_inc_address_0x20 d'2' ; skip information type and length
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
606 FLASH_CC_READ_0x20 divisor_tank ; store tank pressure divisor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
607
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
608
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
609 ; start drawing the profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
610
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
611 ; set color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
612 movlw color_deepblue
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
613 call TFT_set_color
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
614
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
615 ; draw a frame around profile area
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
616 WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1
0
heinrichsweikamp
parents:
diff changeset
617
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
618 ; draw depth grid
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
619 movlw profile_top ; set top position of plot area
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
620 movwf win_top ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
621 movlw profile_left ; set left position of plot area
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
622 movwf win_leftx2 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
623 movlw d'1' ; draw lines of 1 pixel width
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
624 movwf win_height ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
625 movlw profile_width_pixels+.1 ; set right position of plot area
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
626 movwf win_width+0 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
627 clrf win_width+1 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
628 bra display_profile2_loline ; do not draw the 0 m line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
629 display_profile2_loop:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
630 call TFT_box ; draw the line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
631 display_profile2_loline:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
632 movf win_top,W ; get last row drawn
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
633 addwf x_scale+0,W ; add line interval distance, low byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
634 tstfsz x_scale+1 ; interval distance > 255 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
635 movlw d'255' ; YES - would make win_top > 239 -> prepare abort
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
636 btfsc STATUS,C ; did the add produce a carry?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
637 movlw d'255' ; YES - would make win_top > 239 -> prepare abort
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
638 movwf win_top ; write position of next line back to win_top
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
639 movlw profile_top+profile_height_pixels+.1 ; get limit for last line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
640 cpfsgt win_top ; line to draw beyond limit?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
641 bra display_profile2_loop ; NO - draw the line
0
heinrichsweikamp
parents:
diff changeset
642
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
643 ; do various initializations for drawing the curves
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
644 clrf gaslist_gas ; here: used as counter for depth readings
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
645 movlw profile_width_pixels+profile_left-.1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
646 movwf ignore_digits ; here: used as counter for x-pixels
372
f8adb2d5d328 logbook work
heinrichsweikamp
parents: 371
diff changeset
647
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
648 movlw profile_left+.1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
649 movwf logbook_pixel_x_pos ; here: used as column x2 (start at column 5)
372
f8adb2d5d328 logbook work
heinrichsweikamp
parents: 371
diff changeset
650
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
651 movlw profile_top+.1 ; zero-m row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
652 movwf fill_between_rows
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
653 movwf logbook_last_tp ; initialize for temperature curve, too
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
654
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
655 movlw LOW(-.100) ; initialize max temperature to -10.0 °C
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
656 movwf logbook_max_tp+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
657 movlw HIGH 0xFFFF & (-.100)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
658 movwf logbook_max_tp+1
0
heinrichsweikamp
parents:
diff changeset
659
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
660 setf logbook_cur_tp+0 ; initialize temperature to 0xFFFF = 'no data'
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
661 setf logbook_cur_tp+1 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
662 clrf logbook_last_tp ; also reset previous Y for temperature
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
663 clrf logbook_ceiling ; ceiling = 0, correct value for no ceiling
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
664 movlw profile_top+.1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
665 movwf logbook_min_temp_pos ; initialize for displaying the lowest temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
666 movlw profile_top+profile_height_pixels
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
667 movwf logbook_max_temp_pos ; initialize for displaying the highest temperature
0
heinrichsweikamp
parents:
diff changeset
668
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
669 movlw profile_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
670 movwf win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
671 movlw profile_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
672 movwf win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
673 movlw profile_height_pixels
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
674 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
675 movlw LOW (profile_width_pixels*.2)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
676 movwf win_width+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
677 movlw HIGH (profile_width_pixels*.2)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
678 movwf win_width+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
679 call TFT_box_write ; open box for d1
371
fec5eec4c8b7 fix some display issues with display1
heinrichsweikamp
parents: 343
diff changeset
680
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
681 ; INIT_PIXEL_WRITE logbook_pixel_x_pos ; pixel x2 (also sets standard color!)
0
heinrichsweikamp
parents:
diff changeset
682
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
683 ; start profile plotting loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
684 CLRI logbook_sample_counter ; clear counter for amount of samples read so far
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
685
0
heinrichsweikamp
parents:
diff changeset
686 profile_display_loop:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
687 ; initialize pixel write
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
688 movf logbook_pixel_x_pos,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
689 mullw 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
690 call pixel_write_col320
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
691
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
692 MOVII profile_temp1,profile_temp2 ; 16 bit x-scaler
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
693
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
694 incf profile_temp2+1,F
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
695 tstfsz profile_temp2+0 ; must not be zero, is zero?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
696 bra profile_display_loop2 ; NO - ok
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
697 incf profile_temp2+0,F ; YES - increase by 1
0
heinrichsweikamp
parents:
diff changeset
698
heinrichsweikamp
parents:
diff changeset
699 profile_display_loop2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
700 rcall profile_view_get_depth ; read one set of depth, temp and event data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
701 btfsc end_of_profile ; end of profile data reached?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
702 bra profile_display_loop_done ; YES - skip all remaining pixels
0
heinrichsweikamp
parents:
diff changeset
703
heinrichsweikamp
parents:
diff changeset
704
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
705 ;---- draw ceiling curve, if any ---------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
706
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
707 movf divisor_deco,W ; get divisor, deco data logged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
708 bz profile_display_skip_deco ; NO - skip
0
heinrichsweikamp
parents:
diff changeset
709
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
710 movf logbook_ceiling,W ; any deco ceiling?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
711 bz profile_display_skip_deco ; NO - skip
0
heinrichsweikamp
parents:
diff changeset
712
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
713 mullw .100 ; YES - convert to mbar
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
714 MOVII PROD, sub_a ; - ceiling depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
715 MOVII logbook_cur_depth+0,sub_b ; - current depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
716 call cmpU16 ; - compute ceiling - current depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
717 movlw color_dark_green ; - dark green if ok
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
718 btfss neg_flag ; - current depth > ceiling ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
719 movlw color_dark_red ; NO - dark red because ceiling is violated
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
720 call TFT_set_color ; - set color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
721 MOVII PROD,xA ; - divide pressure in mbar/pixel for row offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
722 MOVII y_scale,xB ; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
723 call div16x16 ; - xC = xA / xB with xA as remainder
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
724 movlw profile_top+.1 ; - start right after the top line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
725 movwf win_top ; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
726 movff logbook_pixel_x_pos,win_leftx2 ; - set left border (0-159)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
727 movff xC+0,win_height ; - set hight
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
728 call half_vertical_line ; - color the area
0
heinrichsweikamp
parents:
diff changeset
729
heinrichsweikamp
parents:
diff changeset
730 profile_display_skip_deco:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
731
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
732 ;---- draw temperature curve, if any ---------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
733
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
734 movf divisor_temperature,W ; get divisor, deco data logged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
735 bz profile_display_skip_temp ; NO - skip
0
heinrichsweikamp
parents:
diff changeset
736
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
737 movf logbook_cur_tp+0,W ; did we had a valid temperature record already (0xFF = 'no data')?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
738 andwf logbook_cur_tp+1,W ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
739 incf WREG ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
740 bz profile_display_skip_temp ; NO - skip drawing
0
heinrichsweikamp
parents:
diff changeset
741
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
742 ; fixed temperature scale: (-2 .. +35°C * scale256 ) / 153 pixel
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
743 movlw LOW (((profile_height_pixels-.10)*.256)/.370)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
744 movwf xB+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
745 movlw HIGH (((profile_height_pixels-.10)*.256)/.370)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
746 movwf xB+1
0
heinrichsweikamp
parents:
diff changeset
747
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
748 movf logbook_cur_tp+0,W ; current temperature - (-2.0°C) == temperature + 20
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
749 addlw LOW(.20) ; low byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
750 movwf xA+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
751 movf logbook_cur_tp+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
752 btfsc STATUS,C ; propagate carry, if any
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
753 incf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
754 movwf xA+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
755 call mult16x16 ; xA*xB=xC
0
heinrichsweikamp
parents:
diff changeset
756
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
757 ; scale: divide by 256 -> just take the high byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
758 movf xC+1,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
759 sublw profile_top+profile_height_pixels-.10 ; upside-down: Y = .75 + (.153 - result)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
760 movwf xC+0
0
heinrichsweikamp
parents:
diff changeset
761
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
762 ; check limits
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
763 movlw profile_top+.1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
764 movwf xC+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
765 cpfsgt xC+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
766 movff xC+1,xC+0
0
heinrichsweikamp
parents:
diff changeset
767
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
768 movlw color_orange ; select color for temperature curve
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
769 call TFT_set_color ; set color
0
heinrichsweikamp
parents:
diff changeset
770
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
771 movf logbook_last_tp,W ; do we have a valid previous value?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
772 bz profile_display_temp_1 ; NO - skip the vertical line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
773 movwf xC+1 ; YES - set end position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
774 call profile_display_fill ; - draw in this column between this row (xC+0) and the last row (xC+1)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
775
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
776 profile_display_temp_1:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
777 movf xC+0,W ; get position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
778 cpfsgt logbook_min_temp_pos ; > min limit?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
779 movwf logbook_min_temp_pos ; NO - set to lowest position for the temp graph
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
780 cpfslt logbook_max_temp_pos ; < max limit?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
781 movwf logbook_max_temp_pos ; NO - set to highest position for the temp graph
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
782
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
783 movff xC+0,logbook_last_tp ; set col (0..159) x row (0..239)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
784 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; draw a pixel
0
heinrichsweikamp
parents:
diff changeset
785
heinrichsweikamp
parents:
diff changeset
786 profile_display_skip_temp:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
787
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
788 ;---- draw depth curve ---------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
789
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
790 MOVII y_scale, xB ; divide pressure in mbar/pixel for row offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
791 MOVII logbook_cur_depth,xA ; get current depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
792 call div16x16 ; xC = xA / xB with xA as remainder
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
793 movlw profile_top+.1 ; get offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
794 addwf xC+0,F ; add offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
795 btfsc STATUS,C ; profile error?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
796 movff fill_between_rows,xC+0 ; YES - ignore
0
heinrichsweikamp
parents:
diff changeset
797
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
798 movf backup_color1,W ; copy gas number to WREG for color-coding
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
799 call TFT_color_code_gas ; set color
0
heinrichsweikamp
parents:
diff changeset
800
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
801 movff fill_between_rows,xC+1 ; set position
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
802 call profile_display_fill ; in this column between this row (xC+0) and the last row (xC+1)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
803 movff xC+0,fill_between_rows ; store last row for fill routine
0
heinrichsweikamp
parents:
diff changeset
804
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
805 PIXEL_WRITE logbook_pixel_x_pos,xC+0 ; draw a pixel
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
806 incf logbook_pixel_x_pos,F ; advance to next column
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
807
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
808 ;---- draw marker square, if any -----------------------------------------
0
heinrichsweikamp
parents:
diff changeset
809
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
810 btfss log_marker_found ; any marker to draw?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
811 bra profile_display_skip_marker ; NO - skip
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
812 bcf log_marker_found ; YES - clear flag
402
a3a0f1fd7fc4 NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents: 392
diff changeset
813
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
814 ; set position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
815 incf fill_between_rows,W ; increase row (Y)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
816 movwf win_top
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
817
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
818 ; limit win_top to 220
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
819 movlw .220
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
820 cpfslt win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
821 movwf win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
822 decf logbook_pixel_x_pos,W ; decrease column (X)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
823 movwf win_leftx2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
824
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
825 ; limit win_leftx2 to 151
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
826 movlw .151
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
827 cpfslt win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
828 movwf win_leftx2
402
a3a0f1fd7fc4 NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents: 392
diff changeset
829
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
830 ; print marker
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
831 movlw color_orange
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
832 call TFT_set_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
833 WIN_FONT FT_TINY
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
834 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
835 STRCPY_PRINT "m"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
836
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
837 movlw profile_left
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
838 movwf win_leftx2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
839 movlw profile_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
840 movwf win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
841 movlw profile_height_pixels
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
842 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
843 movlw LOW (profile_width_pixels*.2)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
844 movwf win_width+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
845 movlw HIGH (profile_width_pixels*.2)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
846 movwf win_width+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
847 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
848
a3a0f1fd7fc4 NEW: Logbook shows markers with small orange boxes in the profile
heinrichsweikamp
parents: 392
diff changeset
849 profile_display_skip_marker:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
850
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
851 ;---- draw CNS curve, if any ---------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
852
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
853 movf divisor_cns,W ; get divisor, CNS logged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
854 bz profile_display_skip_cns ; NO - skip
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
855 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
856 ; add further code here...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
857 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
858
0
heinrichsweikamp
parents:
diff changeset
859 profile_display_skip_cns:
heinrichsweikamp
parents:
diff changeset
860
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
861 ;---- draw saturation curve, if any --------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
862
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
863 movf divisor_gf,W ; get divisor, saturation logged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
864 bz profile_display_skip_gf ; NO - skip
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
865 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
866 ; add further code here...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
867 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
868
0
heinrichsweikamp
parents:
diff changeset
869 profile_display_skip_gf:
heinrichsweikamp
parents:
diff changeset
870
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
871 ; all curves done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
872 bra profile_display_skip_loop1
0
heinrichsweikamp
parents:
diff changeset
873
heinrichsweikamp
parents:
diff changeset
874
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
875 profile_display_skip_loop1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
876 dcfsnz profile_temp2+0,F ; decrement low byte of x-scaler, became zero?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
877 bra profile_display_loop3 ; YES - decrement high byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
878 rcall profile_view_get_depth ; NO - read next depth, temp and profile data set
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
879 btfsc end_of_profile ; - end-of profile reached?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
880 bra profile_display_loop_done ; YES - skip all remaining pixels
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
881 bra profile_display_skip_loop1 ; NO - continue
0
heinrichsweikamp
parents:
diff changeset
882
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
883 profile_display_loop3:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
884 decfsz profile_temp2+1,F ; decrement high byte of x-scaler, became zero?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
885 bra profile_display_skip_loop1 ; NO - continue
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
886 decfsz ignore_digits,F ; YES - count drown x-pixels to zero, became zero?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
887 bra profile_display_loop ; NO - draw next sample
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
888 bra profile_display_loop_done ; YES - done
0
heinrichsweikamp
parents:
diff changeset
889
heinrichsweikamp
parents:
diff changeset
890 profile_display_loop_done:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
891 btfss bailout_mode ; bailout during the dive?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
892 bra profile_display_gas6 ; NO - skip next
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
893 movlw color_pink ; YES - show "Bailout" in pink color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
894 call TFT_set_color ; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
895 WIN_TINY logbook_bailout_column,logbook_bailout_row; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
896 STRCPY_TEXT_PRINT tDiveBailout ; - print text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
897
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
898 profile_display_gas6:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
899 btfss event_gas_change_gas6 ; did a change to gas 6 occurred?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
900 bra profile_display_temperatures ; NO - skip next
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
901 movlw color_pink ; YES - select color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
902 call TFT_set_color ; - set color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
903 WIN_TINY logbook_bailout_column,logbook_bailout_row-.15
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
904 STRCPY_TEXT tGas ; - print "Gas"
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
905 STRCAT_PRINT " 6!" ; - print " 6!"
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
906
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
907 profile_display_temperatures:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
908 movff logbook_min_temp_pos,win_top ; get Y position at lowest temperature
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
909 movff logbook_pixel_x_pos,win_leftx2 ; get X ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
910 movlw .130 ; left border limit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
911 cpfslt win_leftx2 ; too far to the left?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
912 movwf win_leftx2 ; YES - set to limit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
913 WIN_FONT FT_TINY ; select font
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
914 movlw color_yellow ; select color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
915 call TFT_set_color ; set color
0
heinrichsweikamp
parents:
diff changeset
916
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
917 MOVII logbook_min_tp,mpr ; get min temperature
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
918 lfsr FSR2,buffer ; initialize string buffer
0
heinrichsweikamp
parents:
diff changeset
919
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
920 TSTOSS opt_units ; 0=°C, 1=°F
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
921 bra logbook_show_temp_metric ; 0 - do Celsius
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
922 ;bra logbook_show_temp_imperial ; 1 - do Fahrenheit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
923
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
924 logbook_show_temp_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
925 ; min temperature
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
926 call TFT_convert_signed_16bit ; convert lo:hi into signed-short and add '-' to POSTINC2 if required
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
927 call convert_celsius_to_fahrenheit ; convert value in lo:hi from Celsius to Fahrenheit
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
928 lfsr FSR2,buffer ; overwrite "-"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
929 bsf ignore_digit5 ; full degrees only
0
heinrichsweikamp
parents:
diff changeset
930 output_16
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
931 STRCAT_TEXT_PRINT tLogTunitF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
932 ; max temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
933 movlw .15
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
934 subwf logbook_max_temp_pos,W
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
935 movwf win_top ; Y position at max temperature
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
936 MOVII logbook_max_tp,mpr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
937 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
938 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
939 call convert_celsius_to_fahrenheit ; convert value in lo:hi from Celsius to Fahrenheit
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
940 output_16
0
heinrichsweikamp
parents:
diff changeset
941 bcf ignore_digit5
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
942 STRCAT_TEXT_PRINT tLogTunitF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
943 bra logbook_show_gases
0
heinrichsweikamp
parents:
diff changeset
944
heinrichsweikamp
parents:
diff changeset
945 logbook_show_temp_metric:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
946 ; min temperature
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
947 call TFT_convert_signed_16bit ; convert lo:hi into signed-short and add '-' to POSTINC2 if required
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
948 movlw d'3'
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
949 movwf ignore_digits
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
950 bsf leftbind
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
951 output_16dp d'2' ; temperature
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
952 STRCAT_TEXT_PRINT tLogTunitC
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
953 ; max temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
954 movlw .15
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
955 subwf logbook_max_temp_pos,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
956 movwf win_top ; Y position at max temperature
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
957 MOVII logbook_max_tp,mpr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
958 lfsr FSR2,buffer
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
959 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
960 movlw d'3'
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
961 movwf ignore_digits
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
962 bsf leftbind
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
963 output_16dp d'2' ; temperature
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
964 STRCAT_TEXT_PRINT tLogTunitC
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
965 bra logbook_show_gases
0
heinrichsweikamp
parents:
diff changeset
966
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
967
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
968 display_profile_no_profile:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
969 ; print message "No Data anymore..."
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
970 WIN_SMALL .4,.110 ; set text size and position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
971 call TFT_disabled_color ; use the color for disabled things
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
972 STRCPY_TEXT_PRINT tNoProfileData ; print message
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
973
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
974
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
975 logbook_show_gases:
50
ec4d8503ec45 NEW: user-selectable color schemes
heinrichsweikamp
parents: 25
diff changeset
976 bcf leftbind
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
977 call TFT_standard_color
0
heinrichsweikamp
parents:
diff changeset
978
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
979 btfss aux_flag ; dive done in a deco mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
980 bra logbook_show_gases_done ; NO - don't show gases
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
981
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
982 ; show gases
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
983 lfsr FSR0,header_buffer+index_gas1 ; load base address of gases
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
984 bsf log_show_gas_short ; do the short version of log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
985 bsf leftbind
0
heinrichsweikamp
parents:
diff changeset
986
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
987 WIN_TINY log_gas_column1, log_gas_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
988 movlw .1 ; color for gas 1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
989 call log_show_gas
0
heinrichsweikamp
parents:
diff changeset
990
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
991 WIN_TINY log_gas_column2, log_gas_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
992 movlw .2 ; color for gas 2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
993 call log_show_gas
0
heinrichsweikamp
parents:
diff changeset
994
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
995 WIN_TINY log_gas_column3, log_gas_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
996 movlw .3 ; color for gas 3
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
997 call log_show_gas
0
heinrichsweikamp
parents:
diff changeset
998
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
999 WIN_TINY log_gas_column4, log_gas_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1000 movlw .4 ; color for gas 4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1001 call log_show_gas
0
heinrichsweikamp
parents:
diff changeset
1002
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1003 WIN_TINY log_gas_column5, log_gas_row
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1004 movlw .5 ; color for gas 5
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1005 call log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1006
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1007 bcf leftbind
0
heinrichsweikamp
parents:
diff changeset
1008
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1009 logbook_show_gases_done:
0
heinrichsweikamp
parents:
diff changeset
1010
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1011 rcall logbook_preloop_tasks ; clear timeout, some flags and set to Speed_eco
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1012 display_profile_loop:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1013 btfsc switch_right ; right button pressed?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1014 bra logbook_page1 ; YES - show more information
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1015 btfsc switch_left ; NO - left button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1016 bra exit_profileview ; YES - back to list
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1017 call housekeeping ; NO - handle screen dump request, timeout and entering dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1018 bra display_profile_loop ; - loop waiting for something to do
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1019
0
heinrichsweikamp
parents:
diff changeset
1020
heinrichsweikamp
parents:
diff changeset
1021 ;=============================================================================
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1022 ; Draw a vertical line between xC+1 and xC+0, at current X position
0
heinrichsweikamp
parents:
diff changeset
1023 ;
heinrichsweikamp
parents:
diff changeset
1024 ; Note: should keep xC+0
heinrichsweikamp
parents:
diff changeset
1025 ; Note: ascending or descending !
heinrichsweikamp
parents:
diff changeset
1026 ;
heinrichsweikamp
parents:
diff changeset
1027 profile_display_fill:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1028 ; First, check if xC+0 > fill_between_rows or xC+0 < aponoe_mins
0
heinrichsweikamp
parents:
diff changeset
1029 movf xC+0,W
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1030 cpfseq xC+1 ; xC+0 = apnoe_mins ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1031 bra profile_display_fill2 ; NO
0
heinrichsweikamp
parents:
diff changeset
1032 return
heinrichsweikamp
parents:
diff changeset
1033
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1034 profile_display_fill2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1035 ; Make sure to init X position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1036 movf logbook_pixel_x_pos,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1037 mullw 2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1038 decf PRODL,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1039 movlw 0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1040 subwfb PRODH,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1041 call pixel_write_col320
0
heinrichsweikamp
parents:
diff changeset
1042
heinrichsweikamp
parents:
diff changeset
1043 movf xC+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1044 cpfsgt xC+1 ; fill_between_rows > xC+0 ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1045 bra profile_display_fill_up ; YES
0
heinrichsweikamp
parents:
diff changeset
1046
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1047 profile_display_fill_down2: ; loop
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1048 decf xC+1,F
0
heinrichsweikamp
parents:
diff changeset
1049
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1050 HALF_PIXEL_WRITE xC+1 ; updates just row (0..239)
0
heinrichsweikamp
parents:
diff changeset
1051
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1052 movf xC+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1053 cpfseq xC+1 ; loop until xC+1 = xC+0
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1054 bra profile_display_fill_down2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1055 return ; fill_between_rows and xC+0 are untouched
0
heinrichsweikamp
parents:
diff changeset
1056
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1057 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
1058 incf xC+1,F
0
heinrichsweikamp
parents:
diff changeset
1059
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1060 HALF_PIXEL_WRITE xC+1 ; updates just row (0..239)
0
heinrichsweikamp
parents:
diff changeset
1061
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1062 movf xC+0,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1063 cpfseq xC+1 ; loop until xC+1 = fill_between_rows
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1064 bra profile_display_fill_up
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1065 return ; fill_between_rows and xC+0 are untouched
0
heinrichsweikamp
parents:
diff changeset
1066
heinrichsweikamp
parents:
diff changeset
1067 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
1068
heinrichsweikamp
parents:
diff changeset
1069
heinrichsweikamp
parents:
diff changeset
1070 profile_view_get_depth:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1071 INCI logbook_sample_counter ; count read pixels
0
heinrichsweikamp
parents:
diff changeset
1072
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1073 movf logbook_sample_counter+0,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1074 cpfseq vertical_interval+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1075 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1076 movf logbook_sample_counter+1,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1077 cpfseq vertical_interval+1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1078 bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1079 ; draw a new 10min line here...
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1080 CLRI logbook_sample_counter ; clear counting registers for next line
0
heinrichsweikamp
parents:
diff changeset
1081
heinrichsweikamp
parents:
diff changeset
1082 ; Vertical lines...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1083 movlw color_deepblue
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1084 call TFT_set_color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1085 movlw profile_top+.1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1086 movwf win_top
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1087 incf logbook_pixel_x_pos,W ; draw one line to right to make sure it's the background of the profile
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1088 movwf win_leftx2 ; left border (0-159)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1089 movlw profile_height_pixels
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1090 movwf win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1091 movlw profile_height_pixels
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1092 movwf win_width ; "window" height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1093 call half_horizontal_line ; inputs: win_top, win_leftx2, win_width, win_color1, win_color2
0
heinrichsweikamp
parents:
diff changeset
1094
heinrichsweikamp
parents:
diff changeset
1095 profile_view_get_depth_no_line:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1096 FLASH_II_READ_0x20 logbook_cur_depth ; read depth (2 bytes)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1097 FLASH_CC_READ_0x20 gaslist_gas ; read Profile Flag Byte
0
heinrichsweikamp
parents:
diff changeset
1098
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1099 bcf event_occured ; clear flag by default
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1100 btfsc gaslist_gas,7 ; event recorded?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1101 bsf event_occured ; YES - we also have an event byte
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1102 bcf gaslist_gas,7 ; clear event byte flag (if any)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1103
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1104 ; gaslist_gas now holds the number of additional bytes to ignore (0-127)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1105
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1106 ; check for end of profile
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1107 movlw 0xFD ; load token for end of profile data
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1108 cpfseq logbook_cur_depth+0 ; end of profile token in 1st depth byte?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1109 bra profile_view_get_depth_new1 ; NO - profile continues
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1110 cpfseq logbook_cur_depth+1 ; YES - end of profile token in 2nd depth byte?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1111 bra profile_view_get_depth_new1 ; NO - profile continues
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1112 bsf end_of_profile ; YES - end of profile, set flag to skip remaining pixels
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1113 return ; - done
0
heinrichsweikamp
parents:
diff changeset
1114
heinrichsweikamp
parents:
diff changeset
1115 profile_view_get_depth_new1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1116 btfsc event_occured ; was there an event attached to this sample?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1117 rcall profile_view_get_depth_events ; YES - get information about this event(s)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1118
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1119 ; read temperature if available AND divisor reached AND bytes available
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1120 movf divisor_temperature,W ; is temperature divisor null ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1121 bz profile_view_get_depth_no_tp ; YES - no temperature curve
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1122 decf count_temperature,F ; NO - decrement temperature counter, counter zero now?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1123 bnz profile_view_get_depth_no_tp ; NO - no temperature this time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1124 FLASH_II_READ_0x20 logbook_cur_tp ; YES - read temperature (2 bytes)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1125 decf gaslist_gas,F ; - reduce counter twice
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1126 decf gaslist_gas,F ; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1127 movff divisor_temperature,count_temperature ; - restart counter
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
1128
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1129 ; compute max temperature on the fly...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1130 MOVII logbook_cur_tp,sub_a ; copy current temperature to sub_a
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1131 MOVII logbook_max_tp,sub_b ; copy maximum temperature to sub_b
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1132 call sub16 ; SIGNED sub_a - sub_b
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1133 btfsc neg_flag ; current temperature > maximum temperature ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1134 bra profile_view_get_depth_no_tp ; NO - no new max temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1135
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1136 ; store new max. temperature, but only if below dive_threshold_norm_alt_start
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1137 tstfsz logbook_cur_depth+1 ; deeper than 2.55 m ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1138 bra profile_view_compute_max_temp ; YES - include in max. temp measurement
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1139 movlw dive_threshold_norm_alt_start+0 ; get start-of-dive depth in mbar / cm, low byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1140 cpfsgt logbook_cur_depth+0 ; deeper that start-of-dive threshold?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1141 bra profile_view_get_depth_no_tp ; NO - ignore current temperature
162
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
1142
95d05cc14736 NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents: 124
diff changeset
1143 profile_view_compute_max_temp:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1144 MOVII logbook_cur_tp,logbook_max_tp ; store new max temperature
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1145
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1146 ;---- read deco, if any AND divisor=0 AND bytes available ----------------
0
heinrichsweikamp
parents:
diff changeset
1147 profile_view_get_depth_no_tp:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1148 movf divisor_deco,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1149 bz profile_view_get_depth_no_deco
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1150 decf count_deco,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1151 bnz profile_view_get_depth_no_deco
0
heinrichsweikamp
parents:
diff changeset
1152
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1153 FLASH_CC_READ_0x20 logbook_ceiling ; read the ceiling
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1154 decf gaslist_gas,F ; reduce the counter
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1155 movff divisor_deco,count_deco ; restart counter
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1156 ext_flash_inc_address_0x40 d'1' ; skip the stop duration
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1157 decf gaslist_gas,F ; reduce the counter
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1158
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1159 ;---- read GF, if any AND divisor=0 AND bytes available ------------------
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1160
0
heinrichsweikamp
parents:
diff changeset
1161 profile_view_get_depth_no_deco:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1162 ; then skip remaining bytes...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1163 movf gaslist_gas,W ; get number of additional bytes to ignore (0-127)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1164 tstfsz WREG ; anything to skip?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1165 call incf_ext_flash_address0_0x20 ; YES - skip #WREG bytes
0
heinrichsweikamp
parents:
diff changeset
1166 return
heinrichsweikamp
parents:
diff changeset
1167
168
1784ab9362ca BUGFIX: False max. temp in Logbook, false Bailout and Gas 6 flags in logbook
heinrichsweikamp
parents: 167
diff changeset
1168 profile_view_get_depth_events:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1169 clrf event_byte2 ; clear event byte 2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1170 FLASH_CC_READ_0x20 event_byte1 ; read event byte 1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1171 decf gaslist_gas,F ; reduce counter
98
24b3fd59e61f add event "bailout" in profile
heinrichsweikamp
parents: 89
diff changeset
1172
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1173 btfss event_byte1,7 ; another event byte?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1174 bra profile_no_second_eventbyte ; NO - skip next
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1175 FLASH_CC_READ_0x20 event_byte2 ; YES - read event byte 2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1176 decf gaslist_gas,F ; - reduce counter
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1177 bcf event_byte1,7 ; - clear flag
98
24b3fd59e61f add event "bailout" in profile
heinrichsweikamp
parents: 89
diff changeset
1178
24b3fd59e61f add event "bailout" in profile
heinrichsweikamp
parents: 89
diff changeset
1179 profile_no_second_eventbyte:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1180 ; Check event flags in the EventBytes
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1181 btfsc event_byte1,4 ; manual gas changed?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1182 rcall logbook_event1 ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1183 btfsc event_byte1,5 ; stored gas changed?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1184 rcall logbook_event4 ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1185 btfsc event_byte1,6 ; setpoint change?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1186 rcall logbook_event3 ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1187 btfsc event_byte2,0 ; bailout?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1188 rcall logbook_event2 ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1189 ; any alarm?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1190 bcf event_byte1,4 ; clear bits already tested
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1191 bcf event_byte1,5
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1192 bcf event_byte1,6
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1193 movlw .6 ; coding for manual marker
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1194 cpfseq event_byte1 ; manual marker set?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1195 return ; NO - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1196 bsf log_marker_found ; YES - draw small yellow rectangle here
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1197 return ; - done
163
4d71549dcf6c clarify diluent change in the documentation
heinrichsweikamp
parents: 162
diff changeset
1198
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1199 logbook_event4: ; stored gas changed
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1200 FLASH_CC_READ_0x20 backup_color1 ; read gas number, to be used as color index
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1201 decf gaslist_gas,F ; reduce counter
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1202 call TFT_color_code_gas ; change profile color according to gas number (still in WREG)
0
heinrichsweikamp
parents:
diff changeset
1203 return
heinrichsweikamp
parents:
diff changeset
1204
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1205 logbook_event1: ; gas 6 used
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1206 bsf event_gas_change_gas6 ; set event flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1207 movlw .6 ; use gas 6 color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1208 movwf backup_color1 ; select color for gas 6
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1209 call TFT_color_code_gas ; set profile color
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1210 ext_flash_inc_address_0x20 d'2' ; skip two bytes
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1211 decf gaslist_gas,F ; reduce counter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1212 decf gaslist_gas,F ; reduce counter
167
05f2100d2eb8 logbook
heinrichsweikamp
parents: 163
diff changeset
1213 return
0
heinrichsweikamp
parents:
diff changeset
1214
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1215 logbook_event2: ; bailout
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1216 bsf bailout_mode ; set flag
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1217 movff backup_color1,backup_color2 ; backup last gas color in case we return to CCR
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1218 movlw .6 ; use Gas6 color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1219 movwf backup_color1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1220 call TFT_color_code_gas ; use gas 6 color
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1221 ext_flash_inc_address_0x20 d'2' ; skip two bytes
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1222 decf gaslist_gas,F ; reduce counter
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1223 decf gaslist_gas,F ; reduce counter
167
05f2100d2eb8 logbook
heinrichsweikamp
parents: 163
diff changeset
1224 return
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
1225
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1226 logbook_event3: ; setpoint change
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1227 ext_flash_inc_address_0x20 d'1' ; skip one byte
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1228 decf gaslist_gas,F ; reduce counter
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1229 btfss bailout_mode ; in bailout?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1230 return ; NO - done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1231 movff backup_color2,backup_color1 ; YES - restore color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1232 movf backup_color2,W ; - copy gas number to WREG for color-coding
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1233 call TFT_color_code_gas ; - back to normal profile color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1234 return ; - done
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 98
diff changeset
1235
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1236 ; ------------------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1237
0
heinrichsweikamp
parents:
diff changeset
1238 exit_profileview:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1239 clrf gaslist_gas ; restore all registers to build same page again
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1240 movff logbook_divenumber_temp,logbook_divenumber
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1241 movff logbook_max_dive_counter_temp,logbook_max_dive_counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1242 movff logbook_temp_backup,logbook_temp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1243 incf logbook_max_dive_counter,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1244 decf logbook_divenumber,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1245 bcf all_dives_shown
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1246 clrf menu_pos_max ; number of rows used on current logbook-page
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1247 movlw logbook_row_number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1248 movwf menu_pos_cur ; here: active row on current page
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1249 call TFT_boot
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1250 goto logbook2 ; start search
0
heinrichsweikamp
parents:
diff changeset
1251
heinrichsweikamp
parents:
diff changeset
1252 next_logbook2:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1253 btfsc all_dives_shown ; all shown?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1254 goto logbook ; YES
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1255 clrf menu_pos_max ; number of used rows on current logbook-page
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1256 movlw logbook_row_number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1257 movwf menu_pos_cur
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1258 incf logbook_page_number,F ; start new screen
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1259 bsf keep_cursor_new_page ; keep cursor on "next page"
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1260 call TFT_boot
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1261 goto logbook2 ; start search
0
heinrichsweikamp
parents:
diff changeset
1262
heinrichsweikamp
parents:
diff changeset
1263 next_logbook3:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1264 incf menu_pos_cur,F ; set cursor to next line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1265 movlw logbook_row_number+.2 ; get maximum number of lines
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1266 cpfsgt menu_pos_cur ; cursor position beyond last line?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1267 bra next_logbook3a ; NO - ok, done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1268 movlw .1 ; YES - reset to first line
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1269 movwf menu_pos_cur ; - ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1270 bra next_logbook3b ; - done
0
heinrichsweikamp
parents:
diff changeset
1271
heinrichsweikamp
parents:
diff changeset
1272 next_logbook3a:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1273 incf menu_pos_max,W ; last entry on current page +1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1274 cpfseq menu_pos_cur ; same as cursor position?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1275 bra next_logbook3b ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1276 movlw logbook_row_number+.1 ; YES - ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1277 movwf menu_pos_cur ; - ... jump directly to "next page" if page is not full
0
heinrichsweikamp
parents:
diff changeset
1278
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1279 movlw logbook_row_number
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1280 cpfseq menu_pos_max ; last dive was row logbook_row_number?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1281 bsf all_dives_shown ; NO - set flag to load first page again (full reset)
0
heinrichsweikamp
parents:
diff changeset
1282
heinrichsweikamp
parents:
diff changeset
1283 next_logbook3b:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1284 call TFT_logbook_cursor
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1285 goto logbook_loop_pre
0
heinrichsweikamp
parents:
diff changeset
1286
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1287 ; ------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1288 ; list one dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1289 ;
0
heinrichsweikamp
parents:
diff changeset
1290 display_listdive:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1291 bsf logbook_page_not_empty ; flag page will not be empty
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1292 incf menu_pos_max,F ; increment number of lines shown
0
heinrichsweikamp
parents:
diff changeset
1293
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1294 lfsr FSR2,buffer ; initialize output buffer
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1295 WIN_FONT FT_SMALL ; select font
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1296 WIN_LEFT logbook_list_left ; set horizontal output position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1297 decf menu_pos_max,W ; get current line -1 into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1298 mullw logbook_row_offset ; multiply with row spacing
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1299 movff PRODL,win_top ; set vertical output position
392
32780516c8c6 NEW: Show actual dive count in logbook list view (If <1000)
heinrichsweikamp
parents: 389
diff changeset
1300
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1301 ; print dive number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1302 movf logbook_divenumber,W ; get running number of the dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1303 call log_compute_divenumber ; compute dive number to show (incorporate dive number offset)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1304 bsf leftbind ; start left-aligned
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
1305 movlw .3 ; start with 3rd digit (i.e. suppress the thousands)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1306 movwf ignore_digits ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1307 output_16dp .0 ; print dive number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1308 bcf leftbind ; end left-alignment
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1309
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1310 PUTC ' ' ; print a space char
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1311
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1312 ; print dive date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1313 MOVTT header_buffer+index_date,mpr ; get date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1314 call TFT_convert_date_short ; convert and print date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1315
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1316 PUTC ' ' ; print a space char
0
heinrichsweikamp
parents:
diff changeset
1317
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1318 ; print dive depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1319 MOVII header_buffer+index_max_depth,mpr ; get max depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1320
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1321 TSTOSS opt_units ; switch by configured units
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1322 bra display_listdive2_metric ; 0 - do metric
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1323 ;bra display_listdive2_imperial ; 1 - do imperial
0
heinrichsweikamp
parents:
diff changeset
1324
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1325 display_listdive2_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1326 call convert_cm_to_feet ; convert value in mpr from [cm] to [feet]
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1327 PUTC ' ' ; print one space char
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1328 output_16_3 ; print depth, limited to 999
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1329 STRCAT_TEXT tFeets1 ; print unit label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1330 bra display_listdive3 ; continue with common part
0
heinrichsweikamp
parents:
diff changeset
1331
heinrichsweikamp
parents:
diff changeset
1332 display_listdive2_metric:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1333 bsf ignore_digit5 ; do not print the cm
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1334 movlw d'1' ; do not print the first digit (no 1000 m)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1335 movwf ignore_digits ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1336 output_16dp .3 ; print depth in format xxx.y
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1337 STRCAT_TEXT tMeters ; print unit label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1338 PUTC ' ' ; print one space char
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1339 ;bra display_listdive3 ; continue with common part
0
heinrichsweikamp
parents:
diff changeset
1340
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1341 ; print dive time
0
heinrichsweikamp
parents:
diff changeset
1342 display_listdive3:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1343 MOVII header_buffer+index_divetime,mpr ; get dive time (minutes only)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1344 output_16_3 ; print minutes (0-999 min)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1345 STRCAT_TEXT tMinutes ; print minutes mark ("'")
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1346 clrf WREG ; create string terminator
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1347 movff WREG,buffer+.21 ; hard limit the output to 21 chars
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1348 STRCAT_PRINT "" ; finalize output
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1349
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1350 return ; done
0
heinrichsweikamp
parents:
diff changeset
1351
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1352 ; ------------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1353
0
heinrichsweikamp
parents:
diff changeset
1354 logbook_show_divenumber:
heinrichsweikamp
parents:
diff changeset
1355 WIN_MEDIUM logbook_divenumer_column, logbook_divenumer_row
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1356 movf divenumber,W ; log_compute_divenumber needs the list number
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1357 call log_compute_divenumber ; compute dive number
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1358 bsf leftbind
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1359 output_16 ; show dive number
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1360 bcf leftbind
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1361 STRCAT_PRINT "" ; finalize output
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1362 return ; done
0
heinrichsweikamp
parents:
diff changeset
1363
heinrichsweikamp
parents:
diff changeset
1364
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1365 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1366 ; 1st Details Page after Profile: Dive Statistics
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1367
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1368 logbook_page1: ; show more info
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1369 rcall log_details_header ; shows number, time/date and basic dive info
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1370
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1371 btfss aux_flag ; dive done in a deco mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1372 bra logbook_page1_1 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1373
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1374 ; deco model
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1375 WIN_SMALL .5,.65
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1376 MOVCC header_buffer+index_decomodel,WREG ; get deco model (0= ZH-L16, 1=ZH-L16+GF)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1377 decfsz WREG,W ; GF model?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1378 bra logbook_decomodel_1 ; NO - ZH-L16
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1379 ;bra logbook_decomodel_2 ; YES - ZH-L16+GF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1380
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1381 logbook_decomodel_2:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1382 ; deco model GF version
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1383 STRCAT_PRINT "ZHL-16+GF"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1384 WIN_SMALL .5,.90
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1385 STRCPY_TEXT tGF2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1386 MOVII header_buffer+index_gf_lo_hi,mpr ; get GF factors
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1387 output_8 ; print GF lo
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1388 STRCAT "%/"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1389 movff hi,lo ; print GF hi
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1390 output_8 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1391 STRCAT_PRINT "%"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1392 bra logbook_cns
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1393
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1394 logbook_decomodel_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1395 ; deco model none-GF version
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1396 STRCAT_PRINT "ZH-L16"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1397 WIN_SMALL .5,.90
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1398 MOVII header_buffer+index_factor_sat_desat,mpr; get both factors
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1399 output_8 ; print saturation factor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1400 STRCAT "%/"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1401 movff hi,lo ; print desaturation factor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1402 output_8 ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1403 STRCAT_PRINT "%"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1404 ;bra logbook_cns
0
heinrichsweikamp
parents:
diff changeset
1405
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1406 logbook_cns:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1407 WIN_SMALL .5,.115
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1408 STRCPY_TEXT tCNS2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1409 MOVII header_buffer+index_cns_start,mpr ; get CNS at start of dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1410 bcf mpr+1,int_warning_flag ; clear warning flag (fix for cases were the flags already got stored to EEPROM)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1411 bcf mpr+1,int_attention_flag ; clear attention flag (fix for cases were the flags already got stored to EEPROM)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1412 output_16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1413 STRCAT "->"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1414 MOVII header_buffer+index_cns_end,mpr ; get CNS at end of dive
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1415 bcf hi,int_warning_flag ; clear warning flag (fix for cases were the flags already got stored to EEPROM)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1416 bcf hi,int_attention_flag ; clear attention flag (fix for cases were the flags already got stored to EEPROM)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1417 output_16
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1418 STRCAT_PRINT "%"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1419
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1420 logbook_page1_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1421 WIN_SMALL .5,.140
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1422 STRCPY_TEXT tAVG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1423 MOVII header_buffer+index_avr_depth,mpr ; get average depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1424
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1425 TSTOSS opt_units ; 0=Meters, 1=Feets
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1426 bra logbook_page1_1_metric ; do metric
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1427 ;bra logbook_page1_1_imperial ; do imperial
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1428
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1429 logbook_page1_1_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1430 call convert_cm_to_feet ; convert value in lo:hi from [cm] to [feet]
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1431 PUTC ' '
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1432 output_16_3 ; limit to 999 and display only (0-999)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1433 STRCAT_PRINT "ft"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1434 bra logbook_page1_1_common
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 437
diff changeset
1435
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1436 logbook_page1_1_metric:
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
1437 bsf ignore_digit5 ; no cm (flag will be cleared by output_16)
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
1438 movlw .1 ; no 1000 meters
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
1439 movwf ignore_digits ; ...
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
1440 output_16dp .3 ; xxx.y
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1441 STRCAT_PRINT "m"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1442 ;bra logbook_page1_1_common
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 437
diff changeset
1443
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1444 logbook_page1_1_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1445 btfss aux_flag ; dive done in a deco mode?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1446 bra logbook_page1_2 ; NO
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1447
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1448 ; Salinity
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1449 WIN_SMALL .5,.165 ; ex WIN_SMALL .5,.140
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1450 STRCPY_TEXT tDvSalinity2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1451 bsf leftbind
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1452 MOVCC header_buffer+index_salinity,lo ; read salinity
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1453 output_8
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1454 STRCAT_PRINT "%"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1455
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1456 ; Last deco
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1457 WIN_SMALL .5,.190
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1458 STRCPY_TEXT tLastDeco
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1459 MOVCC header_buffer+index_last_stop,lo ; read last stop depth
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1460 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1461 STRCAT_PRINT "m"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1462
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1463 logbook_page1_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1464 movlw color_lightblue
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1465 call TFT_set_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1466 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
1467
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1468 ; Firmware
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1469 call TFT_standard_color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1470 WIN_SMALL .110,.65
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1471 STRCAT "V:"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1472 MOVII header_buffer+index_firmware,mpr ; get firmware version
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1473 movff lo,up ; keep a backup of major in up
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1474 bsf leftbind ; print left-aligned
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1475 output_8 ; print major version (in 1 digit due to leftbind)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1476 PUTC "." ; print "."
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1477 movff hi,lo ; print minor version...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1478 output_99x ; ... in 2 digit format
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1479 STRCAT_PRINT "" ; finalize output
620
cd986267a5ca potential compass bug "fixed"
heinrichsweikamp
parents: 604
diff changeset
1480
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1481 movf up,W ; get major into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1482 xorlw .3 ; major == 3 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1483 bz logbook_battery_percent ; YES - show battery %
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1484 movf up,W ; NO - get major into WREG (again)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1485 xorlw .2 ; major == 2 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1486 bnz logbook_battery_voltage ; NO - skip battery %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1487 movlw .14 ; YES - check minor version
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1488 cpfsgt lo ; - minor > 14 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1489 bra logbook_battery_voltage ; NO - skip battery %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1490 ;bra logbook_battery_percent ; YES - show battery %
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1491
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1492 ; Battery %
620
cd986267a5ca potential compass bug "fixed"
heinrichsweikamp
parents: 604
diff changeset
1493 logbook_battery_percent:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1494 WIN_SMALL .110,.140
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1495 MOVCC header_buffer+index_batt_percent,lo ; get battery percent
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1496 output_8 ; print battery percent
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1497 STRCAT_PRINT "%" ; print "%" and finalize output
496
a0247e9f71d0 show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents: 495
diff changeset
1498
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1499 ; Battery Voltage
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1500 logbook_battery_voltage:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1501 WIN_SMALL .110,.90
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1502 STRCAT_PRINT "Batt:"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1503 WIN_SMALL .110,.115
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1504 MOVII header_buffer+index_battery_voltage,mpr ; get battery voltage
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1505 output_16dp .2 ; print battery voltage
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1506 STRCAT_PRINT "V" ; print unit (Volt)
496
a0247e9f71d0 show battery % in logbook (For dives made with 2.15 or newer)
heinrichsweikamp
parents: 495
diff changeset
1507
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1508 ; Surface Pressure
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1509 MOVII header_buffer+index_surface_press,mpr ; get surface pressure
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1510 WIN_SMALL .110,.165 ; set output position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1511 bsf leftbind ; print without leading spaces
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1512 output_16 ; print surface pressure before dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1513 STRCAT_TEXT tMBAR ; print unit
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1514 clrf WREG ; string terminator
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1515 movff WREG,buffer+7 ; limit to 7 chars
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1516 STRCAT_PRINT "" ; dump buffer to screen
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 437
diff changeset
1517
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1518 movlw color_greenish ; select color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1519 call TFT_set_color ; ...
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1520 WIN_FRAME_COLOR16 .63,.220,.107,.159 ; draw a frame with coordinates top, bottom, left, right
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1521
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1522 ; handle HMI
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1523 rcall logbook_preloop_tasks ; clear timeout and remaining button events
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1524 display_details1_loop:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1525 btfsc switch_right ; right button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1526 bra display_details1_more ; YES - more info or back to profile
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1527 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1528 bra exit_profileview ; YES - back to list
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1529 call housekeeping ; NO - handle screen dump request, timeout and entering dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1530 bra display_details1_loop ; - loop waiting for something to do
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1531
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1532 display_details1_more:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1533 btfss aux_flag ; YES - dive done in a deco mode?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1534 goto display_profile2 ; NO - show the profile view again
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1535 ;bra logbook_page2 ; YES - show more details
490
8dfb93e80338 NEW: Deep Sleep mode for OSTC Plus and OSTC 2 (2017) (Entered automatically)
heinrichsweikamp
parents: 437
diff changeset
1536
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1537
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1538 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1539 ; 2nd Details Page after Profile: Tissue and Decompression Status
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1540
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1541 logbook_page2:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1542
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1543 ; ################# to be removed later ##################################
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1544 ; movlw fw_version_beta ; get beta status
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1545 ; tstfsz WREG ; beta?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1546 ; bra display_page2_betajump ; YES - omit firmware version check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1547 ; ########################################################################
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1548
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1549 ; skip this page for dives recorded with firmwares < 3.09
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1550 MOVII header_buffer+index_firmware,mpr ; get firmware version major and minor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1551
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1552 movlw .2 ; minimum required major is 3, -1 for cpfsgt
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1553 cpfsgt lo ; major >= requirement?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1554 bra logbook_page3 ; NO - skip this page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1555 movlw .8 ; YES - minimum required minor is 9, -1 for cpfsgt
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1556 cpfsgt hi ; - minor >= requirement?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1557 bra logbook_page3 ; NO - skip this page
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1558
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1559 ; ################# to be removed later ##################################
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1560 display_page2_betajump:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1561 ; ########################################################################
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1562
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1563 rcall log_details_header ; shows number, time/date and basic dive info
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1564
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1565 ; basic configuration of tissue graphics
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1566 bsf tissue_graphic_mode ; select logbook mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1567 bcf tissue_graphic_layout ; select press+sat
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1568 bcf tissue_graphic_cns ; do not show CNS value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1569 bcf tissue_graphic_gf ; do not show GF lines by default
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1570
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1571 ; GF configuration
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1572 MOVCC header_buffer+index_decomodel,WREG ; get deco model (0= ZH-L16, 1=ZH-L16+GF)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1573 dcfsnz WREG ; GF model?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1574 bsf tissue_graphic_gf ; YES - show GF lines
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1575
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1576 ; draw the graphics
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1577 call TFT_surface_tissues
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1578
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1579 ; calculate time/date of the end of the dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1580 MOVTT header_buffer+index_date, rtc_latched_year ; get start of the dive - year, month, day
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1581 MOVII header_buffer+index_time, rtc_latched_hour ; get start of the dive - hour, minute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1582 MOVCC header_buffer+index_divetime+2,rtc_latched_secs ; get duration of the dive - seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1583 MOVII header_buffer+index_divetime+0,mpr ; get duration of the dive - minutes
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1584 call rtc_add_minutes ; add minutes in mpr to time/date in rtc_latched
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1585
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1586 ; print time/date of the end of the dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1587 WIN_SMALL .8,.193 ; select font and output position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1588 MOVTT rtc_latched_year,mpr ; get computed end-of-dive date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1589 call TFT_convert_date_short ; convert and print date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1590 STRCAT ".-" ; print spacing ".-"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1591 MOVII rtc_latched_hour,mpr ; get computed end-of-dive time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1592 output_99x ; print hour
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1593 PUTC ':' ; print spacing ":"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1594 movff hi,lo ; print minute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1595 output_99x ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1596 STRCAT_PRINT "" ; finalize output
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1597
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1598
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1599 ; draw a white frame around the time/date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1600 WIN_FRAME_STD surf_tissue_diagram_bottom,.220, surf_tissue_diagram_left, surf_tissue_diagram_right
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1601
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1602 bra logbook_page2_rightside ; continue with right side
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1603
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1604 logbook_page2_nograph:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1605 WIN_SMALL .6,.118 ; no tissue graphics because the
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1606 STRCAT_PRINT "(< FW 3.08)" ; profile was recorded on a FW < 3.08
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1607
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1608 logbook_page2_rightside:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1609
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1610 ; 1st line: supersaturation at end of dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1611 WIN_SMALL .100,.68
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1612 STRCAT_TEXT_PRINT tBeginOfDive ; print "Begin"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1613
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1614 ; 2nd line:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1615 WIN_SMALL .100+.28,.93 ; +16 for centered, +28 for right-aligned
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1616 MOVCC header_buffer+index_supersat_start,lo ; get supersaturation at start of dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1617 bcf leftbind
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1618 output_8 ; print percent value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1619 STRCAT_PRINT "%" ; print "%" and finalize output
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1620
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1621 ; 3rd line:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1622 WIN_SMALL .100,.118
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1623 STRCAT_TEXT_PRINT tEndOfDive ; print "End"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1624
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1625 ; 4th line:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1626 WIN_SMALL .100+.28,.143 ; +16 for centered, +28 for right-aligned
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1627 MOVCC header_buffer+index_supersat_end,lo ; get supersaturation at end of dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1628 bcf leftbind
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1629 output_8 ; print percent value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1630 STRCAT_PRINT "%" ; print "%" and finalize output
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1632 ; 5th line: desaturation time label
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1633 WIN_SMALL .100,.168
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1634 STRCAT_TEXT_PRINT tDesatTime ; print "Desat"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1635
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1636 ; 6th line: desaturation time value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1637 WIN_SMALL .100+.14,.193 ; +?? for centered, +14 for right-aligned
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1638 MOVII header_buffer+index_desattime,mpr ; get desaturation time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1639 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1640 movf lo,W ; swap hi and lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1641 movff hi,lo ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1642 movwf hi ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1643 output_99 ; print hours in 0-99
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1644 PUTC 'h' ; print hours mark
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1645 movff hi,lo ; print minutes...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1646 output_99x ; ... in two digits, leading zero
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1647 STRCAT_PRINT "m" ; print minutes mark and finalize output
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1648
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1649 ; draw a colored frame around the right side
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1650 movlw color_orange ; select color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1651 call TFT_set_color ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1652 WIN_FRAME_COLOR16 .65,.220,.97,.159 ; draw a frame with coordinates top, bottom, left, right
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1653
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1654 ; handle HMI
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1655 rcall logbook_preloop_tasks ; clear timeout and remaining button events
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1656 display_details1b_loop:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1657 btfsc switch_right ; right button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1658 bra logbook_page3 ; YES - show more info
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1659 btfsc switch_left ; left button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1660 bra exit_profileview ; YES - back to list
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1661 call housekeeping ; NO - handle screen dump request, timeout and entering dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1662 bra display_details1b_loop ; - loop waiting for something to do
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1663
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1664
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1665 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1666 ; helper function
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1667 logbook_preloop_tasks:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1668 movlw CCP1CON_VALUE ; see hwos.inc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1669 movwf CCP1CON ; power-on backlight
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1670 call TFT_standard_color ; revert to standard color
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1671 call reset_timeout_surfmode ; reset timeout
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1672 bcf switch_left ; clear left-over left button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1673 bcf switch_right ; clear left-over right button event
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1674 return ; done
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1675
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1676 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1677 ; 3rd Details Page after Profile: Gases / Diluents
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1678
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1679 logbook_page3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1680 rcall log_details_header ; shows number, time/date and basic dive info
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1681 lfsr FSR0,header_buffer+index_gas1 ; load base address of the gases
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1682 bcf log_show_gas_short ; do the long version of log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1683 bcf leftbind
0
heinrichsweikamp
parents:
diff changeset
1684
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1685 WIN_SMALL .5,.90
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1686 movlw .1 ; color for gas 1
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1687 rcall log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1688
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1689 WIN_SMALL .5,.115
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1690 movlw .2 ; color for gas 2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1691 rcall log_show_gas
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1692
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1693 WIN_SMALL .5,.140
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1694 movlw .3 ; color for gas 3
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1695 rcall log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1696
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1697 WIN_SMALL .5,.165
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1698 movlw .4 ; color for gas 4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1699 rcall log_show_gas
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1700
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1701 WIN_SMALL .5,.190
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1702 movlw .5 ; color for gas 5
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1703 rcall log_show_gas
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1704
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1705 ; OC/CC gas list
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1706 WIN_SMALL .5,.65
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1707 WIN_COLOR color_greenish
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1708
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1709 MOVCC header_buffer+index_divemode,WREG ; read dive mode (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4= pSCR)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1710 decfsz WREG,W ; dive mode = CC ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1711 bra logbook_page3a ; NO - print OC title
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1712 STRCPY_TEXT_PRINT tGaslistCC ; YES - print CC title
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1713 bra logbook_page3b ; - continue with common part
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1714 logbook_page3a:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1715 STRCPY_TEXT_PRINT tGaslist ; print OC title
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 549
diff changeset
1716 logbook_page3b:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1717 movlw color_lightblue ; select color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1718 call TFT_set_color ; set color
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1719 WIN_FRAME_COLOR16 .63,.220,.2,.114 ; draw a frame with coordinates top, bottom, left, right
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1720
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1721 ; handle HMI
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1722 rcall logbook_preloop_tasks ; clear timeout, some flags and set to speed_eco
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1723 display_details2_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1724 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1725 goto logbook_page4 ; YES - show more info
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1726 btfsc switch_left ; NO - left button pressed?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1727 bra exit_profileview ; YES - back to list
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1728 call housekeeping ; NO - handle screen dump request, timeout and entering dive mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1729 bra display_details2_loop ; - loop waiting for something to do
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1730
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1731
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1732 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1733 ; 4th Details Page after Profile: Setpoints
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1734
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1735 logbook_page4:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1736 MOVCC header_buffer+index_divemode,WREG ; get dive mode (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4= pSCR)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1737 decfsz WREG,W ; =1 (CC)?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1738 goto display_profile2 ; NO - skip setpoints
530
d36f9fca10ae 2.20beta release
heinrichsweikamp
parents: 502
diff changeset
1739
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1740 rcall log_details_header ; shows number, time/date and basic dive info
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1741
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1742 ; print setpoint list
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1743 lfsr FSR0,header_buffer+index_sp1 ; load base address of the setpoints
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1744 WIN_SMALL .5,.65
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1745 WIN_COLOR color_greenish
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1746 STRCPY_TEXT_PRINT tFixedSetpoints
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1747 call TFT_standard_color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1748 WIN_SMALL .5,.90
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1749 rcall log_show_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1750 WIN_SMALL .5,.115
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1751 rcall log_show_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1752 WIN_SMALL .5,.140
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1753 rcall log_show_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1754 WIN_SMALL .5,.165
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1755 rcall log_show_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1756 WIN_SMALL .5,.190
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1757 rcall log_show_sp
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1758
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1759 movlw color_greenish
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1760 call TFT_set_color
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1761 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
1762
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1763 ; handle HMI
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1764 rcall logbook_preloop_tasks ; clear timeout, some flags and set to Speed_eco
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1765 display_details3_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1766 btfsc switch_right ; right button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1767 goto display_profile2 ; YES - show the profile view again
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1768 btfsc switch_left ; left button pressed?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1769 bra exit_profileview ; YES - back to list
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1770 call housekeeping ; NO to both - handle screen dump request, timeout and entering dive mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1771 bra display_details3_loop ; - loop waiting for something to do
0
heinrichsweikamp
parents:
diff changeset
1772
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1773
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1774 ;-----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1775 ; Helper Functions
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1776
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1777 log_details_header:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1778 call TFT_boot
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1779 call TFT_standard_color
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1780
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1781 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
1782
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1783 ; show date and time in first row
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1784 WIN_SMALL .59,.10
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1785 MOVTT header_buffer+index_date,mpr ; get date
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1786 call TFT_convert_date ; convert into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in buffer
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1787
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1788 PUTC "-"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1789
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1790 MOVII header_buffer+index_time,mpr ; get time
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1791 output_99x ; print hour
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1792 PUTC ':' ; print spacing ":"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1793 movff hi,lo ; print minute
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1794 output_99x ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1795 STRCAT_PRINT "" ; display 1st row of details
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1796
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1797 ; show max depth and dive time
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1798 WIN_SMALL .5,.35
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1799 STRCAT "Max:"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1800 MOVII header_buffer+index_max_depth,mpr ; get max depth
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1801
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1802 TSTOSS opt_units ; 0=Meters, 1=Feet
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1803 bra logbook_page2_depth_metric ; 1 - do metric
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1804 ;bra logbook_page2_depth_imperial ; 0 - do imperial
629
237931377539 3.07 stable release
heinrichsweikamp
parents: 628
diff changeset
1805
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1806 logbook_page2_depth_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1807 call convert_cm_to_feet ; convert value in lo:hi from [cm] to [feet]
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1808 PUTC ' '
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1809 bcf leftbind
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1810 output_16_3
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1811 STRCAT_TEXT tFeets
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1812 bra logbook_page2_depth_common
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1813
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1814 logbook_page2_depth_metric:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1815 bsf ignore_digit5 ; no cm...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1816 movlw d'1' ; no 1000 m
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1817 movwf ignore_digits ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1818 output_16dp d'3' ; xxy.y
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1819 STRCAT_TEXT tMeters
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1820 ;bra logbook_page2_depth_common
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1821
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1822 logbook_page2_depth_common:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1823 STRCAT " - "
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1824 MOVTT header_buffer+index_divetime,mpr ; get dive time
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1825 bsf leftbind
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1826 output_16 ; print minutes
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1827 PUTC "m"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1828 movff up,lo ; print seconds
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1829 output_99x ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1830 STRCAT_PRINT "s"
500
989917fe2d9f Battery % in logbook when updated from Sport to Tech
heinrichsweikamp
parents: 496
diff changeset
1831 return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1832
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1833
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1834 log_show_sp:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1835 ; log point is set by caller
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1836 MOVCC POSTINC0,lo ; copy set point into lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1837 MOVCC POSTINC0,hi ; copy change depth into hi
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1838
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1839 movff mpr+1,mpr+2 ; save change depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1840 clrf mpr+1 ; set high byte to zero for printing setpoint
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1841 bsf leftbind
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1842 output_16dp d'3' ; print setpoint x.xx
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1843 bcf leftbind
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1844 STRCAT_TEXT tbar
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1845 PUTC " "
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1846 movff mpr+2,mpr+0 ; restore change depth to lo
0
heinrichsweikamp
parents:
diff changeset
1847
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1848 TSTOSS opt_units ; 0=Meter, 1=Feet
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1849 bra log_show_sp_metric ; 0 - do metric
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1850 ;bra log_show_sp_imperial ; 1 - do imperial
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1851
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1852 log_show_sp_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1853 call convert_meter_to_feet ; convert value in lo from [m] to [feet]
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1854 output_16_3
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1855 PUTC " "
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1856 STRCAT_TEXT tFeets ; "ft"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1857 bra log_show_sp_common
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1858
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1859 log_show_sp_metric:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1860 output_8
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1861 PUTC " "
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1862 STRCAT_TEXT tMeters ; "m"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1863 ;bra log_show_sp_common
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1864
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1865 log_show_sp_common:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1866 STRCAT_PRINT ""
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1867 return
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1868
0
heinrichsweikamp
parents:
diff changeset
1869
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1870 log_show_gas: ; show gas data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1871 call TFT_color_code_gas ; color the output (gas number is in WREG)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1872 MOVCC POSTINC0,lo ; copy O2 fraction into lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1873 MOVCC POSTINC0,hi ; copy He fraction into hi
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1874 call gaslist_show_mix ; put "Nxlo", "Txlo/hi", "Air" or "O2" into buffer
0
heinrichsweikamp
parents:
diff changeset
1875
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1876 MOVCC POSTINC0,lo ; copy change depth into lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1877 MOVCC POSTINC0,hi ; copy gas type into hi
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1878 btfsc log_show_gas_short ; shall we do the short version?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1879 bra log_show_gas_common ; YES - do short version
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1880 ;bra log_show_gas_long ; NO - add gas types
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1881
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1882 log_show_gas_long:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1883 PUTC " " ; put one space between gas composition and gas type marking
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1884 tstfsz hi ; gas disabled?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1885 bra log_show_gas_1 ; NO - next check
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1886 PUTC "x" ; YES - mark with "x"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1887 bra log_show_gas_4 ; - continue with change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1888 log_show_gas_1:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1889 decfsz hi,F ; now: -1 disabled, 0 first, 1 travel, 2 deco -> first?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1890 bra log_show_gas_2 ; NO - next check
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1891 PUTC "*" ; YES - mark with "*"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1892 bra log_show_gas_4 ; - continue with change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1893 log_show_gas_2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1894 decf hi,F ; now: -2 disabled, -1 first, 0 travel, 1 deco
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1895 decfsz hi,F ; now: -3 disabled, -2 first, -1 travel, 0 deco -> deco?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1896 bra log_show_gas_3 ; NO - nothing to mark
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1897 PUTC "=" ; YES - mark with "="
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1898 bra log_show_gas_4 ; - continue with change depth
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1899 log_show_gas_3:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1900 PUTC " " ; print a space in absence of any other marking
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1901 log_show_gas_4:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1902 PUTC " " ; put one space between gas type marking and change depth
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1903
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1904 TSTOSS opt_units ; 0=Meter, 1=Feet
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1905 bra log_show_gas_metric ; 0 - do metric
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1906 ;bra log_show_gas_imperial ; 1 - do imperial
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1907
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1908 log_show_gas_imperial:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1909 call convert_meter_to_feet ; convert value in lo from [m] to [feet]
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1910 output_16_3 ; limit to 999 and display only 0-999
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1911 STRCAT_TEXT tFeets ; "ft"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1912 bra log_show_gas_common
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1913
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1914 log_show_gas_metric:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1915 output_8
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1916 STRCAT_TEXT tMeters ; "m"
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1917 ;bra log_show_gas_common
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1918
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1919 log_show_gas_common:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1920 STRCAT_PRINT ""
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 572
diff changeset
1921 return
0
heinrichsweikamp
parents:
diff changeset
1922
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1923
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1924 log_compute_divenumber:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1925 movwf mpr+2 ; store current dive number in mpr+2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1926 call eeprom_log_offset_read ; read log offset into mpr+0 & +1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1927 ; check if offset = 0
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1928 tstfsz mpr+0 ; low byte = 0 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1929 bra log_compute_divenumber_2 ; NO - apply offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1930 tstfsz mpr+1 ; YES - high byte = 0 ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1931 bra log_compute_divenumber_2 ; NO - apply offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1932 ;bra log_compute_divenumber_1 ; YES - no offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1933
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1934 log_compute_divenumber_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1935 movff mpr+2,mpr+0 ; use plain number from dive list
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1936 clrf mpr+1 ; set high byte to 0
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1937 return ; done
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1938
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1939 log_compute_divenumber_2:
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1940 ; check limit (offset must be < 10000)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1941 MOVLI .9999,sub_a ; sub_a = 9999
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1942 MOVII mpr, sub_b ; sub_b = offset
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1943 call cmpU16 ; 9999 - offset
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1944 btfsc neg_flag ; result negative, i.e. offset > 9999 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1945 bc log_compute_divenumber_1 ; YES - ignore offset
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1946 INCI mpr ; NO - increment offset by 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1947 MOVII mpr,sub_a ; - sub_a = offset + 1
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1948 movff mpr+2,sub_b+0 ; - sub_b = number from list (low byte)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1949 clrf sub_b+1 ; - high byte is 0
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1950 call subU16 ; - sub_c = offset + 1 - (number from list)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1951 MOVII sub_c,mpr ; - copy result back to mpr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1952 return ; - done
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 620
diff changeset
1953
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1954 ;----------------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1955 ; Compute flash address for header data of a particular dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1956 ;
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1957 ; Memory map in flash:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1958 ;
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1959 ; low(total number of dives) -> index -> start address end address
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1960 ; --------------------------------------------------------------------
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1961 ; 1 0 0x2|00|000 - 0x2|00|FFF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1962 ; 2 1 0x2|01|000 - 0x2|01|FFF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1963 ; 3 2 0x2|02|000 - 0x2|02|FFF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1964 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1965 ; 256 -> 0 255 0x2|FF|000 - 0x2|FF|FFF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1966
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1967 log_header_addr_by_divenumber:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1968 ; compute index of the dive with number 'divenumber'
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1969 decf divenumber,W ; compute number of dive to show -1...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1970 movwf mpr+3 ; ... and store in mpr+3
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1971 movf total_num_dives,W ; get number of total dives (low byte)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1972 bcf STATUS,C ; clear carry/borrow bit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1973 subfwb mpr+3,W ; index = number of total dives - number of dive to show + 1
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1974 ;bra log_header_addr_by_index ; get address by index
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1975
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1976 global log_header_addr_by_index
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1977 log_header_addr_by_index:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1978 ; compute the start address of the header belonging to the dive whose index is in WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1979 movwf mpr+3 ; copy index to mpr+3
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1980 clrf mpr+0 ; set up base address 0x200000
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1981 clrf mpr+1 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1982 movlw 0x20 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1983 movwf mpr+2 ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1984 movlw .16 ; prepare a shift left by 4 bit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1985 mulwf mpr+3 ; shift left index to create offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1986 movf PRODL,W ; get low byte of offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1987 addwf mpr+1,F ; add to high byte of address
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1988 movf PRODH,W ; get high byte of offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1989 addwfc mpr+2,F ; add to upper byte of address
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1990
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1991 return
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 629
diff changeset
1992
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1993 ; ----------------------------------------------------------------
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 601
diff changeset
1994
0
heinrichsweikamp
parents:
diff changeset
1995 END