# HG changeset patch # User heinrichsweikamp # Date 1359133249 -3600 # Node ID 6e456a6398e006f7d203ee5661f63813a7cfdb97 # Parent c6220d340684d8dd9820977fa6772a6d1469cde6 Hardware4 support diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/MAIN.ASM --- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Fri Jan 25 18:00:49 2013 +0100 @@ -77,7 +77,7 @@ #include displaytext.asm ; sends texts to wordprocessor #include math.asm ; mathematical functions #include wait.asm ; waitroutines -#include oled_samsung.asm ; Attached in 80-System 8-Bit Mode +#include display_lowlevel.asm; Low level display routines #include aa_wordprocessor.asm; New antialiased word processor and fonts #include color_processor.asm ; Color image drawing. #include dump_screen.asm ; Copy screen contains to serial interface @@ -88,7 +88,7 @@ #include menu_reset.asm ; Submenu "Reset" #include menu_settime.asm ; Submenu "Set Time" #include ms5535.asm ; Interface to MS5535A,B or C pressure sensor -#include pled_outputs.asm ; div. PLED outputs and background debugger +#include outputs.asm ; div. outputs and background debugger #include i2c_eeprom.asm ; for external I2C EEPROM and general I2C Routines #include menu_logbook.asm ; Submenu "Logbook" #include interface.asm ; Interface routines diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm --- a/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm Fri Jan 25 18:00:49 2013 +0100 @@ -332,7 +332,7 @@ bra aa_decode_12 movff aa_temp+0,PRODH ; Add color/2 if bit set. - movff aa_temp+1,PRODL ; OLED is big endian, so swap here. + movff aa_temp+1,PRODL ; DISPLAY is big endian, so swap here. aa_decode_12: btfss aa_color_quart,ACCESS bra aa_decode_3 @@ -360,12 +360,14 @@ ; WHITE pixel (ie. full color) movff win_color1,PRODH ; current draw color - movff win_color2,PRODL ; (rem: OLED is big endian) + movff win_color2,PRODL ; (rem: DISPLAY is big endian) + setf win_color3 bra aa_decode_3 aa_decode_2: clrf PRODH,A ; BLACK pixel clrf PRODL,A + clrf win_color3 aa_decode_3: ;---- PIXEL WRITE LOOP ----------------------------------------------- @@ -387,7 +389,7 @@ ;------------------------------------------------------------------------------ ; Setup pointers for a char: ; Inputs : letter : string to print (SHOULD BE NULL TERMINATED) -; Output : OLED commands on port D + clocks. +; Output : DISPLAY commands on port D + clocks. ; global aa_wordprocessor ; Callable from C-code. aa_wordprocessor: @@ -395,7 +397,7 @@ movlb HIGH win_top ; Switch to bank 0... rcall aa_string_width ; Set win_height, compute win_width - rcall PLED_box_write ; Use that for the box. + call DISP_box_write ; Use that for the box. ; Restart the loop for each char to print lfsr FSR2, letter ; FSR2 pointer to start of string. diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/altimeter.asm --- a/code_part1/OSTC_code_asm_part1/altimeter.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/altimeter.asm Fri Jan 25 18:00:49 2013 +0100 @@ -112,7 +112,7 @@ WIN_LEFT .90 WIN_INVERT .0 WIN_FONT .0 - call PLED_standard_color + call DISP_standard_color STRCPY TXT_ALT5 @@ -229,9 +229,9 @@ rcall altimeter_reset altimeter_menu_1: - call PLED_ClearScreen ; Menu header. - call PLED_standard_color - call PLED_topline_box + call DISP_ClearScreen ; Menu header. + call DISP_standard_color + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXTH .288 ; Title bar @@ -299,7 +299,7 @@ STRCAT_PRINT TXT_METER5 alt_menu_loop: - call PLED_menu_cursor ; Display cursor + call DISP_menu_cursor ; Display cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! alt_menu_loop1: ; Wait for button. diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Fri Jan 25 18:00:49 2013 +0100 @@ -1,6 +1,7 @@ New in 2.60: BETA Version - Do NOT use for diving! CHANGE: Removed "Mix type" Icons and CF43 +CHANGE: Hardware4 support New in 2.59: BETA Version - Do NOT use for diving! @@ -145,7 +146,7 @@ BETA Version - Do NOT use for diving! BUGFIX: German text layout in Divemode NEW: Always show numeric velocity... -NEW: OLED Brightness setting +NEW: DISPLAY Brightness setting New in 2.04 beta: BETA Version - Do NOT use for diving! diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/color_processor.asm --- a/code_part1/OSTC_code_asm_part1/color_processor.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/color_processor.asm Fri Jan 25 18:00:49 2013 +0100 @@ -53,7 +53,7 @@ ;Temporary overlay (in bank 0), ACCESS area CBLOCK 0x000 img_colors - img_width:2 ; SHOULD be @1, because of PLED_box_write + img_width:2 ; SHOULD be @1, because of DISP_box_write img_pixelsL img_pixelsH img_pixelsU @@ -100,7 +100,7 @@ clrf img_width+1 ; x2 on width, for the true box size. rlcf img_width+0 rlcf img_width+1 - call PLED_box_write + call DISP_box_write AA_CMD_WRITE 0x22 ;---- Decode pixels -------------------------------------------------- diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/customview.asm --- a/code_part1/OSTC_code_asm_part1/customview.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Fri Jan 25 18:00:49 2013 +0100 @@ -107,18 +107,18 @@ return customview_1sec_average: - goto PLED_total_average_show2 ; Update the figures only + goto DISP_total_average_show2 ; Update the figures only customview_1sec_stopwatch: btfsc gauge_mode ; In Gauge mode? bra customview_1sec_stopwatch_gauge; Yes bsf menu3_active ; Set Flag - goto PLED_stopwatch_show2 ; Update figures only + goto DISP_stopwatch_show2 ; Update figures only customview_1sec_stopwatch_gauge: bsf menu3_active ; Set Flag - goto PLED_stopwatch_show_gauge ; Update figures + Description + goto DISP_stopwatch_show_gauge ; Update figures + Description customview_1sec_marker: ; Do nothing extra customview_1sec_show_change_gf: ; Do nothing extra @@ -135,20 +135,20 @@ call deco_calc_desaturation_time ; calculate desaturation time movlb b'00000001' ; select ram bank 1 - goto PLED_tissue_saturation_graph + goto DISP_tissue_saturation_graph customview_1sec_ead_end: - goto PLED_show_end_ead_divemode + goto DISP_show_end_ead_divemode customview_1sec_@5: - goto PLED_show_@5 + goto DISP_show_@5 customview_1sec_cave_bailout: bsf menu3_active ; Set Flag - goto PLED_show_cave_bailout + goto DISP_show_cave_bailout customview_1sec_pSCR_ppO2: - goto PLED_show_pSCR_ppO2 ; Yes, compute and show value + goto DISP_show_pSCR_ppO2 ; Yes, compute and show value ;============================================================================= @@ -183,10 +183,10 @@ return customview_minute_clock: - goto PLED_diveclock2 ; Update the clock + goto DISP_diveclock2 ; Update the clock customview_minute_lead_tiss: - goto PLED_show_leading_tissue_2 ; Update the leading tissue + goto DISP_show_leading_tissue_2 ; Update the leading tissue customview_minute_show_change_gf: ; Do nothing extra customview_minute_cave_bailout: ; Do nothing extra @@ -217,7 +217,7 @@ clrf menupos3 ; Reset to zero (Zero=no custom view) customview_mask: - call PLED_clear_customview_divemode + call DISP_clear_customview_divemode bcf tts_extra_time ; By default, CLEAR computation of @5 request. movff menupos3,WREG ; Menupos3 holds number of customview function @@ -248,7 +248,7 @@ bra customview_toggle_exit customview_init_average: - call PLED_total_average_show ; Show Average with mask + call DISP_total_average_show ; Show Average with mask bra customview_toggle_exit customview_init_stopwatch: @@ -259,24 +259,24 @@ btfsc gauge_mode ; In Gauge mode? bra customview_init_stopwatch_gauge ; Yes - call PLED_stopwatch_show ; Init Stopwatch display + call DISP_stopwatch_show ; Init Stopwatch display bsf menu3_active ; Set Flag bra customview_toggle_exit customview_init_stopwatch_gauge: - call PLED_stopwatch_show_gauge ; Init Stopwatch display + call DISP_stopwatch_show_gauge ; Init Stopwatch display bsf menu3_active ; Set Flag bra customview_toggle_exit customview_init_marker: ; Init Marker btfsc gauge_mode ; In Gauge mode? - call PLED_clear_divemode_menu; Yes, clear BIG stopwatch + call DISP_clear_divemode_menu; Yes, clear BIG stopwatch GETCUSTOM8 d'50' ; Show Marker? (=1 in WREG) decfsz WREG,F ; WREG=1? bra customview_toggle ; No, use next Customview - call PLED_standard_color + call DISP_standard_color DISPLAYTEXT d'151' ; Set Marker? bsf menu3_active ; Set Flag @@ -287,11 +287,11 @@ cpfseq AlarmType ; Marker recently set? bra customview_toggle_exit ; No - call PLED_marker_set ; Show some feedback + call DISP_marker_set ; Show some feedback bra customview_toggle_exit customview_init_clock: ; Init Clock - call PLED_diveclock + call DISP_diveclock bra customview_toggle_exit customview_init_lead_tissue: ; Show leading tissue @@ -302,14 +302,14 @@ btfsc no_deco_customviews ; no-deco-mode-flag = 1 bra customview_toggle ; Yes, use next Customview! - call PLED_show_leading_tissue + call DISP_show_leading_tissue bra customview_toggle_exit customview_init_ead_end: btfsc no_deco_customviews ; no-deco-mode-flag = 1 bra customview_toggle ; Yes, use next Customview! - call PLED_show_end_ead_divemode + call DISP_show_end_ead_divemode bra customview_toggle_exit customview_init_@5: @@ -327,7 +327,7 @@ movlw 1 movwf apnoe_mins ; Start compute after next cycle. bsf tts_extra_time - call PLED_show_@5 ; Show (wait) + call DISP_show_@5 ; Show (wait) bra customview_toggle_exit @@ -338,7 +338,7 @@ bz customview_toggle ; No: jump to next Customview ! bsf menu3_active ; Set Flag - call PLED_show_cave_bailout + call DISP_show_cave_bailout bra customview_toggle_exit customview_init_graphs: ; Show tissue graph @@ -354,7 +354,7 @@ call deco_calc_desaturation_time ; calculate desaturation time movlb b'00000001' ; select ram bank 1 - call PLED_tissue_saturation_graph + call DISP_tissue_saturation_graph bra customview_toggle_exit @@ -366,7 +366,7 @@ btfsc no_deco_customviews ; no-deco-mode-flag = 1 bra customview_toggle ; Yes, use next Customview! - call PLED_show_pSCR_ppO2 ; Yes, compute and show value + call DISP_show_pSCR_ppO2 ; Yes, compute and show value bra customview_toggle_exit @@ -383,7 +383,7 @@ bra customview_toggle_exit bsf menu3_active ; Set Flag - call PLED_show_gf_customview ; Show info + call DISP_show_gf_customview ; Show info bra customview_toggle_exit customview_toggle_exit: @@ -402,7 +402,7 @@ bra surfcustomview_mask ; No, show clrf menupos3 ; Reset to zero (Zero=no custom view) surfcustomview_mask: - call PLED_clear_customview_surfmode + call DISP_clear_customview_surfmode movff menupos3,WREG ; Menupos3 holds number of customview function dcfsnz WREG,F bra surfcustomview_init_graphs ; Show the tissue graphs @@ -420,21 +420,21 @@ btfsc no_deco_customviews ; no-deco-mode-flag = 1 bra surfcustomview_toggle ; Yes, use next Customview! - call PLED_tissue_saturation_graph; Draw the graphs + call DISP_tissue_saturation_graph; Draw the graphs bra surfcustomview_toggle_exit surfcustomview_init_gaslist: btfsc no_deco_customviews ; no-deco-mode-flag = 1 bra surfcustomview_toggle ; Yes, use next Customview! - call PLED_pre_dive_screen ; Show the Gaslist/Setpoint list + call DISP_pre_dive_screen ; Show the Gaslist/Setpoint list bra surfcustomview_toggle_exit surfcustomview_init_interval: - call PLED_standard_color + call DISP_standard_color DISPLAYTEXT d'189' ; Surface DISPLAYTEXT d'240' ; Interval: - call PLED_interval ; Display the interval + call DISP_interval ; Display the interval bra surfcustomview_toggle_exit surfcustomview_init_cfview: @@ -442,19 +442,19 @@ incf EEDATA,W ; +1 -> WREG movwf temp10 dcfsnz temp10,F - call PLED_show_cf11_cf12_cf29 ; =0 (ZH-L16 OC) + call DISP_show_cf11_cf12_cf29 ; =0 (ZH-L16 OC) dcfsnz temp10,F bra surfcustomview_toggle_exit ; =1 (Gauge) dcfsnz temp10,F - call PLED_show_cf11_cf12_cf29 ; =2 (ZH-L16 CC) + call DISP_show_cf11_cf12_cf29 ; =2 (ZH-L16 CC) dcfsnz temp10,F bra surfcustomview_toggle_exit ; =3 (Apnoe) dcfsnz temp10,F - call PLED_show_cf32_cf33_cf29 ; =4 (L16-GF OC) + call DISP_show_cf32_cf33_cf29 ; =4 (L16-GF OC) dcfsnz temp10,F - call PLED_show_cf32_cf33_cf29 ; =5 (L16-GF CC) + call DISP_show_cf32_cf33_cf29 ; =5 (L16-GF CC) dcfsnz temp10,F - call PLED_show_cf32_cf33_cf62_cf63 ; =6 (pSCR-GF) + call DISP_show_cf32_cf33_cf62_cf63 ; =6 (pSCR-GF) bra surfcustomview_toggle_exit @@ -502,13 +502,13 @@ surfcustomview_minute_graphs: call deco_calc_desaturation_time ; calculate desaturation time movlb b'00000001' ; select ram bank 1 - call PLED_tissue_saturation_graph ; Draw/Update the graphs + call DISP_tissue_saturation_graph ; Draw/Update the graphs return surfcustomview_minute_interval: DISPLAYTEXT d'189' ; Surface DISPLAYTEXT d'240' ; Interval: - call PLED_interval ; Display the interval + call DISP_interval ; Display the interval return surfcustomview_minute_gaslist: ; Do nothing extra diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/debugcodes.txt --- a/code_part1/OSTC_code_asm_part1/debugcodes.txt Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/debugcodes.txt Fri Jan 25 18:00:49 2013 +0100 @@ -1,33 +1,33 @@ Byte38 im EEPROM=1: -a - PLED Serial and Firmware version updated -b - PLED Ambient pressure updated -c - PLED Clock updated -e - PLED Temperature updated -d - PLED Date updated -f - PLED Battery voltage updated -g - PLED NoFly time updated -h - PLED Desaturation time updated -h - PLED Tissue saturation graph divemode updated -i - PLED Tissue saturation graph surfacemode updated -j - PLED const. ppO2 value surfacemode updated -k - PLED cns value updated -l - PLED Divemenu cursor updated -m - PLED Divemode gaslist updated -n - PLED Decoplan updated -o - PLED Divemode menu updated -p - PLED max Depth updated -q - PLED Surfacemode startgas updated -r - PLED Depth updated -s - PLED Divemode active gas updated -t - PLED ppO2 value divemode updated -u - PLED Temperature divemode updated -v - PLED Velocity updated -w - PLED Gradient Factor updated -x - PLED complete ascend time updated -y - PLED decompression updated -z - PLED NDL updated -A - PLED Divetime updated +a - DISP Serial and Firmware version updated +b - DISP Ambient pressure updated +c - DISP Clock updated +e - DISP Temperature updated +d - DISP Date updated +f - DISP Battery voltage updated +g - DISP NoFly time updated +h - DISP Desaturation time updated +h - DISP Tissue saturation graph divemode updated +i - DISP Tissue saturation graph surfacemode updated +j - DISP const. ppO2 value surfacemode updated +k - DISP cns value updated +l - DISP Divemenu cursor updated +m - DISP Divemode gaslist updated +n - DISP Decoplan updated +o - DISP Divemode menu updated +p - DISP max Depth updated +q - DISP Surfacemode startgas updated +r - DISP Depth updated +s - DISP Divemode active gas updated +t - DISP ppO2 value divemode updated +u - DISP Temperature divemode updated +v - DISP Velocity updated +w - DISP Gradient Factor updated +x - DISP complete ascend time updated +y - DISP decompression updated +z - DISP NDL updated +A - DISP Divetime updated B - Decompression algorithm started C - Decompression algorithm finished D - Profile Sample stored diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Fri Jan 25 18:00:49 2013 +0100 @@ -138,13 +138,14 @@ letter res .26 ;letter buffer win_color1 res 1 win_color2 res 1 +win_color3 res 1 win_top res 1 ; Box/text position (0..239). win_height res 1 ; Box/text height (1..240) win_leftx2 res 1 ; Box/text position (0..159) win_width res 1 ; box width (1..160) win_font res 1 win_invert res 1 -win_bargraph res 1 ; PLED_box swicth to black after this position (0..159). +win_bargraph res 1 ; DISP_box swicth to black after this position (0..159). win_flags res 1 ; flip_screen flag, transparent fonts, etc... pressureSum res 2 ; Stabilize surface presure by a long averaging window [mbar] @@ -196,11 +197,12 @@ flag13 res 1 flag14 res 1 flag15 res 1 +flag16 res 1 -oled1_temp res 1 ; Temp variables for display output -oled2_temp res 1 -oled3_temp res 1 -oled4_temp res 1 ; Used in "Displaytext" +DISPLAY1_temp res 1 ; Temp variables for display output +DISPLAY2_temp res 1 +DISPLAY3_temp res 1 +DISPLAY4_temp res 1 ; Used in "Displaytext" global hi,lo ; Make them visible from C-code lo res 1 ; bin to dec conversion routine @@ -341,7 +343,7 @@ apnoe_surface_secs res 1 ; Surface interval secs for Apnoe mode customfunction_temp1 res 1 ; used in GETCUSTOM8 and GETCUSTOM15 -decoplan_page res 1 ; used in PLED_MultiGF,... +decoplan_page res 1 ; used in DISP_MultiGF,... temp10 res 2 ; used in customview fatal_error_code res 1 ; holds error code value @@ -370,7 +372,7 @@ movff WREG,temp10+0 movlw high(tag) movff WREG,temp10+1 - call PLED_resetdebugger + call DISP_resetdebugger @end: Endif ENDM @@ -397,36 +399,37 @@ ;I/O Ports (I=Input, O=Output) ; #DEFINE sensor_SDO PORTA,1 ;O -#DEFINE oled_rw PORTA,2 ;0 -#DEFINE oled_hv PORTA,3 ;O +#DEFINE DISPLAY_rw PORTA,2 ;0 +#DEFINE DISPLAY_hv PORTA,3 ;O #DEFINE sensor_SDI PORTA,4 ;I -#DEFINE oled_cs PORTA,5 ;O +#DEFINE DISPLAY_cs PORTA,5 ;O #DEFINE sensor_CLK PORTA,7 ;O #DEFINE SWITCH2 PORTB,0 ;I (Right) #DEFINE SWITCH1 PORTB,1 ;I (Left) -#DEFINE oled_vdd PORTB,2 ;O +#DEFINE DISPLAY_vdd PORTB,2 ;O #DEFINE LED_blue PORTB,3 ;0 #DEFINE LED_red PORTB,4 ;O #DEFINE CHRG_OUT PORTC,1 ;O #DEFINE CHRG_IN PORTC,2 ;I -#DEFINE oled_d1 PORTD,0 ;O -#DEFINE oled_d2 PORTD,1 ;O -#DEFINE oled_d3 PORTD,2 ;O -#DEFINE oled_d4 PORTD,3 ;O -#DEFINE oled_d5 PORTD,4 ;O -#DEFINE oled_d6 PORTD,5 ;O -#DEFINE oled_d7 PORTD,6 ;O -#DEFINE oled_d8 PORTD,7 ;O +#DEFINE DISPLAY_d1 PORTD,0 ;O +#DEFINE DISPLAY_d2 PORTD,1 ;O +#DEFINE DISPLAY_d3 PORTD,2 ;O +#DEFINE DISPLAY_d4 PORTD,3 ;O +#DEFINE DISPLAY_d5 PORTD,4 ;O +#DEFINE DISPLAY_d6 PORTD,5 ;O +#DEFINE DISPLAY_d7 PORTD,6 ;O +#DEFINE DISPLAY_d8 PORTD,7 ;O -#DEFINE oled_rs PORTE,0 ;0 -#DEFINE oled_nreset PORTE,1 ;0 -#DEFINE oled_e_nwr PORTE,2 ;0 +#DEFINE DISPLAY_rs PORTE,0 ;0 +#DEFINE DISPLAY_nreset PORTE,1 ;0 +#DEFINE DISPLAY_e_nwr PORTE,2 ;0 ; Bank0 flags -#DEFINE win_flip_screen win_flags,0 ; 180° rotation of the OLED screen. +#DEFINE win_flip_screen win_flags,0 ; 180° rotation of the DISPLAY screen. +#DEFINE win_display_type win_flags,1 ; =1: Display1, =0: Display0 ; Flags #DEFINE tts_extra_time flag1,0 ; Showing "Future TTS" customview @@ -470,7 +473,7 @@ #DEfINE timeout_display flag5,0 ; =1: The divemode timeout is displayed #DEFINE eeprom_blockwrite flag5,1 ; EEPROM blockwrite active -#DEFINE oled_brightness_high flag5,2 ; =1: High brightness, =0: Eco mode +#DEFINE DISPLAY_brightness_high flag5,2 ; =1: High brightness, =0: Eco mode #DEFINE low_battery_state flag5,3 ;=1 if battery low #DEFINE DP_done flag5,4 ; valconv #DEFINE DP_done2 flag5,5 ; valconv @@ -544,7 +547,7 @@ #DEFINE button_delay_done flag13,1 ;=1: Button was pressed for more then 500ms, start counting #DEFINE display_set_active flag13,2 ;=1: De/Activate gases underwater menu is visible #DEFINE deco_mode_changed flag13,3 ;=1: The Decomode was changes, show decomode description! -#DEFINE pled_velocity_display flag13,4 ;=1: Velocity is displayed +#DEFINE DISP_velocity_display flag13,4 ;=1: Velocity is displayed #DEFINE depth_greater_100m flag13,5 ;=1: Depth is greater then 100m #DEFINE display_set_setpoint flag13,6 ;=1: SetPoint list active #DEFINE toggle_customview flag13,7 ;=1: Next customview diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/display_lowlevel.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code_part1/OSTC_code_asm_part1/display_lowlevel.asm Fri Jan 25 18:00:49 2013 +0100 @@ -0,0 +1,1377 @@ +; OSTC - diving computer code +; Copyright (C) 2009 HeinrichsWeikamp GbR + +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. + +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. + +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . + + +; written by: Matthias Heinrichs, info@heinrichsweikamp.com +; written: 090801 +; History: +; 2009-08-30: [MH] last updated. +; 2011-01-07: [jDG] Added flip_screen option +; known bugs: pixel-write (loogbok curves) not done yet... +; ToDo: + +WIN_FONT macro win_font_input + movlw win_font_input + movff WREG,win_font + endm + +WIN_TOP macro win_top_input + movlw win_top_input + movff WREG,win_top + endm + +WIN_LEFT macro win_left_input + movlw win_left_input + movff WREG,win_leftx2 + endm + +WIN_INVERT macro win_invert_input + movlw win_invert_input + movff WREG,win_invert + endm + +WIN_COLOR macro win_color_input + movlw win_color_input + call DISP_set_color + endm + +;============================================================================= + +word_processor: ; word_processor: + clrf POSTINC2 ; Required, to mark end of string. + call aa_wordprocessor + movlb b'00000001' ; Back to Rambank1 + return + +;============================================================================= +; Macro to provides our own interface code. +; +PIXEL_WRITE macro colRegister, rowRegister + movff colRegister,win_leftx2 + movff rowRegister,win_top + call pixel_write + endm + +INIT_PIXEL_WROTE macro colRegister + movff colRegister,win_leftx2 + call init_pixel_write + endm + +HALF_PIXEL_WRITE macro rowRegister + movff rowRegister,win_top + call half_pixel_write + endm + +;----------------------------------------------------------------------------- +; Init for half_pixel_write +; Set column register on DISPLAY device, and current color. +; Inputs: win_leftx2 +; Outputs: win_color:2 +; Trashed: WREG, PROD +init_pixel_write: + movff win_leftx2,WREG + mullw 2 + rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) + goto DISP_standard_color + +;----------------------------------------------------------------------------- +; Writes two half-pixels at position (win_top,win_leftx2) +; Inputs: win_leftx2, win_top, win_color:2 +; Trashed: WREG, PROD +pixel_write: + movff win_leftx2,WREG + mullw 2 + rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) + rcall half_pixel_write ; Write this half-one. + + movff win_leftx2,WREG ; Address of next one + mullw 2 + infsnz PRODL ; +1 + incf PRODH + rcall pixel_write_col320 + bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because + ; of the autoincrement going vertical + + ;---- Do the 16bit 319-X-->X, if needed, and send to DISPLAY ------------ +pixel_write_col320: + movff win_flags,WREG ; BEWARE: bank0 bit-test + btfss WREG,0 ; 180° rotation ? + bra pixel_write_noflip_H + + movf PRODL,W ; 16bits 319 - PROD --> PROD + sublw LOW(.319) ; 319-W --> W + movwf PRODL + movf PRODH,W + btfss STATUS,C ; Borrow = /CARRY + incf WREG + sublw HIGH(.319) + movwf PRODH + +pixel_write_noflip_H: + movlw 0x21 ; Start Address Vertical (.0 - .319) + rcall DISP_CmdWrite + bra DISP_DataWrite_PROD + +;----------------------------------------------------------------------------- +; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). +; Inputs: win_leftx2, win_top, win_height, win_color:2 +; Trashed: WREG, PROD, TABLAT, TBLPTRL +half_vertical_line: + clrf TABLAT ; Loop index. + +half_vertical_line_loop: + movff win_leftx2,WREG ; Init X position. + mullw 2 + movf TABLAT,W ; Get loop index + andlw 1 ; Just low bit + xorwf PRODL,F ; And use it to jitter current X position + rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) + + movff win_height,WREG ; Index reached height (Bank0 read) ? + xorwf TABLAT,W + btfsc STATUS,Z ; Equals ? + return ; Yes: done. + movff win_top,WREG ; Y = top + index (Bank0 read) + addwf TABLAT,W + rcall half_pixel_write_1 + incf TABLAT,F ; index++ + bra half_vertical_line_loop + +;----------------------------------------------------------------------------- +; Writes one half-pixel at position (win_top,win_leftx2). +; Inputs: win_leftx2, win_top, win_color:2 +; Trashed: WREG, PROD +half_pixel_write: + movff win_top,WREG ; d'0' ... d'239' + +; Variant with Y position in WREG. +half_pixel_write_1: + movff win_flags,PRODL ; BEWARE: bank0 bit-test + btfsc PRODL,0 ; 180° rotation ? + sublw .239 ; 239-Y --> Y + + mullw 1 ; Copy row to PRODH:L + movlw 0x20 ; Horizontal Address START:END + rcall DISP_CmdWrite + rcall DISP_DataWrite_PROD + + movlw 0x22 ; Start Writing Data to GRAM + rcall DISP_CmdWrite + bsf DISPLAY_rs ; Data! + movff win_color1, PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + movff win_color2, PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfss WREG,1 + return ; No, Done. + movff win_color3, PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + return + +; ----------------------------- +; DISP Display Off +; ----------------------------- +DISP_DisplayOff: + clrf PORTD + bcf DISPLAY_hv + bcf DISPLAY_vdd + bcf DISPLAY_cs + bcf DISPLAY_e_nwr + bcf DISPLAY_rw + bcf DISPLAY_nreset + return + +;============================================================================= +; Fast macros to write to DISPLAY display. +; Adding a call/return adds 3 words and a pipeline flush, hence make it +; nearly twice slower... +; +; Input : commande as macro parameter. +; Output : NONE +; Trash : WREG +; +AA_CMD_WRITE macro cmd + movlw cmd + rcall DISP_CmdWrite ; slow but saves a lot of bytes in flash + endm +; +; Input : data as macro parameter. +; Output : NONE +; Trash : WREG +; +AA_DATA_WRITE macro data + movlw data + rcall DISP_DataWrite + endm +; +; Input : PRODH:L as 16bits data. +; Output : NONE +; Trash : NONE +; +AA_DATA_WRITE_PROD macro + rcall DISP_DataWrite_PROD ; slow but saves a lot of bytes in flash + endm + +;============================================================================= +; Output DISPLAY Window Address commands. +; Inputs : win_top, win_leftx2, win_height, aa_width. +; Output : PortD commands. +; Trashed: PROD +; +DISP_box_write: + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + bra DISP_box_write_display1 ; Yes + + movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD + mullw 2 + + movff win_flags,WREG ; BEWARE: bank0 bit-test + btfsc WREG,0 ; 180° rotation ? + bra DISP_box_flip_H ; YES: + + ;---- Normal horizontal window --------------------------------------- + ; Output 0x35 left, + ; 0x36 right == left + width - 1. + AA_CMD_WRITE 0x35 ; this is the left border + AA_DATA_WRITE_PROD ; Output left + AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord. + AA_DATA_WRITE_PROD + + movf aa_width+0,W,ACCESS ; right = left + width - 1 + addwf PRODL,F + movf aa_width+1,W,ACCESS + addwfc PRODH,F + decf PRODL,F,A ; decrement result + btfss STATUS,C + decf PRODH,F,A + + AA_CMD_WRITE 0x36 ; Write and the right border + AA_DATA_WRITE_PROD + + bra DISP_box_noflip_H + + ;---- Flipped horizontal window -------------------------------------- +DISP_box_flip_H: + ; Output 0x36 flipped(left) = 319-left + ; 0x35 flipped(right) = 319-right = 320 - left - width + movf PRODL,W ; 16bits 319 - PROD --> PROD + sublw LOW(.319) ; 319-W --> W + movwf PRODL + movf PRODH,W + btfss STATUS,C ; Borrow = /CARRY + incf WREG + sublw HIGH(.319) + movwf PRODH + AA_CMD_WRITE 0x36 ; this is the left border + AA_DATA_WRITE_PROD ; Output left + AA_CMD_WRITE 0x21 + AA_DATA_WRITE_PROD + + movf aa_width+0,W ; 16bits PROD - width --> PROD + subwf PRODL,F ; PRODL - WREG --> PRODL + movf aa_width+1,W + subwfb PRODH,F + infsnz PRODL ; PROD+1 --> PROD + incf PRODH + AA_CMD_WRITE 0x35 ; this is the left border + AA_DATA_WRITE_PROD ; Output left + +DISP_box_noflip_H: + movff win_flags,WREG ; BEWARE: bank0 bit-test + btfsc WREG,0 ; 180° rotation ? + bra DISP_box_flip_V + + ;---- Normal vertical window ----------------------------------------- + ; Output 0x37 (top) (bottom) + movff win_top,PRODH ; top --> PRODH (first byte) + movff win_height,WREG + addwf PRODH,W + decf WREG + movwf PRODL ; top+height-1 --> PRODL (second byte) + + AA_CMD_WRITE 0x37 + AA_DATA_WRITE_PROD + + movff PRODH,PRODL + clrf PRODH ; Start pixel V coord == top. + AA_CMD_WRITE 0x20 + AA_DATA_WRITE_PROD + + return + + ;---- Flipped vertical window ---------------------------------------- + ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height + ; flipped(top) = 239-top +DISP_box_flip_V: + movff win_top,PRODL + movff win_height,WREG + addwf PRODL,W + sublw .240 ; 240 - top - height + movwf PRODH ; First byte + + movf PRODL,W + sublw .239 ; 249-top + movwf PRODL ; --> second byte. + + AA_CMD_WRITE 0x37 + AA_DATA_WRITE_PROD + + clrf PRODH ; Start pixel V coord. + AA_CMD_WRITE 0x20 + AA_DATA_WRITE_PROD + + return + +DISP_box_write_display1: + movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD + mullw 2 + + movlw 0x06 + rcall DISP_CmdWrite + movf PRODH,W + rcall DISP_DataWrite + movlw 0x07 + rcall DISP_CmdWrite + movf PRODL,W + rcall DISP_DataWrite + + movf aa_width+0,W,ACCESS ; right = left + width - 1 + addwf PRODL,F + movf aa_width+1,W,ACCESS + addwfc PRODH,F + decf PRODL,F,A ; decrement result + btfss STATUS,C + decf PRODH,F,A + + movlw 0x08 + rcall DISP_CmdWrite + movf PRODH,W + rcall DISP_DataWrite + movlw 0x09 + rcall DISP_CmdWrite + movf PRODL,W + rcall DISP_DataWrite + + ;---- Normal vertical window ----------------------------------------- + ; Output 0x37 (top) (bottom) + movff win_top,PRODH ; top --> PRODH (first byte) + movff win_height,WREG + addwf PRODH,W + decf WREG + movwf PRODL ; top+height-1 --> PRODL (second byte) + + movlw 0x02 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x03 + rcall DISP_CmdWrite + movf PRODH,W + rcall DISP_DataWrite + + + movlw 0x04 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x05 + rcall DISP_CmdWrite + movf PRODL,W + rcall DISP_DataWrite + return + +;============================================================================= +; DISP_frame : draw a frame around current box with current color. +; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 +; Outputs: (none) +; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 + global DISP_frame +DISP_frame: + movff win_top,aa_start+0 ; Backup everything. + movff win_height,aa_start+1 + movff win_leftx2,aa_end+0 + movff win_width,aa_end+1 + + ;---- TOP line ----------------------------------------------------------- + movlw 1 ; row ~ height=1 + movff WREG,win_height + rcall DISP_box + + ;---- BOTTOM line -------------------------------------------------------- + movff aa_start+0,PRODL ; Get back top, + movff aa_start+1,WREG ; and height + addwf PRODL,W ; top+height + decf WREG ; top+height-1 + movff WREG,win_top ; top+height-1 --> top + rcall DISP_box + + ;---- LEFT column -------------------------------------------------------- + movff aa_start+0,win_top ; Restore top/height. + movff aa_start+1,win_height + movlw 1 ; column ~ width=1 + movff WREG,win_width + rcall DISP_box + + ;---- RIGHT column ------------------------------------------------------- + movff aa_end+0,WREG + movff aa_end+1,PRODL + addwf PRODL,W + decf WREG + movff WREG,win_leftx2 + bra DISP_box + +;============================================================================= +; DISP_box : fills current box with current color. +; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 +; Outputs: (none) +; Trashed: WREG, PROD + + global DISP_box +DISP_box: + ;---- Define Window ------------------------------------------------------ + movff win_width,WREG + bcf STATUS,C + rlcf WREG + movwf aa_width+0 + movlw 0 + rlcf WREG + movwf aa_width+1 + rcall DISP_box_write + + ;---- Fill Window -------------------------------------------------------- + movlw 0x22 ; Start Writing Data to GRAM + rcall DISP_CmdWrite + + clrf PRODH ; Column counter. + bsf DISPLAY_rs ; Data! + +DISP_box2: ; Loop height times + movff win_height,PRODL + +DISP_box3: ; loop width times + movff win_color1,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + movff win_color2,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfss WREG,1 ; Display1? + bra DISP_box3a ; No + movff win_color3,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + +DISP_box3a: + movff win_color1,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + movff win_color2,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfss WREG,1 ; Display1? + bra DISP_box3b ; No + movff win_color3,PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + +DISP_box3b: + decfsz PRODL,F ; row loop finished ? + bra DISP_box3 ; No: continue. + + incf PRODH,F ; column count ++ + + movff win_bargraph,WREG ; current column == bargraph ? + cpfseq PRODH + bra DISP_box4 ; No: just loop. + + clrf WREG ; Yes: switch to black + movff WREG,win_color1 + movff WREG,win_color2 + movff WREG,win_color3 ; Yes. +DISP_box4: + movff win_width,WREG + cpfseq PRODH + bra DISP_box2 + + setf WREG ; Reset bargraph mode... + movff WREG,win_bargraph + + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + return ; Yes, done. + + movlw 0x00 ; NOP, to stop window mode + bra DISP_CmdWrite ; Returns.... + +;============================================================================= +; DISP_ClearScreen: An optimized version of PLEX_box, for full screen black. +; Trashed: WREG, PROD + + global DISP_ClearScreen +DISP_ClearScreen: + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + bra DISP_ClearScreen_display1; Yes + + movlw 0x35 ; VerticalStartAddress HIGH:LOW + rcall DISP_CmdWrite + mullw 0 + rcall DISP_DataWrite_PROD + + movlw 0x36 ; VerticalEndAddress HIGH:LOW + rcall DISP_CmdWrite + movlw 0x01 + rcall DISP_DataWrite + movlw 0x3F + rcall DISP_DataWrite + + movlw 0x37 ; HorizontalAddress START:END + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0xEF + rcall DISP_DataWrite + + movlw 0x20 ; Start Address Horizontal (.0 - .239) + rcall DISP_CmdWrite + rcall DISP_DataWrite_PROD + + movlw 0x21 ; Start Address Vertical (.0 - .319) + rcall DISP_CmdWrite + rcall DISP_DataWrite_PROD + + movlw 0x22 ; Start Writing Data to GRAM + rcall DISP_CmdWrite + + ; See Page 101 of DISPLAY Driver IC Datasheet how to handle rs/rw clocks + bsf DISPLAY_rs ; Data! + + movlw .160 + movwf PRODH +DISP_ClearScreen2: + movlw .240 + movwf PRODL +DISP_ClearScreen3: + + clrf PORTD ; Need to generate trace here too. + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + + clrf PORTD ; Need to generate trace here too. + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + + clrf PORTD ; Need to generate trace here too. + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + + clrf PORTD ; Need to generate trace here too. + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + + decfsz PRODL,F + bra DISP_ClearScreen3 + decfsz PRODH,F + bra DISP_ClearScreen2 + + movlw 0x00 ; NOP, to stop Address Update Counter + bra DISP_CmdWrite + +DISP_ClearScreen_display1: + ; Column Address start + movlw 0x02 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x03 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + +; Column Address end + movlw 0x04 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x05 + rcall DISP_CmdWrite + movlw 0xEF + rcall DISP_DataWrite + +; Row address start + movlw 0x06 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x07 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + +; Row address end + movlw 0x08 + rcall DISP_CmdWrite + movlw 0x01 + rcall DISP_DataWrite + movlw 0x09 + rcall DISP_CmdWrite + movlw 0x3F + rcall DISP_DataWrite + + movlw 0x22 ; Start Writing Data to GRAM + rcall DISP_CmdWrite + + bsf DISPLAY_rs ; Data! + + movlw .160 + movwf PRODH +DISP_ClearScreen2_display1: + movlw .240 + movwf PRODL + clrf PORTD ; Need to generate trace here too. +DISP_ClearScreen3_display1: + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + bcf DISPLAY_rw + bsf DISPLAY_rw ; High + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + bcf DISPLAY_rw + bsf DISPLAY_rw ; Upper + bcf DISPLAY_rw + bsf DISPLAY_rw ; High + bcf DISPLAY_rw + bsf DISPLAY_rw ; Lower + decfsz PRODL,F + bra DISP_ClearScreen3_display1 + decfsz PRODH,F + bra DISP_ClearScreen2_display1 + return + + +; ----------------------------- +; DISP Write Cmd via W +; ----------------------------- +DISP_CmdWrite: + bcf DISPLAY_rs ; Command! + movwf PORTD ; Move Data to PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw + return + +; ----------------------------- +; DISP Write Display Data via W +; ----------------------------- +DISP_DataWrite: + bsf DISPLAY_rs ; Data! + movwf PORTD ; Move Data to PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw + return + +; ----------------------------- +; DISP Data Cmd via W +; ----------------------------- +DISP_DataWrite_PROD: + bsf DISPLAY_rs ; Data! + movff PRODH,PORTD ; Move high byte to PORTD (DISPLAY is bigendian) + bcf DISPLAY_rw + bsf DISPLAY_rw + movff PRODL,PORTD ; Move low byte to PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfss WREG,1 ; Display1? + return ; No, done. + movff win_color3,PORTD ; Move low byte to PORTD + bcf DISPLAY_rw + bsf DISPLAY_rw + return + + +; ----------------------------- +; DISP Read data into WREG +; ----------------------------- +; NOTE: you should "setf TRISD" before calling this function, +; to make PortD an input port... +DISP_DataRead: + bsf DISPLAY_rs ; Data register. + bcf DISPLAY_e_nwr ; Read enable. + nop + nop + nop + nop + movf PORTD,W ; Read byte. + bsf DISPLAY_e_nwr ; release bus. + return + +; ----------------------------- +; DISP boot +; ----------------------------- +DISPLAY_boot: + movlw LOW 0x17FDC + movwf TBLPTRL + movlw HIGH 0x17FDC + movwf TBLPTRH + movlw UPPER 0x17FDC + movwf TBLPTRU + TBLRD* + movlw 0x01 + cpfseq TABLAT ; Display1? + bra display0_init ; No, Display0 + + banksel win_flags + bsf win_flags,0 + bsf win_flags,1 + banksel flag1 + bcf DISPLAY_hv ; Backlight off + nop + bcf DISPLAY_vdd + WAITMS d'10' + bsf DISPLAY_vdd + WAITMS d'100' + bsf DISPLAY_rw + nop + bcf DISPLAY_cs + nop + bsf DISPLAY_nreset + WAITMS d'1' + bcf DISPLAY_nreset + WAIT10US d'2' + bsf DISPLAY_nreset + WAITMS d'120' + bsf DISPLAY_e_nwr ; release bus. + rcall display1_init ; Init sequence + rcall DISP_ClearScreen + WAITMS d'60' + bsf DISPLAY_hv ; Backlight on + return + +display1_init: + movlw LOW display1_config_table + movwf TBLPTRL + movlw HIGH display1_config_table + movwf TBLPTRH + movlw UPPER display1_config_table + movwf TBLPTRU +display_init_loop: + TBLRD*+ + movlw 0xFF + cpfseq TABLAT + bra display_config_write ; Write Config pair to Display + ; Delay ms or quit (return) + TBLRD*+ + tstfsz TABLAT ; End of config? + bra $+4 ; No + return ; Done. + movf TABLAT,W + call WAITMSX ; Wait WREG milliseconds + bra display_init_loop ; Loop + +display_config_write: ; With command in WREG + movf TABLAT,W + rcall DISP_CmdWrite ; Write command + TBLRD*+ ; Get config + movf TABLAT,W + rcall DISP_DataWrite ; Write config + bra display_init_loop ; Loop + + +display1_config_table: + ; Reg, Dat or 0xFF, Delay or 0xFF, 0x00 (End) + db 0x96,0x01 + db 0x19,0x87 + db 0xFF,.10 + db 0x26,0x80 + db 0x1B,0x0C + db 0x43,0x00 + db 0x20,0x00 + db 0x1F,0x07 + db 0x44,0x7F + db 0x45,0x14 + db 0x1D,0x05 + db 0x1E,0x00 + db 0x1C,0x04 + db 0x1B,0x14 + db 0xFF,.40 + db 0x43,0x80 + db 0x42,0x08 + db 0x23,0x95 + db 0x24,0x95 + db 0x25,0xFF + db 0x21,0x10 + db 0x2B,0x00 + db 0x95,0x01 + db 0x1A,0x00 + db 0x93,0x0F + db 0x70,0x66 + db 0x18,0x01 + db 0x46,0x86 + db 0x47,0x60 + db 0x48,0x01 + db 0x49,0x67 + db 0x4A,0x46 + db 0x4B,0x13 + db 0x4C,0x01 + db 0x4D,0x67 + db 0x4E,0x00 + db 0x4F,0x13 + db 0x50,0x02 + db 0x51,0x00 + db 0x38,0x00 + db 0x39,0x00 + db 0x27,0x02 + db 0x28,0x03 + db 0x29,0x08 + db 0x2A,0x08 + db 0x2C,0x08 + db 0x2D,0x08 + db 0x35,0x09 + db 0x36,0x09 + db 0x91,0x14 + db 0x37,0x00 + db 0x01,0x06 + db 0x3A,0xA1 + db 0x3B,0xA1 + db 0x3C,0xA1 + db 0x3D,0x00 + db 0x3E,0x2D + db 0x40,0x03 + db 0x41,0xCC + db 0x0A,0x00 + db 0x0B,0x00 + db 0x0C,0x01 + db 0x0D,0x3F + db 0x0E,0x00 + db 0x0F,0x00 + db 0x10,0x01 + db 0x11,0x40 + db 0x12,0x00 + db 0x13,0x00 + db 0x14,0x00 + db 0x15,0x00 + db 0x02,0x00 + db 0x03,0x00 + db 0x04,0x00 + db 0x05,0xEF + db 0x06,0x00 + db 0x07,0x00 + db 0x08,0x01 + db 0x09,0x3F + db 0x16,0x88 + db 0x72,0x00 + db 0x22,0x60 + db 0x94,0x0A + db 0x90,0x7F + db 0x26,0x84 + db 0xFF,.40 + db 0x26,0xA4 + db 0x26,0xAC + db 0xFF,.40 + db 0x26,0xBC + db 0x96,0x00 + db 0xFF,0x00 ; End of table pair + + +display0_init: ; Display0 + banksel win_flags + bcf win_flags,1 + banksel flag1 + bcf DISPLAY_hv + WAITMS d'32' + bsf DISPLAY_vdd + nop + bcf DISPLAY_cs + nop + bsf DISPLAY_nreset +; WAITMS d'10' ; Quick wake-up + WAITMS d'250' ; Standard wake-up + bsf DISPLAY_e_nwr + nop + bcf DISPLAY_nreset + WAIT10US d'2' + bsf DISPLAY_nreset + WAITMS d'10' + + movlw 0x24 ; 80-System 8-Bit Mode + rcall DISP_CmdWrite + + movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) + rcall DISP_CmdWrite + movlw 0x00 ; X X X X X X X RM + rcall DISP_DataWrite + movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL + rcall DISP_DataWrite ; System Interface: RIM is ignored, Internal Clock + + movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) + rcall DISP_CmdWrite + movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color + rcall DISP_DataWrite + + ; Change direction for block-writes of pixels + lfsr FSR0,win_flags + btfss INDF0,0 ; BANK-SAFE bit test. + movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM + btfsc INDF0,0 + movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM + rcall DISP_DataWrite + + movlw 0x18 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x28 + rcall DISP_DataWrite + + movlw 0xF8 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x0F + rcall DISP_DataWrite + + movlw 0xF9 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x0F + rcall DISP_DataWrite + + movlw 0x10 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + +; Now Gamma settings... + rcall DISP_brightness_full + ;rcall DISP_brightness_low +; End Gamma Settings + + rcall DISP_ClearScreen + + bsf DISPLAY_hv + WAITMS d'32' + bsf DISPLAY_hv + WAITMS d'32' + bsf DISPLAY_hv + + movlw 0x05 + rcall DISP_CmdWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x01 + rcall DISP_DataWrite ; Display ON + return + + +DISP_brightness_full: ; Choose between Eco and High... + btfsc DISPLAY_brightness_high ; DISPLAY brightness (=0: Eco, =1: High) + bra DISP_brightness_full_high +; Mid + bsf PORTB,7 + bcf PORTB,6 + + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + return ; Yes, done. + + movlw 0x70 + rcall DISP_CmdWrite + movlw 0x1B + rcall DISP_DataWrite + movlw 0x80 + rcall DISP_DataWrite + movlw 0x71 + rcall DISP_CmdWrite + movlw 0x1F + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x72 + rcall DISP_CmdWrite + movlw 0x22 + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + + movlw 0x73 + rcall DISP_CmdWrite + movlw 0x17 + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + movlw 0x74 + rcall DISP_CmdWrite + movlw 0x1A + rcall DISP_DataWrite + movlw 0x0E + rcall DISP_DataWrite + + movlw 0x75 + rcall DISP_CmdWrite + movlw 0x1D + rcall DISP_DataWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x76 + rcall DISP_CmdWrite + movlw 0x18 + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + + movlw 0x77 + rcall DISP_CmdWrite + movlw 0x1E + rcall DISP_DataWrite + movlw 0x18 + rcall DISP_DataWrite + movlw 0x78 + rcall DISP_CmdWrite + movlw 0x1D + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + return + +DISP_brightness_full_high: +; Full + bsf PORTB,7 + bsf PORTB,6 + + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + return ; Yes, done. + + movlw 0x70 + rcall DISP_CmdWrite + movlw 0x1F + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x71 + rcall DISP_CmdWrite + movlw 0x23 + rcall DISP_DataWrite + movlw 0x80 + rcall DISP_DataWrite + movlw 0x72 + rcall DISP_CmdWrite + movlw 0x2A + rcall DISP_DataWrite + movlw 0x80 + rcall DISP_DataWrite + + movlw 0x73 + rcall DISP_CmdWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + movlw 0x74 + rcall DISP_CmdWrite + movlw 0x1C + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + + movlw 0x75 + rcall DISP_CmdWrite + movlw 0x1B + rcall DISP_DataWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x76 + rcall DISP_CmdWrite + movlw 0x1A + rcall DISP_DataWrite + movlw 0x15 + rcall DISP_DataWrite + + movlw 0x77 + rcall DISP_CmdWrite + movlw 0x1C + rcall DISP_DataWrite + movlw 0x18 + rcall DISP_DataWrite + movlw 0x78 + rcall DISP_CmdWrite + movlw 0x21 + rcall DISP_DataWrite + movlw 0x15 + rcall DISP_DataWrite + return + + +DISP_brightness_low: +;Low + bcf PORTB,7 + bcf PORTB,6 + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + return ; Yes, done. + + movlw 0x70 + rcall DISP_CmdWrite + movlw 0x14 + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x71 + rcall DISP_CmdWrite + movlw 0x17 + rcall DISP_DataWrite + movlw 0x00 + rcall DISP_DataWrite + movlw 0x72 + rcall DISP_CmdWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x80 + rcall DISP_DataWrite + + movlw 0x73 + rcall DISP_CmdWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x11 + rcall DISP_DataWrite + movlw 0x74 + rcall DISP_CmdWrite + movlw 0x14 + rcall DISP_DataWrite + movlw 0x0B + rcall DISP_DataWrite + + movlw 0x75 + rcall DISP_CmdWrite + movlw 0x1B + rcall DISP_DataWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x76 + rcall DISP_CmdWrite + movlw 0x13 + rcall DISP_DataWrite + movlw 0x0E + rcall DISP_DataWrite + + movlw 0x77 + rcall DISP_CmdWrite + movlw 0x1C + rcall DISP_DataWrite + movlw 0x18 + rcall DISP_DataWrite + movlw 0x78 + rcall DISP_CmdWrite + movlw 0x15 + rcall DISP_DataWrite + movlw 0x0E + rcall DISP_DataWrite + + return + +DISP_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB' + movwf DISPLAY1_temp ; Get 8Bit RGB b'RRRGGGBB' + movwf DISPLAY2_temp ; Copy + + movff win_flags,WREG ; Display1? win_flags is in bank0... + btfsc WREG,1 ; Display1? + bra DISP_set_color_display1 ; Yes + + ; Display0 + ; Mask Bit 7,6,5,4,3,2 + movlw b'00000011' + andwf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'01010000' + dcfsnz DISPLAY2_temp,F + movlw b'10100000' + dcfsnz DISPLAY2_temp,F + movlw b'11111000' + movwf DISPLAY3_temp ; Blue done. + + movff DISPLAY1_temp, DISPLAY2_temp ; Copy + ; Mask Bit 7,6,5,1,0 + movlw b'00011100' + andwf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'00000100' + dcfsnz DISPLAY2_temp,F + movlw b'00001000' + dcfsnz DISPLAY2_temp,F + movlw b'00001100' + dcfsnz DISPLAY2_temp,F + movlw b'00010000' + dcfsnz DISPLAY2_temp,F + movlw b'00010100' + dcfsnz DISPLAY2_temp,F + movlw b'00100000' + dcfsnz DISPLAY2_temp,F + movlw b'00111111' + movwf DISPLAY4_temp + + rrcf DISPLAY4_temp,F + rrcf DISPLAY3_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY3_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY3_temp,F ; DISPLAY3_temp (b'GGGBBBBB') done. + + movff DISPLAY1_temp, DISPLAY2_temp ; Copy + clrf DISPLAY1_temp + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F ; Green done. + + ; Mask Bit 4,3,2,1,0 + movlw b'11100000' + andwf DISPLAY2_temp,F + + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'00000100' + dcfsnz DISPLAY2_temp,F + movlw b'00001000' + dcfsnz DISPLAY2_temp,F + movlw b'00001100' + dcfsnz DISPLAY2_temp,F + movlw b'00010000' + dcfsnz DISPLAY2_temp,F + movlw b'00010100' + dcfsnz DISPLAY2_temp,F + movlw b'00100000' + dcfsnz DISPLAY2_temp,F + movlw b'00111111' + movwf DISPLAY4_temp + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F + + rrcf DISPLAY4_temp,F + rrcf DISPLAY1_temp,F ; Red done. + + movff DISPLAY1_temp,win_color1 + movff DISPLAY3_temp,win_color2 ; Set Bank0 Color registers... + return + +DISP_set_color_display1: + ; Mask Bit 7,6,5,4,3,2 + movlw b'00000011' + andwf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'01010000' + dcfsnz DISPLAY2_temp,F + movlw b'10100000' + dcfsnz DISPLAY2_temp,F + movlw b'11111000' +; movwf DISPLAY3_temp ; Blue done. + movff WREG,win_color3 ; B + + movff DISPLAY1_temp, DISPLAY2_temp ; Copy + ; Mask Bit 7,6,5,1,0 + movlw b'00011100' + andwf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'00010000' + dcfsnz DISPLAY2_temp,F + movlw b'00100000' + dcfsnz DISPLAY2_temp,F + movlw b'00110000' + dcfsnz DISPLAY2_temp,F + movlw b'01000000' + dcfsnz DISPLAY2_temp,F + movlw b'01010000' + dcfsnz DISPLAY2_temp,F + movlw b'10000000' + dcfsnz DISPLAY2_temp,F + movlw b'11111100' +; movwf DISPLAY4_temp + movff WREG,win_color2 ; G + + movff DISPLAY1_temp, DISPLAY2_temp ; Copy + ; Mask Bit 4,3,2,1,0 + movlw b'11100000' + andwf DISPLAY2_temp,F + + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + rrncf DISPLAY2_temp,F + + movlw b'00000000' + dcfsnz DISPLAY2_temp,F + movlw b'00010000' + dcfsnz DISPLAY2_temp,F + movlw b'00100000' + dcfsnz DISPLAY2_temp,F + movlw b'00110000' + dcfsnz DISPLAY2_temp,F + movlw b'01000000' + dcfsnz DISPLAY2_temp,F + movlw b'01010000' + dcfsnz DISPLAY2_temp,F + movlw b'10000000' + dcfsnz DISPLAY2_temp,F + movlw b'11111100' +; movwf DISPLAY4_temp + movff WREG,win_color1 ; R + return diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Fri Jan 25 18:00:49 2013 +0100 @@ -32,10 +32,10 @@ ; Startup Tasks for all modes ostc_debug 'R' ; Sends debug-information to screen if debugmode active - call PLED_ClearScreen ; clean up OLED - call PLED_divemode_mask ; Display mask - call PLED_temp_divemode ; Displays temperature - call PLED_active_gas_divemode ; Display gas + call DISP_ClearScreen ; clean up DISPLAY + call DISP_divemode_mask ; Display mask + call DISP_temp_divemode ; Displays temperature + call DISP_active_gas_divemode ; Display gas ; Reload last customview read_int_eeprom d'94' ; Read last selected customview dive mode into EEDATA @@ -51,7 +51,7 @@ bra diveloop_loop ; Skip in apnoe mode ; Startup Tasks for deco modes - call PLED_display_ndl_mask ; display "no stop" if not in gauge or apnoe mode + call DISP_display_ndl_mask ; display "no stop" if not in gauge or apnoe mode btfss FLAG_const_ppO2_mode ; only in const_ppO2_mode bra diveloop_loop ; OC modes, skip @@ -80,7 +80,7 @@ bra diveloop_loop1z ; No btfsc premenu ; Is the divemode menu active? bra diveloop_loop1z ; Yes - call PLED_divemins ; Display (new) divetime! + call DISP_divemins ; Display (new) divetime! diveloop_loop1z: bcf update_divetime ; clear flag @@ -89,7 +89,7 @@ ; Tasks only for OC modes btfsc show_safety_stop ; Show the safety stop? - call PLED_show_safety_stop ; Yes, show/delete if done. + call DISP_show_safety_stop ; Yes, show/delete if done. call check_ppO2 ; check ppO2 and displays warning if required call calc_deko_divemode ; calculate decompression and display result (any two seconds) bra diveloop_loop1x ; Common Tasks @@ -97,7 +97,7 @@ ; Tasks only for Gauge mode diveloop_loop1a: btfss premenu ; Is the divemode menu active? - call PLED_divemins ; display (new) divetime! + call DISP_divemins ; display (new) divetime! call customview_second ; Do every-second tasks for the custom view area call timeout_divemode ; dive finished? This routine sets the required flags @@ -122,8 +122,8 @@ ; Tasks only for ppO2 mode diveloop_loop1c: btfsc show_safety_stop ; Show the safety stop? - call PLED_show_safety_stop ; Yes, show/delete if done. - call PLED_const_ppO2_value ; display const ppO2 setting in [bar] + call DISP_show_safety_stop ; Yes, show/delete if done. + call DISP_const_ppO2_value ; display const ppO2 setting in [bar] call calc_deko_divemode ; calculate decompression and display result (any two seconds) btfsc is_bailout ; Are we in Bailout mode? call check_ppO2_bail ; Yes, display ppO2 (If required) @@ -145,7 +145,7 @@ ; bra diveloop_loop1z ; No ; btfsc premenu ; Is the divemode menu active? ; bra diveloop_loop1z ; Yes -; call PLED_divemins ; Display (new) divetime! +; call DISP_divemins ; Display (new) divetime! ; ;diveloop_loop1z: ; bcf update_divetime ; clear flag @@ -213,19 +213,19 @@ return ; No! bcf premenu ; Yes, so clear "Menu?" and clear pre_menu bit - call PLED_menu_clear ; Remove "Menu?" - call PLED_divemode_mask ; And redraw mask (Redraw missing "T" from "Tauchzeit" in german text version) - call PLED_divemins ; Redraw divetime + call DISP_menu_clear ; Remove "Menu?" + call DISP_divemode_mask ; And redraw mask (Redraw missing "T" from "Tauchzeit" in german text version) + call DISP_divemins ; Redraw divetime return divemode_apnoe_tasks: ; 1 sec. Apnoe tasks - call PLED_divemins ; display (new) divetime! - call PLED_display_apnoe_descent ; Show descent timer + call DISP_divemins ; display (new) divetime! + call DISP_display_apnoe_descent ; Show descent timer btfsc divemode2 ; Time running? bra divemode_apnoe_tasks2 ; New descent, reset data if flag is set - call PLED_display_apnoe_surface + call DISP_display_apnoe_surface incf apnoe_surface_secs,F movlw d'60' cpfseq apnoe_surface_secs @@ -247,7 +247,7 @@ call apnoe_calc_maxdepth ; Yes! divemode_apnoe_tasks3: - call PLED_apnoe_clear_surface ; Clear Surface timer + call DISP_apnoe_clear_surface ; Clear Surface timer clrf apnoe_timeout_counter ; Delete timeout clrf apnoe_surface_secs @@ -319,7 +319,7 @@ GETCUSTOM8 d'27' ; cns_display_high subwf lo,W btfsc STATUS,C - call PLED_display_cns ; Show CNS + call DISP_display_cns ; Show CNS call check_gas_change ; Checks if a better gas should be selected (by user) ;NOTE: always set full gas list, because the user can switch gas, @@ -466,8 +466,8 @@ return ; No, don't delete it bcf show_safety_stop ; Clear flag bcf safety_stop_active ; Clear flag - call PLED_clear_decoarea ; Yes, Clear stop - goto PLED_display_ndl_mask ; Show NDL again (And return) + call DISP_clear_decoarea ; Yes, Clear stop + goto DISP_display_ndl_mask ; Show NDL again (And return) ;----------------------------------------------------------------------------- ; calculate ppO2 in 0.01bar (e.g. 150 = 1.50 bar ppO2) @@ -610,13 +610,13 @@ bra calc_deko_divemode3 ; Yes! btfsc dekostop_active ; Already in nodeco mode ? - call PLED_display_ndl_mask ; Clear deco data, display nostop time + call DISP_display_ndl_mask ; Clear deco data, display nostop time bcf dekostop_active ; clear flag clrf decodata+0 ; for profile memory movff char_O_nullzeit,decodata+1 ; nostop time - call PLED_display_ndl ; display no deco limit + call DISP_display_ndl ; display no deco limit calc_deko_divemode5: ; Check if extra cycles are needed to compute @5 variant: @@ -635,13 +635,13 @@ calc_deko_divemode3: btfss dekostop_active ; Already in deco mode ? - call PLED_display_deko_mask ; clear nostop time, display decodata + call DISP_display_deko_mask ; clear nostop time, display decodata bsf dekostop_active ; Set flag movff char_O_first_deco_depth,decodata+0 ; ceiling movff char_O_first_deco_time,decodata+1 ; length of first stop in minues - call PLED_display_deko ; display decodata + call DISP_display_deko ; display decodata bra calc_deko_divemode5 ;----------------------------------------------------------------------------- @@ -970,11 +970,11 @@ cpfseq lo ; =1? bra update_velocity1 ; No - call PLED_display_velocity_graphical + call DISP_display_velocity_graphical return update_velocity1: - call PLED_display_velocity + call DISP_display_velocity return do_not_display_velocity: @@ -982,7 +982,7 @@ return bcf display_velocity ; Velocity was displayed, delete velocity now - call PLED_display_velocity_clear + call DISP_display_velocity_clear return check_ppO2: ; check current ppO2 and display warning if required @@ -1080,12 +1080,12 @@ btfss ppO2_display_active ; is the value displayed? bra check_ppO2_3 ; No, so clear not required - call PLED_show_ppO2_clear; Clear ppO2 value + call DISP_show_ppO2_clear; Clear ppO2 value bcf ppO2_display_active ; clear flag bra check_ppO2_3 ; done check_ppO2_2: - call PLED_show_ppO2 ; Display ppO2 (stored in xC) + call DISP_show_ppO2 ; Display ppO2 (stored in xC) bsf ppO2_display_active ; Set flag check_ppO2_3: @@ -1226,7 +1226,7 @@ bcf better_gas_available ; Yes, do not blink better gas check_gas_change7: - call PLED_active_gas_divemode; Display gas, if required (and with "*" if required...) + call DISP_active_gas_divemode; Display gas, if required (and with "*" if required...) return ;============================================================================= @@ -1707,7 +1707,7 @@ cpfseq last_temperature+1 bsf temp_changed ; Yes btfsc temp_changed - call PLED_temp_divemode ; Displays temperature + call DISP_temp_divemode ; Displays temperature bcf pres_changed ; Display new depth? SAFE_2BYTE_COPY amb_pressure, lo @@ -1722,13 +1722,13 @@ bsf pres_changed btfsc pres_changed - call PLED_depth ; Displays new depth + call DISP_depth ; Displays new depth return update_divemode60: ; update any minute call get_battery_voltage ; gets battery voltage call set_powersafe ; red LED blinking if battery is low - call PLED_max_pressure ; No, use normal max. depth + call DISP_max_pressure ; No, use normal max. depth call check_temp_extrema ; check for new temperature extremas call customview_minute ; Do every-minute tasks for the custom view area bcf oneminupdate @@ -1746,7 +1746,7 @@ ;max_pressure0, Normal = 0) movlw d'0' cpfsgt EEDATA - call PLED_brightness_full + call DISP_brightness_full bcf use_aGF bcf timeout_display diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/divemode_menu.asm --- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm Fri Jan 25 18:00:49 2013 +0100 @@ -95,10 +95,10 @@ test_switches_divemode2b: bsf menubit ; Enter Divemode-Menu! bcf premenu ; clear premenu flag - call PLED_clear_divemode_menu ; Clear dive mode menu area - call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask + call DISP_clear_divemode_menu ; Clear dive mode menu area + call DISP_divemode_menu_mask_first ; Write Divemode menu1 mask bcf display_set_simulator ; Clear Simulator-Menu flag - call PLED_divemenu_cursor ; show cursor + call DISP_divemenu_cursor ; show cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! return @@ -156,9 +156,9 @@ incf menupos,F ; No, +1, skip to menuos=4 test_switches_divemode_menu1a: - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor btfsc display_set_gas ; In Gaslist or Setpoint list menu? - call PLED_show_change_depth ; Yes, show change depth for gas #menupos + call DISP_show_change_depth ; Yes, show change depth for gas #menupos return test_switches_divemode_menu3: @@ -193,7 +193,7 @@ dcfsnz menupos,F bra divemode_menu3 ; Customview-function dcfsnz menupos,F - bra divemode_toggle_brightness ; Toggle OLED-Brightness + bra divemode_toggle_brightness ; Toggle DISPLAY-Brightness dcfsnz menupos,F bra timeout_divemenu2 ; Quit divemode menu bra timeout_divemenu2 ; Quit divemode menu @@ -268,37 +268,37 @@ tstfsz EEDATA ; Was dimmed? bra divemode_toggle_brightness1 ; Yes... - call PLED_brightness_low + call DISP_brightness_low movlw d'1' movwf EEDATA ; Copy to EEDATA write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) bra divemode_toggle_brightness3 divemode_toggle_brightness1: - call PLED_brightness_full + call DISP_brightness_full movlw d'0' movwf EEDATA ; Copy to EEDATA write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) divemode_toggle_brightness3: ; Now, redraw all outputs (All modes) - call PLED_active_gas_divemode ; Display gas, if required - call PLED_temp_divemode ; Displays temperature - call PLED_depth ; Displays new depth... - call PLED_max_pressure ; ...and max. depth + call DISP_active_gas_divemode ; Display gas, if required + call DISP_temp_divemode ; Displays temperature + call DISP_depth ; Displays new depth... + call DISP_max_pressure ; ...and max. depth bra timeout_divemenu2 ; quit menu! divemenu_de_activate: bsf display_set_active ; Set display flag bcf display_set_xgas ; Clear Flag - call PLED_clear_divemode_menu ; Clear Menu + call DISP_clear_divemode_menu ; Clear Menu - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist movlw d'1' movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor return divemenu_de_activate2: ; Toggle active flag @@ -323,52 +323,52 @@ btg gaslist_active,0 ; Toggle flag movlw d'2' movwf menupos ; reset cursor - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist return divemenu_de_activate2_g2: btg gaslist_active,1 ; Toggle flag movlw d'3' movwf menupos ; reset cursor - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist return divemenu_de_activate2_g3: btg gaslist_active,2 ; Toggle flag movlw d'4' movwf menupos ; reset cursor - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist return divemenu_de_activate2_g4: btg gaslist_active,3 ; Toggle flag movlw d'5' movwf menupos ; reset cursor - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist return divemenu_de_activate2_g5: btg gaslist_active,4 ; Toggle flag movlw d'6' movwf menupos ; reset cursor - call PLED_de_activelist ; show (de)active gaslist + call DISP_de_activelist ; show (de)active gaslist return divemode_set_xgas: ; Set the extra gas... bsf display_set_xgas ; Set Flag bcf display_set_gas ; Clear Flag - call PLED_clear_divemode_menu ; Clear Menu + call DISP_clear_divemode_menu ; Clear Menu movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas write_int_eeprom d'24' movff char_I_He_ratio, EEDATA write_int_eeprom d'25' - call PLED_divemode_set_xgas ; Show mask + call DISP_divemode_set_xgas ; Show mask movlw d'1' movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor return divemode_menu_simulator: @@ -377,11 +377,11 @@ call wait_switches ; Waits until switches are released, resets flag if button stays pressed! bsf display_set_simulator ; Set Flag bsf menu3_active ; So "+1" is accessible at all times - call PLED_clear_divemode_menu ; Clear Menu - call PLED_divemode_simulator_mask; Show mask + call DISP_clear_divemode_menu ; Clear Menu + call DISP_divemode_simulator_mask; Show mask movlw d'1' movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor return divemode_menu_simulator2: @@ -400,7 +400,7 @@ bra timeout_divemenu2 ; quit underwater menu! divemode_menu_simulator_common: - call PLED_divemode_simulator_mask ; Redraw Simualtor mask + call DISP_divemode_simulator_mask ; Redraw Simualtor mask ; Check limits (130m and 0m) movlw LOW d'14000' ; Compare to 14bar=14000mbar (130m). @@ -476,7 +476,7 @@ divemenu_see_decoplan: bsf display_see_deco ; set flag - call PLED_clear_divemode_menu ; Clear Menu + call DISP_clear_divemode_menu ; Clear Menu bcf last_ceiling_gf_shown ; Clear flag clrf decoplan_page ; Starts on page 0 @@ -489,7 +489,7 @@ divemenu_see_decoplan2_1: clrf timeout_counter3 ; Clear timeout Divemode menu - call PLED_decoplan ; Display the new screen + call DISP_decoplan ; Display the new screen return divemenu_see_decoplan2_0: @@ -523,7 +523,7 @@ movff lo, EEDATA write_int_eeprom d'25' ; He Value - call PLED_divemode_set_xgas ; Redraw menu + call DISP_divemode_set_xgas ; Redraw menu movlw d'5' movwf menupos ; reset cursor return @@ -550,7 +550,7 @@ movff lo, EEDATA write_int_eeprom d'25' ; He Value - call PLED_divemode_set_xgas ; Redraw menu + call DISP_divemode_set_xgas ; Redraw menu movlw d'4' movwf menupos ; reset cursor return @@ -570,7 +570,7 @@ movff lo, EEDATA write_int_eeprom d'24' ; O2 Value - call PLED_divemode_set_xgas ; Redraw menu + call DISP_divemode_set_xgas ; Redraw menu movlw d'3' movwf menupos ; reset cursor return @@ -597,7 +597,7 @@ movff lo, EEDATA write_int_eeprom d'24' ; O2 Value - call PLED_divemode_set_xgas ; Redraw menu + call DISP_divemode_set_xgas ; Redraw menu movlw d'2' movwf menupos ; reset cursor return @@ -620,7 +620,7 @@ clrf WREG movff WREG,char_O_deco_status ; Restart decoplan computation mH bsf is_bailout ;=1: CC mode, but bailout active! - clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" + clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail" movff lo,char_I_const_ppO2 movlw 6 movff WREG,char_I_current_gas ; Current gas is Gas6 (manual setting). @@ -632,28 +632,28 @@ divemenu_set_gas_2: bsf display_set_gas ; set flag - call PLED_clear_divemode_menu ; Clear Menu - call PLED_gas_list ; Display all 5 gases + call DISP_clear_divemode_menu ; Clear Menu + call DISP_gas_list ; Display all 5 gases movlw d'1' ; Reset cursor btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode movf better_gas_number,W ; better gas 1-5 movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor - call PLED_show_change_depth ; And show the first change depth + call DISP_divemenu_cursor ; update cursor + call DISP_show_change_depth ; And show the first change depth return divemenu_set_setpoint: bsf display_set_setpoint ; set flag bsf display_set_gas ; set flag - call PLED_clear_divemode_menu ; Clear Menu - call PLED_splist_start ; Display SetPoints + call DISP_clear_divemode_menu ; Clear Menu + call DISP_splist_start ; Display SetPoints DISPLAYTEXT d'137' ; Bailout (as a sub-menu) DISPLAYTEXT d'232' ; Diluent (as a sub-menu) movlw d'1' movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor return @@ -665,7 +665,7 @@ bra divemenu_set_gas2a ; no, choose gas ; Yes, so select SP 1-3 bcf is_bailout ;=1: CC mode, but bailout active! - call PLED_show_ppO2_clear ; Clear ppO2 value + call DISP_show_ppO2_clear ; Clear ppO2 value divemenu_set_gas1: movlw d'1' @@ -683,11 +683,11 @@ bcf display_set_setpoint ; Clear Flag bcf display_set_gas ; Clear Flag bsf display_set_diluent ; Set Flag - call PLED_clear_divemode_menu ; Clear Menu - call PLED_diluent_list ; Display all 5 diluents + call DISP_clear_divemode_menu ; Clear Menu + call DISP_diluent_list ; Display all 5 diluents movlw d'1' ; Reset cursor movwf menupos ; reset cursor - call PLED_divemenu_cursor ; update cursor + call DISP_divemenu_cursor ; update cursor return divemode_set_diluent2: ; Choose diluent #menupos @@ -746,7 +746,7 @@ divemenu_set_gas2b: bsf is_bailout ;=1: CC mode, but bailout active! - clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" + clrf lo ; clear Setpoint, DISP_const_ppO2_value now displayes "Bail" movff lo,char_I_const_ppO2 bcf display_set_gas ; clear flag @@ -801,7 +801,7 @@ timeout_divemenu2: ; quit divemode menu ; Restore some outputs clrf decoplan_page ; Page 0-1 of deco list - call PLED_clear_divemode_menu; Clear dive mode menu + call DISP_clear_divemode_menu; Clear dive mode menu btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode bra timeout_divemenu2b ; skip! @@ -810,17 +810,17 @@ bcf menubit btfsc dekostop_active - call PLED_display_deko_mask ; clear nostop time, display decodata + call DISP_display_deko_mask ; clear nostop time, display decodata btfss dekostop_active - call PLED_display_ndl_mask ; Clear deco data, display nostop time + call DISP_display_ndl_mask ; Clear deco data, display nostop time btfsc decoplan_invalid ; The decoplan needs to updated bra timeout_divemenu2a ; Yes, skip update btfsc dekostop_active - call PLED_display_deko ; Update deco display at once + call DISP_display_deko ; Update deco display at once btfss dekostop_active - call PLED_display_ndl ; Update NDL display at once + call DISP_display_ndl ; Update NDL display at once timeout_divemenu2a: btfsc safety_stop_active @@ -829,9 +829,9 @@ timeout_divemenu2b: bcf menubit bcf premenu ; Yes, clear flags and menu, display dive time and mask again - call PLED_active_gas_divemode; Display gas, if required - call PLED_divemode_mask ; Display mask - call PLED_divemins ; Display (new) divetime! + call DISP_active_gas_divemode; Display gas, if required + call DISP_divemode_mask ; Display mask + call DISP_divemins ; Display (new) divetime! call customview_mask ; Redraw current customview mask clrf timeout_counter3 ; Also clear timeout bcf display_see_deco ; clear all display flags @@ -850,12 +850,12 @@ movff char_O_deco_status,WREG ; Get last computation state (BANK safe) iorwf WREG ; Is it zero ? btfsc STATUS,Z - call PLED_decoplan ; Yes: new data available. + call DISP_decoplan ; Yes: new data available. bra timeout_divemenu1 ; Check timeout timeout_divemenu6: ; Update Simulator Mask bsf menu3_active ; So "+1" is accessible at all times - call PLED_divemode_simulator_mask; Show mask - call PLED_divemenu_cursor ; update cursor + call DISP_divemode_simulator_mask; Show mask + call DISP_divemenu_cursor ; update cursor bra timeout_divemenu1 ; Check timeout diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/dump_screen.asm --- a/code_part1/OSTC_code_asm_part1/dump_screen.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/dump_screen.asm Fri Jan 25 18:00:49 2013 +0100 @@ -58,7 +58,7 @@ dump_screen_0: - ;---- Send OLED box command for the full screen window ------------------- + ;---- Send DISPLAY box command for the full screen window ------------------- mullw 0 ; PRODH:L <- 0 AA_CMD_WRITE 0x35 ; VerticalStartAddress HIGH:LOW @@ -88,8 +88,8 @@ AA_DATA_WRITE_PROD ; 00:00 AA_CMD_WRITE 0x22 ; Start reading. - rcall PLED_DataRead ; Dummy pixel to skip. - rcall PLED_DataRead ; Dummy pixel to skip. + rcall DISP_DataRead ; Dummy pixel to skip. + rcall DISP_DataRead ; Dummy pixel to skip. movlw .160 ; 160x2 columns movwf ds_column @@ -106,9 +106,9 @@ movlw .240 ; 240 lines, once. movwf ds_line dump_screen_2: - rcall PLED_DataRead ; read pixel-high byte + rcall DISP_DataRead ; read pixel-high byte movwf PRODH - rcall PLED_DataRead ; read pixel-low byte + rcall DISP_DataRead ; read pixel-low byte movwf PRODL rcall dump_screen_pixel @@ -120,9 +120,9 @@ movlw .240 ; 240 lines, twice. movwf ds_line dump_screen_3: - rcall PLED_DataRead ; read pixel-high byte + rcall DISP_DataRead ; read pixel-high byte movwf PRODH - rcall PLED_DataRead ; read pixel-low byte + rcall DISP_DataRead ; read pixel-low byte movwf PRODL rcall dump_screen_pixel diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/eeprom_rs232.asm --- a/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm Fri Jan 25 18:00:49 2013 +0100 @@ -221,9 +221,9 @@ uart_115k_bootloader: bcf PIE1,RCIE ; disable interrupt for RS232 - call PLED_ClearScreen ; Clear screen + call DISP_ClearScreen ; Clear screen movlw color_red - call PLED_set_color ; Set to Red + call DISP_set_color ; Set to Red DISPLAYTEXTH d'302' ; Bootloader bcf RCSTA,CREN ; Clear receiver status bsf RCSTA,CREN diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/english_text.asm --- a/code_part1/OSTC_code_asm_part1/english_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -465,7 +465,7 @@ TCODE .94, .54, "Stopwatch" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "High" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/french_text.asm --- a/code_part1/OSTC_code_asm_part1/french_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/french_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -467,7 +467,7 @@ TCODE .116, .54, "Chrono" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Bail. Sout" ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "Forte" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/german_text.asm --- a/code_part1/OSTC_code_asm_part1/german_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -465,7 +465,7 @@ TCODE .109, .54, "Stoppuhr" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "Hoch" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/interface.asm --- a/code_part1/OSTC_code_asm_part1/interface.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/interface.asm Fri Jan 25 18:00:49 2013 +0100 @@ -116,8 +116,8 @@ bcf dump_external_eeprom ; clear flag bcf PIE1,RCIE ; No Interrupt for UART bsf LED_blue - call PLED_ClearScreen - call PLED_topline_box + call DISP_ClearScreen + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .15 ; "Interface" WIN_INVERT .0 ; Init new Wordprocessor diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/italian_text.asm --- a/code_part1/OSTC_code_asm_part1/italian_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/italian_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -465,7 +465,7 @@ TCODE .94, .54, "Cronometro" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "High" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu.asm --- a/code_part1/OSTC_code_asm_part1/menu.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu.asm Fri Jan 25 18:00:49 2013 +0100 @@ -34,10 +34,10 @@ movlw d'1' movwf menupos menu2: - call PLED_ClearScreen + call DISP_ClearScreen call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_menu_mask - call PLED_menu_cursor + call DISP_menu_mask + call DISP_menu_cursor menu_loop: call check_switches_menu @@ -94,7 +94,7 @@ refresh_cursor: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! return @@ -103,11 +103,11 @@ movwf menupos more_menu2: bcf leftbind - call PLED_ClearScreen + call DISP_ClearScreen more_menu3: call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_more_menu_mask - call PLED_menu_cursor + call DISP_more_menu_mask + call DISP_menu_cursor more_menu_loop: call check_switches_menu @@ -116,7 +116,7 @@ ; bra more_menu_loop2 ; movlw d'6' ; movwf menupos -; call PLED_menu_cursor +; call DISP_menu_cursor ;more_menu_loop2: btfsc menubit2 @@ -156,12 +156,12 @@ movwf menupos setup_menu2: bcf leftbind - call PLED_ClearScreen - call PLED_setup_menu_mask + call DISP_ClearScreen + call DISP_setup_menu_mask setup_menu3a: call menu_pre_loop_common ; Clear some menu flags, timeout and switches call show_decotype - call PLED_menu_cursor + call DISP_menu_cursor setup_menu_loop: call check_switches_menu @@ -255,10 +255,10 @@ btfss deco_mode_changed ; Was the decomode changed in Setup menu? goto restart ; No, restart to surfacemode - call PLED_ClearScreen + call DISP_ClearScreen deco_info_screen1: - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .235 ;Decomode changed! WIN_INVERT .0 ; Init new Wordprocessor @@ -292,14 +292,14 @@ movwf menupos more_setup_menu2: bcf leftbind - call PLED_ClearScreen - call PLED_more_setup_menu_mask + call DISP_ClearScreen + call DISP_more_setup_menu_mask more_setup_menu3a: call menu_pre_loop_common ; Clear some menu flags, timeout and switches call show_debugstate call show_dateformat call show_salinity_value - call PLED_menu_cursor + call DISP_menu_cursor call toggle_brightness_show more_setup_menu_loop: @@ -310,7 +310,7 @@ ; bra more_setup_menu_loop2 ; movlw d'6' ; movwf menupos -; call PLED_menu_cursor +; call DISP_menu_cursor ;more_setup_menu_loop2: ; btfsc menubit2 @@ -439,27 +439,27 @@ movlw LOW 0x103 movwf EEADR movlw HIGH 0x103 - movwf EEADRH ; OLED brightness (=0: Eco, =1: High) + movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High) call read_eeprom ; read byte - bcf oled_brightness_high ; Eco mode + bcf DISPLAY_brightness_high ; Eco mode movlw .0 cpfseq EEDATA ; High? - bsf oled_brightness_high ; Yes! + bsf DISPLAY_brightness_high ; Yes! ; Value loaded, now toggle it... - btg oled_brightness_high + btg DISPLAY_brightness_high ; ...Display it... rcall toggle_brightness_show - call PLED_brightness_full ; Set OLED + call DISP_brightness_full ; Set DISPLAY ; ...and write it again to EEPROM movlw LOW 0x103 movwf EEADR movlw HIGH 0x103 - movwf EEADRH ; OLED brightness (=0: Eco, =1: High) + movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High) movlw .0 - btfsc oled_brightness_high + btfsc DISPLAY_brightness_high movlw .1 movwf EEDATA call write_eeprom ; write byte @@ -471,7 +471,7 @@ bra more_setup_menu3a ; return to menu loop toggle_brightness_show: - btfsc oled_brightness_high + btfsc DISPLAY_brightness_high bra toggle_brightness_show2 DISPLAYTEXTH .312 ; Eco return diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_battery.asm --- a/code_part1/OSTC_code_asm_part1/menu_battery.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm Fri Jan 25 18:00:49 2013 +0100 @@ -24,8 +24,8 @@ ; ToDo: menu_battery_state: - call PLED_ClearScreen - call PLED_topline_box + call DISP_ClearScreen + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .114 ; Battery Information WIN_INVERT .0 ; Init new Wordprocessor @@ -60,7 +60,7 @@ movff EEDATA,convert_value_temp+1 read_int_eeprom d'49' ; Year movff EEDATA,convert_value_temp+2 - call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 call word_processor WIN_TOP .91 @@ -86,7 +86,7 @@ movff EEDATA,convert_value_temp+1 read_int_eeprom d'44' ; Year movff EEDATA,convert_value_temp+2 - call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 call word_processor WIN_TOP .147 @@ -96,7 +96,7 @@ movff EEDATA,lo read_int_eeprom d'55' ; TEMP_min HIGH movff EEDATA,hi - call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required + call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output @@ -109,7 +109,7 @@ movff EEDATA,convert_value_temp+1 read_int_eeprom d'58' ; Year movff EEDATA,convert_value_temp+2 - call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 STRCAT_PRINT ") " WIN_TOP .175 @@ -119,7 +119,7 @@ movff EEDATA,lo read_int_eeprom d'60' ; TEMP_max HIGH movff EEDATA,hi - call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required + call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output @@ -132,7 +132,7 @@ movff EEDATA,convert_value_temp+1 read_int_eeprom d'63' ; Year movff EEDATA,convert_value_temp+2 - call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 STRCAT_PRINT ") " WIN_TOP .203 diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_custom.asm --- a/code_part1/OSTC_code_asm_part1/menu_custom.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm Fri Jan 25 18:00:49 2013 +0100 @@ -199,7 +199,7 @@ menu_custom_functions0: bsf leftbind - call PLED_ClearScreen + call DISP_ClearScreen movlw d'1' movwf menupos @@ -211,14 +211,14 @@ movlw 1 ; Stepsize: 1, 10, or 100. movwf cf_step - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor movff cf_title_text,WREG ; Title text in low bank call displaytext_1_low WIN_INVERT .0 ; Init new Wordprocessor menu_custom_functions1: - call PLED_standard_color ; Trash EEADRH... + call DISP_standard_color ; Trash EEADRH... movff cf_page_number,EEADRH ; CF page number (0: 0-31, 1: 32-63) @@ -305,7 +305,7 @@ call read_eeprom ; Highbyte movff EEDATA,cf_value+1 - call PLED_standard_color ; Changed by color swatches, but trash EEADRH... + call DISP_standard_color ; Changed by color swatches, but trash EEADRH... movff cf_value+0,lo movff cf_value+1,hi call display_customfunction @@ -315,7 +315,7 @@ DISPLAYTEXT .11 ; Exit call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor customfunctions_loop: call check_switches_logbook @@ -361,7 +361,7 @@ customfunctions3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -473,7 +473,7 @@ bc cf_min_passed ; Ok if CARRY, ie. min >= lo cf_min_failed: - call PLED_warnings_color + call DISP_warnings_color WIN_INVERT 1 cf_min_passed: @@ -488,7 +488,7 @@ ; Display max line WIN_TOP .95 - call PLED_standard_color + call DISP_standard_color WIN_INVERT 0 lfsr FSR2, letter @@ -521,7 +521,7 @@ bc cf_max_passed ; Ok if no carry, ie. max <= lo cf_max_failed: - call PLED_warnings_color + call DISP_warnings_color WIN_INVERT 1 cf_max_passed: @@ -535,7 +535,7 @@ call word_processor cf_minmax_done: - call PLED_standard_color + call DISP_standard_color WIN_INVERT 0 movff FSR1H, EEADRH return @@ -643,7 +643,7 @@ STRCAT_PRINT " " movf lo,W ; Get color. - call PLED_set_color + call DISP_set_color movlw .23 movff WREG,win_height ; row bottom (0-239) movlw .110 @@ -651,7 +651,7 @@ movlw .148-.110+1 movff WREG,win_width ; column right (0-159) - call PLED_box + call DISP_box retlw -1 ; wp already done. Skip it... cf_type_00: ; 8bit mode. Or unrecognized type... @@ -894,7 +894,7 @@ WIN_LEFT .125 WIN_FONT FT_SMALL WIN_INVERT .1 ; Init new Wordprocessor - call PLED_warnings_color + call DISP_warnings_color STRCPY TXT_CF2 movff cf_checker_counter,lo diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_gassetup.asm --- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Fri Jan 25 18:00:49 2013 +0100 @@ -28,10 +28,10 @@ movwf menupos menu_gassetup_prelist: - call PLED_ClearScreen + call DISP_ClearScreen call gassetup_sort_gaslist ; Sorts Gaslist according to change depth call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .106 ; Gas List WIN_INVERT .0 ; Init new Wordprocessor @@ -60,7 +60,7 @@ PUTC ':' movf decodata+0,W - call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases + call DISP_grey_inactive_gas ; Sets Greyvalue for inactive gases call word_processor WIN_LEFT .40 movf waitms_temp,W ; Load row into WREG @@ -78,7 +78,7 @@ ; New v1.44se menu_gassetup_Tx: movf decodata+0,W - call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases + call DISP_grey_inactive_gas ; Sets Greyvalue for inactive gases call word_processor WIN_LEFT .48 @@ -149,7 +149,7 @@ ; Changed v1.44se menu_gassetup_list0: movf decodata+0,W - call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases + call DISP_grey_inactive_gas ; Sets Greyvalue for inactive gases call word_processor WIN_LEFT .105 @@ -167,10 +167,10 @@ output_8 PUTC TXT_METER_C movf decodata+0,W - call PLED_grey_inactive_gas ; Sets Greyvalue for inactive gases + call DISP_grey_inactive_gas ; Sets Greyvalue for inactive gases call word_processor - call PLED_standard_color + call DISP_standard_color incf decodata+0,F movlw d'5' @@ -179,7 +179,7 @@ DISPLAYTEXT .11 ; Exit call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor gassetup_list_loop: call check_switches_logbook @@ -210,7 +210,7 @@ gassetup_list3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -278,7 +278,7 @@ bcf first_FA ; Here: =1: -, =0: + menu_gassetup0: - call PLED_ClearScreen + call DISP_ClearScreen DISPLAYTEXT .147 ; More... DISPLAYTEXT .11 ; Exit @@ -402,7 +402,7 @@ STRCAT_PRINT " " call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor gassetup_loop: call check_switches_logbook @@ -434,7 +434,7 @@ gassetup3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -606,7 +606,7 @@ next_gas_page: - call PLED_ClearScreen + call DISP_ClearScreen movlw d'1' movwf menupos bcf first_FA ; Here: =1: -, =0: + @@ -677,13 +677,13 @@ call sub16 ; sub_c = sub_a - sub_b btfss neg_flag bra gassetup_color_code_ppo2_1; too high -> Warning Color! - call PLED_standard_color + call DISP_standard_color bra gassetup_color_code_ppo2_2 gassetup_color_code_ppo2_1: - call PLED_warnings_color + call DISP_warnings_color gassetup_color_code_ppo2_2: call word_processor - call PLED_standard_color + call DISP_standard_color WIN_TOP .95 WIN_LEFT .95 @@ -739,7 +739,7 @@ call word_processor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor next_gas_page_loop: call check_switches_logbook @@ -771,7 +771,7 @@ next_gas_page3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -897,7 +897,7 @@ ; Changed v1.44se gassetup_title_bar2: - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor WIN_TOP .2 WIN_LEFT .0 diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Fri Jan 25 18:00:49 2013 +0100 @@ -49,7 +49,7 @@ bcf return_from_profileview ; clear some flags menu_logbook1: bcf logbook_header_drawn - call PLED_ClearScreen ; Clear screen + call DISP_ClearScreen ; Clear screen bcf all_dives_shown ; clear some flags bcf logbook_profile_view bcf logbook_page_not_empty @@ -200,7 +200,7 @@ btfss logbook_page_not_empty ; Was there one dive at all? bra menu_logbook ; Yes, so reload the first page - call PLED_topline_box ; Draw box + call DISP_topline_box ; Draw box WIN_INVERT .1 DISPLAYTEXT .26 ; "Logbook" WIN_INVERT .0 @@ -216,7 +216,7 @@ bcf return_from_profileview ; Do this only once while the page is loaded again! bcf logbook_page_not_empty ; Obviously the current page is NOT empty - call PLED_logbook_cursor + call DISP_logbook_cursor menu_logbook_loop: call check_switches_logbook @@ -254,7 +254,7 @@ addwf menupos,W ; page*5+menupos= movwf divesecs ; # of dive to search - call PLED_ClearScreen ; search for dive + call DISP_ClearScreen ; search for dive bsf logbook_profile_view ; set flag for search routine clrf divenumber ; search from scratch @@ -270,8 +270,8 @@ clrf average_divesecs+0 clrf average_divesecs+1 ; holds amount of read samples - call PLED_display_wait_clear - call PLED_standard_color + call DISP_display_wait_clear + call DISP_standard_color WIN_TOP .0 WIN_LEFT .0 STRCPY "#" @@ -327,7 +327,7 @@ movff SSPBUF,convert_value_temp+1 call I2CREAD2 ; Year movff SSPBUF,convert_value_temp+2 - call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 PUTC ' ' @@ -516,15 +516,15 @@ movff lo,logbook_min_tp+0 ; Backup min Tp° too. movff hi,logbook_min_tp+1 movlw color_orange ; Use same color as tp° curve - call PLED_set_color + call DISP_set_color - call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required + call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind output_16dp d'2' ; temperature STRCAT_PRINT "°C" ; Display 2nd row of details - call PLED_standard_color ; Back to normal + call DISP_standard_color ; Back to normal WIN_TOP .50 WIN_LEFT .05 @@ -597,7 +597,7 @@ ; Start Profile display ; Write 0m X-Line.. movlw color_grey - call PLED_set_color ; Make this configurable? + call DISP_set_color ; Make this configurable? movlw d'75' movff WREG,win_top @@ -608,7 +608,7 @@ movlw d'155' movff WREG,win_width ; Right border (0-159) display_profile2e: - call PLED_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 + call DISP_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 movff win_top,WREG ; Get row addwf last_temperature+0,W ; Add line interval distance to win_top tstfsz last_temperature+1 ; >255? @@ -623,7 +623,7 @@ ; Write 0min Y-Line.. movlw color_grey - call PLED_set_color ; Make this configurable? + call DISP_set_color ; Make this configurable? movlw d'75' movff WREG,win_top @@ -633,7 +633,7 @@ movff WREG,win_height movlw d'1' movff WREG,win_width ; "Window" Width - call PLED_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 + call DISP_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 ; Draw frame around profile movlw color_blue @@ -695,7 +695,7 @@ movlw color_dark_green ; Dark green if Ok, btfss neg_flag movlw color_dark_red ; Or dark red if ceiling overflown. - call PLED_set_color + call DISP_set_color movff PRODL,xA+0 movff PRODH,xA+1 @@ -751,7 +751,7 @@ movff xC+1,xC+0 movlw color_orange - call PLED_set_color + call DISP_set_color movf logbook_last_tp,W ; do we have a valid previous value ? bz profile_display_temp_1 ; No: skip the vertical line. @@ -818,7 +818,7 @@ bra profile_display_loop ; Not ready yet ; Done. profile_display_loop_done: - call PLED_standard_color ; Restore color + call DISP_standard_color ; Restore color call menu_pre_loop_common ; Clear some menu flags, timeout and switches display_profile_loop: @@ -851,7 +851,7 @@ movlw color_violet ; Color for Gas 5 dcfsnz active_gas,F movlw color_cyan ; Color for Gas 6 - goto PLED_set_color ; Set Color... + goto DISP_set_color ; Set Color... ;============================================================================= profileview_page2: @@ -861,7 +861,7 @@ movff average_depth_hold+1,eeprom_address+1 ; Pointer to Gaslist movlw color_white ; Color for Gas 1 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... bsf leftbind WIN_TOP .0 WIN_LEFT .0 @@ -876,7 +876,7 @@ call word_processor ; Display Gas information movlw color_green ; Color for Gas 2 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... WIN_TOP .25 STRCPY TXT_G2_3 call I2CREAD2 ; Gas2 current O2 @@ -889,7 +889,7 @@ call word_processor ; Display Gas information movlw color_red ; Color for Gas 3 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... WIN_TOP .50 STRCPY TXT_G3_3 call I2CREAD2 ; Gas3 current O2 @@ -902,7 +902,7 @@ call word_processor ; Display Gas information movlw color_yellow ; Color for Gas 4 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... WIN_TOP .0 WIN_LEFT .60 STRCPY TXT_G4_3 @@ -916,7 +916,7 @@ call word_processor ; Display Gas information movlw color_violet ; Color for Gas 5 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... WIN_TOP .25 STRCPY TXT_G5_3 call I2CREAD2 ; Gas5 current O2 @@ -929,7 +929,7 @@ call word_processor ; Display Gas information movlw color_cyan ; Color for Gas 6 - call PLED_set_color ; Set Color... + call DISP_set_color ; Set Color... WIN_TOP .50 STRCPY TXT_G6_3 call I2CREAD2 ; Gas6 current O2 @@ -941,7 +941,7 @@ output_8 call word_processor ; Display Gas information - call PLED_standard_color + call DISP_standard_color WIN_TOP .0 WIN_LEFT .120 STRCPY TXT_1ST4 @@ -1005,7 +1005,7 @@ profileview_page3: WIN_BOX_BLACK .0, .74, .0, .159 ;top, bottom, left, right - call PLED_standard_color + call DISP_standard_color movff average_depth_hold+0,eeprom_address+0 movff average_depth_hold+1,eeprom_address+1 ; Pointer to Gaslist @@ -1192,7 +1192,7 @@ clrf average_divesecs+1 ; clear counting registers for next line movlw color_grey - call PLED_set_color ; Make this configurable? + call DISP_set_color ; Make this configurable? movlw d'76' movff WREG,win_top incf timeout_counter3,W ; draw one line to right to make sure it's the background of the profile @@ -1201,7 +1201,7 @@ movff WREG,win_height movlw d'1' movff WREG,win_width ; "Window" Width - call PLED_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 + call DISP_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 profile_view_get_depth_no_line: call I2CREAD2 ; read first depth @@ -1315,7 +1315,7 @@ clrf menupos3 ; here: used row on current page movlw d'5' movwf menupos ; here: active row on current page - call PLED_ClearScreen ; clear details/profile + call DISP_ClearScreen ; clear details/profile goto menu_logbook1b ; start search next_logbook2: @@ -1326,7 +1326,7 @@ movlw d'5' movwf menupos ; incf menupos2,F ; start new screen - call PLED_ClearScreen + call DISP_ClearScreen next_logbook: movff eeprom_header_address+0,eeprom_address+0 @@ -1360,7 +1360,7 @@ next_logbook3b: clrf timeout_counter2 - call PLED_logbook_cursor + call DISP_logbook_cursor bcf switch_right bcf menubit3 ; clear flag @@ -1372,7 +1372,7 @@ btfsc logbook_header_drawn ; "Logbook already displayed? bra display_listdive1a - call PLED_topline_box ; Draw box + call DISP_topline_box ; Draw box WIN_INVERT .1 DISPLAYTEXT .26 ; "Logbook" WIN_INVERT .0 @@ -1415,7 +1415,7 @@ movff SSPBUF,convert_value_temp+1 call I2CREAD4 ; Year (Block read) movff SSPBUF,convert_value_temp+2 - call PLED_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in s + call DISP_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in s incf_eeprom_address d'2' ; Skip Bytes in EEPROM (faster) @@ -1446,10 +1446,10 @@ return logbook_convert_64k: ; Converts <1.91 logbook (32kB) to 64kB variant - call PLED_boot - call PLED_ClearScreen ; Clear screen + call DISPLAY_boot + call DISP_ClearScreen ; Clear screen movlw color_red - call PLED_set_color ; Set to Red + call DISP_set_color ; Set to Red DISPLAYTEXTH d'303' ; Please wait! clrf EEADR movlw d'1' diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_ppO2.asm --- a/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_ppO2.asm Fri Jan 25 18:00:49 2013 +0100 @@ -42,8 +42,8 @@ movlw d'1' movwf menupos menu_const_ppO2_return: - call PLED_ClearScreen - call PLED_ccr_setup_menu_mask + call DISP_ClearScreen + call DISP_ccr_setup_menu_mask call refresh_cursor call menu_pre_loop_common @@ -54,7 +54,7 @@ bra menu_const_ppO2_preloop2 ; Returns movlw d'6' movwf menupos - call PLED_menu_cursor + call DISP_menu_cursor menu_const_ppO2_preloop2: btfsc menubit2 @@ -89,9 +89,9 @@ movwf menupos menu_diluentsetup_prelist: - call PLED_ClearScreen + call DISP_ClearScreen call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .231 ; Dil. Setup - Gaslist WIN_INVERT .0 ; Init new Wordprocessor @@ -206,7 +206,7 @@ DISPLAYTEXT .11 ; Exit call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor menu_diluentsetup_loop: call check_switches_logbook @@ -237,7 +237,7 @@ menu_diluentsetup_list3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -295,7 +295,7 @@ bcf first_FA ; Here: =1: -, =0: + menu_diluentgas0: - call PLED_ClearScreen + call DISP_ClearScreen WIN_LEFT .20 WIN_TOP .185 lfsr FSR2, letter @@ -446,7 +446,7 @@ STRCAT_PRINT " " call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - call PLED_menu_cursor + call DISP_menu_cursor diluentgassetup_loop: call check_switches_logbook @@ -477,7 +477,7 @@ diluentgassetup3: clrf timeout_counter2 - call PLED_menu_cursor + call DISP_menu_cursor call wait_switches ; Waits until switches are released, resets flag if button stays pressed! @@ -629,7 +629,7 @@ diluent_title_bar2: - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor WIN_TOP .2 WIN_LEFT .30 @@ -733,8 +733,8 @@ bcf second_FA ; Here: =1: 1, =0: 10 steps menu_const_ppO20: - call PLED_ClearScreen - call PLED_topline_box + call DISP_ClearScreen + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .111 ; Constant ppO2 Setup @@ -803,7 +803,7 @@ DISPLAYTEXT .11 ; Exit call wait_switches ; Waits until switches are released, resets flag if button stays pressed! call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_menu_cursor + call DISP_menu_cursor menu_const_ppO2_loop: call check_switches_logbook @@ -841,7 +841,7 @@ menu_const_ppO23: call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_menu_cursor + call DISP_menu_cursor bra menu_const_ppO2_loop do_menu_const_ppO2: diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_reset.asm --- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Fri Jan 25 18:00:49 2013 +0100 @@ -236,13 +236,13 @@ movlw d'1' movwf menupos - call PLED_ClearScreen - call PLED_reset_menu_mask + call DISP_ClearScreen + call DISP_reset_menu_mask menu_reset2: call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_reset_menu_mask - call PLED_menu_cursor + call DISP_reset_menu_mask + call DISP_menu_cursor menu_reset_loop: call check_switches_menu btfsc menubit2 @@ -281,14 +281,14 @@ do_menu_reset_reboot: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! + call DISP_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! movwf menupos ; Used as temp tstfsz menupos bra do_menu_reset_reboot2 ; Delete now! bra do_menu_reset_exit ; Cancel! do_menu_reset_reboot2: - call PLED_DisplayOff ; Power-down OLED + call DISP_DisplayOff ; Power-down DISPLAY movlw b'00000000' ; Bit6: PPL Disable movwf OSCTUNE movlw b'01111110' ; 8MHz @@ -297,14 +297,14 @@ goto 0x00000 ; restart to 0x00000 do_menu_reset_logbook: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! + call DISP_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! movwf menupos ; Used as temp tstfsz menupos bra do_menu_reset_logbook2 ; Delete Logbook now! bra do_menu_reset_exit ; Cancel! do_menu_reset_logbook2: - call PLED_ClearScreen + call DISP_ClearScreen setf win_color1 ; Make sure to display in white color. setf win_color2 DISPLAYTEXT .25 ; "Reset..." @@ -312,7 +312,7 @@ bra do_menu_reset_exit do_menu_reset_decodata: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! + call DISP_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! movwf menupos ; Used as temp tstfsz menupos bra do_menu_reset_decodata2 ; Reset Deco Data now! @@ -320,7 +320,7 @@ do_menu_reset_decodata2: ; reset deco data - call PLED_ClearScreen + call DISP_ClearScreen DISPLAYTEXT .25 ; "Reset..." SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine @@ -334,14 +334,14 @@ goto restart ; done. quit to surfmode do_menu_reset_all: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! + call DISP_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! movwf menupos ; Used as temp tstfsz menupos bra do_menu_reset_all2 ; Reset all now! bra do_menu_reset_exit ; Cancel! do_menu_reset_all2: - call PLED_ClearScreen + call DISP_ClearScreen DISPLAYTEXT .25 ; "Reset..." reset_start: diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/menu_settime.asm --- a/code_part1/OSTC_code_asm_part1/menu_settime.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_settime.asm Fri Jan 25 18:00:49 2013 +0100 @@ -25,7 +25,7 @@ menu_settime: - call PLED_ClearScreen + call DISP_ClearScreen call menu_pre_loop_common ; Clear some menu flags, timeout and switches bcf set_minutes @@ -35,7 +35,7 @@ bcf set_month clrf menupos2 - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .29 ; Set Time WIN_INVERT .0 ; Init new Wordprocessor @@ -94,7 +94,7 @@ movff month,convert_value_temp+0 movff day,convert_value_temp+1 movff year,convert_value_temp+2 - call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call DISP_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 STRCAT_PRINT " " return @@ -134,7 +134,7 @@ WIN_TOP .215 movlw (.160-.0)/7 ; full line length, for various translations. movwf temp1 - call PLED_display_clear_common_y1 + call DISP_display_clear_common_y1 movlw d'5' movwf wait_temp @@ -188,7 +188,7 @@ WIN_LEFT .0 WIN_TOP .215 - call PLED_standard_color + call DISP_standard_color lfsr FSR2,letter OUTPUTTEXT .94 ; Set diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/oled_samsung.asm --- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm Fri Jan 25 16:31:22 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,963 +0,0 @@ -; OSTC - diving computer code -; Copyright (C) 2009 HeinrichsWeikamp GbR - -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. - -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. - -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . - - -; hardware routines for S6E6D6 Samsung OLED Driver IC -; written by: Matthias Heinrichs, info@heinrichsweikamp.com -; written: 090801 -; History: -; 2009-08-30: [MH] last updated. -; 2011-01-07: [jDG] Added flip_screen option -; known bugs: pixel-write (loogbok curves) not done yet... -; ToDo: - -WIN_FONT macro win_font_input - movlw win_font_input - movff WREG,win_font - endm - -WIN_TOP macro win_top_input - movlw win_top_input - movff WREG,win_top - endm - -WIN_LEFT macro win_left_input - movlw win_left_input - movff WREG,win_leftx2 - endm - -WIN_INVERT macro win_invert_input - movlw win_invert_input - movff WREG,win_invert - endm - -WIN_COLOR macro win_color_input - movlw win_color_input - call PLED_set_color - endm - -;============================================================================= - -word_processor: ; word_processor: - clrf POSTINC2 ; Required, to mark end of string. - call aa_wordprocessor - movlb b'00000001' ; Back to Rambank1 - return - -;============================================================================= -; Macro to provides our own interface code. -; -PIXEL_WRITE macro colRegister, rowRegister - movff colRegister,win_leftx2 - movff rowRegister,win_top - call pixel_write - endm - -INIT_PIXEL_WROTE macro colRegister - movff colRegister,win_leftx2 - call init_pixel_write - endm - -HALF_PIXEL_WRITE macro rowRegister - movff rowRegister,win_top - call half_pixel_write - endm - -;----------------------------------------------------------------------------- -; Init for half_pixel_write -; Set column register on OLED device, and current color. -; Inputs: win_leftx2 -; Outputs: win_color:2 -; Trashed: WREG, PROD -init_pixel_write: - movff win_leftx2,WREG - mullw 2 - rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) - goto PLED_standard_color - -;----------------------------------------------------------------------------- -; Writes two half-pixels at position (win_top,win_leftx2) -; Inputs: win_leftx2, win_top, win_color:2 -; Trashed: WREG, PROD -pixel_write: - movff win_leftx2,WREG - mullw 2 - rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) - rcall half_pixel_write ; Write this half-one. - - movff win_leftx2,WREG ; Address of next one - mullw 2 - infsnz PRODL ; +1 - incf PRODH - rcall pixel_write_col320 - bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because - ; of the autoincrement going vertical - - ;---- Do the 16bit 319-X-->X, if needed, and send to OLED ------------ -pixel_write_col320: - movff win_flags,WREG ; BEWARE: bank0 bit-test - btfss WREG,0 ; 180° rotation ? - bra pixel_write_noflip_H - - movf PRODL,W ; 16bits 319 - PROD --> PROD - sublw LOW(.319) ; 319-W --> W - movwf PRODL - movf PRODH,W - btfss STATUS,C ; Borrow = /CARRY - incf WREG - sublw HIGH(.319) - movwf PRODH - -pixel_write_noflip_H: - movlw 0x21 ; Start Address Vertical (.0 - .319) - rcall PLED_CmdWrite - bra PLED_DataWrite_PROD - -;----------------------------------------------------------------------------- -; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). -; Inputs: win_leftx2, win_top, win_height, win_color:2 -; Trashed: WREG, PROD, TABLAT, TBLPTRL -half_vertical_line: - clrf TABLAT ; Loop index. - -half_vertical_line_loop: - movff win_leftx2,WREG ; Init X position. - mullw 2 - movf TABLAT,W ; Get loop index - andlw 1 ; Just low bit - xorwf PRODL,F ; And use it to jitter current X position - rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) - - movff win_height,WREG ; Index reached height (Bank0 read) ? - xorwf TABLAT,W - btfsc STATUS,Z ; Equals ? - return ; Yes: done. - movff win_top,WREG ; Y = top + index (Bank0 read) - addwf TABLAT,W - rcall half_pixel_write_1 - incf TABLAT,F ; index++ - bra half_vertical_line_loop - -;----------------------------------------------------------------------------- -; Writes one half-pixel at position (win_top,win_leftx2). -; Inputs: win_leftx2, win_top, win_color:2 -; Trashed: WREG, PROD -half_pixel_write: - movff win_top,WREG ; d'0' ... d'239' - -; Variant with Y position in WREG. -half_pixel_write_1: - movff win_flags,PRODL ; BEWARE: bank0 bit-test - btfsc PRODL,0 ; 180° rotation ? - sublw .239 ; 239-Y --> Y - - mullw 1 ; Copy row to PRODH:L - movlw 0x20 ; Horizontal Address START:END - rcall PLED_CmdWrite - rcall PLED_DataWrite_PROD - - movlw 0x22 ; Start Writing Data to GRAM - rcall PLED_CmdWrite - bsf oled_rs ; Data! - movff win_color1, PORTD - bcf oled_rw - bsf oled_rw ; Upper - movff win_color2, PORTD - bcf oled_rw - bsf oled_rw ; Lower - return - -; ----------------------------- -; PLED Display Off -; ----------------------------- -PLED_DisplayOff: - clrf PORTD - bcf oled_hv - bcf oled_vdd - bcf oled_cs - bcf oled_e_nwr - bcf oled_rw - bcf oled_nreset - return - -;============================================================================= -; Fast macros to write to OLED display. -; Adding a call/return adds 3 words and a pipeline flush, hence make it -; nearly twice slower... -; -; Input : commande as macro parameter. -; Output : NONE -; Trash : WREG -; -AA_CMD_WRITE macro cmd - movlw cmd -; rcall PLED_CmdWrite ; slow but saves a lot of bytes in flash - ; /* Fast writing - bcf oled_rs ; Cmd mode - movwf PORTD,A - bcf oled_rw ; Tick the clock - bsf oled_rw - ; Fast writing */ - endm -; -; Input : data as macro parameter. -; Output : NONE -; Trash : WREG -; -AA_DATA_WRITE macro data - movlw data - rcall PLED_DataWrite - endm -; -; Input : PRODH:L as 16bits data. -; Output : NONE -; Trash : NONE -; -AA_DATA_WRITE_PROD macro -; rcall PLED_DataWrite_PROD ; slow but saves a lot of bytes in flash - ; /* Fast writing - bsf oled_rs ; Data mode - movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! - bcf oled_rw ; Tick the clock - bsf oled_rw - movff PRODL,PORTD - bcf oled_rw ; Tick the clock - bsf oled_rw - ; Fast writing */ - endm - -;============================================================================= -; Output OLED Window Address commands. -; Inputs : win_top, win_leftx2, win_height, aa_width. -; Output : PortD commands. -; Trashed: PROD -; -PLED_box_write: - movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD - mullw 2 - - movff win_flags,WREG ; BEWARE: bank0 bit-test - btfsc WREG,0 ; 180° rotation ? - bra PLED_box_flip_H ; YES: - - ;---- Normal horizontal window --------------------------------------- - ; Output 0x35 left, - ; 0x36 right == left + width - 1. - AA_CMD_WRITE 0x35 ; this is the left border - AA_DATA_WRITE_PROD ; Output left - AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord. - AA_DATA_WRITE_PROD - - movf aa_width+0,W,ACCESS ; right = left + width - 1 - addwf PRODL,F - movf aa_width+1,W,ACCESS - addwfc PRODH,F - decf PRODL,F,A ; decrement result - btfss STATUS,C - decf PRODH,F,A - - AA_CMD_WRITE 0x36 ; Write and the right border - AA_DATA_WRITE_PROD - - bra PLED_box_noflip_H - - ;---- Flipped horizontal window -------------------------------------- -PLED_box_flip_H: - ; Output 0x36 flipped(left) = 319-left - ; 0x35 flipped(right) = 319-right = 320 - left - width - movf PRODL,W ; 16bits 319 - PROD --> PROD - sublw LOW(.319) ; 319-W --> W - movwf PRODL - movf PRODH,W - btfss STATUS,C ; Borrow = /CARRY - incf WREG - sublw HIGH(.319) - movwf PRODH - AA_CMD_WRITE 0x36 ; this is the left border - AA_DATA_WRITE_PROD ; Output left - AA_CMD_WRITE 0x21 - AA_DATA_WRITE_PROD - - movf aa_width+0,W ; 16bits PROD - width --> PROD - subwf PRODL,F ; PRODL - WREG --> PRODL - movf aa_width+1,W - subwfb PRODH,F - infsnz PRODL ; PROD+1 --> PROD - incf PRODH - AA_CMD_WRITE 0x35 ; this is the left border - AA_DATA_WRITE_PROD ; Output left - -PLED_box_noflip_H: - movff win_flags,WREG ; BEWARE: bank0 bit-test - btfsc WREG,0 ; 180° rotation ? - bra PLED_box_flip_V - - ;---- Normal vertical window ----------------------------------------- - ; Output 0x37 (top) (bottom) - movff win_top,PRODH ; top --> PRODH (first byte) - movff win_height,WREG - addwf PRODH,W - decf WREG - movwf PRODL ; top+height-1 --> PRODL (second byte) - - AA_CMD_WRITE 0x37 - AA_DATA_WRITE_PROD - - movff PRODH,PRODL - clrf PRODH ; Start pixel V coord == top. - AA_CMD_WRITE 0x20 - AA_DATA_WRITE_PROD - - return - - ;---- Flipped vertical window ---------------------------------------- - ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height - ; flipped(top) = 239-top -PLED_box_flip_V: - movff win_top,PRODL - movff win_height,WREG - addwf PRODL,W - sublw .240 ; 240 - top - height - movwf PRODH ; First byte - - movf PRODL,W - sublw .239 ; 249-top - movwf PRODL ; --> second byte. - - AA_CMD_WRITE 0x37 - AA_DATA_WRITE_PROD - - clrf PRODH ; Start pixel V coord. - AA_CMD_WRITE 0x20 - AA_DATA_WRITE_PROD - - return - -;============================================================================= -; PLED_frame : draw a frame around current box with current color. -; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 -; Outputs: (none) -; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 - global PLED_frame -PLED_frame: - movff win_top,aa_start+0 ; Backup everything. - movff win_height,aa_start+1 - movff win_leftx2,aa_end+0 - movff win_width,aa_end+1 - - ;---- TOP line ----------------------------------------------------------- - movlw 1 ; row ~ height=1 - movff WREG,win_height - rcall PLED_box - - ;---- BOTTOM line -------------------------------------------------------- - movff aa_start+0,PRODL ; Get back top, - movff aa_start+1,WREG ; and height - addwf PRODL,W ; top+height - decf WREG ; top+height-1 - movff WREG,win_top ; top+height-1 --> top - rcall PLED_box - - ;---- LEFT column -------------------------------------------------------- - movff aa_start+0,win_top ; Restore top/height. - movff aa_start+1,win_height - movlw 1 ; column ~ width=1 - movff WREG,win_width - rcall PLED_box - - ;---- RIGHT column ------------------------------------------------------- - movff aa_end+0,WREG - movff aa_end+1,PRODL - addwf PRODL,W - decf WREG - movff WREG,win_leftx2 - bra PLED_box - -;============================================================================= -; PLED_box : fills current box with current color. -; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 -; Outputs: (none) -; Trashed: WREG, PROD - - global PLED_box -PLED_box: - ;---- Define Window ------------------------------------------------------ - movff win_width,WREG - bcf STATUS,C - rlcf WREG - movwf aa_width+0 - movlw 0 - rlcf WREG - movwf aa_width+1 - rcall PLED_box_write - - ;---- Fill Window -------------------------------------------------------- - movlw 0x22 ; Start Writing Data to GRAM - rcall PLED_CmdWrite - - clrf PRODH ; Column counter. - bsf oled_rs ; Data! - -PLED_box2: ; Loop height times - movff win_height,PRODL - -PLED_box3: ; loop width times - movff win_color1,PORTD - bcf oled_rw - bsf oled_rw ; Upper - movff win_color2,PORTD - bcf oled_rw - bsf oled_rw ; Lower - - movff win_color1,PORTD - bcf oled_rw - bsf oled_rw ; Upper - movff win_color2,PORTD - bcf oled_rw - bsf oled_rw ; Lower - - decfsz PRODL,F ; row loop finished ? - bra PLED_box3 ; No: continue. - - incf PRODH,F ; column count ++ - - movff win_bargraph,WREG ; current column == bargraph ? - cpfseq PRODH - bra PLED_box4 ; No: just loop. - - clrf WREG ; Yes: switch to black - movff WREG,win_color1 - movff WREG,win_color2 -PLED_box4: - movff win_width,WREG - cpfseq PRODH - bra PLED_box2 - - movlw 0x00 ; NOP, to stop window mode - rcall PLED_CmdWrite - - setf WREG ; Reset bargraph mode... - movff WREG,win_bargraph - return - -;============================================================================= -; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black. -; Trashed: WREG, PROD - - global PLED_ClearScreen -PLED_ClearScreen: - movlw 0x35 ; VerticalStartAddress HIGH:LOW - rcall PLED_CmdWrite - mullw 0 - rcall PLED_DataWrite_PROD - - movlw 0x36 ; VerticalEndAddress HIGH:LOW - rcall PLED_CmdWrite - movlw 0x01 - rcall PLED_DataWrite - movlw 0x3F - rcall PLED_DataWrite - - movlw 0x37 ; HorizontalAddress START:END - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0xEF - rcall PLED_DataWrite - - movlw 0x20 ; Start Address Horizontal (.0 - .239) - rcall PLED_CmdWrite - rcall PLED_DataWrite_PROD - - movlw 0x21 ; Start Address Vertical (.0 - .319) - rcall PLED_CmdWrite - rcall PLED_DataWrite_PROD - - movlw 0x22 ; Start Writing Data to GRAM - rcall PLED_CmdWrite - - ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks - bsf oled_rs ; Data! - - movlw .160 - movwf PRODH -PLED_ClearScreen2: - movlw .240 - movwf PRODL -PLED_ClearScreen3: - - clrf PORTD ; Need to generate trace here too. - bcf oled_rw - bsf oled_rw ; Upper - - clrf PORTD ; Need to generate trace here too. - bcf oled_rw - bsf oled_rw ; Lower - - clrf PORTD ; Need to generate trace here too. - bcf oled_rw - bsf oled_rw ; Upper - - clrf PORTD ; Need to generate trace here too. - bcf oled_rw - bsf oled_rw ; Lower - - decfsz PRODL,F - bra PLED_ClearScreen3 - decfsz PRODH,F - bra PLED_ClearScreen2 - - movlw 0x00 ; NOP, to stop Address Update Counter - bra PLED_CmdWrite - -; ----------------------------- -; PLED Write Cmd via W -; ----------------------------- -PLED_CmdWrite: - bcf oled_rs ; Command! - movwf PORTD ; Move Data to PORTD - bcf oled_rw - bsf oled_rw - return - -; ----------------------------- -; PLED Write Display Data via W -; ----------------------------- -PLED_DataWrite: - bsf oled_rs ; Data! - movwf PORTD ; Move Data to PORTD - bcf oled_rw - bsf oled_rw - return - -; ----------------------------- -; PLED Data Cmd via W -; ----------------------------- -PLED_DataWrite_PROD: - bsf oled_rs ; Data! - movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian) - bcf oled_rw - bsf oled_rw - movff PRODL,PORTD ; Move low byte to PORTD - bcf oled_rw - bsf oled_rw - return - -; ----------------------------- -; PLED Read data into WREG -; ----------------------------- -; NOTE: you should "setf TRISD" before calling this function, -; to make PortD an input port... -PLED_DataRead: - bsf oled_rs ; Data register. - bcf oled_e_nwr ; Read enable. - nop - nop - nop - nop - movf PORTD,W ; Read byte. - bsf oled_e_nwr ; release bus. - return - -; ----------------------------- -; PLED boot -; ----------------------------- -PLED_boot: - bcf oled_hv - WAITMS d'32' - bsf oled_vdd - nop - bcf oled_cs - nop - bsf oled_nreset -; WAITMS d'10' ; Quick wake-up - WAITMS d'250' ; Standard wake-up - bsf oled_e_nwr - nop - bcf oled_nreset - WAIT10US d'2' - bsf oled_nreset - WAITMS d'10' - - movlw 0x24 ; 80-System 8-Bit Mode - rcall PLED_CmdWrite - - movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) - rcall PLED_CmdWrite - movlw 0x00 ; X X X X X X X RM - rcall PLED_DataWrite - movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL - rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock - - movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) - rcall PLED_CmdWrite - movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color - rcall PLED_DataWrite - - ; Change direction for block-writes of pixels - lfsr FSR0,win_flags - btfss INDF0,0 ; BANK-SAFE bit test. - movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM - btfsc INDF0,0 - movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM - rcall PLED_DataWrite - - movlw 0x18 - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x28 - rcall PLED_DataWrite - - movlw 0xF8 - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x0F - rcall PLED_DataWrite - - movlw 0xF9 - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x0F - rcall PLED_DataWrite - - movlw 0x10 - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - -; Now Gamma settings... - rcall PLED_brightness_full - ;rcall PLED_brightness_low -; End Gamma Settings - - rcall PLED_ClearScreen - - bsf oled_hv - WAITMS d'32' - bsf oled_hv - WAITMS d'32' - bsf oled_hv - - movlw 0x05 - rcall PLED_CmdWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x01 - rcall PLED_DataWrite ; Display ON - return - - -PLED_brightness_full: ; Choose between Eco and High... - btfsc oled_brightness_high ; OLED brightness (=0: Eco, =1: High) - bra PLED_brightness_full_high -; Mid - movlw 0x70 - rcall PLED_CmdWrite - movlw 0x1B - rcall PLED_DataWrite - movlw 0x80 - rcall PLED_DataWrite - movlw 0x71 - rcall PLED_CmdWrite - movlw 0x1F - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x72 - rcall PLED_CmdWrite - movlw 0x22 - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - - movlw 0x73 - rcall PLED_CmdWrite - movlw 0x17 - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - movlw 0x74 - rcall PLED_CmdWrite - movlw 0x1A - rcall PLED_DataWrite - movlw 0x0E - rcall PLED_DataWrite - - movlw 0x75 - rcall PLED_CmdWrite - movlw 0x1D - rcall PLED_DataWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x76 - rcall PLED_CmdWrite - movlw 0x18 - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - - movlw 0x77 - rcall PLED_CmdWrite - movlw 0x1E - rcall PLED_DataWrite - movlw 0x18 - rcall PLED_DataWrite - movlw 0x78 - rcall PLED_CmdWrite - movlw 0x1D - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - return - -PLED_brightness_full_high: -; Full - movlw 0x70 - rcall PLED_CmdWrite - movlw 0x1F - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x71 - rcall PLED_CmdWrite - movlw 0x23 - rcall PLED_DataWrite - movlw 0x80 - rcall PLED_DataWrite - movlw 0x72 - rcall PLED_CmdWrite - movlw 0x2A - rcall PLED_DataWrite - movlw 0x80 - rcall PLED_DataWrite - - movlw 0x73 - rcall PLED_CmdWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - movlw 0x74 - rcall PLED_CmdWrite - movlw 0x1C - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - - movlw 0x75 - rcall PLED_CmdWrite - movlw 0x1B - rcall PLED_DataWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x76 - rcall PLED_CmdWrite - movlw 0x1A - rcall PLED_DataWrite - movlw 0x15 - rcall PLED_DataWrite - - movlw 0x77 - rcall PLED_CmdWrite - movlw 0x1C - rcall PLED_DataWrite - movlw 0x18 - rcall PLED_DataWrite - movlw 0x78 - rcall PLED_CmdWrite - movlw 0x21 - rcall PLED_DataWrite - movlw 0x15 - rcall PLED_DataWrite - return - - -PLED_brightness_low: -;Low - movlw 0x70 - rcall PLED_CmdWrite - movlw 0x14 - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x71 - rcall PLED_CmdWrite - movlw 0x17 - rcall PLED_DataWrite - movlw 0x00 - rcall PLED_DataWrite - movlw 0x72 - rcall PLED_CmdWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x80 - rcall PLED_DataWrite - - movlw 0x73 - rcall PLED_CmdWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x11 - rcall PLED_DataWrite - movlw 0x74 - rcall PLED_CmdWrite - movlw 0x14 - rcall PLED_DataWrite - movlw 0x0B - rcall PLED_DataWrite - - movlw 0x75 - rcall PLED_CmdWrite - movlw 0x1B - rcall PLED_DataWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x76 - rcall PLED_CmdWrite - movlw 0x13 - rcall PLED_DataWrite - movlw 0x0E - rcall PLED_DataWrite - - movlw 0x77 - rcall PLED_CmdWrite - movlw 0x1C - rcall PLED_DataWrite - movlw 0x18 - rcall PLED_DataWrite - movlw 0x78 - rcall PLED_CmdWrite - movlw 0x15 - rcall PLED_DataWrite - movlw 0x0E - rcall PLED_DataWrite - - return - -PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB' - movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' - movwf oled2_temp ; Copy - - ; Mask Bit 7,6,5,4,3,2 - movlw b'00000011' - andwf oled2_temp,F - - movlw b'00000000' - dcfsnz oled2_temp,F - movlw b'01010000' - dcfsnz oled2_temp,F - movlw b'10100000' - dcfsnz oled2_temp,F - movlw b'11111000' - movwf oled3_temp ; Blue done. - - movff oled1_temp, oled2_temp ; Copy - ; Mask Bit 7,6,5,1,0 - movlw b'00011100' - andwf oled2_temp,F - rrncf oled2_temp,F - rrncf oled2_temp,F - - movlw b'00000000' - dcfsnz oled2_temp,F - movlw b'00000100' - dcfsnz oled2_temp,F - movlw b'00001000' - dcfsnz oled2_temp,F - movlw b'00001100' - dcfsnz oled2_temp,F - movlw b'00010000' - dcfsnz oled2_temp,F - movlw b'00010100' - dcfsnz oled2_temp,F - movlw b'00100000' - dcfsnz oled2_temp,F - movlw b'00111111' - movwf oled4_temp - - rrcf oled4_temp,F - rrcf oled3_temp,F - - rrcf oled4_temp,F - rrcf oled3_temp,F - - rrcf oled4_temp,F - rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. - - movff oled1_temp, oled2_temp ; Copy - clrf oled1_temp - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F ; Green done. - - ; Mask Bit 4,3,2,1,0 - movlw b'11100000' - andwf oled2_temp,F - - rrncf oled2_temp,F - rrncf oled2_temp,F - rrncf oled2_temp,F - rrncf oled2_temp,F - rrncf oled2_temp,F - - movlw b'00000000' - dcfsnz oled2_temp,F - movlw b'00000100' - dcfsnz oled2_temp,F - movlw b'00001000' - dcfsnz oled2_temp,F - movlw b'00001100' - dcfsnz oled2_temp,F - movlw b'00010000' - dcfsnz oled2_temp,F - movlw b'00010100' - dcfsnz oled2_temp,F - movlw b'00100000' - dcfsnz oled2_temp,F - movlw b'00111111' - movwf oled4_temp - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F - - rrcf oled4_temp,F - rrcf oled1_temp,F ; Red done. - - movff oled1_temp,win_color1 - movff oled3_temp,win_color2 ; Set Bank0 Color registers... - return - - \ No newline at end of file diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/outputs.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code_part1/OSTC_code_asm_part1/outputs.asm Fri Jan 25 18:00:49 2013 +0100 @@ -0,0 +1,4163 @@ + +; OSTC - diving computer code +; Copyright (C) 2008 HeinrichsWeikamp GbR + +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. + +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. + +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . + + +; routines for display outputs +; written by: Matthias Heinrichs, info@heinrichsweikamp.com +; written: 15/01/05 +; +; History: +; 2008-06-06 [MH] last updated +; 2010-12-31 [jDG] Multi-page display for GF decoplan +; 2011-01-04 [jDG] Saturation graphs in customview divemode +; +; known bugs: +; ToDo: More comments + + global DISP_divemask_color +DISP_divemask_color: + GETCUSTOM8 d'36' ; Divemask output color + bra DISP_standard_color_0 + + global DISP_warnings_color +DISP_warnings_color: + GETCUSTOM8 d'37' ; Warnings output color + bra DISP_standard_color_0 + + global DISP_standard_color +DISP_standard_color: + GETCUSTOM8 d'35' ; Standard output color +DISP_standard_color_0: ; Common entry point + movwf DISPLAY1_temp ; copy + movlw d'0' + cpfseq DISPLAY1_temp + bra DISP_standard_color_1 + bra DISP_standard_color2 +DISP_standard_color_1: + movlw d'4' + cpfseq DISPLAY1_temp + bra DISP_standard_color_2 + bra DISP_standard_color2 +DISP_standard_color_2: + movlw d'8' + cpfseq DISPLAY1_temp + bra DISP_standard_color_3 + bra DISP_standard_color2 +DISP_standard_color_3: + movlw d'192' + cpfseq DISPLAY1_temp + bra DISP_standard_color_4 + bra DISP_standard_color2 +DISP_standard_color_4: + movlw d'196' + cpfseq DISPLAY1_temp + bra DISP_standard_color_5 + bra DISP_standard_color2 +DISP_standard_color_5: + movlw d'200' + cpfseq DISPLAY1_temp + bra DISP_standard_color_6 + bra DISP_standard_color2 +DISP_standard_color_6: + movf DISPLAY1_temp,W ; Color should be OK... + call DISP_set_color + return +DISP_standard_color2: + movlw 0xFF ; Force full white. + call DISP_set_color + return + +DISP_color_code macro color_code_temp + movlw color_code_temp + call DISP_color_code1 + endm + +DISP_color_code1: ; Color-codes the output, if required + dcfsnz WREG + bra DISP_color_code_depth ; CF43 [mbar], 16Bit + dcfsnz WREG + bra DISP_color_code_cns ; CF44 [%] + dcfsnz WREG + bra DISP_color_code_gf ; CF45 [%] + dcfsnz WREG + bra DISP_color_code_ppo2 ; CF46 [cbar] + dcfsnz WREG + bra DISP_color_code_velocity ; CF47 [m/min] + dcfsnz WREG + bra DISP_color_code_ceiling ; Show warning if CF41=1 and current depth>shown ceiling + dcfsnz WREG + bra DISP_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA") + + +DISP_color_code_gaslist: ; %O2 in "EEDATA" +; Check very high ppO2 manually + SAFE_2BYTE_COPY amb_pressure,xA + movlw d'10' + movwf xB+0 + clrf xB+1 + call div16x16 ; xC=p_amb/10 + movff xC+0,xA+0 + movff xC+1,xA+1 + movff EEDATA,xB+0 + clrf xB+1 + call mult16x16 ; EEDATA * p_amb/10 + + tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? + bra DISP_color_code_gaslist1 ; Yes, warn in warning color +; Check if ppO2>3,30bar + btfsc xC+1,7 + bra DISP_color_code_gaslist1 ; Yes, warn in warning color + + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar] + mullw d'100' ; ppo2_warning_high*100 + movff PRODL,sub_b+0 + movff PRODH,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag + bra DISP_color_code_gaslist1; too high -> Warning Color! + call DISP_standard_color + return + +DISP_color_code_gaslist1: + call DISP_warnings_color + return + +DISP_color_code_ceiling: + GETCUSTOM8 d'40' ; =1: Warn at all? + movwf lo + movlw d'1' + cpfseq lo ; =1? + bra DISP_color_code_ceiling1 ; No, Set to default color + + SAFE_2BYTE_COPY rel_pressure, lo + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + movff hi,xA+1 + movff lo,xA+0 + movff char_O_first_deco_depth,lo ; Ceiling in m + decf lo,F ; -1 + movlw LOW d'100' + movwf xB+0 + clrf xB+1 ; Devide/100 -> xC+0 = Depth in m + call div16x16 ; xA/xB=xC with xA as remainder + movf xC+0,W ; Depth in m + subwf lo,W + btfsc STATUS,C + bra DISP_color_code_ceiling2 ; Set to warning color +DISP_color_code_ceiling1: + call DISP_standard_color + return +DISP_color_code_ceiling2: + call DISP_warnings_color + return + +DISP_color_code_depth: + movff hi,hi_temp + movff lo,lo_temp + SAFE_2BYTE_COPY rel_pressure, lo + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + movff lo,sub_a+0 + movff hi,sub_a+1 + GETCUSTOM15 d'43' ; Depth warn [mbar] + movff lo,sub_b+0 + movff hi,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag + bra DISP_color_code_depth2; Set to warning color + call DISP_standard_color + movff hi_temp,hi + movff lo_temp,lo ; Restore hi, lo + return +DISP_color_code_depth2: + call DISP_warnings_color + movff hi_temp,hi + movff lo_temp,lo ; Restore hi, lo + return + +DISP_color_code_cns: + movff char_O_CNS_fraction,lo + GETCUSTOM8 d'44' ; CNS Warn [%] + subwf lo,W + btfsc STATUS,C + bra DISP_color_code_cns2 ; Set to warning color + call DISP_standard_color + return +DISP_color_code_cns2: + call DISP_warnings_color + return + +DISP_color_code_gf: + movff char_O_gradient_factor,lo ; gradient factor + GETCUSTOM8 d'45' ; GF Warn [%] + subwf lo,W + btfsc STATUS,C + bra DISP_color_code_gf2 ; Set to warning color + call DISP_standard_color + return +DISP_color_code_gf2: + call DISP_warnings_color + return + +DISP_color_code_ppo2: +; Check if ppO2>6,55bar + tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? + bra DISP_color_code_ppo22 ; Yes, warn in warning color +; Check if ppO2>3,30bar + btfsc xC+1,7 + bra DISP_color_code_ppo22 ; Yes, warn in warning color + + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar] + mullw d'100' + movff PRODL,sub_b+0 + movff PRODH,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag + bra DISP_color_code_ppo22; Set to warning color + call DISP_standard_color + return +DISP_color_code_ppo22: + call DISP_warnings_color + return + +DISP_color_code_velocity: + btfss neg_flag ; Ignore for ascend! + bra DISP_color_code_velocity1 ; Skip check! + movff divA+0,lo + GETCUSTOM8 d'47' ; Velocity warn [m/min] + subwf lo,W + btfsc STATUS,C + bra DISP_color_code_velocity2 ; Set to warning color +DISP_color_code_velocity1: + call DISP_standard_color + return +DISP_color_code_velocity2: + call DISP_warnings_color + return + +ostc_debug macro value + movlw value + call ostc_debug1 + endm + +ostc_debug1: + movff debug_char+4,debug_char+5 ; Save for background debugger + movff debug_char+3,debug_char+4 + movff debug_char+2,debug_char+3 + movff debug_char+1,debug_char+2 + movff debug_char+0,debug_char+1 + movff WREG,debug_char+0 + + btfss debug_mode ; Are we in debugmode? + return ; No, return! + + WIN_TOP .192 + WIN_LEFT .100 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + lfsr FSR2,letter + movf debug_char+0,W + movwf POSTINC2 + movf debug_char+1,W + movwf POSTINC2 + movf debug_char+2,W + movwf POSTINC2 + movf debug_char+3,W + movwf POSTINC2 + movf debug_char+4,W + movwf POSTINC2 + movf debug_char+5,W + movwf POSTINC2 + + STRCAT_PRINT " " + return + +;============================================================================= +; BlueScreen function. +; +DISP_resetdebugger: + global DISP_resetdebugger + global temp10 + + movlb 1 ; For C-code calls + call DISPLAY_boot ; DISP boot + call DISP_standard_color + WIN_INVERT .0 ; Init new Wordprocessor + + DISPLAYTEXT .133 + DISPLAYTEXT .134 + DISPLAYTEXT .135 + DISPLAYTEXT .136 ; Display Debug intro + + WIN_TOP .100 + WIN_LEFT .10 + + lfsr FSR2,letter + movff temp10+0,lo ; Code-stack point at crash time. + movff temp10+1,hi ; Code-stack point at crash time. + output_16 + movlw ' ' + movwf POSTINC2 + movf debug_char+0,W + movwf POSTINC2 + movf debug_char+1,W + movwf POSTINC2 + movf debug_char+2,W + movwf POSTINC2 + movf debug_char+3,W + movwf POSTINC2 + movf debug_char+4,W + movwf POSTINC2 + movf debug_char+5,W + movwf POSTINC2 + STRCAT ". " + movff flag1,lo + output_8 + PUTC ' ' + movff flag2,lo + output_8 + call word_processor + + WIN_TOP .125 + + lfsr FSR2,letter + movff flag3,lo + output_8 + PUTC ' ' + movff flag4,lo + output_8 + PUTC ' ' + movff flag5,lo + output_8 + PUTC ' ' + movff flag6,lo + output_8 + PUTC ' ' + movff flag7,lo + output_8 + call word_processor + + WIN_TOP .150 + + lfsr FSR2,letter + movff flag8,lo + output_8 + PUTC ' ' + movff flag9,lo + output_8 + PUTC ' ' + movff flag10,lo + output_8 + PUTC ' ' + movff flag11,lo + output_8 + PUTC ' ' + movff flag12,lo + output_8 + call word_processor + + call wait_switches ; Waits until switches are released, resets flag if button stays pressed! +DISP_resetdebugger_loop: + bcf LED_blue ; Blink blue led every seconds.. + btfss secs,0 + bsf LED_blue + + btfss switch_left + bra DISP_resetdebugger_loop ; Loop + + bcf LED_blue + call wait_switches ; Waits until switches are released, resets flag if button stays pressed! + return + +DISP_divemode_mask: ; Displays mask in Dive-Mode + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH .267 ; Max. + DISPLAYTEXT .86 ; Divetime + DISPLAYTEXT .87 ; Depth + call DISP_standard_color + return + +DISP_clear_customview_divemode: + WIN_BOX_BLACK .168, .239, .90, .159 ;top, bottom, left, right + return + +DISP_clear_customview_surfmode: + WIN_BOX_BLACK .25, .121, .82, .159 ;top, bottom, left, right + return + +DISP_clear_decoarea: + WIN_BOX_BLACK .54, .168, .90, .159 ;top, bottom, left, right + return + +DISP_display_ndl_mask: + ; Clears Gradient Factor + movlw d'8' + movwf temp1 + WIN_TOP .145 + WIN_LEFT .0 + call DISP_display_clear_common_y1 + + btfsc menubit ; Divemode menu active? + return ; Yes, return + + ; Clear Dekostop and Dekosum + rcall DISP_clear_decoarea + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'84' ; NoStop + call DISP_standard_color + return + +DISP_display_ndl: + GETCUSTOM8 d'66' ; Always show GF? + decfsz WREG,F ; WREG=1? + bra DISP_display_ndl2 ; No + rcall DISP_display_gf ; Show GF (If GF > CF08) + +DISP_display_ndl2: + btfsc menubit ; Divemode menu active? + return ; Yes, return + + ostc_debug 'z' ; Sends debug-information to screen if debugmode active + + WIN_TOP .136 + WIN_LEFT .119 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + movff char_O_nullzeit,lo ; NDL in minutes + output_8 + STRCAT_PRINT "'" + WIN_FONT FT_SMALL + return + +DISP_display_deko_mask: + btfsc menubit ; Divemode menu active? + return ; Yes, return + + rcall DISP_clear_decoarea + ; total deco time word + bcf show_safety_stop ; Clear safety stop flag + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'85' ; TTS + DISPLAYTEXT d'82' ; DEKOSTOP + call DISP_standard_color + return + +DISP_display_deko: + btfsc menubit ; Divemode menu active? + bra DISP_display_deko1 ; Yes, do not display deco, only GF (if required) + + ostc_debug 'y' ; Sends debug-information to screen if debugmode active + WIN_TOP .80 + WIN_LEFT .94 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + bcf leftbind + DISP_color_code warn_ceiling ; Color-code Output + btfsc decoplan_invalid ; The decoplan needs to updated... + call DISP_grey ; .. so set the color to grey + lfsr FSR2,letter + movff char_O_first_deco_depth,lo ; Ceiling in m + output_99 + PUTC TXT_METER_C + movff char_O_first_deco_time,lo ; length of first stop in m + output_99 + STRCAT_PRINT "'" + WIN_FONT FT_SMALL + + ostc_debug 'x' ; Sends debug-information to screen if debugmode active + + WIN_TOP .136 + WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + + call DISP_standard_color + btfsc decoplan_invalid ; The decoplan needs to updated... + call DISP_grey ; .. so set the color to grey + lfsr FSR2,letter + movff int_O_ascenttime+0,lo ; TTS + movff int_O_ascenttime+1,hi ; on 16bits + output_16 + STRCAT_PRINT "'" + call DISP_standard_color + +DISP_display_deko1: + rcall DISP_display_gf ; Show GF (If GF > CF08) + return ; Done. + +DISP_display_gf: + movff char_O_gradient_factor,lo ; gradient factor + GETCUSTOM8 d'8' ; threshold for display + cpfslt lo ; show value? + bra DISP_display_deko2 ; Yes + ; No + ; Clears Gradient Factor + movlw d'8' + movwf temp1 + WIN_TOP .145 + WIN_LEFT .0 + call DISP_display_clear_common_y1 + return + +DISP_display_deko2: + ostc_debug 'w' ; Sends debug-information to screen if debugmode active +;GF + WIN_TOP .145 + WIN_LEFT .0 + WIN_FONT FT_SMALL + DISP_color_code warn_gf ; Color-code Output + + STRCPY TXT_GF3 + movff char_O_gradient_factor,lo ; gradient factor + output_8 + STRCAT_PRINT "% " + call DISP_standard_color + return + +DISP_show_safety_stop: + tstfsz safety_stop_countdown ; Countdown at zero? + bra DISP_show_safety_stop2 ; No, show stop + + bcf show_safety_stop ; Clear flag + + btfsc safety_stop_active ; Displayed? + rcall DISP_clear_decoarea ; Yes, Clear stop + bcf safety_stop_active ; Clear flag + bra DISP_display_ndl_mask ; Show NDL again + +DISP_show_safety_stop2: + btfsc safety_stop_active ; Displayed? + bra DISP_show_safety_stop3 ; Yes. + + bsf safety_stop_active ; Set flag + + btfsc menubit ; Divemode menu active? + bra DISP_show_safety_stop3 ; Yes, do not display now but countdown + + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'227' ; Safety stop + +DISP_show_safety_stop3: + decf safety_stop_countdown,F ; Reduce countdown + btfsc menubit ; Divemode menu active? + return ; Yes, do not show + movff safety_stop_countdown,lo + call DISP_standard_color + WIN_TOP .80 + WIN_LEFT .104 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + lfsr FSR2,letter + clrf hi + call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) + movf hi,W + movff lo,hi + movwf lo ; exchange lo and hi + output_99 + PUTC ':' + movff hi,lo + output_99x + STRCAT_PRINT "" + WIN_FONT FT_SMALL + call DISP_standard_color + return + +;============================================================================= +; Update simulator menu with time/depth +; Note: because translations might change a bit the string length, we reprint +; that part of the mask to be sure the numbers fit in the right places. +DISP_simulator_data: + WIN_LEFT .20 + WIN_FONT FT_SMALL + call DISP_standard_color + + ;---- Updates interval line ---------------------------------------------- + WIN_TOP .35 + lfsr FSR2,letter + OUTPUTTEXTH .307 ; Interval: + + movff char_I_dive_interval,lo + movf lo,W + bnz DISP_simulator_data_1 + OUTPUTTEXTH .308 ; Now + clrf POSTINC2 ; End buffer. + bra DISP_simulator_data_2 + +DISP_simulator_data_1: + bsf leftbind + output_8 + STRCAT TXT_0MIN5 + +DISP_simulator_data_2: + call word_processor + + ;---- Updates bottom time line ------------------------------------------- + WIN_TOP .95 + lfsr FSR2,letter + OUTPUTTEXTH .277 ; Bottom Time: + + movff sim_btm_time,lo + bsf leftbind + output_8 + STRCAT_PRINT TXT_MIN4 + + ;---- Updates depth line ------------------------------------------------- + WIN_TOP .125 + lfsr FSR2,letter + OUTPUTTEXTH .278 ; Max. Depth: + + movff sim_btm_depth,lo + bsf leftbind + output_8 + STRCAT_PRINT TXT_METER3 + + bcf leftbind + return + +;============================================================================= + +DISP_divemode_timeout2: + WIN_TOP .54 + WIN_LEFT .112 + WIN_FONT FT_SMALL + WIN_INVERT .1 + call DISP_warnings_color + STRCPY 0x94 ; "End of dive" icon + movff timeout_counter, lo + movff timeout_counter2, hi + call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) + movf hi,W + movff lo,hi + movwf lo ; exchange lo and hi + output_99x + PUTC ':' + movff hi,lo + output_99x + STRCAT_PRINT " " + bsf timeout_display ; Set Flag + call DISP_standard_color + WIN_INVERT .0 + return + +DISP_divemode_timeout: + WIN_TOP .54 + WIN_LEFT .112 + WIN_FONT FT_SMALL + call DISP_standard_color + STRCPY 0x94 ; "End of dive" icon + GETCUSTOM15 d'2' ; diveloop_timeout + movff lo,sub_a+0 + movff hi,sub_a+1 + movff timeout_counter, sub_b+0 + movff timeout_counter2, sub_b+1 ; Divemode timeout + call sub16 ; sub_c = sub_a - sub_b + movff sub_c+0,lo + movff sub_c+1,hi + call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) + movf hi,W + movff lo,hi + movwf lo ; exchange lo and hi + output_99x + PUTC ':' + movff hi,lo + output_99x + STRCAT_PRINT " " + bsf timeout_display ; Set Flag + return + +DISP_divemode_timeout_clear: + btfsc dekostop_active ; Is a deco stop displayed? + call DISP_display_deko_mask ; Yes, redraw mask + + WIN_TOP .54 + WIN_LEFT .112 + movlw d'6' + movwf temp1 + bcf timeout_display ; Clear flag + bra DISP_display_clear_common_y1 + +DISP_display_velocity_graph_clr: + WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display + bra DISP_display_velocity ; Continue with normal output + +DISP_display_velocity_graphical: + btfss neg_flag + bra DISP_display_velocity_graph_clr + bsf DISP_velocity_display + ; divA+0 holding the ascend speed in m/min + movff divA+0,hi ; Copy + WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display + GETCUSTOM8 d'36' ; Divemode mask + WIN_FRAME_COLOR .20, .90, .65, .75 ; Outer frame + GETCUSTOM8 d'36' ; Divemode mask + WIN_FRAME_COLOR .20+.10, .90-.10, .65, .75 ; Inner frames + GETCUSTOM8 d'36' ; Divemode mask + WIN_FRAME_COLOR .20+.20, .90-.20, .65, .75 ; + GETCUSTOM8 d'36' ; Divemode mask + WIN_FRAME_COLOR .20+.30, .90-.30, .65, .75 ; + + GETCUSTOM8 d'47' ; color_warn_celocity_mmin + movwf xA+0 + clrf xA+1 + movlw .5 + movwf xB+0 ; Threshold for color warning (5 color normal + 2 color warning) + clrf xB+1 + call div16x16 ;xA/xB=xC with xA as remainder + ; xC+0 holds stepsize in m/min (e.g. =3 for 15m/min warning treshold) + movff hi,xA+0 ; Velocity in m/min + clrf xA+1 + movff xC+0,xB+0 ; Step size + clrf xB+1 + call div16x16 ;xA/xB=xC with xA as remainder + ; xC+0 now holds amount of segments to show + + movff hi,divA+0 ; Copy back for numeric output + movlw d'7' + cpfslt xC+0 + bra DISP_graph_vel_7 + movlw d'6' + cpfslt xC+0 + bra DISP_graph_vel_6 + movlw d'5' + cpfslt xC+0 + bra DISP_graph_vel_5 + movlw d'4' + cpfslt xC+0 + bra DISP_graph_vel_4 + movlw d'3' + cpfslt xC+0 + bra DISP_graph_vel_3 + movlw d'2' + cpfslt xC+0 + bra DISP_graph_vel_2 + movlw d'1' + cpfslt xC+0 + bra DISP_graph_vel_1 + bra DISP_graph_vel_0 ; Should not happen... + +DISP_graph_vel_7: + GETCUSTOM8 d'37' ; Color warning + WIN_BOX_COLOR .22, .22+.6, .67, .73 ; Fill box +DISP_graph_vel_6: + GETCUSTOM8 d'37' ; Color warning + WIN_BOX_COLOR .32, .32+.6, .67, .73 ; Fill box +DISP_graph_vel_5: + WIN_BOX_STD .42, .42+.6, .67, .73 ; Fill box +DISP_graph_vel_4: + WIN_BOX_STD .52, .52+.6, .67, .73 ; Fill box +DISP_graph_vel_3: + WIN_BOX_STD .62, .62+.6, .67, .73 ; Fill box +DISP_graph_vel_2: + WIN_BOX_STD .72, .72+.6, .67, .73 ; Fill box +DISP_graph_vel_1: + WIN_BOX_STD .82, .82+.6, .67, .73 ; Fill box +DISP_graph_vel_0: + +DISP_display_velocity: + ostc_debug 'v' ; Sends debug-information to screen if debugmode active + WIN_TOP .90 + WIN_LEFT .0 + WIN_FONT FT_SMALL + DISP_color_code warn_velocity ; Color code output + lfsr FSR2,letter + movlw '-' + btfsc neg_flag + movlw '+' + movwf POSTINC2 + movff divA+0,lo + output_99 + OUTPUTTEXT d'83' ; m/min + call word_processor + call DISP_standard_color + bsf DISP_velocity_display + return + +DISP_display_velocity_clear: + GETCUSTOM8 d'60' ; use graphic velocity (=1)? + movwf lo + movlw d'1' + cpfseq lo ; =1? + bra DISP_display_velocity_clear1 ; No, clear text display + WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display + +DISP_display_velocity_clear1: + movlw d'8' + movwf temp1 + WIN_TOP .90 + WIN_LEFT .0 + bcf DISP_velocity_display + bra DISP_display_clear_common_y1 + +DISP_display_wait_clear: + WIN_BOX_BLACK .0, .25, .0, .159 ;top, bottom, left, right + return + +DISP_display_clear_common_y2: ; Clears with y-scale=2 + WIN_FONT FT_MEDIUM + bra DISP_display_clear_common1 + +DISP_display_clear_common_y1: ; Clears with y-scale=1 + WIN_FONT FT_SMALL +DISP_display_clear_common1: + lfsr FSR2,letter +DISP_display_clear_common2: + PUTC ' ' + decfsz temp1,F + bra DISP_display_clear_common2 + call word_processor + WIN_FONT FT_SMALL + return + + +DISP_diveclock: + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'255' ; Clock + call DISP_standard_color + +DISP_diveclock2: + WIN_TOP .192 + WIN_LEFT .123 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + lfsr FSR2,letter + movff hours,lo + output_99x + PUTC ':' + movff mins,lo + output_99x + call word_processor + return + +DISP_clock: + ostc_debug 'c' + WIN_TOP .50 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + lfsr FSR2,letter + movff hours,lo + output_99x + PUTC ':' + movff mins,lo + output_99x + PUTC ':' + movff secs,lo + output_99x + STRCAT_PRINT " " + return + +DISP_interval: + WIN_TOP .75 + WIN_LEFT .90 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + lfsr FSR2,letter + + movff surface_interval+0,lo + movff surface_interval+1,hi + call convert_time ; lo=mins, hi=hours + + movf hi,W + movff lo,hi + movwf lo ; exchange lo and hi + output_99x + PUTC ':' + movff hi,lo + output_99x + STRCAT_PRINT " " + return + +DISP_show_gf_customview: + WIN_LEFT .93 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH .268 ;"Gradient Factors" + + GETCUSTOM8 d'64' ; Set to grey + call DISP_set_color + btfss use_aGF + call DISP_standard_color + + WIN_TOP .192 + STRCPY TXT_GF3 ; "GF:" + GETCUSTOM8 d'32' ; GF_lo + movwf lo + bsf leftbind + output_8 + STRCAT "/" + GETCUSTOM8 d'33' ; GF_hi + movwf lo + output_8 + STRCAT_PRINT "" + + GETCUSTOM8 d'64' ; Set to grey + call DISP_set_color + btfsc use_aGF + call DISP_standard_color + + WIN_TOP .216 + STRCPY TXT_aGF4 ; "aGF:" + GETCUSTOM8 d'67' ; aGF_lo + movwf lo + bsf leftbind + output_8 + STRCAT "/" + GETCUSTOM8 d'68' ; aGF_hi + movwf lo + output_8 + STRCAT_PRINT "" + bcf leftbind + + call DISP_standard_color + return + +DISP_show_cf11_cf12_cf29:; Display saturations/desaturation multiplier and last deco in the customview field + WIN_TOP .25 + WIN_LEFT .90 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + STRCPY TXT_BSAT5 + + GETCUSTOM8 d'11' + movwf lo + bsf leftbind + output_8 + STRCAT_PRINT "%" + + WIN_TOP .50 + STRCPY TXT_BDES5 + + GETCUSTOM8 d'12' + movwf lo + bsf leftbind + output_8 + STRCAT_PRINT "%" + +DISP_show_cf11_cf12_cf29_2: + WIN_TOP .75 + STRCPY TXT_LAST5 + GETCUSTOM8 d'29' + movwf lo + bsf leftbind + output_8 + STRCAT_PRINT TXT_METER1 + + bcf leftbind + return + +DISP_show_cf32_cf33_cf62_cf63: ; Display GF_LOW, GF_HIGH, pSCR ratio and drop in the customview field + WIN_TOP .25 + WIN_LEFT .90 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + GETCUSTOM8 d'32' ; GF_lo + movwf lo + STRCPY TXT_GFLO6 + bsf leftbind + output_8 + STRCAT_PRINT "%" + + WIN_TOP .50 + GETCUSTOM8 d'33' ; GF_hi + movwf lo + STRCPY TXT_GFHI6 + bsf leftbind + output_8 + STRCAT_PRINT "%" + + WIN_TOP .75 + lfsr FSR2,letter + GETCUSTOM8 d'62' ; O2 Drop in percent + movwf lo + bsf leftbind + output_8 + + STRCAT "% 1/" + GETCUSTOM8 d'63' ; Counter lung ratio in 1/X + movwf lo + output_8 + bcf leftbind + STRCAT_PRINT "" + return + + + +DISP_show_cf32_cf33_cf29:; Display GF_LOW, GF_HIGH and last deco in the customview field + WIN_TOP .25 + WIN_LEFT .90 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + GETCUSTOM8 d'32' ; GF_lo + movwf lo + + STRCPY TXT_GFLO6 + bsf leftbind + output_8 + STRCAT_PRINT "%" + + WIN_TOP .50 + GETCUSTOM8 d'33' ; GF_hi + movwf lo + STRCPY TXT_GFHI6 + bsf leftbind + output_8 + STRCAT_PRINT "%" + + bra DISP_show_cf11_cf12_cf29_2 ; Display CF29 in the third row and RETURN + + +DISP_logbook_cursor: + +DISP_menu_cursor: + WIN_BOX_BLACK .35, .239, .0, .16 ;top, bottom, left, right + + WIN_LEFT .0 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + movff menupos,temp1 + dcfsnz temp1,F + movlw d'35' + dcfsnz temp1,F + movlw d'65' + dcfsnz temp1,F + movlw d'95' + dcfsnz temp1,F + movlw d'125' + dcfsnz temp1,F + movlw d'155' + dcfsnz temp1,F + movlw d'185' + + movff WREG,win_top + STRCPY_PRINT "\xB7" + return + +DISP_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .5 ; Menu: + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .6 ; Logbook + DISPLAYTEXT .7 ; Gas Setup + DISPLAYTEXT .9 ; Reset all + DISPLAYTEXT .10 ; Setup... + DISPLAYTEXT .142 ; More... + DISPLAYTEXT .11 ; Exit + +; Write OSTC serial in Main Menu + WIN_TOP .215 + WIN_LEFT .47 + GETCUSTOM8 d'64' ; Write header in blue when + call DISP_set_color ; compiled in DEBUG mode... + lfsr FSR2,letter + OUTPUTTEXTH d'262' ; "OSTC " + clrf EEADRH + clrf EEADR ; Get Serial number LOW + call read_eeprom ; read byte + movff EEDATA,lo + incf EEADR,F ; Get Serial number HIGH + call read_eeprom ; read byte + movff EEDATA,hi + bsf leftbind + output_16 + call word_processor + call DISP_standard_color + return + +DISP_setup_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .98 ; Setup Menu: + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .99 ; Custom FunctionsI + DISPLAYTEXT .153 ; Custom FunctionsII + DISPLAYTEXTH .295 ; Custom FunctionsIII + DISPLAYTEXT .100 ; Decotype: + DISPLAYTEXT .142 ; More... + DISPLAYTEXT .11 ; Exit + return + +DISP_ccr_setup_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .111 ; CCR Setup Menu + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .229 ; Diluent Setup + DISPLAYTEXT .230 ; Setpoint Setup + DISPLAYTEXT .11 ; Exit + return + + +DISP_more_setup_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXTH .258 ; Setup Menu 2: + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXTH .257 ; Date format: + DISPLAYTEXT .129 ; Debug: + DISPLAYTEXT .187 ; Show License + DISPLAYTEXTH .276 ; Salinity: + DISPLAYTEXTH .280 ; Brightness: + DISPLAYTEXT .11 ; Exit + return + +DISP_more_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .144 ; Menu 2: + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .8 ; Set Time + DISPLAYTEXT .110 ; Const. ppO2 Setup + DISPLAYTEXT .113 ; Battery Info + DISPLAYTEXT .247 ; Simulator + DISPLAYTEXTH .287 ; Altimeter + DISPLAYTEXT .11 ; Exit + return + +DISP_reset_menu_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .28 ; Reset Menu + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .21 ; Cancel Reset + DISPLAYTEXT .245 ; Reset CF,Gases & Deco + DISPLAYTEXTH .284 ; Reset Logbook + DISPLAYTEXTH .285 ; Reboot OSTC + DISPLAYTEXTH .286 ; Reset Decodata + DISPLAYTEXT .11 ; Exit + return + +DISP_simulator_mask: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT .248 ; OSTC Simulator + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXTH .307 ; Interval: + DISPLAYTEXT .249 ; Start Dive + DISPLAYTEXTH .277 ; Bottom Time: + DISPLAYTEXTH .278 ; Max. Depth: + DISPLAYTEXTH .279 ; Calculate Deco + DISPLAYTEXT .11 ; Exit + return + +DISP_temp_surfmode: + ostc_debug 'e' + SAFE_2BYTE_COPY temperature, last_temperature + WIN_TOP .100 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + movff last_temperature+1,hi + movff last_temperature+0,lo + lfsr FSR2,letter + call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required + movlw d'3' + movwf ignore_digits + bsf leftbind ; left orientated output + output_16dp d'2' + bcf leftbind + STRCAT_PRINT "°C " + return + +DISP_temp_divemode: + ostc_debug 'u' ; Sends debug-information to screen if debugmode active + +; temperature + SAFE_2BYTE_COPY temperature, last_temperature + + WIN_TOP .216 + WIN_LEFT .50 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + movff last_temperature+1,hi + movff last_temperature+0,lo + + lfsr FSR2,letter + call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required + movlw d'3' + movwf ignore_digits + bsf leftbind ; left orientated output + output_16dp d'2' + bcf leftbind + STRCAT "° " + clrf WREG ; Allow up to 5 chars to avoid + movff WREG,letter+5 ; collision with sat graphs + call word_processor + return + +DISP_show_ppO2: ; Show ppO2 (ppO2 stored in xC) + ostc_debug 't' ; Sends debug-information to screen if debugmode active + WIN_TOP .117 + WIN_LEFT .0 + WIN_FONT FT_SMALL + DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) + STRCPY TXT_PPO2_5 + +; Check very high ppO2 manually + tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? + bra DISP_show_ppO2_3 ; Yes, display fixed Value! + + movff xC+0,lo + movff xC+1,hi + bsf ignore_digit4 + output_16dp d'1' + bcf ignore_digit4 +DISP_show_ppO2_2: + STRCAT_PRINT " " + call DISP_standard_color + return + +DISP_show_ppO2_3: + STRCAT ">6.6" + bra DISP_show_ppO2_2 + +DISP_show_ppO2_clear: ; Clear ppO2 + movlw d'10' + movwf temp1 + WIN_TOP .117 + WIN_LEFT .0 + call DISP_display_clear_common_y1 + return + +DISP_active_gas_clear: ; clears active gas! + WIN_TOP .192 + WIN_LEFT .50 + movlw d'5' + movwf temp1 + bra DISP_display_clear_common_y1; also returns! + +DISP_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9 + btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode + return + + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_active_gas_divemode_show ; Show gas (Non-Inverted in all cases) + + btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode + return ; Done. + +; Check if Gas Output should blink when a better gas is available... + GETCUSTOM8 d'42' ; =1 if gas should blink + movwf lo + movlw d'1' + cpfseq lo ; =1? + return ; No, Done. + + btg blinking_better_gas ; Toggle blink bit... + btfss blinking_better_gas ; blink now? + return ; No, Done. + movlw color_yellow ; Blink in yellow + call DISP_set_color + WIN_INVERT .1 ; Init new Wordprocessor + call DISP_active_gas_divemode_show1 ; Show gas (Non-Inverted in all cases) + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + return ; Done. + +DISP_active_gas_divemode_show: + call DISP_standard_color +DISP_active_gas_divemode_show1: + ostc_debug 's' ; Sends debug-information to screen if debugmode active +; gas + WIN_TOP .192 + WIN_LEFT .50 + WIN_FONT FT_SMALL + + movlw d'100' ; 100% in the tank + movff char_I_N2_ratio,lo ; minus N2 + bsf STATUS,C ; set borrow bit + subfwb lo,W + movff char_I_He_ratio,lo ; minus He + bsf STATUS,C ; set borrow bit + subfwb lo,F ; =% O2 + GETCUSTOM8 d'9' ; get oxygen treshold + movff char_I_He_ratio,hi ; He ratio + cpfsgt lo + bra DISP_active_gas_divemode2 ; Check He + bra DISP_active_gas_divemode3 ; Skip He check, display gas + +DISP_active_gas_divemode2: + tstfsz hi ; He = 0 % + bra DISP_active_gas_divemode3 ; display gas + + call DISP_warnings_color ; O2 below treshold, He=0 : Bad stuff ! + bra DISP_active_gas_divemode4 + +DISP_active_gas_divemode3: + movlw d'21' + cpfseq lo ; Air? (O2=21%) + bra DISP_active_gas_divemode4 ; No! + tstfsz hi ; Air? (He=0%) + bra DISP_active_gas_divemode4 ; No! + + ; Yes, display "Air" instead of 21/0 + lfsr FSR2,letter + OUTPUTTEXTH d'264' ;"Air " + PUTC ' ' + clrf WREG ; Allow up to 5 chars to avoid + movff WREG,letter+5 ; collision with sat graphs + bcf leftbind + call word_processor +DISP_active_better_gas: + WIN_TOP .192 + WIN_LEFT .43 + WIN_FONT FT_SMALL + lfsr FSR2,letter + movlw ' ' + btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode + movlw '*' + movwf POSTINC2 + call word_processor + return + +DISP_active_gas_divemode4: + lfsr FSR2,letter + bsf leftbind ; left orientated output + output_8 ; O2 ratio is still in "lo" + PUTC '/' + movff char_I_He_ratio,lo ; copy He ratio into lo + output_8 + PUTC ' ' + clrf WREG ; Allow up to 5 chars to avoid + movff WREG,letter+5 ; collision with sat graphs + bcf leftbind + call word_processor + rcall DISP_active_better_gas ; show *, if required + call DISP_standard_color ; Back to normal (if O2<21 and He=0) + return + +;----------------------------------------------------------------------------- +; Set color to grey when gas is inactive +; Inputs: WREG : gas# (0..4) +; Trashes: lo +; New v1.44se +DISP_grey_inactive_gas: + movwf lo ; copy gas number 0-4 + incf lo,F ; 1-5 + + read_int_eeprom d'33' ; Get First gas (1-5) + movf EEDATA,W + subwf lo,W ; Compare with current + bz DISP_white_gas ; First is always on. + + movlw .28-1 ; Depth for gas# is at idx+28 + addwf lo,W + movwf EEADR ; address in EEPROM. + call read_eeprom ; Read depth + clrf WREG + cpfsgt EEDATA ; is depth > 0 ? + bra DISP_grey_gas + + clrf EEADRH ; Lower page of EEPROM. + read_int_eeprom d'27' ; read flag register +DISP_grey_inactive_gas1: + rrcf EEDATA ; roll flags into carry + decfsz lo,F ; max. 5 times... + bra DISP_grey_inactive_gas1 + + bnc DISP_grey_gas ; test carry + +DISP_white_gas: + GETCUSTOM8 d'35' ;movlw color_white + goto DISP_set_color ; grey out inactive gases! + ; return + +DISP_grey_gas: +DISP_grey: + GETCUSTOM8 d'64' ;movlw color_grey + goto DISP_set_color ; grey out inactive gases! + ; return + +;----------------------------------------------------------------------------- +; Display Pre-Dive Screen + +DISP_pre_dive_screen: + ; List active gases/Setpoints + + btfsc FLAG_const_ppO2_mode ; in ppO2 mode? + bra DISP_pre_dive_screen3 ; Yes, display SetPoint/Sensor result list + +DISP_pre_dive_screen2: + ostc_debug 'm' ; Sends debug-information to screen if debugmode active + + WIN_LEFT .90 + WIN_FONT FT_SMALL + bsf leftbind + + movlw d'2' + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'0' + movwf waitms_temp ; here: stores row for gas list + clrf hi ; here: Gas counter + +DISP_pre_dive_screen2_loop: + incf hi,F ; Increase Gas + movlw d'4' + addwf wait_temp,F ; Increase eeprom address for gas list + + STRCPY TXT_GAS1 + movff hi,lo ; copy gas number + output_8 ; display gas number + STRCAT ": " + movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '/' + incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + + decf hi,W ; Gas # in 0..4 + call DISP_grey_inactive_gas + + read_int_eeprom d'33' ; Read start gas (1-5) + movf EEDATA,W + cpfseq hi ; Current Gas the active gas? + bra DISP_pre_dive_screen2a + bra DISP_pre_dive_screen2b + +DISP_pre_dive_screen2a: + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .90 + movff waitms_temp,win_top ; Set Row + call word_processor ; No, display gas + +DISP_pre_dive_screen2b: + movlw d'5' ; list all four (remaining) gases + cpfseq hi ; All gases shown? + bra DISP_pre_dive_screen2_loop ; No + + return ; No, return (OC mode) + +DISP_pre_dive_screen3: + WIN_LEFT .90 + WIN_FONT FT_SMALL + bsf leftbind + call DISP_standard_color + + ; list three SP in Gaslist + movlw d'35' ; 36 = current SP position in EEPROM + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'0' + movwf waitms_temp ; here: stores row for gas list + clrf apnoe_mins ; here: SP counter + +DISP_pre_dive_screen3_loop: + incf wait_temp,F ; EEPROM address + incf apnoe_mins,F ; Increase SP + + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .90 + movff waitms_temp,win_top ; Set Row + + STRCPY TXT_SP2 + movff apnoe_mins,lo ; copy gas number + output_8 ; display gas number + STRCAT ": " + movff wait_temp, EEADR ; SP #hi position + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + clrf hi + output_16dp d'3' ; outputs into Postinc2! + call word_processor + + movlw d'3' ; list all three SP + cpfseq apnoe_mins ; All gases shown? + bra DISP_pre_dive_screen3_loop ;no + + + call get_first_diluent ; Read first diluent into lo(O2) and hi(He) + WIN_LEFT .90 + WIN_TOP .100 + STRCPY TXT_DIL4 + output_8 ; O2 Ratio + PUTC '/' + movff hi,lo + output_8 ; He Ratio + call word_processor + + bcf leftbind + return ; Return (CC Mode) + +DISP_active_gas_surfmode: ; Displays start gas/SP 1 + ostc_debug 'q' ; Sends debug-information to screen if debugmode active + + btfsc FLAG_apnoe_mode ; In Apnoe mode? + return ; Yes, return + + btfsc gauge_mode ; In Gauge mode? + return ; Yes, return + + btfss FLAG_const_ppO2_mode ; are we in const. ppO2 mode? + bra DISP_active_gas_surfmode2 ; No, display gases + +; In CC Mode + WIN_TOP .135 + WIN_LEFT .90 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + read_int_eeprom d'36' + movff EEDATA,lo ; copy to lo + clrf hi + output_16dp d'3' ; outputs into Postinc2! + bcf leftbind + + STRCAT_PRINT TXT_BAR3 + return ; Done. + +DISP_active_gas_surfmode2: + WIN_TOP .130 + WIN_LEFT .100 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + read_int_eeprom d'33' ; Read byte (stored in EEDATA) + movff EEDATA,active_gas ; Read start gas (1-5) + + decf active_gas,W ; Gas 0-4 + mullw d'4' + movf PRODL,W + addlw d'7' ; = address for He ratio + movwf EEADR + call read_eeprom ; Read He ratio + movff EEDATA,char_I_He_ratio ; And copy into hold register + + decf active_gas,W ; Gas 0-4 + mullw d'4' + movf PRODL,W + addlw d'6' ; = address for O2 ratio + movwf EEADR + call read_eeprom ; Read O2 ratio + movff EEDATA, char_I_O2_ratio ; O2 ratio + movff char_I_He_ratio, wait_temp ; copy into bank1 register + bsf STATUS,C ; Borrow bit + movlw d'100' ; 100% + subfwb wait_temp,W ; minus He + bsf STATUS,C ; Borrow bit + subfwb EEDATA,F ; minus O2 + movff EEDATA, char_I_N2_ratio ; = N2! + + movlw d'100' ; 100% in the tank + movff char_I_N2_ratio,lo ; minus N2 + bsf STATUS,C ; set borrow bit + subfwb lo,W + movff char_I_He_ratio,lo ; minus He + bsf STATUS,C ; set borrow bit + subfwb lo,F ; =% O2 + + movff char_I_He_ratio,hi ; Copy into Bank1 register + + movlw d'21' + cpfseq lo ; Air? (O2=21%) + bra DISP_active_gas_surfmode4 ; No! + tstfsz hi ; Air? (He=0%) + bra DISP_active_gas_surfmode4 ; No! + + ; Yes, display "Air" instead of 21/0 + DISPLAYTEXTH d'265' ;"Air ", y-scale=2 + return ; Done. + +DISP_active_gas_surfmode4: + lfsr FSR2,letter + bsf leftbind ; left orientated output + output_99 ; O2 ratio is still in "lo" + movff char_I_He_ratio,lo ; copy He ratio into lo + tstfsz lo ; He>0? + bra DISP_active_gas_surfmode5 ; Yes. + bra DISP_active_gas_surfmode6 ; No, skip He +DISP_active_gas_surfmode5: + PUTC '/' + output_99 +DISP_active_gas_surfmode6: + bcf leftbind + call word_processor + + rcall DISP_mainscreen_show_nx + tstfsz lo ; He>0? + rcall DISP_mainscreen_show_tx ; Yes + return ; Done. + +DISP_mainscreen_show_tx: + WIN_LEFT .85 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + WIN_TOP .127 + + STRCPY_PRINT TXT_TX1 + WIN_TOP .148 + STRCPY_PRINT TXT_TX2 + return +DISP_mainscreen_show_nx: + WIN_LEFT .85 + WIN_TOP .127 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + + STRCPY_PRINT TXT_NX1 + WIN_TOP .148 + STRCPY_PRINT TXT_NX2 + return + + +DISP_confirmbox: + WIN_BOX_BLACK .68, .146, .34, .101 ;top, bottom, left, right + WIN_FRAME_STD .70, .144, .35, .100 + + DISPLAYTEXT .143 ; Confirm: + DISPLAYTEXT .145 ; Cancel + DISPLAYTEXT .146 ; OK! + + movlw d'1' + movwf menupos + +DISP_confirmbox2: + WIN_BOX_BLACK .96, .143, .39, .51 ;top, bottom, left, right + + movff menupos,temp1 + movlw d'96' + dcfsnz temp1,F + movlw d'96' + dcfsnz temp1,F + movlw d'120' + movff WREG,win_top + WIN_LEFT .39 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + STRCPY_PRINT "\xB7" ; Cursor + + bcf sleepmode ; clear some flags + bcf menubit2 + bcf menubit3 + bcf switch_right + bcf switch_left + clrf timeout_counter2 + WAITMS d'100' + +DISP_confirmbox_loop: + call check_switches_logbook + + btfsc menubit3 ; SET/MENU? + bra DISP_confirmbox_move_cursor; Move Cursor + btfsc menubit2 ; ENTER? + bra DISP_confirmbox_menu_do ; Do task + + btfsc onesecupdate + call timeout_surfmode ; timeout + + btfsc onesecupdate + call set_dive_modes ; check, if divemode must be entered + bcf onesecupdate ; one second update + + btfsc sleepmode ; Timeout? + bra DISP_confirmbox_cancel ; back with cancel + btfsc divemode + bra DISP_confirmbox_cancel ; back with cancel + + bra DISP_confirmbox_loop ; wait for something to do + +DISP_confirmbox_cancel: + retlw .0 +DISP_confirmbox_ok: + retlw .1 + +DISP_confirmbox_menu_do: + dcfsnz menupos,F + bra DISP_confirmbox_cancel + dcfsnz menupos,F + bra DISP_confirmbox_ok + bra DISP_confirmbox_cancel + +DISP_confirmbox_move_cursor: + incf menupos,F + movlw d'3' ; number of menu options+1 + cpfseq menupos ; =limit? + bra DISP_confirmbox_move_cursor2 ; No! + movlw d'1' ; Yes, reset to position 1! + movwf menupos +DISP_confirmbox_move_cursor2: + bra DISP_confirmbox2 ; Return to Profile Menu, also updates cursor + + +DISP_depth: +; ostc_debug 'r' ; Sends debug-information to screen if debugmode active + SAFE_2BYTE_COPY rel_pressure, lo + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + + movlw .039 + cpfslt hi + bra depth_greater_99_84mtr + + btfsc depth_greater_100m ; Was depth>100m during last call + call DISP_clear_depth ; Yes, clear depth area + bcf depth_greater_100m ; Do this once only... + + lfsr FSR2,letter + + movlw HIGH d'1000' + movwf sub_a+1 + movlw LOW d'1000' + movwf sub_a+0 + movff hi,sub_b+1 + movff lo,sub_b+0 + incf sub_b+0,F + movlw d'0' + addwfc sub_b+1,F ; Add 1mbar offset + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag ; Depth lower then 10m? + rcall depth_less_10mtr ; Yes, add extra space + + WIN_TOP .24 + WIN_LEFT .0 + WIN_FONT FT_LARGE + WIN_INVERT .0 ; Init new Wordprocessor + DISP_color_code warn_depth ; Color-code the output + + movlw HIGH d'99' + movwf sub_a+1 + movlw LOW d'99' + movwf sub_a+0 + movff hi,sub_b+1 + movff lo,sub_b+0 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag ; Depth lower then 1m? + bra DISP_depth2 ; Yes, display manual Zero + + bsf leftbind + bsf ignore_digit4 + output_16 ; Full meters in Big font + bcf leftbind + bra DISP_depth3 + +DISP_depth2: + PUTC '0' + +DISP_depth3: + call word_processor + bcf ignore_digit4 + + WIN_FONT FT_MEDIUM + WIN_TOP .50 + WIN_LEFT .40 + DISP_color_code warn_depth ; Color-code the output + + SAFE_2BYTE_COPY rel_pressure, lo + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + + STRCPY "." + + movlw HIGH d'20' ; Display 0.0m if lower then 20cm + movwf sub_a+1 + movlw LOW d'20' + movwf sub_a+0 + movff hi,sub_b+1 + movff lo,sub_b+0 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag ; Depth lower then 0.3m? + bra DISP_depth4 ; Yes, display manual Zero + + movlw d'4' + movwf ignore_digits + bsf ignore_digit5 + output_16dp d'0' + bra DISP_depth5 + +DISP_depth4: + PUTC '0' + +DISP_depth5: + call word_processor ; decimeters in medium font + bcf ignore_digit5 + WIN_FONT FT_SMALL + return + +depth_greater_99_84mtr: ; Display only in full meters + btfss depth_greater_100m ; Is depth>100m already? + call DISP_clear_depth ; No, clear depth area and set flag + ; Depth is already in hi:lo + ; Show depth in Full meters + ; That means ignore figure 4 and 5 + lfsr FSR2,letter + WIN_TOP .24 + WIN_LEFT .0 + WIN_FONT FT_LARGE + WIN_INVERT .0 ; Init new Wordprocessor + DISP_color_code warn_depth ; Color-code the output + + bsf ignore_digit4 + bsf leftbind + output_16 + bcf leftbind + call word_processor + bcf ignore_digit4 + WIN_FONT FT_SMALL + return + +depth_less_10mtr: + PUTC ' ' + return + +DISP_clear_depth ; No, clear depth area and set flag + WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right + bsf depth_greater_100m ; Set Flag + return + +DISP_desaturation_time: + movff int_O_desaturation_time+0,lo + movff int_O_desaturation_time+1,hi ; Copy + tstfsz lo ; =0? + bra DISP_desaturation_time2 ; No! + tstfsz hi ; =0? + bra DISP_desaturation_time2 ; No! + return ; Do not display Desat + +DISP_desaturation_time2: + ostc_debug 'h' + WIN_TOP .150 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + OUTPUTTEXT d'14' ; Desat + PUTC ' ' + movff desaturation_time_buffer+0,lo ; divide by 60... + movff desaturation_time_buffer+1,hi + + call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) + bsf leftbind + movf lo,W + movff hi,lo + movwf hi ; exchange lo and hi... + output_8 ; Hours + PUTC ':' + movff hi,lo ; Minutes + output_99x + bcf leftbind + PUTC ' ' +; clrf WREG ; Allow up to 5 chars to avoid +; movff WREG,letter+6 ; collision with decotype letters + call word_processor + return + +DISP_nofly_time: + movf nofly_time+0,W ; Is nofly null ? + iorwf nofly_time+1,W + bnz DISP_nofly_time2 ; No... + return + +DISP_nofly_time2: + ostc_debug 'g' + WIN_TOP .125 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + OUTPUTTEXT d'35' ; NoFly + PUTC ' ' + movff nofly_time+0,lo ; divide by 60... + movff nofly_time+1,hi + call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) + bsf leftbind + movf lo,W + movff hi,lo + movwf hi ; exchange lo and hi... + output_8 ; Hours + PUTC ':' + movff hi,lo ; Minutes + output_99x + bcf leftbind + PUTC ' ' +; clrf WREG ; Allow up to 5 chars to avoid +; movff WREG,letter+6 ; collision with decotype letters + call word_processor + return + + +update_surf_press: + btfsc premenu ; Do not update when "Menu?" is displayed! + return + + ostc_debug 'b' ; Sends debug-information to screen if debugmode active + WIN_TOP .25 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + +; btfss high_altitude_mode ; In high altitude mode? + call DISP_standard_color ; No +; btfsc high_altitude_mode ; In high altitude mode? +; call DISP_warnings_color ; Yes, display ambient pressure in red + + SAFE_2BYTE_COPY amb_pressure, lo + lfsr FSR2,letter + + movff lo,sub_a+0 + movff hi,sub_a+1 + movff last_surfpressure_30min+0,sub_b+0 + movff last_surfpressure_30min+1,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + btfsc neg_flag ; Pressure lower? + rcall update_surf_press2 ; Yes, test threshold + + tstfsz sub_c+1 ; >255mbar difference? + bra update_surf_press_common; Yes, display! + movlw d'5' + subwf sub_c+0,W + btfsc STATUS,C + bra update_surf_press_common; Yes, display! +; PUTC '+' ; For debug only + SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... + +update_surf_press_common: + bsf leftbind + output_16 + bcf leftbind + STRCAT_PRINT TXT_MBAR5 + call DISP_standard_color ; Reset color + return + +update_surf_press2: + movff lo,sub_b+0 + movff hi,sub_b+1 + movff last_surfpressure_30min+0,sub_a+0 + movff last_surfpressure_30min+1,sub_a+1 + call sub16 ; sub_c = sub_a - sub_b +; PUTC '-' ; For debug only + return + +update_batt_voltage_divemode: + call DISP_warnings_color + DISPLAYTEXT d'246' ; LowBatt! + call DISP_standard_color + return + +update_batt_voltage: + ostc_debug 'f' + + GETCUSTOM8 d'31' ; =1 if battery voltage should be visible + movwf lo + movlw d'1' + cpfseq lo ; =1? + bra update_batt_voltage2 ; No, show symbol + + WIN_TOP .175 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + movff batt_voltage+0,lo + movff batt_voltage+1,hi + movlw d'1' + movwf ignore_digits + bsf ignore_digit5 ; do not display mV + bsf leftbind + output_16dp d'2' ; e.g. 3.45V + bcf leftbind + STRCAT_PRINT TXT_VOLT2 + return + +update_batt_voltage2: + WIN_FRAME_STD .174, .194, .1, .32 + +; 4100-Vbatt + movlw LOW d'4100' + movwf sub_a+0 + movlw HIGH d'4100' + movwf sub_a+1 + movff batt_voltage+0,sub_b+0 + movff batt_voltage+1,sub_b+1 + call sub16 ; sub_c = sub_a - sub_b +; Battery full (>4100mV? + btfsc neg_flag + bra update_batt_voltage2_full + +; Vbatt-3500 + movlw LOW d'3500' + movwf sub_b+0 + movlw HIGH d'3500' + movwf sub_b+1 + movff batt_voltage+0,sub_a+0 + movff batt_voltage+1,sub_a+1 + call sub16 ; sub_c = sub_a - sub_b +; Battery lower then 3500mV? + btfsc neg_flag + bra update_batt_voltage2_empty + +; Battery is between 3500 and 4100mV +; sub_c:2 is between 0 and 600 + movff sub_c+0,xA+0 + movff sub_c+1,xA+1 + movlw d'20' + movwf xB+0 + clrf xB+1 + call div16x16 ;xA/xB=xC with xA as remainder +; xC is between 0 and 30 + movff xC+0,wait_temp ;save value + incf wait_temp,F ; +1 + + movlw d'3' + cpfsgt wait_temp + movwf wait_temp ; Minimum = 3 + +update_batt_voltage2a: + WIN_BOX_STD .181, .187, .32, .34 ; Battery nose + +update_batt_voltage3: + GETCUSTOM8 d'34' ; Color battery + btfsc cc_active + movlw color_yellow ; CC active + btfsc charge_done + movlw color_green ; Charge done. + call DISP_set_color + + movlw .175 + movff WREG,win_top ; row top (0-239) + movlw .19 + movff WREG,win_height + movlw .2 + movff WREG,win_leftx2 ; column left (0-159) + movff wait_temp,win_width ; column right (0-159) + call DISP_box + call DISP_standard_color + return + +update_batt_voltage2_empty: + movlw d'1' + movwf wait_temp + bra update_batt_voltage2a + +update_batt_voltage2_full: + movlw d'30' + movwf wait_temp + bra update_batt_voltage2a + +DISP_convert_signed_temperature: + btfss hi,7 ; Negative temperature ? + return ; No, return +; Yes, negative temperature! + PUTC '-' ; Display "-" + comf hi ; Then, 16bit sign changes. + negf lo + btfsc STATUS,C + incf hi + return ; and return + +DISP_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) + tstfsz EEDATA + bra DISP_convert_date1 + +; Use MMDDYY + movff convert_value_temp+0,lo ;month + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+1,lo ;day + bra DISP_convert_date1_common ;year + +DISP_convert_date1: + read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) + decfsz EEDATA,F + bra DISP_convert_date2 + +; Use DDMMYY + movff convert_value_temp+1,lo ;day + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+0,lo ;month + +DISP_convert_date1_common: + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+2,lo ;year + bsf leftbind + output_99x + return + +DISP_convert_date2: +; Use YYMMDD + movff convert_value_temp+2,lo ;year + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+0,lo ;month + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+1,lo ;day + bsf leftbind + output_99x + return + +DISP_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 + read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) + tstfsz EEDATA + bra DISP_convert_date_short1 + +; Use MMDDYY +DISP_convert_date_short_common: + movff convert_value_temp+0,lo ;month + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+1,lo ;day + bsf leftbind + output_99x + bcf leftbind + return + +DISP_convert_date_short1: + read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) + decfsz EEDATA,F + bra DISP_convert_date_short_common ; Use YYMMDD + +; Use DDMMYY + movff convert_value_temp+1,lo ;day + bsf leftbind + output_99x + bcf leftbind + PUTC '.' + movff convert_value_temp+0,lo ;month + bsf leftbind + output_99x + bcf leftbind + return + +update_date: + ostc_debug 'd' + WIN_TOP .75 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + lfsr FSR2,letter + + movff month,convert_value_temp+0 + movff day,convert_value_temp+1 + movff year,convert_value_temp+2 + call DISP_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 + call word_processor + return + +DISP_menu_clear: + WIN_BOX_BLACK .0, .26, .50, .100 ;top, bottom, left, right + return + +DISP_max_pressure: + ostc_debug 'p' ; Sends debug-information to screen if debugmode active + movff max_pressure+0,lo + movff max_pressure+1,hi + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + + movlw .039 + cpfslt hi + bra maxdepth_greater_99_84mtr + +; Display normal "xx.y" + lfsr FSR2,letter + call DISP_standard_color + WIN_TOP .207 + WIN_LEFT .0 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + bsf leftbind + bsf ignore_digit5 ; do not display 1cm depth + output_16dp d'3' + bcf leftbind + bcf show_last3 + call word_processor + WIN_FONT FT_SMALL + return + +maxdepth_greater_99_84mtr: ; Display only in full meters + btfss maxdepth_greater_100m ; Is max.depth>100m already? + call DISP_clear_maxdepth ; No, clear maxdepth area and set flag + ; max Depth is already in hi:lo + ; Show max depth in Full meters + ; That means ignore figure 4 and 5 + lfsr FSR2,letter + call DISP_standard_color + WIN_TOP .207 + WIN_LEFT .0 + WIN_FONT FT_MEDIUM + WIN_INVERT .0 ; Init new Wordprocessor + + bsf ignore_digit4 + bsf leftbind + output_16 + bcf leftbind + call word_processor + bcf ignore_digit4 + WIN_FONT FT_SMALL + return + +DISP_clear_maxdepth: + WIN_BOX_BLACK .207, .239, .0, .41 ;top, bottom, left, right + bsf maxdepth_greater_100m ; Set Flag + return + +DISP_divemins: + btfsc menubit ; Divemode menu active? + return ; Yes, do not update divetime + + ostc_debug 'A' ; Sends debug-information to screen if debugmode active + + btfsc gauge_mode ; different display in gauge mode + bra DISP_divemins_gauge + + btfsc FLAG_apnoe_mode ; different display in apnoe mode + bra DISP_divemins_apnoe + + GETCUSTOM8 d'38' ; Show seconds (=1?) + movwf lo + movlw d'1' + cpfseq lo ; =1? + bra DISP_divemins2 ; No, minutes only + bra DISP_divemins_gauge ; Yes, use Gauge routine + +DISP_divemins2: + movff divemins+0,lo + movff divemins+1,hi + bcf leftbind + lfsr FSR2,letter + output_16_3 ; displays only last three figures from a 16Bit value (0-999) + WIN_TOP .20 + WIN_LEFT .120 + WIN_FONT FT_MEDIUM + call DISP_standard_color + call word_processor + WIN_FONT FT_SMALL + return + +DISP_display_apnoe_surface: + btfsc menubit ; Divemode menu active? + return ; Yes, do not display surface mode timeout + + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'140' ; "SURFACE" + call DISP_standard_color + + WIN_TOP .85 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call DISP_standard_color + + + movff apnoe_surface_mins,lo + bcf leftbind + lfsr FSR2,letter + output_8 + PUTC ':' + movff apnoe_surface_secs,lo + output_99x + call word_processor + WIN_FONT FT_SMALL + return + +DISP_apnoe_clear_surface: + ; Clear Surface timer.... + WIN_BOX_BLACK .60, .119, .90, .159 ;top, bottom, left, right + return + + +DISP_display_apnoe_descent: + btfsc menubit ; Divemode menu active? + return ; Yes, do not display/update descent time + + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXT d'139' ; "Descent" + call DISP_standard_color + + + WIN_TOP .145 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call DISP_standard_color + + + movff apnoe_mins,lo + lfsr FSR2,letter + output_8 + PUTC ':' + movff apnoe_secs,lo + output_99x + call word_processor + WIN_FONT FT_SMALL + return + +DISP_divemins_apnoe: + +DISP_divemins_gauge: + movff divemins+0,lo + movff divemins+1,hi + bcf leftbind + bsf show_last3 + lfsr FSR2,letter + output_16_3 ;Displays only 0...999 + PUTC ':' + movff divesecs,lo + output_99x + WIN_TOP .20 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call DISP_standard_color + + call word_processor + bcf show_last3 + WIN_FONT FT_SMALL + return + +DISP_stopwatch_show: + ; Stopwatch + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH d'283' ; Stopwatch + +DISP_stopwatch_show2: + call DISP_standard_color + ostc_debug 'V' ; Sends debug-information to screen if debugmode active + WIN_TOP .192 + WIN_LEFT .110 + WIN_FONT FT_SMALL + call DISP_standard_color + + lfsr FSR2,letter + movff average_divesecs+0,lo ; Stopwatch + movff average_divesecs+1,hi ; Stopwatch + movlw d'2' + subwf lo,F + movlw d'0' + subwfb hi,F ; Subtract 2 seconds + + call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo) + + movff lo,wait_temp + movff hi,lo + clrf hi + + movlw d'0' + bcf leftbind + bsf show_last3 + output_16_3 ;Displays only 0...999 + PUTC ':' + movff wait_temp,lo + output_99x + call word_processor + + ostc_debug 'U' ; Sends debug-information to screen if debugmode active + + WIN_TOP .216 + WIN_LEFT .110 + WIN_FONT FT_SMALL + call DISP_standard_color + + lfsr FSR2,letter + movff avr_rel_pressure+0,lo + movff avr_rel_pressure+1,hi + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + bsf ignore_digit5 ; do not display 1cm depth + output_16dp d'3' + bcf leftbind + STRCAT_PRINT TXT_METER1 + return + +DISP_stopwatch_show_gauge: + btfsc menubit ; Divemode menu active? + return ; Yes, return + ; BIG Stopwatch + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH d'310' ; Stopwatch + DISPLAYTEXTH d'309' ; Average + call DISP_standard_color + ostc_debug 'V' ; Sends debug-information to screen if debugmode active + WIN_TOP .80 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call DISP_standard_color + + lfsr FSR2,letter + movff average_divesecs+0,lo ; Stopwatch + movff average_divesecs+1,hi ; Stopwatch + movlw d'2' + subwf lo,F + movlw d'0' + subwfb hi,F ; Subtract 2 seconds + call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo) + movff lo,wait_temp + movff hi,lo + clrf hi + movlw d'0' + bcf leftbind + bsf show_last3 + output_16_3 ;Displays only 0...999 + PUTC ':' + movff wait_temp,lo + output_99x + call word_processor + + ostc_debug 'U' ; Sends debug-information to screen if debugmode active + WIN_TOP .136 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call DISP_standard_color + lfsr FSR2,letter + movff avr_rel_pressure+0,lo + movff avr_rel_pressure+1,hi + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + bsf ignore_digit5 ; do not display 1cm depth + output_16dp d'3' + bcf leftbind + STRCAT_PRINT TXT_METER1 + WIN_FONT FT_SMALL ; Reset... + return + + +DISP_total_average_show: + ; Non-Resettable Average + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH d'281' ; Avr.Depth + +DISP_total_average_show2: + WIN_TOP .192 + WIN_LEFT .110 + WIN_FONT FT_SMALL + call DISP_standard_color + + lfsr FSR2,letter + movff avr_rel_pressure_total+0,lo + movff avr_rel_pressure_total+1,hi + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + bsf ignore_digit5 ; do not display 1cm depth + bcf leftbind + output_16dp d'3' + STRCAT_PRINT TXT_METER1 + return + +;============================================================================= +; Writes OSTC #Serial and Firmware version in surfacemode +; +DISP_serial: + ostc_debug 'a' ; Sends debug-information to screen if debugmode active + WIN_TOP .0 + WIN_LEFT .1 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + + ifdef __DEBUG + GETCUSTOM8 d'64' ; Write header in blue when + call DISP_set_color ; compiled in DEBUG mode... + else + call DISP_standard_color + endif + + lfsr FSR2,letter + read_int_eeprom d'34' ; Read deco data + tstfsz EEDATA + bra show_decotype_mainscreen2 + OUTPUTTEXT .101 ; ZH-L16 OC =0 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen2: + decfsz EEDATA,F + bra show_decotype_mainscreen3 + OUTPUTTEXT .102 ; Gauge =1 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen3: + decfsz EEDATA,F + bra show_decotype_mainscreen4 + OUTPUTTEXT .104 ; ZH-L16 CC =2 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen4: + decfsz EEDATA,F + bra show_decotype_mainscreen5 + OUTPUTTEXT .138 ; Apnoe =3 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen5: + decfsz EEDATA,F + bra show_decotype_mainscreen6 + OUTPUTTEXT .152 ; L16-GF OC =4 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen6: + decfsz EEDATA,F + bra show_decotype_mainscreen7 + OUTPUTTEXT .236 ; L16-GF CC =5 + bra show_decotype_mainscreen8 ; Done. +show_decotype_mainscreen7: + decfsz EEDATA,F + bra show_decotype_mainscreen8 ; Done. + OUTPUTTEXT .226 ; pSCR-GF =6 +show_decotype_mainscreen8: + STRCAT " \x90\x91 V" ; Scribble logo... + movlw softwareversion_x + movwf lo + bsf leftbind + output_8 + PUTC '.' + movlw softwareversion_y + movwf lo + bsf leftbind + output_99x + bcf leftbind + + ifdef __DEBUG + STRCAT_PRINT "-Dbg" + else + call word_processor + + movlw softwareversion_beta ; =1: Beta, =0: Release + decfsz WREG,F + return ; Release version -> Return + + call DISP_warnings_color + DISPLAYTEXT d'243' ; beta + call DISP_standard_color + endif + + return + +;============================================================================= + +DISP_divemode_menu_mask_first: ; Write Divemode menu1 mask + ostc_debug 'o' ; Sends debug-information to screen if debugmode active + call DISP_menu_clear ; clear "Menu?" + call DISP_standard_color + + btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode? + bra DISP_divemode_menu_mask_first2 + +; in OC Mode + DISPLAYTEXT .32 ;"Gaslist" + DISPLAYTEXT .31 ;"Decoplan" + bra DISP_divemode_menu_mask_first3 + +DISP_divemode_menu_mask_first2: +; in CC Mode + DISPLAYTEXT .238 ;"SetPoint" + DISPLAYTEXT .31 ;"Decoplan" + +DISP_divemode_menu_mask_first3: +; In all modes + call customview_menu_entry3 ; Show customview-dependent menu entry + DISPLAYTEXT .241 ;"Display" + DISPLAYTEXT .34 ;"Exit" + return + +DISP_divemode_set_xgas: ; Displayes the "Set Gas" menu + WIN_LEFT .100 + WIN_TOP .0 + WIN_FONT FT_SMALL + call DISP_standard_color + + STRCPY TXT_G6_3 + read_int_eeprom d'24' ; Get Gas6 %O2 + movff EEDATA,lo + bcf leftbind + output_99 ; outputs into Postinc2! + PUTC '/' + read_int_eeprom d'25' ; Get Gas6 %He + movff EEDATA,lo + output_99 ; outputs into Postinc2! + call word_processor + DISPLAYTEXT .123 ; O2 + + DISPLAYTEXT .124 ; O2 - + DISPLAYTEXT .125 ; He + + DISPLAYTEXT .126 ; He - + DISPLAYTEXTH d'300' ; Active? (Enable/Disable Gas underwater) + return + +DISP_divemode_simulator_mask: + call DISP_standard_color + DISPLAYTEXT .254 ; Close + DISPLAYTEXT .250 ; + 1m + DISPLAYTEXT .251 ; - 1m + DISPLAYTEXT .252 ; +10m + DISPLAYTEXT .253 ; -10m + DISPLAYTEXTH .306 ; Quit Sim + return + +;----------------------------------------------------------------------------- +; Draw a stop of the deco plan (simulator or dive). +; Inputs: lo = depth. Range 3m...93m +; + 80 if this is a switch-gas stop. +; hi = minutes. range 1'..240'. +; win_top = line to draw on screen. +; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*, +; WREG, PROD, TBLPTR TABLAT. +; +DISP_decoplan_show_stop: + ;---- Print depth ---------------------------------------------------- + WIN_LEFT .100 + + btfss lo,7 ; Bit set ? + bra DISP_decoplan_std_stop ; No : Just an usual stop + + bcf lo,7 ; cleanup depth + + GETCUSTOM8 d'55' ; Load gas switch [min] in wreg + tstfsz WREG ; =0? + bra DISP_decoplan_show_stop1; No: Show gas switch stop + bra DISP_decoplan_std_stop ; Yes: Just an usual stop + +DISP_decoplan_show_stop1: + movlw color_yellow + call DISP_set_color ; Show in yellow for gas switch + bra DISP_decoplan_nstd_stop + +DISP_decoplan_std_stop: + call DISP_standard_color + +DISP_decoplan_nstd_stop: + lfsr FSR2,letter + bsf leftbind + output_8 ; outputs into Postinc2! + STRCAT_PRINT TXT_METER2 + + ;---- Print duration ------------------------------------------------- + WIN_LEFT .140 + lfsr FSR2,letter + + movf lo,W ; Swap hi & lo + movff hi,lo + movwf hi + + output_8 ; Allow up to 240' + STRCAT_PRINT "' " ; 1 to 3 chars for depth. + + movf lo,W ; Swap back hi & lo + movff hi,lo + movwf hi + + ;--------------------------------------------------------------------- + ; Draw the bar graph used for deco stops (decoplan in simulator or dive). + movff win_top,WREG ; Increment win_top (BANK SAFE) + incf WREG + movff WREG,win_top + movlw d'18'+1 ; 19 --> height (bank safe !) + movff WREG,win_height + movlw .122 + movff WREG,win_leftx2 ; column left (0-159) + movlw .16 + movff WREG,win_width ; column max width. + + ; Draw used area (hi = minutes): + movlw d'16' ; Limit length (16min) + cpfslt hi + movwf hi + movff hi,win_bargraph ; Active width, the rest is cleared. + call DISP_box + + ; Restore win_top + call DISP_standard_color + movff win_top,WREG ; decf win_top (BANK SAFE) + decf WREG + movff WREG,win_top + return + +;----------------------------------------------------------------------------- +; Clear unused area belw last stop +; Inputs: win_top : last used area... +DISP_decoplan_clear_bottom: + movff win_top,WREG ; Get back from bank0 + btfsc divemode ; In dive mode ? + sublw .168 ; Yes: bottom row in divemode + btfss divemode ; In dive mode ? + sublw .240 ; No: bottom row in planning + movff WREG,win_height + + WIN_LEFT .85 ; Full divemenu width + movlw .160-.85+1 + movff WREG,win_width + + clrf WREG ; Fill with black + movff WREG,win_color1 + movff WREG,win_color2 + + goto DISP_box + +;----------------------------------------------------------------------------- +; Display the decoplan (simulator or divemode) for GF model +; Inputs: char_O_deco_table (array of stop times, in minutes) +; decoplan_page = page number. Displays 5 stop by page. +; +#define decoplan_index apnoe_mins ; within each page +#define decoplan_gindex apnoe_secs ; global index +#define decoplan_last apnoe_max_pressure ; Depth of last stop (CF#29) +#define decoplan_max apnoe_max_pressure+1; Number of lines per page. 7 in planning, 5 in diving. + +DISP_decoplan: + ostc_debug 'n' ; Sends debug-information to screen if debugmode active + + WIN_INVERT 0 + + ;---- Is there deco stops ? ------------------------------------------ + movff char_O_first_deco_depth,WREG + iorwf WREG + bnz DISP_decoplan_1 + + ;---- No Deco -------------------------------------------------------- + call DISP_standard_color + DISPLAYTEXT d'239' ;"No Deco" + bsf last_ceiling_gf_shown + return + +DISP_decoplan_1: + lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing. + lfsr FSR1,char_O_deco_time + + movlw .8 ; 8 lines/page in decoplan + btfsc divemode + movlw .6 ; 6 lines/page in divemode. + movwf decoplan_max + + clrf decoplan_index ; Start with index = 0 + clrf WREG + movff WREG,win_top ; and row = 0 + + ; Read stop parameters, indexed by decoplan_index and decoplan_page + movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index + mulwf decoplan_max + movf decoplan_index,W + addwf PRODL,W + movwf decoplan_gindex ; --> decoplan_gindex + + bcf last_ceiling_gf_shown ; Not finished yet... + +DISP_decoplan_2: + btfsc decoplan_gindex,5 ; Reached table length (32) ? + bra DISP_decoplan_99 ; YES: finished... + + ; Read stop parameters, indexed by decoplan_index + movf decoplan_gindex,W ; index + movff PLUSW1,hi ; char_O_deco_time [gindex] --> hi + movff PLUSW0,lo ; char_O_deco_depth[gindex] + movf lo,W + bz DISP_decoplan_99 ; depth == 0 : finished. + + ; Display the stop line + call DISP_decoplan_show_stop + + ; Next + movff win_top,WREG ; row: += 24 + addlw .24 + movff WREG,win_top + incf decoplan_index,F ; local index += 1 + incf decoplan_gindex,F ; global index += 1 + + ; Max number of lines/page reached ? + movf decoplan_max,W ; index+1 == max ? + cpfseq decoplan_index + bra DISP_decoplan_2 ; NO: loop + + ; Check if next stop if end-of-list ? + movf decoplan_gindex,W + movff PLUSW0,WREG ; char_O_deco_depth[gindex] + iorwf WREG + bz DISP_decoplan_99 ; End of list... + + ; Display the message "more..." + bcf last_ceiling_gf_shown ; More page to display... + + rcall DISP_decoplan_clear_bottom ; Clear from next line + + WIN_LEFT .130 - 7*3 + call DISP_standard_color + lfsr FSR2,letter + OUTPUTTEXT .142 ; More... + goto word_processor + +DISP_decoplan_99: + bsf last_ceiling_gf_shown ; Nothing more in table to display. + rcall DISP_decoplan_clear_bottom ; Clear from next line + return +;----------------------------------------------------------------------------- +; Toggle gas activity flag during dive. +; +; Input: gaslist_active +; Gaslist from eeprom[2...] +; +; Output: gaslist_active +; +; Note: Gas with a zero depth cannot be used in deco simulation, hence +; should not be displayed as selected here... +; +DISP_de_activelist: ; show (de)active gaslist + call DISP_standard_color + DISPLAYTEXT .254 ; Close + + WIN_LEFT .100 + WIN_FONT FT_SMALL + bsf leftbind + + movlw d'2' + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'0' + movwf waitms_temp ; here: stores row for gas list + clrf hi ; here: Gas counter + +DISP_de_activelist_loop: + incf hi,F ; Increase Gas + movlw d'4' + addwf wait_temp,F ; Increase eeprom address for gas list + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .100 + movff waitms_temp,win_top ; Set Row + + lfsr FSR2,letter + movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '/' + incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '@' + + movlw d'27' + addwf hi,W + movwf EEADR ; Point to Change depth + + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + + movf lo,w ; Gas with a zero depth + bz DISP_de_activelist_grey ; should be displayed inactive. + +; Check if gas needs to be greyed-out (inactive) + movff gaslist_active,EEDATA ; Get flag register + movff hi,lo ; copy gas number +DISP_de_activelist_loop1: + rrcf EEDATA ; roll flags into carry + decfsz lo,F ; max. 5 times... + bra DISP_de_activelist_loop1 + bc DISP_de_activelist_white + +DISP_de_activelist_grey: ; grey out inactive gases! + GETCUSTOM8 d'64' ;movlw color_grey + call DISP_set_color + +DISP_de_activelist_white: + call word_processor + call DISP_standard_color + + movlw d'5' ; list all five gases + cpfseq hi ; All gases shown? + bra DISP_de_activelist_loop ; No + + return ; return + +DISP_show_change_depth: ; Yes, show change depth for gas #menupos + btfsc display_set_setpoint ; In Setpoint list? + return ; Yes, return. + movlw color_yellow ; Blink in yellow + call DISP_set_color + WIN_LEFT .95 + WIN_TOP .148 + WIN_FONT FT_SMALL + + movlw .6 + cpfslt menupos ; <6? + bra DISP_show_change_depth_clear ; Yes! + + bsf leftbind + STRCPY TXT_GAS1 + movff menupos,lo + output_8 ; Show gas number + STRCAT TXT_AT4 ; " at " + decf menupos,W + addlw d'28' ; offset in memory + movwf EEADR + call read_eeprom ; Low-value + movff EEDATA,lo + output_8 ; Show gas number + STRCAT_PRINT TXT_METER2 ; "m " + bcf leftbind + call DISP_standard_color + return + +DISP_show_change_depth_clear: + STRCPY_PRINT " " + return + +DISP_diluent_list: + ostc_debug 'm' ; Sends debug-information to screen if debugmode active + WIN_LEFT .100 + WIN_FONT FT_SMALL + bsf leftbind + movlw d'94' + movwf wait_temp ; here: stores eeprom address for diluent list (96-2) + movlw d'231' + movwf waitms_temp ; here: stores row for gas list + clrf hi ; here: Diluent counter + +DISP_diluent_list_loop: + incf hi,F ; Increase Diluent + movlw .2 + addwf wait_temp,F ; Increase eeprom address for gas list + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .100 + movff waitms_temp,win_top ; Set Row + STRCPY TXT_DIL_C + movff hi,lo ; copy dil number + output_8 ; display dil number + PUTC ':' + movff wait_temp, EEADR; Dil #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '/' + incf EEADR,F ; Dil #hi: %He - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + + decf EEADR,F ; Dil #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + DISP_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA") + + call word_processor + call DISP_standard_color + + movlw d'5' ; list all five Diluents + cpfseq hi ; All diluents shown? + bra DISP_diluent_list_loop ; No + return ; return + + +DISP_gas_list: + ostc_debug 'm' ; Sends debug-information to screen if debugmode active + + WIN_LEFT .100 + WIN_FONT FT_SMALL + bsf leftbind + + movlw d'2' + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'231' + movwf waitms_temp ; here: stores row for gas list + clrf hi ; here: Gas counter + +DISP_gas_list_loop: + incf hi,F ; Increase Gas + movlw d'4' + addwf wait_temp,F ; Increase eeprom address for gas list + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .100 + movff waitms_temp,win_top ; Set Row + STRCPY TXT_GAS1 + movff hi,lo ; copy gas number + output_8 ; display gas number + PUTC ':' + movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '/' + incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + + decf EEADR,F ; Gas #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + DISP_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA") + +; Check if the "better gas" should be highlighted + + WIN_INVERT .0 ; Init new Wordprocessor + movf better_gas_number,W ; better gas 1-5? + cpfseq hi ; compare with gas# + bra DISP_gas_list_loop2 ; No equal, skip + + movlw color_yellow ; Blink in yellow + call DISP_set_color + WIN_INVERT .1 ; Init new Wordprocessor + +DISP_gas_list_loop2: +; Check if gas needs to be greyed-out (inactive) + movff gaslist_active, EEDATA ; Work with sorted list + movff hi,lo ; copy gas number +DISP_gas_list_loop1: + rrcf EEDATA ; roll flags into carry + decfsz lo,F ; max. 5 times... + bra DISP_gas_list_loop1 + + btfss STATUS,C ; test carry + rcall DISP_gas_list_grey + + call word_processor + call DISP_standard_color + + movlw d'5' ; list all five gases + cpfseq hi ; All gases shown? + bra DISP_gas_list_loop ; No + + DISPLAYTEXT d'122' ; More + return ; return (OC mode) + +DISP_gas_list_grey: + GETCUSTOM8 d'64' ;movlw color_grey + call DISP_set_color ; grey out inactive gases! + return + +DISP_splist_start: + WIN_LEFT .100 + WIN_FONT FT_SMALL + bsf leftbind + call DISP_standard_color + + ; list three SP in Gaslist + movlw d'35' ; 36 = current SP position in EEPROM + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'0' + movwf waitms_temp ; here: stores row for gas list + clrf decoplan_index ; here: SP counter + +DISP_splist_loop: + incf wait_temp,F ; EEPROM address + incf decoplan_index,F ; Increase SP + + movlw d'25' + addwf waitms_temp,F ; Increase row + movff waitms_temp,win_top ; Set Row + WIN_LEFT .100 + + STRCPY TXT_SP2 + movff decoplan_index,lo ; copy gas number + output_8 ; display gas number + PUTC ':' + movff wait_temp, EEADR; SP #hi position + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + clrf hi + output_16dp d'3' ; outputs into Postinc2! + call word_processor + + movlw d'3' ; list all three SP + cpfseq decoplan_index ; All gases shown? + bra DISP_splist_loop ; No + + bcf leftbind + return ; no, return + +DISP_clear_divemode_menu: + WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right + return + +DISP_divemenu_cursor: + ostc_debug 'l' ; Sends debug-information to screen if debugmode active + + WIN_BOX_BLACK .0, .150, .85, .95 ;top, bottom, left, right + + WIN_TOP .0 + WIN_LEFT .85 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_standard_color + + movff menupos,temp1 + movlw d'0' + dcfsnz temp1,F + movlw d'0' + dcfsnz temp1,F + movlw d'25' + dcfsnz temp1,F + movlw d'50' + dcfsnz temp1,F + movlw d'75' + dcfsnz temp1,F + movlw d'100' + dcfsnz temp1,F + movlw d'125' + + movff WREG,win_top + STRCPY_PRINT "\xB7" ; Cursor + return + + +;============================================================================= +; Draw saturation graph, is surface mode or in dive mode. +; +DISP_tissue_saturation_graph: + ostc_debug 'i' ; Sends debug-information to screen if debugmode active + + ;---- Draw Frame --------------------------------------------------------- + btfsc divemode + bra DISP_tsg_1 + + WIN_FRAME_STD .25, .120, .82, .159 ; Surfmode + bra DISP_tsg_2 +DISP_tsg_1: + WIN_FRAME_STD .169, .239, .90, .159 ; Divemode +DISP_tsg_2: + + ;---- Draw grid ---------------------------------------------------------- + btfss divemode + bra DISP_no_graph_grid + + GETCUSTOM8 d'64' ;movlw color_grey + call DISP_set_color + + movlw .169+.1 ; divemode + movff WREG,win_top + movlw .239-.169-.1 ; divemode + movff WREG,win_height + + movlw 1 + movff WREG,win_width + + movlw .122 + movff WREG,win_leftx2 + call DISP_box + movlw .131 + movff WREG,win_leftx2 + call DISP_box + movlw .140 + movff WREG,win_leftx2 + call DISP_box + movlw .149 + movff WREG,win_leftx2 + call DISP_box +DISP_no_graph_grid: + + ;---- Draw N2 Tissues ---------------------------------------------------- + lfsr FSR2, char_O_tissue_N2_saturation + movlw d'16' + movwf wait_temp ; 16 tissues + clrf waitms_temp ; Row offset + + movlw .1 + movff WREG,win_height ; row bottom (0-239) + movlw .82+.18 ; surfmode + btfsc divemode + movlw .90+.18 ; divemode + movff WREG,win_leftx2 ; column left (0-159) + movlw .57 ; surfmode: max width 57pix + btfsc divemode + movlw .57-8 ; divemode: 8pix less... + movff WREG,win_width + +DISP_tissue_saturation_graph3: + call DISP_standard_color ; Reset color foreach iteration + + movlw .25+3 ; surfmode: 3pix below top border + btfsc divemode + movlw .169+3 ; divemode + addwf waitms_temp,W + movff WREG,win_top ; row top (0-239) + + incf waitms_temp,F + incf waitms_temp,F + + movf POSTINC2,W + bcf STATUS,C ; Clear carry + rrcf WREG ; And divide by 4 + bcf STATUS,C + rrcf WREG + movwf temp1 + + movff win_width,WREG ; Max width. + cpfslt temp1 ; skip if 57 (WREG) < win_width + movwf temp1 + movff temp1,win_bargraph + + call DISP_box + + decfsz wait_temp,F + bra DISP_tissue_saturation_graph3 + + ;---- Draw He Tissues ---------------------------------------------------- + lfsr FSR2, char_O_tissue_He_saturation + movlw d'16' + movwf wait_temp ; 16 tissues + clrf waitms_temp ; Row offset + +DISP_tissue_saturation_graph2: + call DISP_standard_color ; Reset color foreach iteration + + movlw .120-.33 ; surfmode : 33pix above bottom border + btfsc divemode + movlw .239-.33 ; divemode + addwf waitms_temp,W + movff WREG,win_top ; row top (0-239) + + incf waitms_temp,F + incf waitms_temp,F + + movf POSTINC2,W + bcf STATUS,C ; Clear carry + rrcf WREG ; And divide by 4 + bcf STATUS,C + rrcf WREG + movwf temp1 + + movff win_width,WREG ; Max width. + cpfslt temp1 ; skip if 57 (WREG) < win_width + movwf temp1 + movff temp1,win_bargraph + + call DISP_box + + decfsz wait_temp,F + bra DISP_tissue_saturation_graph2 + + ;---- Draw N2/He Text ---------------------------------------------------- + call DISP_standard_color ; Reset color after last iterarion. + + movlw .82+2 ; surfmode: 2pix right of left border + btfsc divemode + movlw .90+2 ; divemode + movff WREG,win_leftx2 + + movlw .25+7 ; surfmode: 7pix below top border + btfsc divemode + movlw .169+7 ; divemode + movff WREG,win_top + STRCPY_PRINT TXT_N2_2 + + movlw .120-.30 ; surfmode: 30pix above bottom border + btfsc divemode + movlw .239-.30 ; divemode + movff WREG,win_top + STRCPY_PRINT TXT_HE2 + + ;---- Draw scale and O2[16]% --------------------------------------------- + btfsc divemode + return + + movff char_O_gtissue_no,wait_temp ; used as temp + + lfsr FSR1,char_O_tissue_N2_saturation + movf wait_temp,W ; W <- 0-15 + movff PLUSW1,lo ; lo <- FSR1[W] + + WIN_TOP .62 + WIN_FONT FT_SMALL + lfsr FSR2,letter + bsf leftbind + output_8 + bcf leftbind + + STRCAT_PRINT "% " + + ;---- Draw Scale --------------------------------------------------------- + WIN_BOX_STD .73, .74, .121, .157 + WIN_BOX_STD .61, .84, .121, .122 + WIN_BOX_STD .65, .80, .130, .131 + WIN_BOX_STD .65, .80, .139, .140 + WIN_BOX_STD .65, .80, .148, .149 + WIN_BOX_STD .61, .84, .157, .158 + return + +;============================================================================= + +DISP_startupscreen1: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT d'3' ; "HeinrichsWeikamp" + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .68 ; Licence 1/2 + DISPLAYTEXT .69 + DISPLAYTEXT .70 + DISPLAYTEXT .71 + DISPLAYTEXT .72 + DISPLAYTEXT .73 + DISPLAYTEXT .74 + return + +DISP_startupscreen2: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXT d'3' ; "HeinrichsWeikamp" + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXT .75 ; Licence 2/2 + DISPLAYTEXT .76 + DISPLAYTEXT .77 + DISPLAYTEXT .78 + DISPLAYTEXT .79 + DISPLAYTEXT .80 + DISPLAYTEXT .81 + return + +DISP_new_cf_warning: + call DISP_topline_box + WIN_INVERT .1 ; Init new Wordprocessor + DISPLAYTEXTH .271 ; New CF added! + WIN_INVERT .0 ; Init new Wordprocessor + DISPLAYTEXTH .272 ; New CustomFunctions + DISPLAYTEXTH .273 ; were added! Check + DISPLAYTEXTH .274 ; CF I and CF II Menu + DISPLAYTEXTH .275 ; for Details! + return + +DISP_const_ppO2_value: + ostc_debug 'j' ; Sends debug-information to screen if debugmode active + + WIN_TOP .168 + WIN_LEFT .50 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + + lfsr FSR2,letter + movff char_I_const_ppO2,lo + + tstfsz lo ; In Bailout mode (char_I_const_ppO2=0)? + bra DISP_const_ppO2_value2 ; No, display Setpoint + +; Yes, Display "Bail" + call DISP_standard_color + OUTPUTTEXTH d'263' ;"Bail " + call word_processor + return + +DISP_const_ppO2_value2: ; Display SetPoint +;Show fixed SP value + SAFE_2BYTE_COPY amb_pressure, xA + + movlw d'10' + movwf xB+0 + clrf xB+1 + ;xA/xB=xC with xA as remainder + call div16x16 ; xC+0=p_amb/10 + + ; char_I_const_ppO2 > p_amb/10 -> Not physically possible! -> Display actual value! + tstfsz xC+1 ; xC>255 + setf xC+0 ; Yes, set xC+0 to 2,55bar ppO2 + + movff ppO2_setpoint_store,WREG + cpfslt xC+0 ; Setpoint value possible? + bra DISP_const_ppO2_value1 ; Yes + + clrf hi ; Reset hi + movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value + bra DISP_const_ppO2_value1a + +DISP_const_ppO2_value1: + ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! + SAFE_2BYTE_COPY amb_pressure, xA + movlw d'10' + movwf xB+0 + clrf xB+1 + call div16x16 ; xC=p_amb/10 + movff xC+0,xA+0 + movff xC+1,xA+1 + movff char_I_O2_ratio,xB+0 + clrf xB+1 + call mult16x16 ; xC:2=char_I_O2_ratio * p_amb/10 + + movff xC+0,sub_b+0 + movff xC+1,sub_b+1 + movff ppO2_setpoint_store,WREG; Setpoint + mullw d'100' ; Setpoint*100 + movff PRODL,sub_a+0 + movff PRODH,sub_a+1 + call sub16 ; sub_c = sub_a - sub_b + + btfss neg_flag + bra DISP_const_ppO2_value11 ; Value in range (lower then fix Setpoint) + + ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! + + movff xC+0,xA+0 ; xC=p_amb/10 + movff xC+1,xA+1 + movlw d'100' + movwf xB+0 + clrf xB+1 + call div16x16 ;xA/xB=xC with xA as remainder + + movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value + movff xC+1,hi ; For test if ppO2>2,55bar + + GETCUSTOM8 d'39' ; Adjust fixed SP? + dcfsnz WREG,F + bra DISP_const_ppO2_value1a ; Yes! + ; Do not adjust -> restore original SetPoint + +DISP_const_ppO2_value11: +; Setpoint in possible limits + movff ppO2_setpoint_store,char_I_const_ppO2 ; Restore Setpoint + clrf hi + +DISP_const_ppO2_value1a: + movff char_I_const_ppO2,lo + + movff lo,WREG ; copy to WREG + mullw .100 + movff PRODH,xC+1 + movff PRODL,xC+0 ; For color code + DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) + + tstfsz hi ; >2,55bar? + rcall DISP_const_ppO2_too_hi ; Yes + + bsf leftbind + output_16dp d'3' + bcf leftbind + STRCAT_PRINT " " ; Display Setpoint with trailing zero + call DISP_standard_color ; Reset color + return + +DISP_const_ppO2_too_hi: + PUTC '>' + setf lo ; show ">2.55" + clrf hi ; clear hi + call DISP_warnings_color ; Set Warning color + return + +;============================================================================= +; Display EAD/END computed in calc_hauptroutine_update_tissues() every 2sec. +; +DISP_show_end_ead_divemode: + call DISP_divemask_color ; Set Color for Divemode mask + + WIN_FONT FT_SMALL + WIN_LEFT .95 + WIN_TOP .192 + lfsr FSR2,letter + OUTPUTTEXTH .299 ; EAD: + call word_processor + + WIN_TOP .216 + lfsr FSR2,letter + OUTPUTTEXTH .298 ; END: + call word_processor + + call DISP_standard_color ; Back to white. + WIN_LEFT .125 + WIN_TOP .192 + lfsr FSR2,letter + movff char_O_EAD,lo + bsf leftbind + output_8 ; Print EAD w/o leading space. + STRCAT_PRINT TXT_METER2 + + WIN_TOP .216 + lfsr FSR2,letter + movff char_O_END,lo + output_8 ; Print END w/o leading space. + bcf leftbind + STRCAT_PRINT TXT_METER2 + +; Show ppO2[Flush] iff in CCR mode & not in Bailout: + btfsc is_bailout ; In bailout mode? + return ; Yes: done. + + btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? + return ; No: done. + + WIN_LEFT .95 + WIN_TOP .168 + call DISP_divemask_color ; Set Color for Divemode mask + STRCPY_PRINT TXT_PPO2_5 ; ppO2 of diluent + + movff char_O_flush_ppO2,WREG ; copy to WREG + mullw .100 + movff PRODH,xC+1 + movff PRODL,xC+0 ; For color code + DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) + + WIN_LEFT .130 + WIN_TOP .168 + + movff char_O_flush_ppO2, lo + incf lo,W ; ppO2 == 2.55 ? + bnz DISP_show_end_ead_divemode_1 + + STRCPY_PRINT "----" ; YES: mark overflow. + goto DISP_standard_color ; Back to white. + +DISP_show_end_ead_divemode_1: + lfsr FSR2,letter + clrf hi + bsf leftbind + output_16dp d'3' ; Show ppO2 w/o leading zero + bcf leftbind + STRCAT_PRINT " " ; Display ppO2[Diluent] + goto DISP_standard_color ; Back to white. + +;============================================================================= +; Display TTS after extra time at the same depth. +; +DISP_show_@5: + WIN_FONT FT_SMALL + WIN_LEFT .160-.70 ; 10 chars aligned right. + WIN_TOP .170 + call DISP_divemask_color ; Set Color for Divemode mask + lfsr FSR2,letter + + OUTPUTTEXTH .305 ; "Future TTS" + call word_processor + + WIN_LEFT .97 + WIN_TOP .194 + STRCPY "@" + GETCUSTOM8 d'58' + movwf lo + bsf leftbind + output_8 + bcf leftbind + STRCAT_PRINT "': " + + WIN_LEFT .97+7*5 ; "@10':" is 5 chars long + call DISP_standard_color + lfsr FSR2,letter + + movff int_O_extra_ascenttime+0,lo + movff int_O_extra_ascenttime+1,hi + movf lo,W + iorwf hi,W ; extra_ascenttime == 0 ? + bz DISP_show_@5_nodeco + movf lo,W ; extra_ascenttime == 0xFFFF ? + andwf hi,W + incf WREG,w + bz DISP_show_@5_wait + + bsf leftbind + output_16 + bcf leftbind + STRCAT_PRINT "' " ; From "none" to "1'" we need 2 trailing spaces + return + +DISP_show_@5_nodeco: +DISP_show_@5_wait: + STRCPY_PRINT "--- " + return + +;============================================================================= + +compute_pscr_ppo2: +; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10 + movff char_I_O2_ratio,WREG + sublw .100 ; 100-char_I_O2_ratio -> WREG + mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2 + movff PRODL,xA+0 + movff PRODH,xA+1 + GETCUSTOM8 d'62' ; O2 Drop + movff WREG,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61 + movff xC+0,xA+0 + movff xC+1,xA+1 + GETCUSTOM8 d'63' ; Lung ratio + movff WREG,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62 + + movlw .10 + movwf xB+0 + clrf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + ; store xC:2 in lo:hi + movff xC+0,lo + movff xC+1,hi + + SAFE_2BYTE_COPY amb_pressure, xA + movff char_I_O2_ratio,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio + + movlw .10 + movwf xB+0 + clrf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ; store xC:2 in sub_a + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + ; reload result from lo:hi + movff lo,sub_b+0 + movff hi,sub_b+1 + + call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values) + return + +; Display pSCR ppO2 +DISP_show_pSCR_ppO2: + WIN_FONT FT_SMALL + WIN_LEFT .160-.63 ; 9 chars aligned right. + WIN_TOP .170 + call DISP_divemask_color ; Set Color for Divemode mask + lfsr FSR2,letter + OUTPUTTEXTH .266 ; "pSCR Info" + call word_processor ; pCCR + + rcall compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 + + WIN_FONT FT_SMALL + WIN_LEFT .95 + WIN_TOP .192 + lfsr FSR2,letter + STRCPY_PRINT TXT_PPO2_5 ; ppO2: + + movff sub_c+0,xC+0 + movff sub_c+1,xC+1 + clrf xC+2 + clrf xC+3 ; For color coding + DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) + WIN_LEFT .130 + WIN_TOP .192 + lfsr FSR2,letter + movff xC+0,lo + movff xC+1,hi + bsf ignore_digit4 + output_16dp d'1' + bcf ignore_digit4 + STRCAT_PRINT " " + call DISP_standard_color ; Back to white. +; Show O2 drop and counter lung ration in second row + WIN_LEFT .98 + WIN_TOP .216 + lfsr FSR2,letter + GETCUSTOM8 d'62' ; O2 Drop in percent + movwf lo + bsf leftbind + output_8 + STRCAT "% 1/" + GETCUSTOM8 d'63' ; Counter lung ratio in 1/X + movwf lo + output_8 + bcf leftbind + STRCAT_PRINT " " ; Trailing space needed when changing the O2 drop + return + +;============================================================================= +; Display cave consomation prediction (and warning). +; +DISP_show_cave_bailout: + WIN_FONT FT_SMALL + WIN_LEFT .160-.70 ; 10 chars aligned right. + WIN_TOP .170 + call DISP_divemask_color ; Set Color for Divemode mask + lfsr FSR2,letter + + OUTPUTTEXTH .311 ; "Cave Bail." + call word_processor + +; WIN_TOP .240 - 24 ; DO NOT display liter units, as this +; WIN_LEFT .160 - 7 ; can be Bars also... +; STRCPY_PRINT "l" + + WIN_FONT FT_MEDIUM + WIN_LEFT .90 + WIN_TOP .201 ; 170 + 24 + 14/2 + 32 + 14/2 = 240. + call DISP_standard_color + lfsr FSR2,letter + + ;---- Retrieve divetime in seconds (since last reset) + movff average_divesecs+0,xA+0 + movff average_divesecs+1,xA+1 + + ;---- Multiply by SAC, and divide by 60 (SAC inliters per minutes) + GETCUSTOM8 d'56' ; Get bottom SAC + movwf xB+0 + clrf xB+1 + call mult16x16 ; xC:4=xA:2*xB:2 + + movlw LOW(.60) + movwf xB+0 + movlw HIGH(.60) + movwf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ;---- Multiply by average pressure [absolute, in bar] + movff xC+0,xA+0 ; Get result (in xC+0, noy xC+2 !) into xA + movff xC+1,xA+1 + + movf avr_rel_pressure+0,W ; Add surface pressure to get absolute pressure + addwf last_surfpressure_30min+0,W + movwf xB+0 + movf avr_rel_pressure+1,W + addwfc last_surfpressure_30min+1,W + movwf xB+1 ; --> Into xB + + call mult16x16 ; xC:4=xA:2*xB:2 + + movlw LOW(.1000) ; Pressure was in milibar, so divide by 1000. + movwf xB+0 + movlw HIGH(.1000) + movwf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ;---- Go RED when limit is exceeded + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + GETCUSTOM15 d'59' ; Get Cave bailout alarm threshold + movff lo, sub_b+0 + movff hi, sub_b+1 + call sub16 ; Computes prediction - limit + btfss neg_flag ; Negativ ? + call DISP_warnings_color ; NO: go RED. + + ;---- Then display... + movff xC+0,lo + movff xC+1,hi + + bcf leftbind + output_16 + call word_processor + WIN_FONT FT_SMALL + return + +;============================================================================= + +DISP_show_leading_tissue: + call DISP_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH .282 ; L. Tissue: +DISP_show_leading_tissue_2: + call deco_calc_desaturation_time ; calculate desaturation time + movlb b'00000001' ; select ram bank 1 + + STRCPY "#" + movff char_O_gtissue_no,lo + movff char_O_gtissue_no,wait_temp ; used as temp + bsf leftbind + output_8 + STRCAT " (" + + movlw d'16' + cpfslt wait_temp + bra DISP_show_leading_tissue_he + STRCAT TXT_N2_2 + bra DISP_show_leading_tissue2 + +DISP_show_leading_tissue_he: + STRCAT TXT_HE2 + +DISP_show_leading_tissue2: + WIN_LEFT .95 + WIN_TOP .192 + WIN_FONT FT_SMALL + call DISP_standard_color + + STRCAT_PRINT ") " + + lfsr FSR1,char_O_tissue_N2_saturation + movf wait_temp,W ; W <- 0-15 + movff PLUSW1,lo ; lo <- FSR1[W] + + WIN_LEFT .95 + WIN_TOP .216 + WIN_FONT FT_SMALL + + lfsr FSR2,letter + output_8 + STRCAT_PRINT "% " + bcf leftbind + return + +DISP_marker_set: + WIN_LEFT .105 + WIN_TOP .170 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_divemask_color ; Set Color for Divemode mask + SAFE_2BYTE_COPY marker_depth, lo + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + lfsr FSR2,letter + bsf leftbind + bsf ignore_digit5 ; do not display 1cm depth + output_16dp d'3' + PUTC TXT_METER_C + bcf show_last3 + call word_processor + + WIN_LEFT .105 + WIN_TOP .192 + WIN_INVERT .0 ; Init new Wordprocessor + movff marker_time+0,lo + movff marker_time+1,hi + bsf leftbind + lfsr FSR2,letter + output_16_3 ; displays only last three figures from a 16Bit value (0-999) + PUTC ':' + movff marker_time+2,lo + output_99x + call word_processor + bcf leftbind + call DISP_standard_color + return + +DISP_topline_box_clear: ; Writes an empty box + movlw .0 + bra DISP_topline_box2 +DISP_topline_box: ; Writes a filled box... + GETCUSTOM8 d'35' ; ... with the standard color +DISP_topline_box2: + WIN_BOX_COLOR .0, .26, .0, .159 + call DISP_standard_color ; Reset to standard color in case of unreadable color + return + +DISP_display_cns: + btfsc gauge_mode ; Do not display in gauge mode + return + + btfsc FLAG_apnoe_mode ; Do not display in apnoe mode + return + + btfsc DISP_velocity_display ; Is velocity displayed?` + return ; Yes, do not overwrite until DISP_velocity_clear was called + + ostc_debug 'k' ; Sends debug-information to screen if debugmode active + + WIN_TOP .090 + WIN_LEFT .0 + WIN_FONT FT_SMALL + DISP_color_code warn_cns ; Color-code CNS output + + STRCPY TXT_CNS4 + movff char_O_CNS_fraction,lo + bsf leftbind + output_8 + bcf leftbind + STRCAT_PRINT "%" + return + +;----------------------------------------------------------------------------- +; +DISP_display_cns_surface: +; Check if CNS should be displayed + movff char_O_CNS_fraction,lo ; copy into bank1 + GETCUSTOM8 d'15' ; cns_display_high_surfacemode + subwf lo,W + btfss STATUS,C + return ; Do not show... + ; Show CNS + + ostc_debug 'W' ; Sends debug-information to screen if debugmode active + + WIN_TOP .175 + WIN_LEFT .45 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + DISP_color_code warn_cns ; Color-code CNS output + + STRCPY TXT_CNS4 + movff char_O_CNS_fraction,lo + bsf leftbind + output_8 + bcf leftbind + STRCAT_PRINT "% " + return + +;----------------------------------------------------------------------------- +; Display GF at furface, if > CF8. +; +DISP_display_gf_surface: + movff char_O_gradient_factor,lo ; gradient factor + GETCUSTOM8 d'8' ; threshold for display + cpfslt lo ; show value? + bra DISP_display_gf_surf_1 ; YES: do it. + return + +DISP_display_gf_surf_1: + WIN_TOP .175 + WIN_LEFT .45 + WIN_FONT FT_SMALL + DISP_color_code warn_gf ; Color-code Output + + STRCPY TXT_GF3 + movff char_O_gradient_factor,lo ; gradient factor + output_8 + STRCAT_PRINT "% " + goto DISP_standard_color + +;----------------------------------------------------------------------------- + +DISP_custom_text: + read_int_eeprom d'64' + movlw d'1' + cpfseq EEDATA ; Custom text active? + bra DISP_custom_text_serial ; No, show serial instead + WIN_TOP .200 + WIN_LEFT .0 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_divemask_color ; Set Color for Divemode mask + + lfsr FSR2,letter + movlw d'64' + movwf lo + movlw d'24' + movwf hi ; counter + +DISP_custom_text1: + incf lo,F + call DISP_get_custom_letter ; Get one letter for the custom text + movlw '}' ; End marker found? + cpfseq EEDATA + bra DISP_custom_text2 ; No + bra DISP_custom_text3 +DISP_custom_text2: + movff EEDATA,POSTINC2 ; Copy into Postinc + + decfsz hi,F ; Max. numbers? + bra DISP_custom_text1 ; No, get next letters + +DISP_custom_text3: + call word_processor + call DISP_standard_color + return + +DISP_get_custom_letter: + movff lo,EEADR ; Address for next custom text letter + call read_eeprom ; Read letter + return + +DISP_custom_text_serial: + WIN_TOP .200 + WIN_LEFT .50 + WIN_FONT FT_SMALL + WIN_INVERT .0 ; Init new Wordprocessor + call DISP_divemask_color ; Set Color for Divemode mask + + lfsr FSR2,letter + OUTPUTTEXTH d'262' ; "OSTC " + clrf EEADRH + clrf EEADR ; Get Serial number LOW + call read_eeprom ; read byte + movff EEDATA,lo + incf EEADR,F ; Get Serial number HIGH + call read_eeprom ; read byte + movff EEDATA,hi + bsf leftbind + output_16 + call word_processor + call DISP_standard_color + return + +DISP_simdata_screen: ;Display Pre-Dive Screen + ; List active gases/Setpoints + btfsc FLAG_const_ppO2_mode ; in ppO2 mode? + bra DISP_simdata_screen3 ; Yes, display SetPoint/Sensor result list + +DISP_simdata_screen2: + ostc_debug 'm' ; Sends debug-information to screen if debugmode active + + WIN_LEFT .0 + WIN_FONT FT_SMALL + bsf leftbind + + movlw d'2' + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'10' + movwf waitms_temp ; here: stores row for gas list + clrf hi ; here: Gas counter + +DISP_simdata_screen2_loop: + incf hi,F ; Increase Gas + movlw d'4' + addwf wait_temp,F ; Increase eeprom address for gas list + + STRCPY TXT_GAS1 + movff hi,lo ; copy gas number + output_8 ; display gas number + PUTC ':' + movff wait_temp, EEADR ; Gas #hi: %O2 - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC '/' + incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + output_8 ; outputs into Postinc2! + PUTC ' ' + movf hi,W ; Gas number + addlw d'27' ; -> Adress of change depth register + call read_int_eeprom_1 + movff EEDATA,lo ; Change depth in m + movff lo,divemins ; Store for grey-out + output_99 ; outputs into Postinc2! + PUTC TXT_METER_C + + ; Check if gas is first gas ? + read_int_eeprom d'33' ; First gas (1-5)? + movf hi,W ; Current gas in WREG + cpfseq EEDATA ; Is equal first gas? + bra DISP_simdata_screen2_loop2 ; No : more tests... + + bra DISP_simdata_white ; Yes + +DISP_simdata_screen2_loop2: + ; Check if gas is inactive ? + read_int_eeprom d'27' ; read flag register + movff hi,lo ; copy gas number +DISP_simdata_screen2_loop1: + rrcf EEDATA ; roll flags into carry + decfsz lo,F ; max. 5 times... + bra DISP_simdata_screen2_loop1 + + btfss STATUS,C ; test inactive flag + bra DISP_simdata_grey ; Is inactive! + + tstfsz divemins ; Test change depth=0? + bra DISP_simdata_white ; Is not zero + +DISP_simdata_grey: + GETCUSTOM8 d'64' ;movlw color_grey + call DISP_set_color ; grey out inactive gases! + bra DISP_simdata_color_done + +DISP_simdata_white: + call DISP_standard_color + +DISP_simdata_color_done: + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .0 + movff waitms_temp,win_top ; Set Row + call word_processor ; display gas + +DISP_simdata_screen2b: + call DISP_standard_color + + movlw d'5' ; list all five gases + cpfseq hi ; All gases shown? + bra DISP_simdata_screen2_loop ; No + + return ; No, return (OC mode) + +DISP_simdata_screen3: + WIN_LEFT .0 + WIN_FONT FT_SMALL + bsf leftbind + + ; list three SP in Gaslist + movlw d'35' ; 36 = current SP position in EEPROM + movwf wait_temp ; here: stores eeprom address for gas list + movlw d'10' + movwf waitms_temp ; here: stores row for gas list + clrf decoplan_index ; here: SP counter + +DISP_simdata_screen3_loop: + incf wait_temp,F ; EEPROM address + incf decoplan_index,F ; Increase SP + + movlw d'25' + addwf waitms_temp,F ; Increase row + WIN_LEFT .0 + movff waitms_temp,win_top ; Set Row + + STRCPY TXT_SP2 + movff decoplan_index,lo ; copy gas number + output_8 ; display gas number + STRCAT ": " + movff wait_temp, EEADR; SP #hi position + call read_eeprom ; get byte (stored in EEDATA) + movff EEDATA,lo ; copy to lo + clrf hi + output_16dp d'3' ; outputs into Postinc2! + call word_processor + + movlw d'3' ; list all three SP + cpfseq decoplan_index ; All gases shown? + bra DISP_simdata_screen3_loop ;no + + ; Show Diluent + call get_first_diluent ; Read first diluent into lo(O2) and hi(He) + WIN_LEFT .0 + WIN_TOP .110 + STRCPY TXT_DIL4 + output_8 ; O2 Ratio + STRCAT "/" + movff hi,lo + output_8 ; He Ratio + call word_processor + + bcf leftbind + return ; Return (CC Mode) + +adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] + + btfsc simulatormode_active ; Do apply salinity in Simulatormode + return + + read_int_eeprom d'26' ; Read Salinity from EEPROM + movff EEDATA, wait_temp ; salinity + + movlw d'105' ; 105% ? + cpfslt wait_temp ; Salinity higher limit + return ; Out of limit, do not adjust lo:hi + + movlw d'99' ; 99% ? + cpfsgt wait_temp ; Salinity lower limit + return ; Out of limit, do not adjust lo:hi + + movff lo,xA+0 + movff hi,xA+1 + + movlw d'102' ; 0,98bar/10m + movwf xB+0 + clrf xB+1 + + call mult16x16 ;xA*xB=xC (lo:hi * 100) + + movff wait_temp,xB+0 ; Salinity + clrf xB+1 + + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + movff xC+0,lo + movff xC+1,hi ; restore lo and hi with updated value + + return \ No newline at end of file diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Fri Jan 25 16:31:22 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4163 +0,0 @@ - -; OSTC - diving computer code -; Copyright (C) 2008 HeinrichsWeikamp GbR - -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. - -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. - -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . - - -; routines for display outputs -; written by: Matthias Heinrichs, info@heinrichsweikamp.com -; written: 15/01/05 -; -; History: -; 2008-06-06 [MH] last updated -; 2010-12-31 [jDG] Multi-page display for GF decoplan -; 2011-01-04 [jDG] Saturation graphs in customview divemode -; -; known bugs: -; ToDo: More comments - - global PLED_divemask_color -PLED_divemask_color: - GETCUSTOM8 d'36' ; Divemask output color - bra PLED_standard_color_0 - - global PLED_warnings_color -PLED_warnings_color: - GETCUSTOM8 d'37' ; Warnings output color - bra PLED_standard_color_0 - - global PLED_standard_color -PLED_standard_color: - GETCUSTOM8 d'35' ; Standard output color -PLED_standard_color_0: ; Common entry point - movwf oled1_temp ; copy - movlw d'0' - cpfseq oled1_temp - bra PLED_standard_color_1 - bra PLED_standard_color2 -PLED_standard_color_1: - movlw d'4' - cpfseq oled1_temp - bra PLED_standard_color_2 - bra PLED_standard_color2 -PLED_standard_color_2: - movlw d'8' - cpfseq oled1_temp - bra PLED_standard_color_3 - bra PLED_standard_color2 -PLED_standard_color_3: - movlw d'192' - cpfseq oled1_temp - bra PLED_standard_color_4 - bra PLED_standard_color2 -PLED_standard_color_4: - movlw d'196' - cpfseq oled1_temp - bra PLED_standard_color_5 - bra PLED_standard_color2 -PLED_standard_color_5: - movlw d'200' - cpfseq oled1_temp - bra PLED_standard_color_6 - bra PLED_standard_color2 -PLED_standard_color_6: - movf oled1_temp,W ; Color should be OK... - call PLED_set_color - return -PLED_standard_color2: - movlw 0xFF ; Force full white. - call PLED_set_color - return - -PLED_color_code macro color_code_temp - movlw color_code_temp - call PLED_color_code1 - endm - -PLED_color_code1: ; Color-codes the output, if required - dcfsnz WREG - bra PLED_color_code_depth ; CF43 [mbar], 16Bit - dcfsnz WREG - bra PLED_color_code_cns ; CF44 [%] - dcfsnz WREG - bra PLED_color_code_gf ; CF45 [%] - dcfsnz WREG - bra PLED_color_code_ppo2 ; CF46 [cbar] - dcfsnz WREG - bra PLED_color_code_velocity ; CF47 [m/min] - dcfsnz WREG - bra PLED_color_code_ceiling ; Show warning if CF41=1 and current depth>shown ceiling - dcfsnz WREG - bra PLED_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA") - - -PLED_color_code_gaslist: ; %O2 in "EEDATA" -; Check very high ppO2 manually - SAFE_2BYTE_COPY amb_pressure,xA - movlw d'10' - movwf xB+0 - clrf xB+1 - call div16x16 ; xC=p_amb/10 - movff xC+0,xA+0 - movff xC+1,xA+1 - movff EEDATA,xB+0 - clrf xB+1 - call mult16x16 ; EEDATA * p_amb/10 - - tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? - bra PLED_color_code_gaslist1 ; Yes, warn in warning color -; Check if ppO2>3,30bar - btfsc xC+1,7 - bra PLED_color_code_gaslist1 ; Yes, warn in warning color - - movff xC+0,sub_a+0 - movff xC+1,sub_a+1 - GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar] - mullw d'100' ; ppo2_warning_high*100 - movff PRODL,sub_b+0 - movff PRODH,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag - bra PLED_color_code_gaslist1; too high -> Warning Color! - call PLED_standard_color - return - -PLED_color_code_gaslist1: - call PLED_warnings_color - return - -PLED_color_code_ceiling: - GETCUSTOM8 d'40' ; =1: Warn at all? - movwf lo - movlw d'1' - cpfseq lo ; =1? - bra PLED_color_code_ceiling1 ; No, Set to default color - - SAFE_2BYTE_COPY rel_pressure, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - movff hi,xA+1 - movff lo,xA+0 - movff char_O_first_deco_depth,lo ; Ceiling in m - decf lo,F ; -1 - movlw LOW d'100' - movwf xB+0 - clrf xB+1 ; Devide/100 -> xC+0 = Depth in m - call div16x16 ; xA/xB=xC with xA as remainder - movf xC+0,W ; Depth in m - subwf lo,W - btfsc STATUS,C - bra PLED_color_code_ceiling2 ; Set to warning color -PLED_color_code_ceiling1: - call PLED_standard_color - return -PLED_color_code_ceiling2: - call PLED_warnings_color - return - -PLED_color_code_depth: - movff hi,hi_temp - movff lo,lo_temp - SAFE_2BYTE_COPY rel_pressure, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - movff lo,sub_a+0 - movff hi,sub_a+1 - GETCUSTOM15 d'43' ; Depth warn [mbar] - movff lo,sub_b+0 - movff hi,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag - bra PLED_color_code_depth2; Set to warning color - call PLED_standard_color - movff hi_temp,hi - movff lo_temp,lo ; Restore hi, lo - return -PLED_color_code_depth2: - call PLED_warnings_color - movff hi_temp,hi - movff lo_temp,lo ; Restore hi, lo - return - -PLED_color_code_cns: - movff char_O_CNS_fraction,lo - GETCUSTOM8 d'44' ; CNS Warn [%] - subwf lo,W - btfsc STATUS,C - bra PLED_color_code_cns2 ; Set to warning color - call PLED_standard_color - return -PLED_color_code_cns2: - call PLED_warnings_color - return - -PLED_color_code_gf: - movff char_O_gradient_factor,lo ; gradient factor - GETCUSTOM8 d'45' ; GF Warn [%] - subwf lo,W - btfsc STATUS,C - bra PLED_color_code_gf2 ; Set to warning color - call PLED_standard_color - return -PLED_color_code_gf2: - call PLED_warnings_color - return - -PLED_color_code_ppo2: -; Check if ppO2>6,55bar - tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? - bra PLED_color_code_ppo22 ; Yes, warn in warning color -; Check if ppO2>3,30bar - btfsc xC+1,7 - bra PLED_color_code_ppo22 ; Yes, warn in warning color - - movff xC+0,sub_a+0 - movff xC+1,sub_a+1 - GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar] - mullw d'100' - movff PRODL,sub_b+0 - movff PRODH,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag - bra PLED_color_code_ppo22; Set to warning color - call PLED_standard_color - return -PLED_color_code_ppo22: - call PLED_warnings_color - return - -PLED_color_code_velocity: - btfss neg_flag ; Ignore for ascend! - bra PLED_color_code_velocity1 ; Skip check! - movff divA+0,lo - GETCUSTOM8 d'47' ; Velocity warn [m/min] - subwf lo,W - btfsc STATUS,C - bra PLED_color_code_velocity2 ; Set to warning color -PLED_color_code_velocity1: - call PLED_standard_color - return -PLED_color_code_velocity2: - call PLED_warnings_color - return - -ostc_debug macro value - movlw value - call ostc_debug1 - endm - -ostc_debug1: - movff debug_char+4,debug_char+5 ; Save for background debugger - movff debug_char+3,debug_char+4 - movff debug_char+2,debug_char+3 - movff debug_char+1,debug_char+2 - movff debug_char+0,debug_char+1 - movff WREG,debug_char+0 - - btfss debug_mode ; Are we in debugmode? - return ; No, return! - - WIN_TOP .192 - WIN_LEFT .100 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - lfsr FSR2,letter - movf debug_char+0,W - movwf POSTINC2 - movf debug_char+1,W - movwf POSTINC2 - movf debug_char+2,W - movwf POSTINC2 - movf debug_char+3,W - movwf POSTINC2 - movf debug_char+4,W - movwf POSTINC2 - movf debug_char+5,W - movwf POSTINC2 - - STRCAT_PRINT " " - return - -;============================================================================= -; BlueScreen function. -; -PLED_resetdebugger: - global PLED_resetdebugger - global temp10 - - movlb 1 ; For C-code calls - call PLED_boot ; PLED boot - call PLED_standard_color - WIN_INVERT .0 ; Init new Wordprocessor - - DISPLAYTEXT .133 - DISPLAYTEXT .134 - DISPLAYTEXT .135 - DISPLAYTEXT .136 ; Display Debug intro - - WIN_TOP .100 - WIN_LEFT .10 - - lfsr FSR2,letter - movff temp10+0,lo ; Code-stack point at crash time. - movff temp10+1,hi ; Code-stack point at crash time. - output_16 - movlw ' ' - movwf POSTINC2 - movf debug_char+0,W - movwf POSTINC2 - movf debug_char+1,W - movwf POSTINC2 - movf debug_char+2,W - movwf POSTINC2 - movf debug_char+3,W - movwf POSTINC2 - movf debug_char+4,W - movwf POSTINC2 - movf debug_char+5,W - movwf POSTINC2 - STRCAT ". " - movff flag1,lo - output_8 - PUTC ' ' - movff flag2,lo - output_8 - call word_processor - - WIN_TOP .125 - - lfsr FSR2,letter - movff flag3,lo - output_8 - PUTC ' ' - movff flag4,lo - output_8 - PUTC ' ' - movff flag5,lo - output_8 - PUTC ' ' - movff flag6,lo - output_8 - PUTC ' ' - movff flag7,lo - output_8 - call word_processor - - WIN_TOP .150 - - lfsr FSR2,letter - movff flag8,lo - output_8 - PUTC ' ' - movff flag9,lo - output_8 - PUTC ' ' - movff flag10,lo - output_8 - PUTC ' ' - movff flag11,lo - output_8 - PUTC ' ' - movff flag12,lo - output_8 - call word_processor - - call wait_switches ; Waits until switches are released, resets flag if button stays pressed! -PLED_resetdebugger_loop: - bcf LED_blue ; Blink blue led every seconds.. - btfss secs,0 - bsf LED_blue - - btfss switch_left - bra PLED_resetdebugger_loop ; Loop - - bcf LED_blue - call wait_switches ; Waits until switches are released, resets flag if button stays pressed! - return - -PLED_divemode_mask: ; Displays mask in Dive-Mode - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH .267 ; Max. - DISPLAYTEXT .86 ; Divetime - DISPLAYTEXT .87 ; Depth - call PLED_standard_color - return - -PLED_clear_customview_divemode: - WIN_BOX_BLACK .168, .239, .90, .159 ;top, bottom, left, right - return - -PLED_clear_customview_surfmode: - WIN_BOX_BLACK .25, .121, .82, .159 ;top, bottom, left, right - return - -PLED_clear_decoarea: - WIN_BOX_BLACK .54, .168, .90, .159 ;top, bottom, left, right - return - -PLED_display_ndl_mask: - ; Clears Gradient Factor - movlw d'8' - movwf temp1 - WIN_TOP .145 - WIN_LEFT .0 - call PLED_display_clear_common_y1 - - btfsc menubit ; Divemode menu active? - return ; Yes, return - - ; Clear Dekostop and Dekosum - rcall PLED_clear_decoarea - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'84' ; NoStop - call PLED_standard_color - return - -PLED_display_ndl: - GETCUSTOM8 d'66' ; Always show GF? - decfsz WREG,F ; WREG=1? - bra PLED_display_ndl2 ; No - rcall PLED_display_gf ; Show GF (If GF > CF08) - -PLED_display_ndl2: - btfsc menubit ; Divemode menu active? - return ; Yes, return - - ostc_debug 'z' ; Sends debug-information to screen if debugmode active - - WIN_TOP .136 - WIN_LEFT .119 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - movff char_O_nullzeit,lo ; NDL in minutes - output_8 - STRCAT_PRINT "'" - WIN_FONT FT_SMALL - return - -PLED_display_deko_mask: - btfsc menubit ; Divemode menu active? - return ; Yes, return - - rcall PLED_clear_decoarea - ; total deco time word - bcf show_safety_stop ; Clear safety stop flag - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'85' ; TTS - DISPLAYTEXT d'82' ; DEKOSTOP - call PLED_standard_color - return - -PLED_display_deko: - btfsc menubit ; Divemode menu active? - bra PLED_display_deko1 ; Yes, do not display deco, only GF (if required) - - ostc_debug 'y' ; Sends debug-information to screen if debugmode active - WIN_TOP .80 - WIN_LEFT .94 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - bcf leftbind - PLED_color_code warn_ceiling ; Color-code Output - btfsc decoplan_invalid ; The decoplan needs to updated... - call PLED_grey ; .. so set the color to grey - lfsr FSR2,letter - movff char_O_first_deco_depth,lo ; Ceiling in m - output_99 - PUTC TXT_METER_C - movff char_O_first_deco_time,lo ; length of first stop in m - output_99 - STRCAT_PRINT "'" - WIN_FONT FT_SMALL - - ostc_debug 'x' ; Sends debug-information to screen if debugmode active - - WIN_TOP .136 - WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - - call PLED_standard_color - btfsc decoplan_invalid ; The decoplan needs to updated... - call PLED_grey ; .. so set the color to grey - lfsr FSR2,letter - movff int_O_ascenttime+0,lo ; TTS - movff int_O_ascenttime+1,hi ; on 16bits - output_16 - STRCAT_PRINT "'" - call PLED_standard_color - -PLED_display_deko1: - rcall PLED_display_gf ; Show GF (If GF > CF08) - return ; Done. - -PLED_display_gf: - movff char_O_gradient_factor,lo ; gradient factor - GETCUSTOM8 d'8' ; threshold for display - cpfslt lo ; show value? - bra PLED_display_deko2 ; Yes - ; No - ; Clears Gradient Factor - movlw d'8' - movwf temp1 - WIN_TOP .145 - WIN_LEFT .0 - call PLED_display_clear_common_y1 - return - -PLED_display_deko2: - ostc_debug 'w' ; Sends debug-information to screen if debugmode active -;GF - WIN_TOP .145 - WIN_LEFT .0 - WIN_FONT FT_SMALL - PLED_color_code warn_gf ; Color-code Output - - STRCPY TXT_GF3 - movff char_O_gradient_factor,lo ; gradient factor - output_8 - STRCAT_PRINT "% " - call PLED_standard_color - return - -PLED_show_safety_stop: - tstfsz safety_stop_countdown ; Countdown at zero? - bra PLED_show_safety_stop2 ; No, show stop - - bcf show_safety_stop ; Clear flag - - btfsc safety_stop_active ; Displayed? - rcall PLED_clear_decoarea ; Yes, Clear stop - bcf safety_stop_active ; Clear flag - bra PLED_display_ndl_mask ; Show NDL again - -PLED_show_safety_stop2: - btfsc safety_stop_active ; Displayed? - bra PLED_show_safety_stop3 ; Yes. - - bsf safety_stop_active ; Set flag - - btfsc menubit ; Divemode menu active? - bra PLED_show_safety_stop3 ; Yes, do not display now but countdown - - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'227' ; Safety stop - -PLED_show_safety_stop3: - decf safety_stop_countdown,F ; Reduce countdown - btfsc menubit ; Divemode menu active? - return ; Yes, do not show - movff safety_stop_countdown,lo - call PLED_standard_color - WIN_TOP .80 - WIN_LEFT .104 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - lfsr FSR2,letter - clrf hi - call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) - movf hi,W - movff lo,hi - movwf lo ; exchange lo and hi - output_99 - PUTC ':' - movff hi,lo - output_99x - STRCAT_PRINT "" - WIN_FONT FT_SMALL - call PLED_standard_color - return - -;============================================================================= -; Update simulator menu with time/depth -; Note: because translations might change a bit the string length, we reprint -; that part of the mask to be sure the numbers fit in the right places. -PLED_simulator_data: - WIN_LEFT .20 - WIN_FONT FT_SMALL - call PLED_standard_color - - ;---- Updates interval line ---------------------------------------------- - WIN_TOP .35 - lfsr FSR2,letter - OUTPUTTEXTH .307 ; Interval: - - movff char_I_dive_interval,lo - movf lo,W - bnz PLED_simulator_data_1 - OUTPUTTEXTH .308 ; Now - clrf POSTINC2 ; End buffer. - bra PLED_simulator_data_2 - -PLED_simulator_data_1: - bsf leftbind - output_8 - STRCAT TXT_0MIN5 - -PLED_simulator_data_2: - call word_processor - - ;---- Updates bottom time line ------------------------------------------- - WIN_TOP .95 - lfsr FSR2,letter - OUTPUTTEXTH .277 ; Bottom Time: - - movff sim_btm_time,lo - bsf leftbind - output_8 - STRCAT_PRINT TXT_MIN4 - - ;---- Updates depth line ------------------------------------------------- - WIN_TOP .125 - lfsr FSR2,letter - OUTPUTTEXTH .278 ; Max. Depth: - - movff sim_btm_depth,lo - bsf leftbind - output_8 - STRCAT_PRINT TXT_METER3 - - bcf leftbind - return - -;============================================================================= - -PLED_divemode_timeout2: - WIN_TOP .54 - WIN_LEFT .112 - WIN_FONT FT_SMALL - WIN_INVERT .1 - call PLED_warnings_color - STRCPY 0x94 ; "End of dive" icon - movff timeout_counter, lo - movff timeout_counter2, hi - call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) - movf hi,W - movff lo,hi - movwf lo ; exchange lo and hi - output_99x - PUTC ':' - movff hi,lo - output_99x - STRCAT_PRINT " " - bsf timeout_display ; Set Flag - call PLED_standard_color - WIN_INVERT .0 - return - -PLED_divemode_timeout: - WIN_TOP .54 - WIN_LEFT .112 - WIN_FONT FT_SMALL - call PLED_standard_color - STRCPY 0x94 ; "End of dive" icon - GETCUSTOM15 d'2' ; diveloop_timeout - movff lo,sub_a+0 - movff hi,sub_a+1 - movff timeout_counter, sub_b+0 - movff timeout_counter2, sub_b+1 ; Divemode timeout - call sub16 ; sub_c = sub_a - sub_b - movff sub_c+0,lo - movff sub_c+1,hi - call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) - movf hi,W - movff lo,hi - movwf lo ; exchange lo and hi - output_99x - PUTC ':' - movff hi,lo - output_99x - STRCAT_PRINT " " - bsf timeout_display ; Set Flag - return - -PLED_divemode_timeout_clear: - btfsc dekostop_active ; Is a deco stop displayed? - call PLED_display_deko_mask ; Yes, redraw mask - - WIN_TOP .54 - WIN_LEFT .112 - movlw d'6' - movwf temp1 - bcf timeout_display ; Clear flag - bra PLED_display_clear_common_y1 - -PLED_display_velocity_graph_clr: - WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display - bra PLED_display_velocity ; Continue with normal output - -PLED_display_velocity_graphical: - btfss neg_flag - bra PLED_display_velocity_graph_clr - bsf pled_velocity_display - ; divA+0 holding the ascend speed in m/min - movff divA+0,hi ; Copy - WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display - GETCUSTOM8 d'36' ; Divemode mask - WIN_FRAME_COLOR .20, .90, .65, .75 ; Outer frame - GETCUSTOM8 d'36' ; Divemode mask - WIN_FRAME_COLOR .20+.10, .90-.10, .65, .75 ; Inner frames - GETCUSTOM8 d'36' ; Divemode mask - WIN_FRAME_COLOR .20+.20, .90-.20, .65, .75 ; - GETCUSTOM8 d'36' ; Divemode mask - WIN_FRAME_COLOR .20+.30, .90-.30, .65, .75 ; - - GETCUSTOM8 d'47' ; color_warn_celocity_mmin - movwf xA+0 - clrf xA+1 - movlw .5 - movwf xB+0 ; Threshold for color warning (5 color normal + 2 color warning) - clrf xB+1 - call div16x16 ;xA/xB=xC with xA as remainder - ; xC+0 holds stepsize in m/min (e.g. =3 for 15m/min warning treshold) - movff hi,xA+0 ; Velocity in m/min - clrf xA+1 - movff xC+0,xB+0 ; Step size - clrf xB+1 - call div16x16 ;xA/xB=xC with xA as remainder - ; xC+0 now holds amount of segments to show - - movff hi,divA+0 ; Copy back for numeric output - movlw d'7' - cpfslt xC+0 - bra PLED_graph_vel_7 - movlw d'6' - cpfslt xC+0 - bra PLED_graph_vel_6 - movlw d'5' - cpfslt xC+0 - bra PLED_graph_vel_5 - movlw d'4' - cpfslt xC+0 - bra PLED_graph_vel_4 - movlw d'3' - cpfslt xC+0 - bra PLED_graph_vel_3 - movlw d'2' - cpfslt xC+0 - bra PLED_graph_vel_2 - movlw d'1' - cpfslt xC+0 - bra PLED_graph_vel_1 - bra PLED_graph_vel_0 ; Should not happen... - -PLED_graph_vel_7: - GETCUSTOM8 d'37' ; Color warning - WIN_BOX_COLOR .22, .22+.6, .67, .73 ; Fill box -PLED_graph_vel_6: - GETCUSTOM8 d'37' ; Color warning - WIN_BOX_COLOR .32, .32+.6, .67, .73 ; Fill box -PLED_graph_vel_5: - WIN_BOX_STD .42, .42+.6, .67, .73 ; Fill box -PLED_graph_vel_4: - WIN_BOX_STD .52, .52+.6, .67, .73 ; Fill box -PLED_graph_vel_3: - WIN_BOX_STD .62, .62+.6, .67, .73 ; Fill box -PLED_graph_vel_2: - WIN_BOX_STD .72, .72+.6, .67, .73 ; Fill box -PLED_graph_vel_1: - WIN_BOX_STD .82, .82+.6, .67, .73 ; Fill box -PLED_graph_vel_0: - -PLED_display_velocity: - ostc_debug 'v' ; Sends debug-information to screen if debugmode active - WIN_TOP .90 - WIN_LEFT .0 - WIN_FONT FT_SMALL - PLED_color_code warn_velocity ; Color code output - lfsr FSR2,letter - movlw '-' - btfsc neg_flag - movlw '+' - movwf POSTINC2 - movff divA+0,lo - output_99 - OUTPUTTEXT d'83' ; m/min - call word_processor - call PLED_standard_color - bsf pled_velocity_display - return - -PLED_display_velocity_clear: - GETCUSTOM8 d'60' ; use graphic velocity (=1)? - movwf lo - movlw d'1' - cpfseq lo ; =1? - bra PLED_display_velocity_clear1 ; No, clear text display - WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display - -PLED_display_velocity_clear1: - movlw d'8' - movwf temp1 - WIN_TOP .90 - WIN_LEFT .0 - bcf pled_velocity_display - bra PLED_display_clear_common_y1 - -PLED_display_wait_clear: - WIN_BOX_BLACK .0, .25, .0, .159 ;top, bottom, left, right - return - -PLED_display_clear_common_y2: ; Clears with y-scale=2 - WIN_FONT FT_MEDIUM - bra PLED_display_clear_common1 - -PLED_display_clear_common_y1: ; Clears with y-scale=1 - WIN_FONT FT_SMALL -PLED_display_clear_common1: - lfsr FSR2,letter -PLED_display_clear_common2: - PUTC ' ' - decfsz temp1,F - bra PLED_display_clear_common2 - call word_processor - WIN_FONT FT_SMALL - return - - -PLED_diveclock: - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'255' ; Clock - call PLED_standard_color - -PLED_diveclock2: - WIN_TOP .192 - WIN_LEFT .123 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - lfsr FSR2,letter - movff hours,lo - output_99x - PUTC ':' - movff mins,lo - output_99x - call word_processor - return - -PLED_clock: - ostc_debug 'c' - WIN_TOP .50 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - lfsr FSR2,letter - movff hours,lo - output_99x - PUTC ':' - movff mins,lo - output_99x - PUTC ':' - movff secs,lo - output_99x - STRCAT_PRINT " " - return - -PLED_interval: - WIN_TOP .75 - WIN_LEFT .90 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - lfsr FSR2,letter - - movff surface_interval+0,lo - movff surface_interval+1,hi - call convert_time ; lo=mins, hi=hours - - movf hi,W - movff lo,hi - movwf lo ; exchange lo and hi - output_99x - PUTC ':' - movff hi,lo - output_99x - STRCAT_PRINT " " - return - -PLED_show_gf_customview: - WIN_LEFT .93 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH .268 ;"Gradient Factors" - - GETCUSTOM8 d'64' ; Set to grey - call PLED_set_color - btfss use_aGF - call PLED_standard_color - - WIN_TOP .192 - STRCPY TXT_GF3 ; "GF:" - GETCUSTOM8 d'32' ; GF_lo - movwf lo - bsf leftbind - output_8 - STRCAT "/" - GETCUSTOM8 d'33' ; GF_hi - movwf lo - output_8 - STRCAT_PRINT "" - - GETCUSTOM8 d'64' ; Set to grey - call PLED_set_color - btfsc use_aGF - call PLED_standard_color - - WIN_TOP .216 - STRCPY TXT_aGF4 ; "aGF:" - GETCUSTOM8 d'67' ; aGF_lo - movwf lo - bsf leftbind - output_8 - STRCAT "/" - GETCUSTOM8 d'68' ; aGF_hi - movwf lo - output_8 - STRCAT_PRINT "" - bcf leftbind - - call PLED_standard_color - return - -PLED_show_cf11_cf12_cf29:; Display saturations/desaturation multiplier and last deco in the customview field - WIN_TOP .25 - WIN_LEFT .90 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - STRCPY TXT_BSAT5 - - GETCUSTOM8 d'11' - movwf lo - bsf leftbind - output_8 - STRCAT_PRINT "%" - - WIN_TOP .50 - STRCPY TXT_BDES5 - - GETCUSTOM8 d'12' - movwf lo - bsf leftbind - output_8 - STRCAT_PRINT "%" - -PLED_show_cf11_cf12_cf29_2: - WIN_TOP .75 - STRCPY TXT_LAST5 - GETCUSTOM8 d'29' - movwf lo - bsf leftbind - output_8 - STRCAT_PRINT TXT_METER1 - - bcf leftbind - return - -PLED_show_cf32_cf33_cf62_cf63: ; Display GF_LOW, GF_HIGH, pSCR ratio and drop in the customview field - WIN_TOP .25 - WIN_LEFT .90 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - GETCUSTOM8 d'32' ; GF_lo - movwf lo - STRCPY TXT_GFLO6 - bsf leftbind - output_8 - STRCAT_PRINT "%" - - WIN_TOP .50 - GETCUSTOM8 d'33' ; GF_hi - movwf lo - STRCPY TXT_GFHI6 - bsf leftbind - output_8 - STRCAT_PRINT "%" - - WIN_TOP .75 - lfsr FSR2,letter - GETCUSTOM8 d'62' ; O2 Drop in percent - movwf lo - bsf leftbind - output_8 - - STRCAT "% 1/" - GETCUSTOM8 d'63' ; Counter lung ratio in 1/X - movwf lo - output_8 - bcf leftbind - STRCAT_PRINT "" - return - - - -PLED_show_cf32_cf33_cf29:; Display GF_LOW, GF_HIGH and last deco in the customview field - WIN_TOP .25 - WIN_LEFT .90 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - GETCUSTOM8 d'32' ; GF_lo - movwf lo - - STRCPY TXT_GFLO6 - bsf leftbind - output_8 - STRCAT_PRINT "%" - - WIN_TOP .50 - GETCUSTOM8 d'33' ; GF_hi - movwf lo - STRCPY TXT_GFHI6 - bsf leftbind - output_8 - STRCAT_PRINT "%" - - bra PLED_show_cf11_cf12_cf29_2 ; Display CF29 in the third row and RETURN - - -PLED_logbook_cursor: - -PLED_menu_cursor: - WIN_BOX_BLACK .35, .239, .0, .16 ;top, bottom, left, right - - WIN_LEFT .0 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - movff menupos,temp1 - dcfsnz temp1,F - movlw d'35' - dcfsnz temp1,F - movlw d'65' - dcfsnz temp1,F - movlw d'95' - dcfsnz temp1,F - movlw d'125' - dcfsnz temp1,F - movlw d'155' - dcfsnz temp1,F - movlw d'185' - - movff WREG,win_top - STRCPY_PRINT "\xB7" - return - -PLED_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .5 ; Menu: - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .6 ; Logbook - DISPLAYTEXT .7 ; Gas Setup - DISPLAYTEXT .9 ; Reset all - DISPLAYTEXT .10 ; Setup... - DISPLAYTEXT .142 ; More... - DISPLAYTEXT .11 ; Exit - -; Write OSTC serial in Main Menu - WIN_TOP .215 - WIN_LEFT .47 - GETCUSTOM8 d'64' ; Write header in blue when - call PLED_set_color ; compiled in DEBUG mode... - lfsr FSR2,letter - OUTPUTTEXTH d'262' ; "OSTC " - clrf EEADRH - clrf EEADR ; Get Serial number LOW - call read_eeprom ; read byte - movff EEDATA,lo - incf EEADR,F ; Get Serial number HIGH - call read_eeprom ; read byte - movff EEDATA,hi - bsf leftbind - output_16 - call word_processor - call PLED_standard_color - return - -PLED_setup_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .98 ; Setup Menu: - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .99 ; Custom FunctionsI - DISPLAYTEXT .153 ; Custom FunctionsII - DISPLAYTEXTH .295 ; Custom FunctionsIII - DISPLAYTEXT .100 ; Decotype: - DISPLAYTEXT .142 ; More... - DISPLAYTEXT .11 ; Exit - return - -PLED_ccr_setup_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .111 ; CCR Setup Menu - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .229 ; Diluent Setup - DISPLAYTEXT .230 ; Setpoint Setup - DISPLAYTEXT .11 ; Exit - return - - -PLED_more_setup_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXTH .258 ; Setup Menu 2: - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXTH .257 ; Date format: - DISPLAYTEXT .129 ; Debug: - DISPLAYTEXT .187 ; Show License - DISPLAYTEXTH .276 ; Salinity: - DISPLAYTEXTH .280 ; Brightness: - DISPLAYTEXT .11 ; Exit - return - -PLED_more_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .144 ; Menu 2: - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .8 ; Set Time - DISPLAYTEXT .110 ; Const. ppO2 Setup - DISPLAYTEXT .113 ; Battery Info - DISPLAYTEXT .247 ; Simulator - DISPLAYTEXTH .287 ; Altimeter - DISPLAYTEXT .11 ; Exit - return - -PLED_reset_menu_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .28 ; Reset Menu - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .21 ; Cancel Reset - DISPLAYTEXT .245 ; Reset CF,Gases & Deco - DISPLAYTEXTH .284 ; Reset Logbook - DISPLAYTEXTH .285 ; Reboot OSTC - DISPLAYTEXTH .286 ; Reset Decodata - DISPLAYTEXT .11 ; Exit - return - -PLED_simulator_mask: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT .248 ; OSTC Simulator - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXTH .307 ; Interval: - DISPLAYTEXT .249 ; Start Dive - DISPLAYTEXTH .277 ; Bottom Time: - DISPLAYTEXTH .278 ; Max. Depth: - DISPLAYTEXTH .279 ; Calculate Deco - DISPLAYTEXT .11 ; Exit - return - -PLED_temp_surfmode: - ostc_debug 'e' - SAFE_2BYTE_COPY temperature, last_temperature - WIN_TOP .100 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - movff last_temperature+1,hi - movff last_temperature+0,lo - lfsr FSR2,letter - call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - movlw d'3' - movwf ignore_digits - bsf leftbind ; left orientated output - output_16dp d'2' - bcf leftbind - STRCAT_PRINT "°C " - return - -PLED_temp_divemode: - ostc_debug 'u' ; Sends debug-information to screen if debugmode active - -; temperature - SAFE_2BYTE_COPY temperature, last_temperature - - WIN_TOP .216 - WIN_LEFT .50 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - movff last_temperature+1,hi - movff last_temperature+0,lo - - lfsr FSR2,letter - call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - movlw d'3' - movwf ignore_digits - bsf leftbind ; left orientated output - output_16dp d'2' - bcf leftbind - STRCAT "° " - clrf WREG ; Allow up to 5 chars to avoid - movff WREG,letter+5 ; collision with sat graphs - call word_processor - return - -PLED_show_ppO2: ; Show ppO2 (ppO2 stored in xC) - ostc_debug 't' ; Sends debug-information to screen if debugmode active - WIN_TOP .117 - WIN_LEFT .0 - WIN_FONT FT_SMALL - PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) - STRCPY TXT_PPO2_5 - -; Check very high ppO2 manually - tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? - bra PLED_show_ppO2_3 ; Yes, display fixed Value! - - movff xC+0,lo - movff xC+1,hi - bsf ignore_digit4 - output_16dp d'1' - bcf ignore_digit4 -PLED_show_ppO2_2: - STRCAT_PRINT " " - call PLED_standard_color - return - -PLED_show_ppO2_3: - STRCAT ">6.6" - bra PLED_show_ppO2_2 - -PLED_show_ppO2_clear: ; Clear ppO2 - movlw d'10' - movwf temp1 - WIN_TOP .117 - WIN_LEFT .0 - call PLED_display_clear_common_y1 - return - -PLED_active_gas_clear: ; clears active gas! - WIN_TOP .192 - WIN_LEFT .50 - movlw d'5' - movwf temp1 - bra PLED_display_clear_common_y1; also returns! - -PLED_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9 - btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode - return - - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_active_gas_divemode_show ; Show gas (Non-Inverted in all cases) - - btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode - return ; Done. - -; Check if Gas Output should blink when a better gas is available... - GETCUSTOM8 d'42' ; =1 if gas should blink - movwf lo - movlw d'1' - cpfseq lo ; =1? - return ; No, Done. - - btg blinking_better_gas ; Toggle blink bit... - btfss blinking_better_gas ; blink now? - return ; No, Done. - movlw color_yellow ; Blink in yellow - call PLED_set_color - WIN_INVERT .1 ; Init new Wordprocessor - call PLED_active_gas_divemode_show1 ; Show gas (Non-Inverted in all cases) - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - return ; Done. - -PLED_active_gas_divemode_show: - call PLED_standard_color -PLED_active_gas_divemode_show1: - ostc_debug 's' ; Sends debug-information to screen if debugmode active -; gas - WIN_TOP .192 - WIN_LEFT .50 - WIN_FONT FT_SMALL - - movlw d'100' ; 100% in the tank - movff char_I_N2_ratio,lo ; minus N2 - bsf STATUS,C ; set borrow bit - subfwb lo,W - movff char_I_He_ratio,lo ; minus He - bsf STATUS,C ; set borrow bit - subfwb lo,F ; =% O2 - GETCUSTOM8 d'9' ; get oxygen treshold - movff char_I_He_ratio,hi ; He ratio - cpfsgt lo - bra PLED_active_gas_divemode2 ; Check He - bra PLED_active_gas_divemode3 ; Skip He check, display gas - -PLED_active_gas_divemode2: - tstfsz hi ; He = 0 % - bra PLED_active_gas_divemode3 ; display gas - - call PLED_warnings_color ; O2 below treshold, He=0 : Bad stuff ! - bra PLED_active_gas_divemode4 - -PLED_active_gas_divemode3: - movlw d'21' - cpfseq lo ; Air? (O2=21%) - bra PLED_active_gas_divemode4 ; No! - tstfsz hi ; Air? (He=0%) - bra PLED_active_gas_divemode4 ; No! - - ; Yes, display "Air" instead of 21/0 - lfsr FSR2,letter - OUTPUTTEXTH d'264' ;"Air " - PUTC ' ' - clrf WREG ; Allow up to 5 chars to avoid - movff WREG,letter+5 ; collision with sat graphs - bcf leftbind - call word_processor -PLED_active_better_gas: - WIN_TOP .192 - WIN_LEFT .43 - WIN_FONT FT_SMALL - lfsr FSR2,letter - movlw ' ' - btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode - movlw '*' - movwf POSTINC2 - call word_processor - return - -PLED_active_gas_divemode4: - lfsr FSR2,letter - bsf leftbind ; left orientated output - output_8 ; O2 ratio is still in "lo" - PUTC '/' - movff char_I_He_ratio,lo ; copy He ratio into lo - output_8 - PUTC ' ' - clrf WREG ; Allow up to 5 chars to avoid - movff WREG,letter+5 ; collision with sat graphs - bcf leftbind - call word_processor - rcall PLED_active_better_gas ; show *, if required - call PLED_standard_color ; Back to normal (if O2<21 and He=0) - return - -;----------------------------------------------------------------------------- -; Set color to grey when gas is inactive -; Inputs: WREG : gas# (0..4) -; Trashes: lo -; New v1.44se -PLED_grey_inactive_gas: - movwf lo ; copy gas number 0-4 - incf lo,F ; 1-5 - - read_int_eeprom d'33' ; Get First gas (1-5) - movf EEDATA,W - subwf lo,W ; Compare with current - bz PLED_white_gas ; First is always on. - - movlw .28-1 ; Depth for gas# is at idx+28 - addwf lo,W - movwf EEADR ; address in EEPROM. - call read_eeprom ; Read depth - clrf WREG - cpfsgt EEDATA ; is depth > 0 ? - bra PLED_grey_gas - - clrf EEADRH ; Lower page of EEPROM. - read_int_eeprom d'27' ; read flag register -PLED_grey_inactive_gas1: - rrcf EEDATA ; roll flags into carry - decfsz lo,F ; max. 5 times... - bra PLED_grey_inactive_gas1 - - bnc PLED_grey_gas ; test carry - -PLED_white_gas: - GETCUSTOM8 d'35' ;movlw color_white - goto PLED_set_color ; grey out inactive gases! - ; return - -PLED_grey_gas: -PLED_grey: - GETCUSTOM8 d'64' ;movlw color_grey - goto PLED_set_color ; grey out inactive gases! - ; return - -;----------------------------------------------------------------------------- -; Display Pre-Dive Screen - -PLED_pre_dive_screen: - ; List active gases/Setpoints - - btfsc FLAG_const_ppO2_mode ; in ppO2 mode? - bra PLED_pre_dive_screen3 ; Yes, display SetPoint/Sensor result list - -PLED_pre_dive_screen2: - ostc_debug 'm' ; Sends debug-information to screen if debugmode active - - WIN_LEFT .90 - WIN_FONT FT_SMALL - bsf leftbind - - movlw d'2' - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'0' - movwf waitms_temp ; here: stores row for gas list - clrf hi ; here: Gas counter - -PLED_pre_dive_screen2_loop: - incf hi,F ; Increase Gas - movlw d'4' - addwf wait_temp,F ; Increase eeprom address for gas list - - STRCPY TXT_GAS1 - movff hi,lo ; copy gas number - output_8 ; display gas number - STRCAT ": " - movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '/' - incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - - decf hi,W ; Gas # in 0..4 - call PLED_grey_inactive_gas - - read_int_eeprom d'33' ; Read start gas (1-5) - movf EEDATA,W - cpfseq hi ; Current Gas the active gas? - bra PLED_pre_dive_screen2a - bra PLED_pre_dive_screen2b - -PLED_pre_dive_screen2a: - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .90 - movff waitms_temp,win_top ; Set Row - call word_processor ; No, display gas - -PLED_pre_dive_screen2b: - movlw d'5' ; list all four (remaining) gases - cpfseq hi ; All gases shown? - bra PLED_pre_dive_screen2_loop ; No - - return ; No, return (OC mode) - -PLED_pre_dive_screen3: - WIN_LEFT .90 - WIN_FONT FT_SMALL - bsf leftbind - call PLED_standard_color - - ; list three SP in Gaslist - movlw d'35' ; 36 = current SP position in EEPROM - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'0' - movwf waitms_temp ; here: stores row for gas list - clrf apnoe_mins ; here: SP counter - -PLED_pre_dive_screen3_loop: - incf wait_temp,F ; EEPROM address - incf apnoe_mins,F ; Increase SP - - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .90 - movff waitms_temp,win_top ; Set Row - - STRCPY TXT_SP2 - movff apnoe_mins,lo ; copy gas number - output_8 ; display gas number - STRCAT ": " - movff wait_temp, EEADR ; SP #hi position - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - clrf hi - output_16dp d'3' ; outputs into Postinc2! - call word_processor - - movlw d'3' ; list all three SP - cpfseq apnoe_mins ; All gases shown? - bra PLED_pre_dive_screen3_loop ;no - - - call get_first_diluent ; Read first diluent into lo(O2) and hi(He) - WIN_LEFT .90 - WIN_TOP .100 - STRCPY TXT_DIL4 - output_8 ; O2 Ratio - PUTC '/' - movff hi,lo - output_8 ; He Ratio - call word_processor - - bcf leftbind - return ; Return (CC Mode) - -PLED_active_gas_surfmode: ; Displays start gas/SP 1 - ostc_debug 'q' ; Sends debug-information to screen if debugmode active - - btfsc FLAG_apnoe_mode ; In Apnoe mode? - return ; Yes, return - - btfsc gauge_mode ; In Gauge mode? - return ; Yes, return - - btfss FLAG_const_ppO2_mode ; are we in const. ppO2 mode? - bra PLED_active_gas_surfmode2 ; No, display gases - -; In CC Mode - WIN_TOP .135 - WIN_LEFT .90 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - read_int_eeprom d'36' - movff EEDATA,lo ; copy to lo - clrf hi - output_16dp d'3' ; outputs into Postinc2! - bcf leftbind - - STRCAT_PRINT TXT_BAR3 - return ; Done. - -PLED_active_gas_surfmode2: - WIN_TOP .130 - WIN_LEFT .100 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - read_int_eeprom d'33' ; Read byte (stored in EEDATA) - movff EEDATA,active_gas ; Read start gas (1-5) - - decf active_gas,W ; Gas 0-4 - mullw d'4' - movf PRODL,W - addlw d'7' ; = address for He ratio - movwf EEADR - call read_eeprom ; Read He ratio - movff EEDATA,char_I_He_ratio ; And copy into hold register - - decf active_gas,W ; Gas 0-4 - mullw d'4' - movf PRODL,W - addlw d'6' ; = address for O2 ratio - movwf EEADR - call read_eeprom ; Read O2 ratio - movff EEDATA, char_I_O2_ratio ; O2 ratio - movff char_I_He_ratio, wait_temp ; copy into bank1 register - bsf STATUS,C ; Borrow bit - movlw d'100' ; 100% - subfwb wait_temp,W ; minus He - bsf STATUS,C ; Borrow bit - subfwb EEDATA,F ; minus O2 - movff EEDATA, char_I_N2_ratio ; = N2! - - movlw d'100' ; 100% in the tank - movff char_I_N2_ratio,lo ; minus N2 - bsf STATUS,C ; set borrow bit - subfwb lo,W - movff char_I_He_ratio,lo ; minus He - bsf STATUS,C ; set borrow bit - subfwb lo,F ; =% O2 - - movff char_I_He_ratio,hi ; Copy into Bank1 register - - movlw d'21' - cpfseq lo ; Air? (O2=21%) - bra PLED_active_gas_surfmode4 ; No! - tstfsz hi ; Air? (He=0%) - bra PLED_active_gas_surfmode4 ; No! - - ; Yes, display "Air" instead of 21/0 - DISPLAYTEXTH d'265' ;"Air ", y-scale=2 - return ; Done. - -PLED_active_gas_surfmode4: - lfsr FSR2,letter - bsf leftbind ; left orientated output - output_99 ; O2 ratio is still in "lo" - movff char_I_He_ratio,lo ; copy He ratio into lo - tstfsz lo ; He>0? - bra PLED_active_gas_surfmode5 ; Yes. - bra PLED_active_gas_surfmode6 ; No, skip He -PLED_active_gas_surfmode5: - PUTC '/' - output_99 -PLED_active_gas_surfmode6: - bcf leftbind - call word_processor - - rcall PLED_mainscreen_show_nx - tstfsz lo ; He>0? - rcall PLED_mainscreen_show_tx ; Yes - return ; Done. - -PLED_mainscreen_show_tx: - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - WIN_TOP .127 - - STRCPY_PRINT TXT_TX1 - WIN_TOP .148 - STRCPY_PRINT TXT_TX2 - return -PLED_mainscreen_show_nx: - WIN_LEFT .85 - WIN_TOP .127 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - - STRCPY_PRINT TXT_NX1 - WIN_TOP .148 - STRCPY_PRINT TXT_NX2 - return - - -PLED_confirmbox: - WIN_BOX_BLACK .68, .146, .34, .101 ;top, bottom, left, right - WIN_FRAME_STD .70, .144, .35, .100 - - DISPLAYTEXT .143 ; Confirm: - DISPLAYTEXT .145 ; Cancel - DISPLAYTEXT .146 ; OK! - - movlw d'1' - movwf menupos - -PLED_confirmbox2: - WIN_BOX_BLACK .96, .143, .39, .51 ;top, bottom, left, right - - movff menupos,temp1 - movlw d'96' - dcfsnz temp1,F - movlw d'96' - dcfsnz temp1,F - movlw d'120' - movff WREG,win_top - WIN_LEFT .39 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - STRCPY_PRINT "\xB7" ; Cursor - - bcf sleepmode ; clear some flags - bcf menubit2 - bcf menubit3 - bcf switch_right - bcf switch_left - clrf timeout_counter2 - WAITMS d'100' - -PLED_confirmbox_loop: - call check_switches_logbook - - btfsc menubit3 ; SET/MENU? - bra PLED_confirmbox_move_cursor; Move Cursor - btfsc menubit2 ; ENTER? - bra PLED_confirmbox_menu_do ; Do task - - btfsc onesecupdate - call timeout_surfmode ; timeout - - btfsc onesecupdate - call set_dive_modes ; check, if divemode must be entered - bcf onesecupdate ; one second update - - btfsc sleepmode ; Timeout? - bra PLED_confirmbox_cancel ; back with cancel - btfsc divemode - bra PLED_confirmbox_cancel ; back with cancel - - bra PLED_confirmbox_loop ; wait for something to do - -PLED_confirmbox_cancel: - retlw .0 -PLED_confirmbox_ok: - retlw .1 - -PLED_confirmbox_menu_do: - dcfsnz menupos,F - bra PLED_confirmbox_cancel - dcfsnz menupos,F - bra PLED_confirmbox_ok - bra PLED_confirmbox_cancel - -PLED_confirmbox_move_cursor: - incf menupos,F - movlw d'3' ; number of menu options+1 - cpfseq menupos ; =limit? - bra PLED_confirmbox_move_cursor2 ; No! - movlw d'1' ; Yes, reset to position 1! - movwf menupos -PLED_confirmbox_move_cursor2: - bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor - - -PLED_depth: -; ostc_debug 'r' ; Sends debug-information to screen if debugmode active - SAFE_2BYTE_COPY rel_pressure, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - - movlw .039 - cpfslt hi - bra depth_greater_99_84mtr - - btfsc depth_greater_100m ; Was depth>100m during last call - call PLED_clear_depth ; Yes, clear depth area - bcf depth_greater_100m ; Do this once only... - - lfsr FSR2,letter - - movlw HIGH d'1000' - movwf sub_a+1 - movlw LOW d'1000' - movwf sub_a+0 - movff hi,sub_b+1 - movff lo,sub_b+0 - incf sub_b+0,F - movlw d'0' - addwfc sub_b+1,F ; Add 1mbar offset - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 10m? - rcall depth_less_10mtr ; Yes, add extra space - - WIN_TOP .24 - WIN_LEFT .0 - WIN_FONT FT_LARGE - WIN_INVERT .0 ; Init new Wordprocessor - PLED_color_code warn_depth ; Color-code the output - - movlw HIGH d'99' - movwf sub_a+1 - movlw LOW d'99' - movwf sub_a+0 - movff hi,sub_b+1 - movff lo,sub_b+0 - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 1m? - bra pled_depth2 ; Yes, display manual Zero - - bsf leftbind - bsf ignore_digit4 - output_16 ; Full meters in Big font - bcf leftbind - bra pled_depth3 - -pled_depth2: - PUTC '0' - -pled_depth3: - call word_processor - bcf ignore_digit4 - - WIN_FONT FT_MEDIUM - WIN_TOP .50 - WIN_LEFT .40 - PLED_color_code warn_depth ; Color-code the output - - SAFE_2BYTE_COPY rel_pressure, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - - STRCPY "." - - movlw HIGH d'20' ; Display 0.0m if lower then 20cm - movwf sub_a+1 - movlw LOW d'20' - movwf sub_a+0 - movff hi,sub_b+1 - movff lo,sub_b+0 - call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 0.3m? - bra pled_depth4 ; Yes, display manual Zero - - movlw d'4' - movwf ignore_digits - bsf ignore_digit5 - output_16dp d'0' - bra pled_depth5 - -pled_depth4: - PUTC '0' - -pled_depth5: - call word_processor ; decimeters in medium font - bcf ignore_digit5 - WIN_FONT FT_SMALL - return - -depth_greater_99_84mtr: ; Display only in full meters - btfss depth_greater_100m ; Is depth>100m already? - call PLED_clear_depth ; No, clear depth area and set flag - ; Depth is already in hi:lo - ; Show depth in Full meters - ; That means ignore figure 4 and 5 - lfsr FSR2,letter - WIN_TOP .24 - WIN_LEFT .0 - WIN_FONT FT_LARGE - WIN_INVERT .0 ; Init new Wordprocessor - PLED_color_code warn_depth ; Color-code the output - - bsf ignore_digit4 - bsf leftbind - output_16 - bcf leftbind - call word_processor - bcf ignore_digit4 - WIN_FONT FT_SMALL - return - -depth_less_10mtr: - PUTC ' ' - return - -PLED_clear_depth ; No, clear depth area and set flag - WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right - bsf depth_greater_100m ; Set Flag - return - -PLED_desaturation_time: - movff int_O_desaturation_time+0,lo - movff int_O_desaturation_time+1,hi ; Copy - tstfsz lo ; =0? - bra PLED_desaturation_time2 ; No! - tstfsz hi ; =0? - bra PLED_desaturation_time2 ; No! - return ; Do not display Desat - -PLED_desaturation_time2: - ostc_debug 'h' - WIN_TOP .150 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - OUTPUTTEXT d'14' ; Desat - PUTC ' ' - movff desaturation_time_buffer+0,lo ; divide by 60... - movff desaturation_time_buffer+1,hi - - call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) - bsf leftbind - movf lo,W - movff hi,lo - movwf hi ; exchange lo and hi... - output_8 ; Hours - PUTC ':' - movff hi,lo ; Minutes - output_99x - bcf leftbind - PUTC ' ' -; clrf WREG ; Allow up to 5 chars to avoid -; movff WREG,letter+6 ; collision with decotype letters - call word_processor - return - -PLED_nofly_time: - movf nofly_time+0,W ; Is nofly null ? - iorwf nofly_time+1,W - bnz PLED_nofly_time2 ; No... - return - -PLED_nofly_time2: - ostc_debug 'g' - WIN_TOP .125 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - OUTPUTTEXT d'35' ; NoFly - PUTC ' ' - movff nofly_time+0,lo ; divide by 60... - movff nofly_time+1,hi - call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) - bsf leftbind - movf lo,W - movff hi,lo - movwf hi ; exchange lo and hi... - output_8 ; Hours - PUTC ':' - movff hi,lo ; Minutes - output_99x - bcf leftbind - PUTC ' ' -; clrf WREG ; Allow up to 5 chars to avoid -; movff WREG,letter+6 ; collision with decotype letters - call word_processor - return - - -update_surf_press: - btfsc premenu ; Do not update when "Menu?" is displayed! - return - - ostc_debug 'b' ; Sends debug-information to screen if debugmode active - WIN_TOP .25 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - -; btfss high_altitude_mode ; In high altitude mode? - call PLED_standard_color ; No -; btfsc high_altitude_mode ; In high altitude mode? -; call PLED_warnings_color ; Yes, display ambient pressure in red - - SAFE_2BYTE_COPY amb_pressure, lo - lfsr FSR2,letter - - movff lo,sub_a+0 - movff hi,sub_a+1 - movff last_surfpressure_30min+0,sub_b+0 - movff last_surfpressure_30min+1,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - btfsc neg_flag ; Pressure lower? - rcall update_surf_press2 ; Yes, test threshold - - tstfsz sub_c+1 ; >255mbar difference? - bra update_surf_press_common; Yes, display! - movlw d'5' - subwf sub_c+0,W - btfsc STATUS,C - bra update_surf_press_common; Yes, display! -; PUTC '+' ; For debug only - SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... - -update_surf_press_common: - bsf leftbind - output_16 - bcf leftbind - STRCAT_PRINT TXT_MBAR5 - call PLED_standard_color ; Reset color - return - -update_surf_press2: - movff lo,sub_b+0 - movff hi,sub_b+1 - movff last_surfpressure_30min+0,sub_a+0 - movff last_surfpressure_30min+1,sub_a+1 - call sub16 ; sub_c = sub_a - sub_b -; PUTC '-' ; For debug only - return - -update_batt_voltage_divemode: - call PLED_warnings_color - DISPLAYTEXT d'246' ; LowBatt! - call PLED_standard_color - return - -update_batt_voltage: - ostc_debug 'f' - - GETCUSTOM8 d'31' ; =1 if battery voltage should be visible - movwf lo - movlw d'1' - cpfseq lo ; =1? - bra update_batt_voltage2 ; No, show symbol - - WIN_TOP .175 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - movff batt_voltage+0,lo - movff batt_voltage+1,hi - movlw d'1' - movwf ignore_digits - bsf ignore_digit5 ; do not display mV - bsf leftbind - output_16dp d'2' ; e.g. 3.45V - bcf leftbind - STRCAT_PRINT TXT_VOLT2 - return - -update_batt_voltage2: - WIN_FRAME_STD .174, .194, .1, .32 - -; 4100-Vbatt - movlw LOW d'4100' - movwf sub_a+0 - movlw HIGH d'4100' - movwf sub_a+1 - movff batt_voltage+0,sub_b+0 - movff batt_voltage+1,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b -; Battery full (>4100mV? - btfsc neg_flag - bra update_batt_voltage2_full - -; Vbatt-3500 - movlw LOW d'3500' - movwf sub_b+0 - movlw HIGH d'3500' - movwf sub_b+1 - movff batt_voltage+0,sub_a+0 - movff batt_voltage+1,sub_a+1 - call sub16 ; sub_c = sub_a - sub_b -; Battery lower then 3500mV? - btfsc neg_flag - bra update_batt_voltage2_empty - -; Battery is between 3500 and 4100mV -; sub_c:2 is between 0 and 600 - movff sub_c+0,xA+0 - movff sub_c+1,xA+1 - movlw d'20' - movwf xB+0 - clrf xB+1 - call div16x16 ;xA/xB=xC with xA as remainder -; xC is between 0 and 30 - movff xC+0,wait_temp ;save value - incf wait_temp,F ; +1 - - movlw d'3' - cpfsgt wait_temp - movwf wait_temp ; Minimum = 3 - -update_batt_voltage2a: - WIN_BOX_STD .181, .187, .32, .34 ; Battery nose - -update_batt_voltage3: - GETCUSTOM8 d'34' ; Color battery - btfsc cc_active - movlw color_yellow ; CC active - btfsc charge_done - movlw color_green ; Charge done. - call PLED_set_color - - movlw .175 - movff WREG,win_top ; row top (0-239) - movlw .19 - movff WREG,win_height - movlw .2 - movff WREG,win_leftx2 ; column left (0-159) - movff wait_temp,win_width ; column right (0-159) - call PLED_box - call PLED_standard_color - return - -update_batt_voltage2_empty: - movlw d'1' - movwf wait_temp - bra update_batt_voltage2a - -update_batt_voltage2_full: - movlw d'30' - movwf wait_temp - bra update_batt_voltage2a - -PLED_convert_signed_temperature: - btfss hi,7 ; Negative temperature ? - return ; No, return -; Yes, negative temperature! - PUTC '-' ; Display "-" - comf hi ; Then, 16bit sign changes. - negf lo - btfsc STATUS,C - incf hi - return ; and return - -PLED_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) - tstfsz EEDATA - bra PLED_convert_date1 - -; Use MMDDYY - movff convert_value_temp+0,lo ;month - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+1,lo ;day - bra PLED_convert_date1_common ;year - -PLED_convert_date1: - read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) - decfsz EEDATA,F - bra PLED_convert_date2 - -; Use DDMMYY - movff convert_value_temp+1,lo ;day - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+0,lo ;month - -PLED_convert_date1_common: - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+2,lo ;year - bsf leftbind - output_99x - return - -PLED_convert_date2: -; Use YYMMDD - movff convert_value_temp+2,lo ;year - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+0,lo ;month - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+1,lo ;day - bsf leftbind - output_99x - return - -PLED_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 - read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) - tstfsz EEDATA - bra PLED_convert_date_short1 - -; Use MMDDYY -PLED_convert_date_short_common: - movff convert_value_temp+0,lo ;month - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+1,lo ;day - bsf leftbind - output_99x - bcf leftbind - return - -PLED_convert_date_short1: - read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) - decfsz EEDATA,F - bra PLED_convert_date_short_common ; Use YYMMDD - -; Use DDMMYY - movff convert_value_temp+1,lo ;day - bsf leftbind - output_99x - bcf leftbind - PUTC '.' - movff convert_value_temp+0,lo ;month - bsf leftbind - output_99x - bcf leftbind - return - -update_date: - ostc_debug 'd' - WIN_TOP .75 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - lfsr FSR2,letter - - movff month,convert_value_temp+0 - movff day,convert_value_temp+1 - movff year,convert_value_temp+2 - call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 - call word_processor - return - -PLED_menu_clear: - WIN_BOX_BLACK .0, .26, .50, .100 ;top, bottom, left, right - return - -PLED_max_pressure: - ostc_debug 'p' ; Sends debug-information to screen if debugmode active - movff max_pressure+0,lo - movff max_pressure+1,hi - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - - movlw .039 - cpfslt hi - bra maxdepth_greater_99_84mtr - -; Display normal "xx.y" - lfsr FSR2,letter - call PLED_standard_color - WIN_TOP .207 - WIN_LEFT .0 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - bsf leftbind - bsf ignore_digit5 ; do not display 1cm depth - output_16dp d'3' - bcf leftbind - bcf show_last3 - call word_processor - WIN_FONT FT_SMALL - return - -maxdepth_greater_99_84mtr: ; Display only in full meters - btfss maxdepth_greater_100m ; Is max.depth>100m already? - call PLED_clear_maxdepth ; No, clear maxdepth area and set flag - ; max Depth is already in hi:lo - ; Show max depth in Full meters - ; That means ignore figure 4 and 5 - lfsr FSR2,letter - call PLED_standard_color - WIN_TOP .207 - WIN_LEFT .0 - WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor - - bsf ignore_digit4 - bsf leftbind - output_16 - bcf leftbind - call word_processor - bcf ignore_digit4 - WIN_FONT FT_SMALL - return - -PLED_clear_maxdepth: - WIN_BOX_BLACK .207, .239, .0, .41 ;top, bottom, left, right - bsf maxdepth_greater_100m ; Set Flag - return - -PLED_divemins: - btfsc menubit ; Divemode menu active? - return ; Yes, do not update divetime - - ostc_debug 'A' ; Sends debug-information to screen if debugmode active - - btfsc gauge_mode ; different display in gauge mode - bra PLED_divemins_gauge - - btfsc FLAG_apnoe_mode ; different display in apnoe mode - bra PLED_divemins_apnoe - - GETCUSTOM8 d'38' ; Show seconds (=1?) - movwf lo - movlw d'1' - cpfseq lo ; =1? - bra PLED_divemins2 ; No, minutes only - bra PLED_divemins_gauge ; Yes, use Gauge routine - -PLED_divemins2: - movff divemins+0,lo - movff divemins+1,hi - bcf leftbind - lfsr FSR2,letter - output_16_3 ; displays only last three figures from a 16Bit value (0-999) - WIN_TOP .20 - WIN_LEFT .120 - WIN_FONT FT_MEDIUM - call PLED_standard_color - call word_processor - WIN_FONT FT_SMALL - return - -PLED_display_apnoe_surface: - btfsc menubit ; Divemode menu active? - return ; Yes, do not display surface mode timeout - - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'140' ; "SURFACE" - call PLED_standard_color - - WIN_TOP .85 - WIN_LEFT .90 - WIN_FONT FT_MEDIUM - call PLED_standard_color - - - movff apnoe_surface_mins,lo - bcf leftbind - lfsr FSR2,letter - output_8 - PUTC ':' - movff apnoe_surface_secs,lo - output_99x - call word_processor - WIN_FONT FT_SMALL - return - -PLED_apnoe_clear_surface: - ; Clear Surface timer.... - WIN_BOX_BLACK .60, .119, .90, .159 ;top, bottom, left, right - return - - -PLED_display_apnoe_descent: - btfsc menubit ; Divemode menu active? - return ; Yes, do not display/update descent time - - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXT d'139' ; "Descent" - call PLED_standard_color - - - WIN_TOP .145 - WIN_LEFT .90 - WIN_FONT FT_MEDIUM - call PLED_standard_color - - - movff apnoe_mins,lo - lfsr FSR2,letter - output_8 - PUTC ':' - movff apnoe_secs,lo - output_99x - call word_processor - WIN_FONT FT_SMALL - return - -PLED_divemins_apnoe: - -PLED_divemins_gauge: - movff divemins+0,lo - movff divemins+1,hi - bcf leftbind - bsf show_last3 - lfsr FSR2,letter - output_16_3 ;Displays only 0...999 - PUTC ':' - movff divesecs,lo - output_99x - WIN_TOP .20 - WIN_LEFT .90 - WIN_FONT FT_MEDIUM - call PLED_standard_color - - call word_processor - bcf show_last3 - WIN_FONT FT_SMALL - return - -PLED_stopwatch_show: - ; Stopwatch - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH d'283' ; Stopwatch - -PLED_stopwatch_show2: - call PLED_standard_color - ostc_debug 'V' ; Sends debug-information to screen if debugmode active - WIN_TOP .192 - WIN_LEFT .110 - WIN_FONT FT_SMALL - call PLED_standard_color - - lfsr FSR2,letter - movff average_divesecs+0,lo ; Stopwatch - movff average_divesecs+1,hi ; Stopwatch - movlw d'2' - subwf lo,F - movlw d'0' - subwfb hi,F ; Subtract 2 seconds - - call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo) - - movff lo,wait_temp - movff hi,lo - clrf hi - - movlw d'0' - bcf leftbind - bsf show_last3 - output_16_3 ;Displays only 0...999 - PUTC ':' - movff wait_temp,lo - output_99x - call word_processor - - ostc_debug 'U' ; Sends debug-information to screen if debugmode active - - WIN_TOP .216 - WIN_LEFT .110 - WIN_FONT FT_SMALL - call PLED_standard_color - - lfsr FSR2,letter - movff avr_rel_pressure+0,lo - movff avr_rel_pressure+1,hi - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - bsf ignore_digit5 ; do not display 1cm depth - output_16dp d'3' - bcf leftbind - STRCAT_PRINT TXT_METER1 - return - -PLED_stopwatch_show_gauge: - btfsc menubit ; Divemode menu active? - return ; Yes, return - ; BIG Stopwatch - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH d'310' ; Stopwatch - DISPLAYTEXTH d'309' ; Average - call PLED_standard_color - ostc_debug 'V' ; Sends debug-information to screen if debugmode active - WIN_TOP .80 - WIN_LEFT .90 - WIN_FONT FT_MEDIUM - call PLED_standard_color - - lfsr FSR2,letter - movff average_divesecs+0,lo ; Stopwatch - movff average_divesecs+1,hi ; Stopwatch - movlw d'2' - subwf lo,F - movlw d'0' - subwfb hi,F ; Subtract 2 seconds - call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo) - movff lo,wait_temp - movff hi,lo - clrf hi - movlw d'0' - bcf leftbind - bsf show_last3 - output_16_3 ;Displays only 0...999 - PUTC ':' - movff wait_temp,lo - output_99x - call word_processor - - ostc_debug 'U' ; Sends debug-information to screen if debugmode active - WIN_TOP .136 - WIN_LEFT .90 - WIN_FONT FT_MEDIUM - call PLED_standard_color - lfsr FSR2,letter - movff avr_rel_pressure+0,lo - movff avr_rel_pressure+1,hi - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - bsf ignore_digit5 ; do not display 1cm depth - output_16dp d'3' - bcf leftbind - STRCAT_PRINT TXT_METER1 - WIN_FONT FT_SMALL ; Reset... - return - - -PLED_total_average_show: - ; Non-Resettable Average - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH d'281' ; Avr.Depth - -PLED_total_average_show2: - WIN_TOP .192 - WIN_LEFT .110 - WIN_FONT FT_SMALL - call PLED_standard_color - - lfsr FSR2,letter - movff avr_rel_pressure_total+0,lo - movff avr_rel_pressure_total+1,hi - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - bsf ignore_digit5 ; do not display 1cm depth - bcf leftbind - output_16dp d'3' - STRCAT_PRINT TXT_METER1 - return - -;============================================================================= -; Writes OSTC #Serial and Firmware version in surfacemode -; -PLED_serial: - ostc_debug 'a' ; Sends debug-information to screen if debugmode active - WIN_TOP .0 - WIN_LEFT .1 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - - ifdef __DEBUG - GETCUSTOM8 d'64' ; Write header in blue when - call PLED_set_color ; compiled in DEBUG mode... - else - call PLED_standard_color - endif - - lfsr FSR2,letter - read_int_eeprom d'34' ; Read deco data - tstfsz EEDATA - bra show_decotype_mainscreen2 - OUTPUTTEXT .101 ; ZH-L16 OC =0 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen2: - decfsz EEDATA,F - bra show_decotype_mainscreen3 - OUTPUTTEXT .102 ; Gauge =1 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen3: - decfsz EEDATA,F - bra show_decotype_mainscreen4 - OUTPUTTEXT .104 ; ZH-L16 CC =2 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen4: - decfsz EEDATA,F - bra show_decotype_mainscreen5 - OUTPUTTEXT .138 ; Apnoe =3 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen5: - decfsz EEDATA,F - bra show_decotype_mainscreen6 - OUTPUTTEXT .152 ; L16-GF OC =4 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen6: - decfsz EEDATA,F - bra show_decotype_mainscreen7 - OUTPUTTEXT .236 ; L16-GF CC =5 - bra show_decotype_mainscreen8 ; Done. -show_decotype_mainscreen7: - decfsz EEDATA,F - bra show_decotype_mainscreen8 ; Done. - OUTPUTTEXT .226 ; pSCR-GF =6 -show_decotype_mainscreen8: - STRCAT " \x90\x91 V" ; Scribble logo... - movlw softwareversion_x - movwf lo - bsf leftbind - output_8 - PUTC '.' - movlw softwareversion_y - movwf lo - bsf leftbind - output_99x - bcf leftbind - - ifdef __DEBUG - STRCAT_PRINT "-Dbg" - else - call word_processor - - movlw softwareversion_beta ; =1: Beta, =0: Release - decfsz WREG,F - return ; Release version -> Return - - call PLED_warnings_color - DISPLAYTEXT d'243' ; beta - call PLED_standard_color - endif - - return - -;============================================================================= - -PLED_divemode_menu_mask_first: ; Write Divemode menu1 mask - ostc_debug 'o' ; Sends debug-information to screen if debugmode active - call PLED_menu_clear ; clear "Menu?" - call PLED_standard_color - - btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode? - bra PLED_divemode_menu_mask_first2 - -; in OC Mode - DISPLAYTEXT .32 ;"Gaslist" - DISPLAYTEXT .31 ;"Decoplan" - bra PLED_divemode_menu_mask_first3 - -PLED_divemode_menu_mask_first2: -; in CC Mode - DISPLAYTEXT .238 ;"SetPoint" - DISPLAYTEXT .31 ;"Decoplan" - -PLED_divemode_menu_mask_first3: -; In all modes - call customview_menu_entry3 ; Show customview-dependent menu entry - DISPLAYTEXT .241 ;"Display" - DISPLAYTEXT .34 ;"Exit" - return - -PLED_divemode_set_xgas: ; Displayes the "Set Gas" menu - WIN_LEFT .100 - WIN_TOP .0 - WIN_FONT FT_SMALL - call PLED_standard_color - - STRCPY TXT_G6_3 - read_int_eeprom d'24' ; Get Gas6 %O2 - movff EEDATA,lo - bcf leftbind - output_99 ; outputs into Postinc2! - PUTC '/' - read_int_eeprom d'25' ; Get Gas6 %He - movff EEDATA,lo - output_99 ; outputs into Postinc2! - call word_processor - DISPLAYTEXT .123 ; O2 + - DISPLAYTEXT .124 ; O2 - - DISPLAYTEXT .125 ; He + - DISPLAYTEXT .126 ; He - - DISPLAYTEXTH d'300' ; Active? (Enable/Disable Gas underwater) - return - -PLED_divemode_simulator_mask: - call PLED_standard_color - DISPLAYTEXT .254 ; Close - DISPLAYTEXT .250 ; + 1m - DISPLAYTEXT .251 ; - 1m - DISPLAYTEXT .252 ; +10m - DISPLAYTEXT .253 ; -10m - DISPLAYTEXTH .306 ; Quit Sim - return - -;----------------------------------------------------------------------------- -; Draw a stop of the deco plan (simulator or dive). -; Inputs: lo = depth. Range 3m...93m -; + 80 if this is a switch-gas stop. -; hi = minutes. range 1'..240'. -; win_top = line to draw on screen. -; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*, -; WREG, PROD, TBLPTR TABLAT. -; -PLED_decoplan_show_stop: - ;---- Print depth ---------------------------------------------------- - WIN_LEFT .100 - - btfss lo,7 ; Bit set ? - bra PLED_decoplan_std_stop ; No : Just an usual stop - - bcf lo,7 ; cleanup depth - - GETCUSTOM8 d'55' ; Load gas switch [min] in wreg - tstfsz WREG ; =0? - bra PLED_decoplan_show_stop1; No: Show gas switch stop - bra PLED_decoplan_std_stop ; Yes: Just an usual stop - -PLED_decoplan_show_stop1: - movlw color_yellow - call PLED_set_color ; Show in yellow for gas switch - bra PLED_decoplan_nstd_stop - -PLED_decoplan_std_stop: - call PLED_standard_color - -PLED_decoplan_nstd_stop: - lfsr FSR2,letter - bsf leftbind - output_8 ; outputs into Postinc2! - STRCAT_PRINT TXT_METER2 - - ;---- Print duration ------------------------------------------------- - WIN_LEFT .140 - lfsr FSR2,letter - - movf lo,W ; Swap hi & lo - movff hi,lo - movwf hi - - output_8 ; Allow up to 240' - STRCAT_PRINT "' " ; 1 to 3 chars for depth. - - movf lo,W ; Swap back hi & lo - movff hi,lo - movwf hi - - ;--------------------------------------------------------------------- - ; Draw the bar graph used for deco stops (decoplan in simulator or dive). - movff win_top,WREG ; Increment win_top (BANK SAFE) - incf WREG - movff WREG,win_top - movlw d'18'+1 ; 19 --> height (bank safe !) - movff WREG,win_height - movlw .122 - movff WREG,win_leftx2 ; column left (0-159) - movlw .16 - movff WREG,win_width ; column max width. - - ; Draw used area (hi = minutes): - movlw d'16' ; Limit length (16min) - cpfslt hi - movwf hi - movff hi,win_bargraph ; Active width, the rest is cleared. - call PLED_box - - ; Restore win_top - call PLED_standard_color - movff win_top,WREG ; decf win_top (BANK SAFE) - decf WREG - movff WREG,win_top - return - -;----------------------------------------------------------------------------- -; Clear unused area belw last stop -; Inputs: win_top : last used area... -PLED_decoplan_clear_bottom: - movff win_top,WREG ; Get back from bank0 - btfsc divemode ; In dive mode ? - sublw .168 ; Yes: bottom row in divemode - btfss divemode ; In dive mode ? - sublw .240 ; No: bottom row in planning - movff WREG,win_height - - WIN_LEFT .85 ; Full divemenu width - movlw .160-.85+1 - movff WREG,win_width - - clrf WREG ; Fill with black - movff WREG,win_color1 - movff WREG,win_color2 - - goto PLED_box - -;----------------------------------------------------------------------------- -; Display the decoplan (simulator or divemode) for GF model -; Inputs: char_O_deco_table (array of stop times, in minutes) -; decoplan_page = page number. Displays 5 stop by page. -; -#define decoplan_index apnoe_mins ; within each page -#define decoplan_gindex apnoe_secs ; global index -#define decoplan_last apnoe_max_pressure ; Depth of last stop (CF#29) -#define decoplan_max apnoe_max_pressure+1; Number of lines per page. 7 in planning, 5 in diving. - -PLED_decoplan: - ostc_debug 'n' ; Sends debug-information to screen if debugmode active - - WIN_INVERT 0 - - ;---- Is there deco stops ? ------------------------------------------ - movff char_O_first_deco_depth,WREG - iorwf WREG - bnz PLED_decoplan_1 - - ;---- No Deco -------------------------------------------------------- - call PLED_standard_color - DISPLAYTEXT d'239' ;"No Deco" - bsf last_ceiling_gf_shown - return - -PLED_decoplan_1: - lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing. - lfsr FSR1,char_O_deco_time - - movlw .8 ; 8 lines/page in decoplan - btfsc divemode - movlw .6 ; 6 lines/page in divemode. - movwf decoplan_max - - clrf decoplan_index ; Start with index = 0 - clrf WREG - movff WREG,win_top ; and row = 0 - - ; Read stop parameters, indexed by decoplan_index and decoplan_page - movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index - mulwf decoplan_max - movf decoplan_index,W - addwf PRODL,W - movwf decoplan_gindex ; --> decoplan_gindex - - bcf last_ceiling_gf_shown ; Not finished yet... - -PLED_decoplan_2: - btfsc decoplan_gindex,5 ; Reached table length (32) ? - bra PLED_decoplan_99 ; YES: finished... - - ; Read stop parameters, indexed by decoplan_index - movf decoplan_gindex,W ; index - movff PLUSW1,hi ; char_O_deco_time [gindex] --> hi - movff PLUSW0,lo ; char_O_deco_depth[gindex] - movf lo,W - bz PLED_decoplan_99 ; depth == 0 : finished. - - ; Display the stop line - call PLED_decoplan_show_stop - - ; Next - movff win_top,WREG ; row: += 24 - addlw .24 - movff WREG,win_top - incf decoplan_index,F ; local index += 1 - incf decoplan_gindex,F ; global index += 1 - - ; Max number of lines/page reached ? - movf decoplan_max,W ; index+1 == max ? - cpfseq decoplan_index - bra PLED_decoplan_2 ; NO: loop - - ; Check if next stop if end-of-list ? - movf decoplan_gindex,W - movff PLUSW0,WREG ; char_O_deco_depth[gindex] - iorwf WREG - bz PLED_decoplan_99 ; End of list... - - ; Display the message "more..." - bcf last_ceiling_gf_shown ; More page to display... - - rcall PLED_decoplan_clear_bottom ; Clear from next line - - WIN_LEFT .130 - 7*3 - call PLED_standard_color - lfsr FSR2,letter - OUTPUTTEXT .142 ; More... - goto word_processor - -PLED_decoplan_99: - bsf last_ceiling_gf_shown ; Nothing more in table to display. - rcall PLED_decoplan_clear_bottom ; Clear from next line - return -;----------------------------------------------------------------------------- -; Toggle gas activity flag during dive. -; -; Input: gaslist_active -; Gaslist from eeprom[2...] -; -; Output: gaslist_active -; -; Note: Gas with a zero depth cannot be used in deco simulation, hence -; should not be displayed as selected here... -; -PLED_de_activelist: ; show (de)active gaslist - call PLED_standard_color - DISPLAYTEXT .254 ; Close - - WIN_LEFT .100 - WIN_FONT FT_SMALL - bsf leftbind - - movlw d'2' - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'0' - movwf waitms_temp ; here: stores row for gas list - clrf hi ; here: Gas counter - -PLED_de_activelist_loop: - incf hi,F ; Increase Gas - movlw d'4' - addwf wait_temp,F ; Increase eeprom address for gas list - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .100 - movff waitms_temp,win_top ; Set Row - - lfsr FSR2,letter - movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '/' - incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '@' - - movlw d'27' - addwf hi,W - movwf EEADR ; Point to Change depth - - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - - movf lo,w ; Gas with a zero depth - bz PLED_de_activelist_grey ; should be displayed inactive. - -; Check if gas needs to be greyed-out (inactive) - movff gaslist_active,EEDATA ; Get flag register - movff hi,lo ; copy gas number -PLED_de_activelist_loop1: - rrcf EEDATA ; roll flags into carry - decfsz lo,F ; max. 5 times... - bra PLED_de_activelist_loop1 - bc PLED_de_activelist_white - -PLED_de_activelist_grey: ; grey out inactive gases! - GETCUSTOM8 d'64' ;movlw color_grey - call PLED_set_color - -PLED_de_activelist_white: - call word_processor - call PLED_standard_color - - movlw d'5' ; list all five gases - cpfseq hi ; All gases shown? - bra PLED_de_activelist_loop ; No - - return ; return - -PLED_show_change_depth: ; Yes, show change depth for gas #menupos - btfsc display_set_setpoint ; In Setpoint list? - return ; Yes, return. - movlw color_yellow ; Blink in yellow - call PLED_set_color - WIN_LEFT .95 - WIN_TOP .148 - WIN_FONT FT_SMALL - - movlw .6 - cpfslt menupos ; <6? - bra PLED_show_change_depth_clear ; Yes! - - bsf leftbind - STRCPY TXT_GAS1 - movff menupos,lo - output_8 ; Show gas number - STRCAT TXT_AT4 ; " at " - decf menupos,W - addlw d'28' ; offset in memory - movwf EEADR - call read_eeprom ; Low-value - movff EEDATA,lo - output_8 ; Show gas number - STRCAT_PRINT TXT_METER2 ; "m " - bcf leftbind - call PLED_standard_color - return - -PLED_show_change_depth_clear: - STRCPY_PRINT " " - return - -PLED_diluent_list: - ostc_debug 'm' ; Sends debug-information to screen if debugmode active - WIN_LEFT .100 - WIN_FONT FT_SMALL - bsf leftbind - movlw d'94' - movwf wait_temp ; here: stores eeprom address for diluent list (96-2) - movlw d'231' - movwf waitms_temp ; here: stores row for gas list - clrf hi ; here: Diluent counter - -PLED_diluent_list_loop: - incf hi,F ; Increase Diluent - movlw .2 - addwf wait_temp,F ; Increase eeprom address for gas list - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .100 - movff waitms_temp,win_top ; Set Row - STRCPY TXT_DIL_C - movff hi,lo ; copy dil number - output_8 ; display dil number - PUTC ':' - movff wait_temp, EEADR; Dil #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '/' - incf EEADR,F ; Dil #hi: %He - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - - decf EEADR,F ; Dil #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - PLED_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA") - - call word_processor - call PLED_standard_color - - movlw d'5' ; list all five Diluents - cpfseq hi ; All diluents shown? - bra PLED_diluent_list_loop ; No - return ; return - - -PLED_gas_list: - ostc_debug 'm' ; Sends debug-information to screen if debugmode active - - WIN_LEFT .100 - WIN_FONT FT_SMALL - bsf leftbind - - movlw d'2' - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'231' - movwf waitms_temp ; here: stores row for gas list - clrf hi ; here: Gas counter - -PLED_gas_list_loop: - incf hi,F ; Increase Gas - movlw d'4' - addwf wait_temp,F ; Increase eeprom address for gas list - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .100 - movff waitms_temp,win_top ; Set Row - STRCPY TXT_GAS1 - movff hi,lo ; copy gas number - output_8 ; display gas number - PUTC ':' - movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '/' - incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - - decf EEADR,F ; Gas #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - PLED_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA") - -; Check if the "better gas" should be highlighted - - WIN_INVERT .0 ; Init new Wordprocessor - movf better_gas_number,W ; better gas 1-5? - cpfseq hi ; compare with gas# - bra PLED_gas_list_loop2 ; No equal, skip - - movlw color_yellow ; Blink in yellow - call PLED_set_color - WIN_INVERT .1 ; Init new Wordprocessor - -PLED_gas_list_loop2: -; Check if gas needs to be greyed-out (inactive) - movff gaslist_active, EEDATA ; Work with sorted list - movff hi,lo ; copy gas number -PLED_gas_list_loop1: - rrcf EEDATA ; roll flags into carry - decfsz lo,F ; max. 5 times... - bra PLED_gas_list_loop1 - - btfss STATUS,C ; test carry - rcall PLED_gas_list_grey - - call word_processor - call PLED_standard_color - - movlw d'5' ; list all five gases - cpfseq hi ; All gases shown? - bra PLED_gas_list_loop ; No - - DISPLAYTEXT d'122' ; More - return ; return (OC mode) - -PLED_gas_list_grey: - GETCUSTOM8 d'64' ;movlw color_grey - call PLED_set_color ; grey out inactive gases! - return - -PLED_splist_start: - WIN_LEFT .100 - WIN_FONT FT_SMALL - bsf leftbind - call PLED_standard_color - - ; list three SP in Gaslist - movlw d'35' ; 36 = current SP position in EEPROM - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'0' - movwf waitms_temp ; here: stores row for gas list - clrf decoplan_index ; here: SP counter - -PLED_splist_loop: - incf wait_temp,F ; EEPROM address - incf decoplan_index,F ; Increase SP - - movlw d'25' - addwf waitms_temp,F ; Increase row - movff waitms_temp,win_top ; Set Row - WIN_LEFT .100 - - STRCPY TXT_SP2 - movff decoplan_index,lo ; copy gas number - output_8 ; display gas number - PUTC ':' - movff wait_temp, EEADR; SP #hi position - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - clrf hi - output_16dp d'3' ; outputs into Postinc2! - call word_processor - - movlw d'3' ; list all three SP - cpfseq decoplan_index ; All gases shown? - bra PLED_splist_loop ; No - - bcf leftbind - return ; no, return - -PLED_clear_divemode_menu: - WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right - return - -PLED_divemenu_cursor: - ostc_debug 'l' ; Sends debug-information to screen if debugmode active - - WIN_BOX_BLACK .0, .150, .85, .95 ;top, bottom, left, right - - WIN_TOP .0 - WIN_LEFT .85 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color - - movff menupos,temp1 - movlw d'0' - dcfsnz temp1,F - movlw d'0' - dcfsnz temp1,F - movlw d'25' - dcfsnz temp1,F - movlw d'50' - dcfsnz temp1,F - movlw d'75' - dcfsnz temp1,F - movlw d'100' - dcfsnz temp1,F - movlw d'125' - - movff WREG,win_top - STRCPY_PRINT "\xB7" ; Cursor - return - - -;============================================================================= -; Draw saturation graph, is surface mode or in dive mode. -; -PLED_tissue_saturation_graph: - ostc_debug 'i' ; Sends debug-information to screen if debugmode active - - ;---- Draw Frame --------------------------------------------------------- - btfsc divemode - bra PLED_tsg_1 - - WIN_FRAME_STD .25, .120, .82, .159 ; Surfmode - bra PLED_tsg_2 -PLED_tsg_1: - WIN_FRAME_STD .169, .239, .90, .159 ; Divemode -PLED_tsg_2: - - ;---- Draw grid ---------------------------------------------------------- - btfss divemode - bra PLED_no_graph_grid - - GETCUSTOM8 d'64' ;movlw color_grey - call PLED_set_color - - movlw .169+.1 ; divemode - movff WREG,win_top - movlw .239-.169-.1 ; divemode - movff WREG,win_height - - movlw 1 - movff WREG,win_width - - movlw .122 - movff WREG,win_leftx2 - call PLED_box - movlw .131 - movff WREG,win_leftx2 - call PLED_box - movlw .140 - movff WREG,win_leftx2 - call PLED_box - movlw .149 - movff WREG,win_leftx2 - call PLED_box -PLED_no_graph_grid: - - ;---- Draw N2 Tissues ---------------------------------------------------- - lfsr FSR2, char_O_tissue_N2_saturation - movlw d'16' - movwf wait_temp ; 16 tissues - clrf waitms_temp ; Row offset - - movlw .1 - movff WREG,win_height ; row bottom (0-239) - movlw .82+.18 ; surfmode - btfsc divemode - movlw .90+.18 ; divemode - movff WREG,win_leftx2 ; column left (0-159) - movlw .57 ; surfmode: max width 57pix - btfsc divemode - movlw .57-8 ; divemode: 8pix less... - movff WREG,win_width - -PLED_tissue_saturation_graph3: - call PLED_standard_color ; Reset color foreach iteration - - movlw .25+3 ; surfmode: 3pix below top border - btfsc divemode - movlw .169+3 ; divemode - addwf waitms_temp,W - movff WREG,win_top ; row top (0-239) - - incf waitms_temp,F - incf waitms_temp,F - - movf POSTINC2,W - bcf STATUS,C ; Clear carry - rrcf WREG ; And divide by 4 - bcf STATUS,C - rrcf WREG - movwf temp1 - - movff win_width,WREG ; Max width. - cpfslt temp1 ; skip if 57 (WREG) < win_width - movwf temp1 - movff temp1,win_bargraph - - call PLED_box - - decfsz wait_temp,F - bra PLED_tissue_saturation_graph3 - - ;---- Draw He Tissues ---------------------------------------------------- - lfsr FSR2, char_O_tissue_He_saturation - movlw d'16' - movwf wait_temp ; 16 tissues - clrf waitms_temp ; Row offset - -PLED_tissue_saturation_graph2: - call PLED_standard_color ; Reset color foreach iteration - - movlw .120-.33 ; surfmode : 33pix above bottom border - btfsc divemode - movlw .239-.33 ; divemode - addwf waitms_temp,W - movff WREG,win_top ; row top (0-239) - - incf waitms_temp,F - incf waitms_temp,F - - movf POSTINC2,W - bcf STATUS,C ; Clear carry - rrcf WREG ; And divide by 4 - bcf STATUS,C - rrcf WREG - movwf temp1 - - movff win_width,WREG ; Max width. - cpfslt temp1 ; skip if 57 (WREG) < win_width - movwf temp1 - movff temp1,win_bargraph - - call PLED_box - - decfsz wait_temp,F - bra PLED_tissue_saturation_graph2 - - ;---- Draw N2/He Text ---------------------------------------------------- - call PLED_standard_color ; Reset color after last iterarion. - - movlw .82+2 ; surfmode: 2pix right of left border - btfsc divemode - movlw .90+2 ; divemode - movff WREG,win_leftx2 - - movlw .25+7 ; surfmode: 7pix below top border - btfsc divemode - movlw .169+7 ; divemode - movff WREG,win_top - STRCPY_PRINT TXT_N2_2 - - movlw .120-.30 ; surfmode: 30pix above bottom border - btfsc divemode - movlw .239-.30 ; divemode - movff WREG,win_top - STRCPY_PRINT TXT_HE2 - - ;---- Draw scale and O2[16]% --------------------------------------------- - btfsc divemode - return - - movff char_O_gtissue_no,wait_temp ; used as temp - - lfsr FSR1,char_O_tissue_N2_saturation - movf wait_temp,W ; W <- 0-15 - movff PLUSW1,lo ; lo <- FSR1[W] - - WIN_TOP .62 - WIN_FONT FT_SMALL - lfsr FSR2,letter - bsf leftbind - output_8 - bcf leftbind - - STRCAT_PRINT "% " - - ;---- Draw Scale --------------------------------------------------------- - WIN_BOX_STD .73, .74, .121, .157 - WIN_BOX_STD .61, .84, .121, .122 - WIN_BOX_STD .65, .80, .130, .131 - WIN_BOX_STD .65, .80, .139, .140 - WIN_BOX_STD .65, .80, .148, .149 - WIN_BOX_STD .61, .84, .157, .158 - return - -;============================================================================= - -PLED_startupscreen1: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT d'3' ; "HeinrichsWeikamp" - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .68 ; Licence 1/2 - DISPLAYTEXT .69 - DISPLAYTEXT .70 - DISPLAYTEXT .71 - DISPLAYTEXT .72 - DISPLAYTEXT .73 - DISPLAYTEXT .74 - return - -PLED_startupscreen2: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXT d'3' ; "HeinrichsWeikamp" - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXT .75 ; Licence 2/2 - DISPLAYTEXT .76 - DISPLAYTEXT .77 - DISPLAYTEXT .78 - DISPLAYTEXT .79 - DISPLAYTEXT .80 - DISPLAYTEXT .81 - return - -PLED_new_cf_warning: - call PLED_topline_box - WIN_INVERT .1 ; Init new Wordprocessor - DISPLAYTEXTH .271 ; New CF added! - WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXTH .272 ; New CustomFunctions - DISPLAYTEXTH .273 ; were added! Check - DISPLAYTEXTH .274 ; CF I and CF II Menu - DISPLAYTEXTH .275 ; for Details! - return - -PLED_const_ppO2_value: - ostc_debug 'j' ; Sends debug-information to screen if debugmode active - - WIN_TOP .168 - WIN_LEFT .50 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - - lfsr FSR2,letter - movff char_I_const_ppO2,lo - - tstfsz lo ; In Bailout mode (char_I_const_ppO2=0)? - bra PLED_const_ppO2_value2 ; No, display Setpoint - -; Yes, Display "Bail" - call PLED_standard_color - OUTPUTTEXTH d'263' ;"Bail " - call word_processor - return - -PLED_const_ppO2_value2: ; Display SetPoint -;Show fixed SP value - SAFE_2BYTE_COPY amb_pressure, xA - - movlw d'10' - movwf xB+0 - clrf xB+1 - ;xA/xB=xC with xA as remainder - call div16x16 ; xC+0=p_amb/10 - - ; char_I_const_ppO2 > p_amb/10 -> Not physically possible! -> Display actual value! - tstfsz xC+1 ; xC>255 - setf xC+0 ; Yes, set xC+0 to 2,55bar ppO2 - - movff ppO2_setpoint_store,WREG - cpfslt xC+0 ; Setpoint value possible? - bra PLED_const_ppO2_value1 ; Yes - - clrf hi ; Reset hi - movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value - bra PLED_const_ppO2_value1a - -PLED_const_ppO2_value1: - ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! - SAFE_2BYTE_COPY amb_pressure, xA - movlw d'10' - movwf xB+0 - clrf xB+1 - call div16x16 ; xC=p_amb/10 - movff xC+0,xA+0 - movff xC+1,xA+1 - movff char_I_O2_ratio,xB+0 - clrf xB+1 - call mult16x16 ; xC:2=char_I_O2_ratio * p_amb/10 - - movff xC+0,sub_b+0 - movff xC+1,sub_b+1 - movff ppO2_setpoint_store,WREG; Setpoint - mullw d'100' ; Setpoint*100 - movff PRODL,sub_a+0 - movff PRODH,sub_a+1 - call sub16 ; sub_c = sub_a - sub_b - - btfss neg_flag - bra PLED_const_ppO2_value11 ; Value in range (lower then fix Setpoint) - - ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value! - - movff xC+0,xA+0 ; xC=p_amb/10 - movff xC+1,xA+1 - movlw d'100' - movwf xB+0 - clrf xB+1 - call div16x16 ;xA/xB=xC with xA as remainder - - movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value - movff xC+1,hi ; For test if ppO2>2,55bar - - GETCUSTOM8 d'39' ; Adjust fixed SP? - dcfsnz WREG,F - bra PLED_const_ppO2_value1a ; Yes! - ; Do not adjust -> restore original SetPoint - -PLED_const_ppO2_value11: -; Setpoint in possible limits - movff ppO2_setpoint_store,char_I_const_ppO2 ; Restore Setpoint - clrf hi - -PLED_const_ppO2_value1a: - movff char_I_const_ppO2,lo - - movff lo,WREG ; copy to WREG - mullw .100 - movff PRODH,xC+1 - movff PRODL,xC+0 ; For color code - PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) - - tstfsz hi ; >2,55bar? - rcall PLED_const_ppO2_too_hi ; Yes - - bsf leftbind - output_16dp d'3' - bcf leftbind - STRCAT_PRINT " " ; Display Setpoint with trailing zero - call PLED_standard_color ; Reset color - return - -PLED_const_ppO2_too_hi: - PUTC '>' - setf lo ; show ">2.55" - clrf hi ; clear hi - call PLED_warnings_color ; Set Warning color - return - -;============================================================================= -; Display EAD/END computed in calc_hauptroutine_update_tissues() every 2sec. -; -PLED_show_end_ead_divemode: - call PLED_divemask_color ; Set Color for Divemode mask - - WIN_FONT FT_SMALL - WIN_LEFT .95 - WIN_TOP .192 - lfsr FSR2,letter - OUTPUTTEXTH .299 ; EAD: - call word_processor - - WIN_TOP .216 - lfsr FSR2,letter - OUTPUTTEXTH .298 ; END: - call word_processor - - call PLED_standard_color ; Back to white. - WIN_LEFT .125 - WIN_TOP .192 - lfsr FSR2,letter - movff char_O_EAD,lo - bsf leftbind - output_8 ; Print EAD w/o leading space. - STRCAT_PRINT TXT_METER2 - - WIN_TOP .216 - lfsr FSR2,letter - movff char_O_END,lo - output_8 ; Print END w/o leading space. - bcf leftbind - STRCAT_PRINT TXT_METER2 - -; Show ppO2[Flush] iff in CCR mode & not in Bailout: - btfsc is_bailout ; In bailout mode? - return ; Yes: done. - - btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? - return ; No: done. - - WIN_LEFT .95 - WIN_TOP .168 - call PLED_divemask_color ; Set Color for Divemode mask - STRCPY_PRINT TXT_PPO2_5 ; ppO2 of diluent - - movff char_O_flush_ppO2,WREG ; copy to WREG - mullw .100 - movff PRODH,xC+1 - movff PRODL,xC+0 ; For color code - PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) - - WIN_LEFT .130 - WIN_TOP .168 - - movff char_O_flush_ppO2, lo - incf lo,W ; ppO2 == 2.55 ? - bnz PLED_show_end_ead_divemode_1 - - STRCPY_PRINT "----" ; YES: mark overflow. - goto PLED_standard_color ; Back to white. - -PLED_show_end_ead_divemode_1: - lfsr FSR2,letter - clrf hi - bsf leftbind - output_16dp d'3' ; Show ppO2 w/o leading zero - bcf leftbind - STRCAT_PRINT " " ; Display ppO2[Diluent] - goto PLED_standard_color ; Back to white. - -;============================================================================= -; Display TTS after extra time at the same depth. -; -PLED_show_@5: - WIN_FONT FT_SMALL - WIN_LEFT .160-.70 ; 10 chars aligned right. - WIN_TOP .170 - call PLED_divemask_color ; Set Color for Divemode mask - lfsr FSR2,letter - - OUTPUTTEXTH .305 ; "Future TTS" - call word_processor - - WIN_LEFT .97 - WIN_TOP .194 - STRCPY "@" - GETCUSTOM8 d'58' - movwf lo - bsf leftbind - output_8 - bcf leftbind - STRCAT_PRINT "': " - - WIN_LEFT .97+7*5 ; "@10':" is 5 chars long - call PLED_standard_color - lfsr FSR2,letter - - movff int_O_extra_ascenttime+0,lo - movff int_O_extra_ascenttime+1,hi - movf lo,W - iorwf hi,W ; extra_ascenttime == 0 ? - bz PLED_show_@5_nodeco - movf lo,W ; extra_ascenttime == 0xFFFF ? - andwf hi,W - incf WREG,w - bz PLED_show_@5_wait - - bsf leftbind - output_16 - bcf leftbind - STRCAT_PRINT "' " ; From "none" to "1'" we need 2 trailing spaces - return - -PLED_show_@5_nodeco: -PLED_show_@5_wait: - STRCPY_PRINT "--- " - return - -;============================================================================= - -compute_pscr_ppo2: -; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10 - movff char_I_O2_ratio,WREG - sublw .100 ; 100-char_I_O2_ratio -> WREG - mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2 - movff PRODL,xA+0 - movff PRODH,xA+1 - GETCUSTOM8 d'62' ; O2 Drop - movff WREG,xB+0 - clrf xB+1 - call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61 - movff xC+0,xA+0 - movff xC+1,xA+1 - GETCUSTOM8 d'63' ; Lung ratio - movff WREG,xB+0 - clrf xB+1 - call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62 - - movlw .10 - movwf xB+0 - clrf xB+1 - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder - ; store xC:2 in lo:hi - movff xC+0,lo - movff xC+1,hi - - SAFE_2BYTE_COPY amb_pressure, xA - movff char_I_O2_ratio,xB+0 - clrf xB+1 - call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio - - movlw .10 - movwf xB+0 - clrf xB+1 - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder - - ; store xC:2 in sub_a - movff xC+0,sub_a+0 - movff xC+1,sub_a+1 - ; reload result from lo:hi - movff lo,sub_b+0 - movff hi,sub_b+1 - - call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values) - return - -; Display pSCR ppO2 -PLED_show_pSCR_ppO2: - WIN_FONT FT_SMALL - WIN_LEFT .160-.63 ; 9 chars aligned right. - WIN_TOP .170 - call PLED_divemask_color ; Set Color for Divemode mask - lfsr FSR2,letter - OUTPUTTEXTH .266 ; "pSCR Info" - call word_processor ; pCCR - - rcall compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2 - - WIN_FONT FT_SMALL - WIN_LEFT .95 - WIN_TOP .192 - lfsr FSR2,letter - STRCPY_PRINT TXT_PPO2_5 ; ppO2: - - movff sub_c+0,xC+0 - movff sub_c+1,xC+1 - clrf xC+2 - clrf xC+3 ; For color coding - PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) - WIN_LEFT .130 - WIN_TOP .192 - lfsr FSR2,letter - movff xC+0,lo - movff xC+1,hi - bsf ignore_digit4 - output_16dp d'1' - bcf ignore_digit4 - STRCAT_PRINT " " - call PLED_standard_color ; Back to white. -; Show O2 drop and counter lung ration in second row - WIN_LEFT .98 - WIN_TOP .216 - lfsr FSR2,letter - GETCUSTOM8 d'62' ; O2 Drop in percent - movwf lo - bsf leftbind - output_8 - STRCAT "% 1/" - GETCUSTOM8 d'63' ; Counter lung ratio in 1/X - movwf lo - output_8 - bcf leftbind - STRCAT_PRINT " " ; Trailing space needed when changing the O2 drop - return - -;============================================================================= -; Display cave consomation prediction (and warning). -; -PLED_show_cave_bailout: - WIN_FONT FT_SMALL - WIN_LEFT .160-.70 ; 10 chars aligned right. - WIN_TOP .170 - call PLED_divemask_color ; Set Color for Divemode mask - lfsr FSR2,letter - - OUTPUTTEXTH .311 ; "Cave Bail." - call word_processor - -; WIN_TOP .240 - 24 ; DO NOT display liter units, as this -; WIN_LEFT .160 - 7 ; can be Bars also... -; STRCPY_PRINT "l" - - WIN_FONT FT_MEDIUM - WIN_LEFT .90 - WIN_TOP .201 ; 170 + 24 + 14/2 + 32 + 14/2 = 240. - call PLED_standard_color - lfsr FSR2,letter - - ;---- Retrieve divetime in seconds (since last reset) - movff average_divesecs+0,xA+0 - movff average_divesecs+1,xA+1 - - ;---- Multiply by SAC, and divide by 60 (SAC inliters per minutes) - GETCUSTOM8 d'56' ; Get bottom SAC - movwf xB+0 - clrf xB+1 - call mult16x16 ; xC:4=xA:2*xB:2 - - movlw LOW(.60) - movwf xB+0 - movlw HIGH(.60) - movwf xB+1 - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder - - ;---- Multiply by average pressure [absolute, in bar] - movff xC+0,xA+0 ; Get result (in xC+0, noy xC+2 !) into xA - movff xC+1,xA+1 - - movf avr_rel_pressure+0,W ; Add surface pressure to get absolute pressure - addwf last_surfpressure_30min+0,W - movwf xB+0 - movf avr_rel_pressure+1,W - addwfc last_surfpressure_30min+1,W - movwf xB+1 ; --> Into xB - - call mult16x16 ; xC:4=xA:2*xB:2 - - movlw LOW(.1000) ; Pressure was in milibar, so divide by 1000. - movwf xB+0 - movlw HIGH(.1000) - movwf xB+1 - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder - - ;---- Go RED when limit is exceeded - movff xC+0,sub_a+0 - movff xC+1,sub_a+1 - GETCUSTOM15 d'59' ; Get Cave bailout alarm threshold - movff lo, sub_b+0 - movff hi, sub_b+1 - call sub16 ; Computes prediction - limit - btfss neg_flag ; Negativ ? - call PLED_warnings_color ; NO: go RED. - - ;---- Then display... - movff xC+0,lo - movff xC+1,hi - - bcf leftbind - output_16 - call word_processor - WIN_FONT FT_SMALL - return - -;============================================================================= - -PLED_show_leading_tissue: - call PLED_divemask_color ; Set Color for Divemode mask - DISPLAYTEXTH .282 ; L. Tissue: -PLED_show_leading_tissue_2: - call deco_calc_desaturation_time ; calculate desaturation time - movlb b'00000001' ; select ram bank 1 - - STRCPY "#" - movff char_O_gtissue_no,lo - movff char_O_gtissue_no,wait_temp ; used as temp - bsf leftbind - output_8 - STRCAT " (" - - movlw d'16' - cpfslt wait_temp - bra PLED_show_leading_tissue_he - STRCAT TXT_N2_2 - bra PLED_show_leading_tissue2 - -PLED_show_leading_tissue_he: - STRCAT TXT_HE2 - -PLED_show_leading_tissue2: - WIN_LEFT .95 - WIN_TOP .192 - WIN_FONT FT_SMALL - call PLED_standard_color - - STRCAT_PRINT ") " - - lfsr FSR1,char_O_tissue_N2_saturation - movf wait_temp,W ; W <- 0-15 - movff PLUSW1,lo ; lo <- FSR1[W] - - WIN_LEFT .95 - WIN_TOP .216 - WIN_FONT FT_SMALL - - lfsr FSR2,letter - output_8 - STRCAT_PRINT "% " - bcf leftbind - return - -PLED_marker_set: - WIN_LEFT .105 - WIN_TOP .170 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_divemask_color ; Set Color for Divemode mask - SAFE_2BYTE_COPY marker_depth, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] - lfsr FSR2,letter - bsf leftbind - bsf ignore_digit5 ; do not display 1cm depth - output_16dp d'3' - PUTC TXT_METER_C - bcf show_last3 - call word_processor - - WIN_LEFT .105 - WIN_TOP .192 - WIN_INVERT .0 ; Init new Wordprocessor - movff marker_time+0,lo - movff marker_time+1,hi - bsf leftbind - lfsr FSR2,letter - output_16_3 ; displays only last three figures from a 16Bit value (0-999) - PUTC ':' - movff marker_time+2,lo - output_99x - call word_processor - bcf leftbind - call PLED_standard_color - return - -PLED_topline_box_clear: ; Writes an empty box - movlw .0 - bra PLED_topline_box2 -PLED_topline_box: ; Writes a filled box... - GETCUSTOM8 d'35' ; ... with the standard color -PLED_topline_box2: - WIN_BOX_COLOR .0, .26, .0, .159 - call PLED_standard_color ; Reset to standard color in case of unreadable color - return - -PLED_display_cns: - btfsc gauge_mode ; Do not display in gauge mode - return - - btfsc FLAG_apnoe_mode ; Do not display in apnoe mode - return - - btfsc pled_velocity_display ; Is velocity displayed?` - return ; Yes, do not overwrite until pled_velocity_clear was called - - ostc_debug 'k' ; Sends debug-information to screen if debugmode active - - WIN_TOP .090 - WIN_LEFT .0 - WIN_FONT FT_SMALL - PLED_color_code warn_cns ; Color-code CNS output - - STRCPY TXT_CNS4 - movff char_O_CNS_fraction,lo - bsf leftbind - output_8 - bcf leftbind - STRCAT_PRINT "%" - return - -;----------------------------------------------------------------------------- -; -PLED_display_cns_surface: -; Check if CNS should be displayed - movff char_O_CNS_fraction,lo ; copy into bank1 - GETCUSTOM8 d'15' ; cns_display_high_surfacemode - subwf lo,W - btfss STATUS,C - return ; Do not show... - ; Show CNS - - ostc_debug 'W' ; Sends debug-information to screen if debugmode active - - WIN_TOP .175 - WIN_LEFT .45 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - PLED_color_code warn_cns ; Color-code CNS output - - STRCPY TXT_CNS4 - movff char_O_CNS_fraction,lo - bsf leftbind - output_8 - bcf leftbind - STRCAT_PRINT "% " - return - -;----------------------------------------------------------------------------- -; Display GF at furface, if > CF8. -; -PLED_display_gf_surface: - movff char_O_gradient_factor,lo ; gradient factor - GETCUSTOM8 d'8' ; threshold for display - cpfslt lo ; show value? - bra PLED_display_gf_surf_1 ; YES: do it. - return - -PLED_display_gf_surf_1: - WIN_TOP .175 - WIN_LEFT .45 - WIN_FONT FT_SMALL - PLED_color_code warn_gf ; Color-code Output - - STRCPY TXT_GF3 - movff char_O_gradient_factor,lo ; gradient factor - output_8 - STRCAT_PRINT "% " - goto PLED_standard_color - -;----------------------------------------------------------------------------- - -PLED_custom_text: - read_int_eeprom d'64' - movlw d'1' - cpfseq EEDATA ; Custom text active? - bra PLED_custom_text_serial ; No, show serial instead - WIN_TOP .200 - WIN_LEFT .0 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_divemask_color ; Set Color for Divemode mask - - lfsr FSR2,letter - movlw d'64' - movwf lo - movlw d'24' - movwf hi ; counter - -PLED_custom_text1: - incf lo,F - call PLED_get_custom_letter ; Get one letter for the custom text - movlw '}' ; End marker found? - cpfseq EEDATA - bra PLED_custom_text2 ; No - bra PLED_custom_text3 -PLED_custom_text2: - movff EEDATA,POSTINC2 ; Copy into Postinc - - decfsz hi,F ; Max. numbers? - bra PLED_custom_text1 ; No, get next letters - -PLED_custom_text3: - call word_processor - call PLED_standard_color - return - -PLED_get_custom_letter: - movff lo,EEADR ; Address for next custom text letter - call read_eeprom ; Read letter - return - -PLED_custom_text_serial: - WIN_TOP .200 - WIN_LEFT .50 - WIN_FONT FT_SMALL - WIN_INVERT .0 ; Init new Wordprocessor - call PLED_divemask_color ; Set Color for Divemode mask - - lfsr FSR2,letter - OUTPUTTEXTH d'262' ; "OSTC " - clrf EEADRH - clrf EEADR ; Get Serial number LOW - call read_eeprom ; read byte - movff EEDATA,lo - incf EEADR,F ; Get Serial number HIGH - call read_eeprom ; read byte - movff EEDATA,hi - bsf leftbind - output_16 - call word_processor - call PLED_standard_color - return - -PLED_simdata_screen: ;Display Pre-Dive Screen - ; List active gases/Setpoints - btfsc FLAG_const_ppO2_mode ; in ppO2 mode? - bra PLED_simdata_screen3 ; Yes, display SetPoint/Sensor result list - -PLED_simdata_screen2: - ostc_debug 'm' ; Sends debug-information to screen if debugmode active - - WIN_LEFT .0 - WIN_FONT FT_SMALL - bsf leftbind - - movlw d'2' - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'10' - movwf waitms_temp ; here: stores row for gas list - clrf hi ; here: Gas counter - -PLED_simdata_screen2_loop: - incf hi,F ; Increase Gas - movlw d'4' - addwf wait_temp,F ; Increase eeprom address for gas list - - STRCPY TXT_GAS1 - movff hi,lo ; copy gas number - output_8 ; display gas number - PUTC ':' - movff wait_temp, EEADR ; Gas #hi: %O2 - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC '/' - incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - output_8 ; outputs into Postinc2! - PUTC ' ' - movf hi,W ; Gas number - addlw d'27' ; -> Adress of change depth register - call read_int_eeprom_1 - movff EEDATA,lo ; Change depth in m - movff lo,divemins ; Store for grey-out - output_99 ; outputs into Postinc2! - PUTC TXT_METER_C - - ; Check if gas is first gas ? - read_int_eeprom d'33' ; First gas (1-5)? - movf hi,W ; Current gas in WREG - cpfseq EEDATA ; Is equal first gas? - bra PLED_simdata_screen2_loop2 ; No : more tests... - - bra PLED_simdata_white ; Yes - -PLED_simdata_screen2_loop2: - ; Check if gas is inactive ? - read_int_eeprom d'27' ; read flag register - movff hi,lo ; copy gas number -PLED_simdata_screen2_loop1: - rrcf EEDATA ; roll flags into carry - decfsz lo,F ; max. 5 times... - bra PLED_simdata_screen2_loop1 - - btfss STATUS,C ; test inactive flag - bra PLED_simdata_grey ; Is inactive! - - tstfsz divemins ; Test change depth=0? - bra PLED_simdata_white ; Is not zero - -PLED_simdata_grey: - GETCUSTOM8 d'64' ;movlw color_grey - call PLED_set_color ; grey out inactive gases! - bra PLED_simdata_color_done - -PLED_simdata_white: - call PLED_standard_color - -PLED_simdata_color_done: - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .0 - movff waitms_temp,win_top ; Set Row - call word_processor ; display gas - -PLED_simdata_screen2b: - call PLED_standard_color - - movlw d'5' ; list all five gases - cpfseq hi ; All gases shown? - bra PLED_simdata_screen2_loop ; No - - return ; No, return (OC mode) - -PLED_simdata_screen3: - WIN_LEFT .0 - WIN_FONT FT_SMALL - bsf leftbind - - ; list three SP in Gaslist - movlw d'35' ; 36 = current SP position in EEPROM - movwf wait_temp ; here: stores eeprom address for gas list - movlw d'10' - movwf waitms_temp ; here: stores row for gas list - clrf decoplan_index ; here: SP counter - -PLED_simdata_screen3_loop: - incf wait_temp,F ; EEPROM address - incf decoplan_index,F ; Increase SP - - movlw d'25' - addwf waitms_temp,F ; Increase row - WIN_LEFT .0 - movff waitms_temp,win_top ; Set Row - - STRCPY TXT_SP2 - movff decoplan_index,lo ; copy gas number - output_8 ; display gas number - STRCAT ": " - movff wait_temp, EEADR; SP #hi position - call read_eeprom ; get byte (stored in EEDATA) - movff EEDATA,lo ; copy to lo - clrf hi - output_16dp d'3' ; outputs into Postinc2! - call word_processor - - movlw d'3' ; list all three SP - cpfseq decoplan_index ; All gases shown? - bra PLED_simdata_screen3_loop ;no - - ; Show Diluent - call get_first_diluent ; Read first diluent into lo(O2) and hi(He) - WIN_LEFT .0 - WIN_TOP .110 - STRCPY TXT_DIL4 - output_8 ; O2 Ratio - STRCAT "/" - movff hi,lo - output_8 ; He Ratio - call word_processor - - bcf leftbind - return ; Return (CC Mode) - -adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] - - btfsc simulatormode_active ; Do apply salinity in Simulatormode - return - - read_int_eeprom d'26' ; Read Salinity from EEPROM - movff EEDATA, wait_temp ; salinity - - movlw d'105' ; 105% ? - cpfslt wait_temp ; Salinity higher limit - return ; Out of limit, do not adjust lo:hi - - movlw d'99' ; 99% ? - cpfsgt wait_temp ; Salinity lower limit - return ; Out of limit, do not adjust lo:hi - - movff lo,xA+0 - movff hi,xA+1 - - movlw d'102' ; 0,98bar/10m - movwf xB+0 - clrf xB+1 - - call mult16x16 ;xA*xB=xC (lo:hi * 100) - - movff wait_temp,xB+0 ; Salinity - clrf xB+1 - - call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder - - movff xC+0,lo - movff xC+1,hi ; restore lo and hi with updated value - - return \ No newline at end of file diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/russian_text.asm --- a/code_part1/OSTC_code_asm_part1/russian_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/russian_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -464,7 +464,7 @@ TCODE .115, .54, "Òàéìå®" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Ïåùåð.Çàï." ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Íîðì" ;312 Eco (Same length as #313!) TCODE .103, .155, "ßðêî" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/shared_definitions.h --- a/code_part1/OSTC_code_asm_part1/shared_definitions.h Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/shared_definitions.h Fri Jan 25 18:00:49 2013 +0100 @@ -169,15 +169,15 @@ extern unsigned char win_top, win_leftx2, win_font, win_invert; extern ram unsigned char letter[26]; -extern void PLED_ClearScreen(void); -extern void PLED_standard_color(void); -extern void PLED_warnings_color(void); -extern void PLED_divemask_color(void); +extern void DISP_ClearScreen(void); +extern void DISP_standard_color(void); +extern void DISP_warnings_color(void); +extern void DISP_divemask_color(void); -extern void PLED_box(void); -extern void PLED_frame(void); +extern void DISP_box(void); +extern void DISP_frame(void); extern void aa_wordprocessor(void); /// Set WREG color. -extern void PLED_set_color(void); +extern void DISP_set_color(void); #endif diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/simulator.asm --- a/code_part1/OSTC_code_asm_part1/simulator.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/simulator.asm Fri Jan 25 18:00:49 2013 +0100 @@ -45,14 +45,14 @@ movff WREG,char_I_dive_interval menu_simulator1: - call PLED_brightness_full ;max. brightness - call PLED_ClearScreen - call PLED_simulator_mask + call DISP_brightness_full ;max. brightness + call DISP_ClearScreen + call DISP_simulator_mask menu_simulator2: call menu_pre_loop_common ; Clear some menu flags, timeout and switches - call PLED_simulator_data - call PLED_menu_cursor + call DISP_simulator_data + call DISP_menu_cursor menu_simulator_loop: call check_switches_menu @@ -175,12 +175,12 @@ ; Show decoplanning result. ; simulator_show_decoplan: - call PLED_ClearScreen - call PLED_simdata_screen + call DISP_ClearScreen + call DISP_simdata_screen call divemenu_see_decoplan WIN_LEFT .0 - call PLED_standard_color + call DISP_standard_color ; Display TTS, if any... movff int_O_ascenttime+0,lo @@ -205,7 +205,7 @@ movlw .100 ; Detect if CNS > 100% cpfslt sim_CNS - call PLED_warnings_color ; Yes: draw in red ! + call DISP_warnings_color ; Yes: draw in red ! STRCPY TXT_CNS4 movff char_O_CNS_fraction,lo ; Current CNS, before dive. @@ -218,11 +218,11 @@ bra simulator_decoplan_cns_2 simulator_decoplan_cns_1: - call PLED_warnings_color ; Yes: draw in red ! + call DISP_warnings_color ; Yes: draw in red ! STRCPY_PRINT TXT_CNSGR10 simulator_decoplan_cns_2: - call PLED_standard_color ; Back to normal. + call DISP_standard_color ; Back to normal. WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .188 ; Sim. Results: WIN_INVERT .0 ; Init new Wordprocessor @@ -255,7 +255,7 @@ btfsc last_ceiling_gf_shown ; last ceiling shown? bra simulator_show_decoplan5_0 ; All done, clear and return - call PLED_decoplan ; Re-Draw Current page of GF Decoplan + call DISP_decoplan ; Re-Draw Current page of GF Decoplan bra simulator_show_decoplan1 ;---- In OCR mode, show the gas Usage special page --------------------------- @@ -286,7 +286,7 @@ lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing. WIN_LEFT .90 ; Set column - call PLED_standard_color + call DISP_standard_color simulator_show_decoplan5_loop: incf wait_temp,F ; Increment gas # @@ -305,9 +305,9 @@ andwf hi,W incf WREG bnz simulator_show_decoplan5_2 - call PLED_warnings_color + call DISP_warnings_color STRCPY_PRINT "= xxxx.x" - call PLED_standard_color + call DISP_standard_color bra simulator_show_decoplan5_1 simulator_show_decoplan5_2: @@ -376,7 +376,7 @@ movff xC+0,sim_pressure+0 movff xC+1,sim_pressure+1 - call PLED_topline_box + call DISP_topline_box WIN_INVERT .1 DISPLAYTEXT .12 ; "Wait..." WIN_INVERT .0 @@ -436,7 +436,7 @@ ; Loop for bottom time duration simulator_calc_deco_loop2: - call PLED_simulator_data ; Update display of bottom time. + call DISP_simulator_data ; Update display of bottom time. call deco_calc_tissue ; JUST calc tissue (faster). call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop) @@ -459,7 +459,7 @@ movlb b'00000001' ; rambank 1 selected movff char_O_deco_last_stop,sim_btm_depth - call PLED_simulator_data ; Animate ascent simu. + call DISP_simulator_data ; Animate ascent simu. dcfsnz timeout_counter2,F ; Abort loop (max. 256 tries)? bra simulator_calc_deco3 ; Yes... diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/sleepmode.asm --- a/code_part1/OSTC_code_asm_part1/sleepmode.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm Fri Jan 25 18:00:49 2013 +0100 @@ -27,13 +27,13 @@ decfsz temp1,F bra sleeploop1 ; build hash (about 90sek @ 16MHz) - call PLED_ClearScreen ; clear + call DISP_ClearScreen ; clear DISPLAYTEXT .1 ; "Building MD2 hash" DISPLAYTEXT .2 ; "Please wait..." call deco_hash ; calculate MD2 hash movlb b'00000001' ; Back to Bank1 sleeploop2: - call PLED_DisplayOff ; display off + call DISP_DisplayOff ; display off call disable_rs232 ; disable UART module ; Save surface mode custom view diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/spanish_text.asm --- a/code_part1/OSTC_code_asm_part1/spanish_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -461,7 +461,7 @@ TCODE .116, .54, "Crono." ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Bail Cueva" ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "Alto" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/start.asm --- a/code_part1/OSTC_code_asm_part1/start.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/start.asm Fri Jan 25 18:00:49 2013 +0100 @@ -28,7 +28,7 @@ clrf temp10+1 call init btfsc divemode ; Reset from Divemode? - call PLED_resetdebugger ; Yes! Something went wrong, show reset informations + call DISP_resetdebugger ; Yes! Something went wrong, show reset informations start3: clrf STKPTR ; Clear Stackpointer lfsr FSR0,year+1 ; Clear rambank 1-9, do not delete RTC registers @@ -155,7 +155,7 @@ movlw LOW 0x103 movwf EEADR movlw HIGH 0x103 - movwf EEADRH ; OLED brightness (=0: Eco, =1: High) + movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High) movlw .0 movwf EEDATA call write_eeprom ; write byte @@ -263,7 +263,7 @@ call reset_gases ; call reset_all_cf ; Show info screen - call PLED_boot ; PLED boot (Incl. Clear Screen!) + call DISPLAY_boot ; DISP boot (Incl. Clear Screen!) rcall display_new_cf_installed; Show info screen ; Save new number of current CF count movlw max_custom_number ; Defined in definitions.asm @@ -288,23 +288,23 @@ cpfseq EEDATA ; is 0xAA already? call logbook_convert_64k ; No, convert now (And write 0xAA to internal EEPROM 0x100) -; Set OLED brightness flag +; Set DISPLAY brightness flag movlw LOW 0x103 movwf EEADR movlw HIGH 0x103 - movwf EEADRH ; OLED brightness (=0: Eco, =1: High) + movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High) call read_eeprom ; read byte - bcf oled_brightness_high ; Eco mode + bcf DISPLAY_brightness_high ; Eco mode movlw .0 cpfseq EEDATA ; High? - bsf oled_brightness_high ; Yes! + bsf DISPLAY_brightness_high ; Yes! clrf EEADRH ; Reset EEADRH goto surfloop ; Jump to Surfaceloop! display_new_cf_installed: - call PLED_new_cf_warning ; Display new CF warning screen + call DISP_new_cf_warning ; Display new CF warning screen movlw d'20' ; timeout for warning screen bra startup_screen3a ; Will RETURN after timeout or button press @@ -397,8 +397,8 @@ ;============================================================================= startup_screen1: - call PLED_ClearScreen - call PLED_startupscreen1 ; show startup sreen + call DISP_ClearScreen + call DISP_startupscreen1 ; show startup sreen startup_screen1_2: movlw d'10' ; timeout for startup screen movwf temp1 @@ -428,8 +428,8 @@ bra screen1_loop ; loop screen startup_screen2: - call PLED_ClearScreen ; Page 1 - call PLED_startupscreen2 ; show startup sreen + call DISP_ClearScreen ; Page 1 + call DISP_startupscreen2 ; show startup sreen bra startup_screen1_2 startup_screen3a:; WARNING: Also used for decodescriptions and CF Warning screen! diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/strings.asm --- a/code_part1/OSTC_code_asm_part1/strings.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/strings.asm Fri Jan 25 18:00:49 2013 +0100 @@ -148,15 +148,16 @@ ;============================================================================= box_std_block: ; Use standard color (CF#35) - call PLED_standard_color + call DISP_standard_color bra box_common box_color_block: ; Use color from WREG - call PLED_set_color + call DISP_set_color bra box_common box_black_block: ; Use black color clrf WREG movff WREG,win_color1 ; Bank-safe addressing. movff WREG,win_color2 + movff WREG,win_color3 box_common: VARARGS_BEGIN VARARGS_GET8 win_top @@ -164,10 +165,10 @@ VARARGS_GET8 win_leftx2 VARARGS_GET8 win_width VARARGS_END - goto PLED_box + goto DISP_box box_frame_std: - call PLED_standard_color + call DISP_standard_color box_frame_common: VARARGS_BEGIN @@ -176,8 +177,8 @@ VARARGS_GET8 win_leftx2 VARARGS_GET8 win_width VARARGS_END - goto PLED_frame + goto DISP_frame box_frame_color: - call PLED_set_color + call DISP_set_color bra box_frame_common diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/surfmode.asm --- a/code_part1/OSTC_code_asm_part1/surfmode.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Fri Jan 25 18:00:49 2013 +0100 @@ -29,12 +29,12 @@ clrf lo movff lo,char_I_const_ppO2 ; reset to standard mode, OSTC assumes Air breathing at the surface! - call PLED_brightness_full ; max. brightness + call DISP_brightness_full ; max. brightness call I2CReset - call PLED_boot - call PLED_serial ; Show OSTC serial and firmware version - call PLED_clock ; display time + call DISPLAY_boot + call DISP_serial ; Show OSTC serial and firmware version + call DISP_clock ; display time call update_date ; display date call get_battery_voltage ; get battery voltage movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine @@ -53,11 +53,11 @@ bra surfloop1 ; Startup tasks for decompression modes - call PLED_display_cns_surface ; Update surface CNS display (If allowed by CF15) - call PLED_desaturation_time ; display desaturation time - call PLED_nofly_time ; display nofly time + call DISP_display_cns_surface ; Update surface CNS display (If allowed by CF15) + call DISP_desaturation_time ; display desaturation time + call DISP_nofly_time ; display nofly time - call PLED_active_gas_surfmode ; Show start gas + call DISP_active_gas_surfmode ; Show start gas surfloop1: btfss gauge_mode ; Display only in gauge mode @@ -92,12 +92,12 @@ WIN_LEFT .0 WIN_FONT FT_SMALL WIN_INVERT .0 ; Init new Wordprocessor - call PLED_standard_color + call DISP_standard_color bcf switch_left bcf switch_right - call PLED_active_gas_surfmode ; Show start gas / SetPoint - call PLED_custom_text ; Displays custom text + call DISP_active_gas_surfmode ; Show start gas / SetPoint + call DISP_custom_text ; Displays custom text clrf cf_checker_counter ; next cf to check ostc_debug 'G' ; Sends debug-information to screen if debugmode active @@ -127,7 +127,7 @@ surfloop_loop1: ; One Second tasks for all modes - call PLED_clock ; update clock + call DISP_clock ; update clock call test_charger ; check if charger IC is active call timeout_surfmode ; check timeout call update_batt_voltage ; display battery voltage @@ -138,9 +138,9 @@ ; Every 2 seconds, overwrite with GF value (if needed to display) btfsc secs,1 ; Alternating every 2sec (if needed) - call PLED_display_cns_surface ; Display CNS (if > CF15). + call DISP_display_cns_surface ; Display CNS (if > CF15). btfss secs,1 - call PLED_display_gf_surface ; Display GF (if > CF8). + call DISP_display_gf_surface ; Display GF (if > CF8). btfsc enter_error_sleep ; Enter Fatal Error Routine? call fatal_error_sleep ; Yes (In Sleepmode.asm!) @@ -159,7 +159,7 @@ ; New sensor value available call update_surf_press ; display surface pressure - call PLED_temp_surfmode ; Displays temperature + call DISP_temp_surfmode ; Displays temperature call set_dive_modes ; tests if depth>threshold call altimeter_calc movf menupos3,W ; Get customview status. @@ -223,11 +223,11 @@ update_surfloop60: ; One minute tasks for all modes -; call PLED_active_gas_surfmode ; Show start gas / SetPoint +; call DISP_active_gas_surfmode ; Show start gas / SetPoint call update_date ; and date in divemode call calc_deko_surfmode ; calculate desaturation every minute call check_temp_extrema ; check for new temperature extremas - call PLED_custom_text ; Displays custom text + call DISP_custom_text ; Displays custom text call surfcustomview_minute ; Do every-minute tasks for the custom view area btfsc gauge_mode ; Ignore in gauge mode @@ -236,8 +236,8 @@ bra update_surfloop60_2 ; One Minute tasks for deco modes - call PLED_nofly_time ; display nofly time - call PLED_desaturation_time ; display desaturation time + call DISP_nofly_time ; display nofly time + call DISP_desaturation_time ; display desaturation time btfsc premenu ; Not when "Menu?" is displayed! bra update_surfloop60_2 @@ -448,7 +448,7 @@ return ; No! bcf premenu ; Yes, so clear "Menu?" and clear pre_menu bit - call PLED_topline_box_clear ; Clears Bar at the top + call DISP_topline_box_clear ; Clears Bar at the top btfsc gauge_mode bra timeout_premenu2 ; Skip in Gauge mode @@ -457,7 +457,7 @@ timeout_premenu2: call update_surf_press ; rewrite serial number - call PLED_serial ; rewrite serial number + call DISP_serial ; rewrite serial number clrf timeout_counter3 ; Also clear timeout bcf switch_left ; and debounce switches bcf switch_right @@ -480,7 +480,7 @@ test_switches_surfmode3: bcf switch_right - call PLED_topline_box ; Write a filled bar at the top + call DISP_topline_box ; Write a filled bar at the top WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .4 ;Menu? WIN_INVERT .0 ; Init new Wordprocessor diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_asm_part1/turkish_text.asm --- a/code_part1/OSTC_code_asm_part1/turkish_text.asm Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_asm_part1/turkish_text.asm Fri Jan 25 18:00:49 2013 +0100 @@ -463,7 +463,7 @@ TCODE .109, .54, "Krono. " ;310 Stopwatch (BIG Stopwatch in Gauge mode) ; Cave consomation TCODE .0, .0, "Mag.Tüket." ;311 Cave Bail. (=10 chars.) -; OLED Brightness settings +; DISPLAY Brightness settings TCODE .103, .155, "Dusuk " ;312 Eco (Same length as #313!) TCODE .103, .155, "Parlak" ;313 High (Same length as #312!) diff -r c6220d340684 -r 6e456a6398e0 code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Fri Jan 25 16:31:22 2013 +0100 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Fri Jan 25 18:00:49 2013 +0100 @@ -317,11 +317,11 @@ #ifdef __DEBUG void assert_failed(PARAMETER short int line) { - extern void PLED_resetdebugger(void); + extern void DISP_resetdebugger(void); extern unsigned short temp10; temp10 = line; // Show source line number as stack depth. - PLED_resetdebugger(); + DISP_resetdebugger(); } #endif