annotate src/logbook.asm @ 592:05053910d668

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