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