annotate src/logbook.asm @ 629:237931377539

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