# HG changeset patch # User Heinrichsweikamp # Date 1294209980 -3600 # Node ID 03df42de03e1ea958700ff0fe90384be1b1315a3 # Parent d721b49b8934b8090606547e360ff6bfb20cee04# Parent 4c588c3d1f12f19f53ee536645bdf4ad20aa5344 Merge 129 with 130 diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/MAIN.ASM --- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Wed Jan 05 07:46:20 2011 +0100 @@ -114,7 +114,6 @@ #include sync_clock.asm ; syncs RTC with PC #include start.asm ; Startup and init, checks background debugger #include simulator.asm ; Stand-alone simulator routines -#include io.asm ; Low-Level I/O access #include customview.asm ; Customview for divemode #include strings.asm ; Basic string operations diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Wed Jan 05 07:46:20 2011 +0100 @@ -1,7 +1,17 @@ New in 1.75 Beta: BETA Version - Do NOT use for diving! BUGFIX: Decomask in Gauge mode removed - +NEW: Decoplan rewritten, now has practically unlimited number of stops (OSTC MK.2 only) +NEW: Altimeter (OSTC MK.2 only) +BUGFIX: Timeout reset in Customview (OSTC MK.2 only) +BUGFIX: Surface Interval +NEW: Non-Resettable Average Depth (OSTC MK.2 only) +NEW: CF41: Mix Type Icons in Surfacemode +NEW: CF49: Show Altimeter in Surfacemode +NEW: CF50: Show LogMarker in Divemode/Customview +NEW: CF51: Show Stopwatch in Divemode/Customview +NEW: CF52: Show Tissue Graph in Divemode/Customview +NEW: CF53: Show Leading Tissue in Divemode/Customview New in 1.74 Beta: BETA Version - Do NOT use for diving! diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/customview.asm --- a/code_part1/OSTC_code_asm_part1/customview.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Wed Jan 05 07:46:20 2011 +0100 @@ -69,10 +69,16 @@ bra customview_1sec_clock ; Update the Clock dcfsnz WREG,F bra customview_1sec_lead_tiss ; Update the leading tissue + dcfsnz temp1,F + bra customview_1sec_average ; Update the Average depth dcfsnz WREG,F bra customview_1sec_graphs ; Update the leading tissue ; Menupos3=0, do nothing return + +customview_1sec_average: + call PLED_total_average_show2 ; Update the figures only + return customview_1sec_stopwatch: call PLED_stopwatch_show2 ; Update figures only @@ -97,6 +103,8 @@ bra customview_minute_clock ; Update the Clock dcfsnz WREG,F bra customview_minute_lead_tiss ; Update the leading tissue + dcfsnz temp1,F + bra customview_minute_average ; Update the Average depth dcfsnz WREG,F bra customview_minute_graphs ; Update the graphs ; Menupos3=0, do nothing @@ -116,6 +124,7 @@ customview_minute_marker: ; Do nothing extra customview_minute_stopwatch: ; Do nothing extra +customview_minute_average: ; Do nothing extra return ;============================================================================= @@ -124,7 +133,7 @@ customview_toggle: ostc_debug 'X' ; Sends debug-information to screen if debugmode active incf menupos3,F ; Number of customview to show - movlw d'5' ; Max number + movlw d'6' ; Max number cpfsgt menupos3 ; Max reached? bra customview_mask ; No, show clrf menupos3 ; Reset to zero (Zero=no custom view) @@ -139,18 +148,31 @@ bra customview_init_clock ; Show the clock dcfsnz WREG,F bra customview_init_lead_tissue ; Show the leading tissue + dcfsnz temp1,F + bra customview_init_average ; Show Total average depth dcfsnz WREG,F bra customview_init_graphs ; Show the graphs customview_init_nocustomview: bra customview_toggle_exit +customview_init_average: + call PLED_total_average_show ; Show Average with mask + bra customview_toggle_exit + customview_init_stopwatch: -; Init Stopwatch - call PLED_stopwatch_show + GETCUSTOM8 d'51' ; Show Stopwatch? (=1 in WREG) + decfsz WREG,F ; WREG=1? + bra customview_toggle ; No, use next Customview + + call PLED_stopwatch_show ; Init Stopwatch display bra customview_toggle_exit customview_init_marker: ; Init Marker + GETCUSTOM8 d'50' ; Show Marker? (=1 in WREG) + decfsz WREG,F ; WREG=1? + bra customview_toggle ; No, use next Customview + call PLED_standard_color DISPLAYTEXT d'151' ; Set Marker? bra customview_toggle_exit @@ -160,12 +182,18 @@ bra customview_toggle_exit customview_init_lead_tissue: ; Show leading tissue + GETCUSTOM8 d'53' ; Show Lead Tissue? (=1 in WREG) + decfsz WREG,F ; WREG=1? + bra customview_toggle ; No, use next Customview + call PLED_show_leading_tissue bra customview_toggle_exit -customview_init_graphs: ; Show graphs +customview_init_graphs: ; Show tissue graph + GETCUSTOM8 d'52' ; Show Tissue Graph? (=1 in WREG) + decfsz WREG,F ; WREG=1? call PLED_tissue_saturation_graph - bra customview_toggle_exit + bra customview_toggle ; No, use next Customview customview_toggle_exit: bcf toggle_customview ; Clear flag @@ -231,7 +259,8 @@ surfcustomview_toggle_exit: bcf toggle_customview ; Clear flag - bra surfcustomview_second + clrf timeout_counter2 ; Clear timeout + return ;============================================================================= ; Do every-second tasks for the custom view area diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Wed Jan 05 07:46:20 2011 +0100 @@ -121,7 +121,8 @@ textlength textaddress:2 - average_depth_hold:4 ; Holds Sum of depths + average_depth_hold:4 ; Holds Sum of depths (Resettable) + average_depth_hold_total:4 ; Holds Sum of depths (Non-Resettable) b0_lo ; Temp (calculate_average) b0_hi ; Temp (calculate_average) average_divesecs:2 ; Used for resetable average depth display @@ -215,7 +216,8 @@ amb_pressure:2 ; ambient pressure [mBar] rel_pressure:2 ; amb_pressure - surface pressure [mBar] max_pressure:2 ; Max. pressure for the dive [mBar] - avr_rel_pressure:2 ; Average rel. pressure (Average depth) for the dive [mBar] + avr_rel_pressure:2 ; Average rel. pressure (Average depth) for the dive [mBar], Resettable + avr_rel_pressure_total:2 ; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable last_pressure:2 temperature:2 last_temperature:2 @@ -297,8 +299,6 @@ customfunction_temp1 ; start of custom function descriptors customfunction_temp2 ; used in GETCUSTOM8 and GETCUSTOM15 - switch_timeout ; used for hold-down count function - decoplan_page ; used in PLED_MultiGF,... temp10 ; used in customview diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Wed Jan 05 07:46:20 2011 +0100 @@ -1274,6 +1274,8 @@ change_logbook_offset2: bcf LED_blue + clrf surface_interval+0 + clrf surface_interval+1 ; Clear surface interval timer end_dive_common: bcf simulatormode_active ; if we were in simulator mode @@ -1284,11 +1286,6 @@ call deco_gradient_array movlb b'00000001' ; select ram bank 1 - btfss restore_deco_data ; Restore decodata? - goto surfloop ; and return to surfaceloop -;new 1.71beta: - clrf surface_interval+0 - clrf surface_interval+1 ; Clear surface interval timer goto surfloop ; and return to surfaceloop timeout_divemode: @@ -1464,7 +1461,7 @@ ; 1. Add new 2xdepth to the Sum of depths registers movff rel_pressure+0,b0_lo - movff rel_pressure+1,b0_hi + movff rel_pressure+1,b0_hi ; Buffer... movf b0_lo,w addwf average_depth_hold+0,F @@ -1482,8 +1479,24 @@ addwfc average_depth_hold+2,F addwfc average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar +; Do the same for the _total registers (Non-Resettable) + movf b0_lo,w + addwf average_depth_hold_total+0,F + movf b0_hi,w + addwfc average_depth_hold_total+1,F + movlw d'0' + addwfc average_depth_hold_total+2,F + addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar + + movf b0_lo,w + addwf average_depth_hold_total+0,F + movf b0_hi,w + addwfc average_depth_hold_total+1,F + movlw d'0' + addwfc average_depth_hold_total+2,F + addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar + ; 2. Compute Average Depth on base of average_divesecs:2 - movff average_divesecs+0,xB+0 movff average_divesecs+1,xB+1 ; Copy movff average_depth_hold+0,xC+0 @@ -1494,6 +1507,36 @@ call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder movff xC+0,avr_rel_pressure+0 movff xC+1,avr_rel_pressure+1 + + ; Compute Total Average Depth on base of divemins:2 and divesecs + movff divemins+0,xA+0 + movff divemins+1,xA+1 + movlw d'60' + movwf xB+0 + clrf xB+1 + call mult16x16 ; xC:4=xA:2*xB:2 + movf divesecs,W + addwf xC+0,F + movlw d'0' + addwfc xC+1,F + movlw d'3' ; 2+1 + btfss divesecs,0 ; divesecs even? + movlw d'2' ; Yes, do not add +1 + addwf xC+0,F + movlw d'0' + addwfc xC+1,F + ; Ignore xC+2 and xC+3. Total Average will only work up to divetime=1092:16 + movff xC+0,xB+0 + movff xC+1,xB+1 ; Copy + movff average_depth_hold_total+0,xC+0 + movff average_depth_hold_total+1,xC+1 + movff average_depth_hold_total+2,xC+2 + movff average_depth_hold_total+3,xC+3 + + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + movff xC+0,avr_rel_pressure_total+0 + movff xC+1,avr_rel_pressure_total+1 + return reset_average1: @@ -1540,6 +1583,10 @@ clrf AlarmType ; Clear all alarms bcf event_occured ; clear flag rcall reset_average1 ; Reset the resettable average depth + clrf average_depth_hold_total+0 + clrf average_depth_hold_total+1 + clrf average_depth_hold_total+2 + clrf average_depth_hold_total+3 ; Clear Non-Resettable Average bcf depth_greater_100m ; clear flag setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) bcf dekostop_active diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/io.asm --- a/code_part1/OSTC_code_asm_part1/io.asm Tue Jan 04 15:14:42 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 . - - -; low-level routines for i/O -; written by: Matthias Heinrichs, info@heinrichsweikamp.com -; written: 090801 -; last updated: 100421 -; known bugs: -; ToDo: Remove file - diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/menu.asm --- a/code_part1/OSTC_code_asm_part1/menu.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu.asm Wed Jan 05 07:46:20 2011 +0100 @@ -28,40 +28,6 @@ bcf switch_right return -; movlw d'40' -; btfss button_delay_done ; Start counting? -; movlw d'200' -; movwf switch_timeout -; -;wait_switches1: -; WAITMS d'5' -; btfsc SWITCH2 -; bra wait_switches2 ; Check other switch -; -; decfsz switch_timeout,F -; bra wait_switches1 -; -; btfsc SWITCH2 -; bra wait_switches3 -; -; bsf button_delay_done ; Start counting -; bsf switch_left ; Set button flag -; bcf switch_right ; only for the other button -;; bcf LEDg -; return -; -;wait_switches2: -; btfss SWITCH1 -; bra wait_switches1 ; Wait -; -; ; Yes, both switches released before timeout... -;wait_switches3: -; bcf switch_left -; bcf switch_right -; bcf button_delay_done -; bcf LED_red -; return -; menu: bcf deco_mode_changed ; Clear flag (Description is only showed once) bcf LED_blue diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Wed Jan 05 07:46:20 2011 +0100 @@ -583,6 +583,7 @@ cpfseq apnoe_mins ; xC+0 = apone_mins? bra profile_display_fill2 ; No! return + profile_display_fill2: movf xC+0,W cpfsgt apnoe_mins ; apnoe_mins>xC+0? @@ -594,6 +595,7 @@ decf xC+1,F movf xC+1,W ; Row call PLED_SetRow ; 0...259 + call PLED_standard_color call PLED_PxlWrite_Single; Write one Pixel @@ -608,6 +610,7 @@ decf xC+1,F movf xC+1,W ; Row call PLED_SetRow ; 0...259 + call PLED_standard_color call PLED_PxlWrite_Single; Write one Pixel diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/menu_reset.asm --- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Wed Jan 05 07:46:20 2011 +0100 @@ -165,11 +165,11 @@ CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min CF_DEFAULT CF_SEC, d'42', d'0', d'240' ; time_correction_value_default Adds to Seconds on Midnight CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF#49 Show Altimeter in surface mode - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF50 Show Log-Marker + CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF51 Show Stopwatch - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF52 Show Tissue Graph in Divemode + CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF53 Show Laeding Tissue in Divemode CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/oled_samsung.asm --- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm Wed Jan 05 07:46:20 2011 +0100 @@ -57,8 +57,8 @@ ; PLED_SetColumnPixel: ; ----------------------------- PLED_SetColumnPixel: - movwf win_leftx2 ; d'0' ... d'159' - mullw 2 ; Copy to POD, times 2. + movff WREG,win_leftx2 ; d'0' ... d'159' + mullw 2 ; Copy to PROD, times 2. movlw 0x21 ; Start Address Vertical (.0 - .319) rcall PLED_CmdWrite @@ -84,7 +84,9 @@ rcall PLED_PxlWrite_Single ; Write first pixel. ; Write 2nd Pixel on same row but one column to the right - movwf win_leftx2,W ; Increment column address. + movff win_top,WREG + rcall PLED_SetRow ; Re-Set Row + movff win_leftx2,WREG ; Increment column address. mullw 2 incf PRODL clrf WREG ; Does not reset CARRY... @@ -237,10 +239,10 @@ bra PLED_box2 movlw 0x00 ; NOP, to stop Address Update Counter - bra PLED_CmdWrite + bra PLED_CmdWrite ; Returns... ;============================================================================= -; PLED_ClearScreen: An optimized version of PLEX_box, for ful screen black. +; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black. ; Trashed: WREG, PROD PLED_ClearScreen: diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Wed Jan 05 07:46:20 2011 +0100 @@ -868,7 +868,7 @@ PLED_show_ppO2: ; Show ppO2 ostc_debug 't' ; Sends debug-information to screen if debugmode active - WIN_TOP .120 + WIN_TOP .119 WIN_LEFT .0 WIN_FONT FT_SMALL PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) @@ -1347,7 +1347,7 @@ WIN_INVERT .0 ; Init new Wordprocessor call PLED_standard_color - STRCPY_PRINT "\xB7" + STRCPY_PRINT "\xB7" ; Cursor bcf sleepmode ; clear some flags bcf menubit2 @@ -2010,7 +2010,6 @@ PUTC ':' movff wait_temp,lo output_99x - bcf leftbind call word_processor ostc_debug 'U' ; Sends debug-information to screen if debugmode active @@ -2030,6 +2029,27 @@ STRCAT_PRINT "m" 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 "m" + return + PLED_serial: ; Writes OSTC #Serial and Firmware version in surfacemode ostc_debug 'a' ; Sends debug-information to screen if debugmode active @@ -2051,7 +2071,7 @@ bsf leftbind output_16 - STRCAT " \x85\x86 V" + STRCAT " \x85\x86 V" ; Scribble logo... movlw softwareversion_x movwf lo bsf leftbind @@ -2542,15 +2562,9 @@ movlw d'125' movff WREG,win_top - STRCPY_PRINT "\xB7" + STRCPY_PRINT "\xB7" ; Cursor return -;PLED_profileview_menu: -; DISPLAYTEXT .127 ;"Exit" -; DISPLAYTEXT .128 ;"Delete" -;; DISPLAYTEXT .132 ;"Format" -; return - ;============================================================================= ; Draw saturation graph, is surface mode or in dive mode. diff -r 4c588c3d1f12 -r 03df42de03e1 code_part1/OSTC_code_asm_part1/text_table.asm --- a/code_part1/OSTC_code_asm_part1/text_table.asm Tue Jan 04 15:14:42 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/text_table.asm Wed Jan 05 07:46:20 2011 +0100 @@ -399,7 +399,7 @@ DB .20,.125 ;279 DB .20,.155 ;280 - DB .100,.50 ;281 + DB .93,.170 ;281 Avr.Depth DB .90,.170 ;282 Lead Tiss. DB .93,.170 ;283 Stopwatch DB .20,.95 ;284 @@ -587,10 +587,10 @@ DA "Vel.warn[m/min]}" ;169 DA "Time offset/day}" ;170 DA "Show altimeter }" ;171 - DA "not used }" ;172 - DA "not used }" ;173 - DA "not used }" ;174 - DA "not used }" ;175 + DA "Show Log-Marker}" ;172 + DA "Show Stopwatch }" ;173 + DA "ShowTissueGraph}" ;174 + DA "Show Lead.Tiss.}" ;175 DA "not used }" ;176 DA "not used }" ;177 DA "not used }" ;178 @@ -709,7 +709,7 @@ DA "Max. Depth:}" ;278 l=12 DA "Calculate Deco}}" ;279 l=16 DA "Show Decoplan}" ;280 l=14 - DA "unused }" ;281 l=10 + DA "Avr.Depth}" ;281 l=10 DA "Lead Tiss.}}" ;282 l=12 DA "Stopwatch}" ;283 l=10 DA "Reset Logbook}" ;284 l=14