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