# HG changeset patch # User Heinrichsweikamp # Date 1304101052 -7200 # Node ID ceedf078b2d874f494d25a481e1f5d66ef6ee356 # Parent 2986e7cdb68c843785f2f7954563786eb7ed944b Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/adc_rtc.asm --- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm Fri Apr 29 20:17:32 2011 +0200 @@ -120,7 +120,8 @@ btfss initialize_battery2 ; battery need to be initialised? bra get_battery_no_init ; No, we have already valid values, just check for new extremas - + +get_battery_voltage_reset: ; Init EEPROM for battery control ; Reset lowest battery seen movlw LOW d'4200' ; reset to 4.2V @@ -232,11 +233,40 @@ movwf mins movlw .12 movwf hours - movlw .10 + movlw .5 movwf day - movlw .4 + movlw .5 movwf month movlw .11 movwf year bsf PIE1, TMR1IE - return \ No newline at end of file + return + +reset_battery_stats: + bcf uart_reset_battery_stats ; Clear flag + bcf PIE1,RCIE ; no interrupt for UART + call rs232_get_byte ; Get Byte + bcf PIR1,RCIF ; clear flag + + btfsc rs232_recieve_overflow ; Byte received? + bra reset_battery_stats_exit ; No, exit + movlw 'f' + cpfseq RCREG ; Really reset statistics? + bra reset_battery_stats_exit ; No, exit + call rs232_get_byte ; Get byte + bcf PIR1,RCIF ; clear flag + + btfsc rs232_recieve_overflow ; Byte received? + bra reset_battery_stats_exit ; No, exit + movlw 'f' + cpfseq RCREG ; Really reset statistics? + bra reset_battery_stats_exit ; No, exit +; Yes, Reset now. + rcall get_battery_voltage_reset ; Reset Statistics + movlw 'f' + movwf TXREG + call rs232_wait_tx ; Wait for uart + +reset_battery_stats_exit: + bsf PIE1,RCIE ; re-enable interrupt for UART + goto surfloop_loop ; return to surface loop \ No newline at end of file diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Fri Apr 29 20:17:32 2011 +0200 @@ -7,6 +7,7 @@ NEW: 115kbauds bootloader. NEW: Colored battery sign when charging (yellow) or charged (green). BUGFIX: Apply salinity for ceiling warning +CHANGE: Gas Setup page 2 reworked New in 1.86 beta: BETA Version - Do NOT use for diving! diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Fri Apr 29 20:17:32 2011 +0200 @@ -464,7 +464,7 @@ #DEFINE nofly_active flag9,0 ;=1: Do not fly! #DEFINE ppO2_display_active flag9,1 ;=1: ppO2 value is displayed #DEFINE ppO2_show_value flag9,2 ;=1: show ppO2 value! -#DEFINE show_startup_screen flag9,3 ;=1: Show startup screen with MD2 hash +#DEFINE uart_reset_battery_stats flag9,3 ;=1: Reset the battery statistics (UART String FFF) #DEFINE ignore_digit3 flag9,4 ;=1: ignores digits 3-5 in valconv #DEFINE ppO2_warn_value flag9,5 ;=1: warn about ppO2! #DEFINE output_to_postinc_only flag9,6 ;=1: Do not call wordprocessor in output diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/english_text.asm --- a/code_part1/OSTC_code_asm_part1/english_text.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Fri Apr 29 20:17:32 2011 +0200 @@ -100,8 +100,8 @@ TCODE .40, .35, "Power Off [min]" ;039 Power Off [min] TCODE .40, .35, "Pre-menu [min]" ;040 Pre-menu [min] (Delais to keep surface-mode menus displayed) TCODE .40, .35, "velocity[m/min]" ;041 velocity[m/min] - TCODE .40, .35, "Wake-up [mBar]" ;042 Wake-up [mBar] - TCODE .40, .35, "max.Surf.[mBar]" ;043 max.Surf.[mBar] + TCODE .40, .35, "Wake-up [mbar]" ;042 Wake-up [mbar] + TCODE .40, .35, "max.Surf.[mbar]" ;043 max.Surf.[mbar] TCODE .40, .35, "GF display [%]" ;044 GF display [%] TCODE .40, .35, "min. O2 Dis.[%]" ;045 min. O2 Dis.[%] TCODE .40, .35, "Dive menus[min]" ;046 Dive menus[min] @@ -111,9 +111,9 @@ TCODE .40, .35, "GF alarm 1 [%]" ;050 GF alarm 1 [%] TCODE .40, .35, "CNSshow surf[%]" ;051 CNSshow surf[%] TCODE .40, .35, "Deco Offset [m]" ;052 Deco Offset [m] - TCODE .40, .35, "ppO2 low [Bar]" ;053 ppO2 low [Bar] - TCODE .40, .35, "ppO2 high [Bar]" ;054 ppO2 high [Bar] - TCODE .40, .35, "ppO2 show [Bar]" ;055 ppO2 show [Bar] + TCODE .40, .35, "ppO2 low [bar]" ;053 ppO2 low [bar] + TCODE .40, .35, "ppO2 high [bar]" ;054 ppO2 high [bar] + TCODE .40, .35, "ppO2 show [bar]" ;055 ppO2 show [bar] TCODE .40, .35, "sampling rate " ;056 sampling rate TCODE .40, .35, "Divisor Temp " ;057 Divisor Temp TCODE .40, .35, "Divisor Decodat" ;058 Divisor Decodat @@ -170,9 +170,9 @@ TCODE .85, .125, "ZH-L16 CC" ;104 ZH-L16 CC TCODE .0, .0, "Active Gas? " ;105 Active Gas? TCODE .10, .2, "Gas Setup - Gaslist" ;106 Gas Setup - Gaslist - TCODE .0, .0, "Depth +" ;107 Depth + - TCODE .0, .0, "Depth -" ;108 Depth - - TCODE .20, .35, "Back" ;109 Back + TCODE .20, .95, "Depth +/-:" ;107 Depth +/-: + TCODE .20, .125, "Change:" ;108 Change: + TCODE .20, .155, "Default:" ;109 Default: TCODE .20, .65, "CCR SetPoint Menu" ;110 CCR SetPoint Menu TCODE .20, .2, "CCR SetPoint Menu" ;111 CCR SetPoint Menu TCODE .0, .0, "SP#" ;112 SP# @@ -212,8 +212,8 @@ TCODE .52, .120, "OK!" ;146 OK! TCODE .20, .35, "More" ;147 More TCODE .0, .0, ":.........:" ;148 :.........: - TCODE .0, .8, "(ppO2:" ;149 (ppO2: - TCODE .2, .39, "Bar) " ;150 Bar) + TCODE .0, .8, "ppO2" ;149 ppO2 + TCODE .2, .39, "bar " ;150 bar TCODE .108, .216, "Marker?" ;151 Marker? TCODE .85, .125, "L16-GF OC" ;152 L16-GF OC TCODE .20, .65, "Custom FunctionsII" ;153 Custom FunctionsII @@ -230,10 +230,10 @@ TCODE .40, .35, "Warn Ceiling " ;162 Warn Ceiling TCODE .40, .35, "Mix type icons " ;163 Mix type icons TCODE .40, .35, "Blink BetterGas" ;164 Blink BetterGas (Remainder in divemode to switch to a better decompression gas). - TCODE .40, .35, "DepthWarn[mBar]" ;165 DepthWarn[mBar] + TCODE .40, .35, "DepthWarn[mbar]" ;165 DepthWarn[mbar] TCODE .40, .35, "CNS warning [%]" ;166 CNS warning [%] TCODE .40, .35, "GF warning [%]" ;167 GF warning [%] - TCODE .40, .35, "ppO2 warn [Bar]" ;168 ppO2 warn [Bar] + TCODE .40, .35, "ppO2 warn [bar]" ;168 ppO2 warn [bar] TCODE .40, .35, "Vel.warn[m/min]" ;169 Vel.warn[m/min] TCODE .40, .35, "Time offset/day" ;170 Time offset/day TCODE .40, .35, "Show altimeter " ;171 Show altimeter diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/german_text.asm --- a/code_part1/OSTC_code_asm_part1/german_text.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Fri Apr 29 20:17:32 2011 +0200 @@ -389,4 +389,5 @@ TCODE .45, .100, "Bootloader" ;302 Bootloader TCODE .40, .130, "Please wait!" ;303 Please wait! TCODE .50, .130, "Aborted!" ;304 Aborted + TCODE .0, .0, "Change:" ;305 Change: ;============================================================================= diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/isr.asm --- a/code_part1/OSTC_code_asm_part1/isr.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/isr.asm Fri Apr 29 20:17:32 2011 +0200 @@ -45,7 +45,7 @@ dcfsnz uart1_temp,F ; "e" bsf uart_send_hash ; set flag dcfsnz uart1_temp,F ; "f" - nop ; no longer used command "f" + bsf uart_reset_battery_stats ; set flag dcfsnz uart1_temp,F ; "g" bsf uart_send_int_eeprom ; set flag dcfsnz uart1_temp,F ; "h" diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/menu.asm --- a/code_part1/OSTC_code_asm_part1/menu.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu.asm Fri Apr 29 20:17:32 2011 +0200 @@ -45,14 +45,13 @@ bsf cursor call PLED_menu_mask call PLED_menu_cursor - bcf switch_left - bcf switch_right + rcall wait_switches menu_loop: call check_switches_menu btfsc menubit2 - bra do_menu ; call submenu + bra do_menu ; call submenu btfss menubit goto restart ; exit menu, restart @@ -81,15 +80,15 @@ check_switches_menu: ; checks switches btfss switch_right - bra check_switches_menu2 + bra check_switches_menu2 bsf menubit3 incf menupos,F movlw d'6' cpfsgt menupos - bra refresh_cursor + bra refresh_cursor movlw d'1' movwf menupos - bra refresh_cursor + bra refresh_cursor check_switches_menu2: btfsc switch_left bsf menubit2 ; Enter! @@ -115,6 +114,7 @@ btfsc cursor call PLED_menu_cursor bcf switch_right + bcf switch_left return more_menu: diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/menu_battery.asm --- a/code_part1/OSTC_code_asm_part1/menu_battery.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm Fri Apr 29 20:17:32 2011 +0200 @@ -133,10 +133,6 @@ call PLED_convert_date ; coverts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 STRCAT_PRINT ") " -;menu_battery_state5: -; btfss SWITCH2 -; bra menu_battery_state5 - bcf switch_left bcf switch_right bcf menubit2 diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/menu_gassetup.asm --- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Fri Apr 29 20:17:32 2011 +0200 @@ -643,8 +643,11 @@ call PLED_ClearScreen movlw d'1' movwf menupos - DISPLAYTEXT .109 ; Back - + bcf first_FA ; Here: =1: -, =0: + + bcf second_FA ; Here: =1: Is first gas + DISPLAYTEXT .107 ; Depth +/- + DISPLAYTEXT .108 ; Change: + DISPLAYTEXT .109 ; Default: DISPLAYTEXT .11 ; Exit next_gas_page1: @@ -652,10 +655,112 @@ bcf menubit2 bcf menubit3 + WIN_TOP .65 + WIN_LEFT .20 + lfsr FSR2,letter + OUTPUTTEXT .88 ; First Gas? + PUTC ' ' + + movlw d'33' + movwf EEADR + call read_eeprom ; Get current startgas 1-5 # into EEDATA + decf EEDATA,W ; 0-4 + cpfseq decodata+0 ; =current displayed gas #? + bra menu_firstgas0 ; no, display three spaces + + OUTPUTTEXT .96 ; Yes + bsf second_FA ; Is first gas + + movf decodata+0,W ; read current value + addlw d'28' ; offset in memory + movwf EEADR + call read_eeprom ; Low-value + clrf EEDATA ; Set change depth to zero + call write_eeprom ; save result in EEPROM + + bra menu_firstgas1 + +menu_firstgas0: + bcf second_FA ; Is not first gas + STRCAT " " ; 3 spaces. + +menu_firstgas1: + call word_processor + + rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info + WIN_TOP .125 + WIN_LEFT .70 + lfsr FSR2,letter + ; lo still holds change depth + bsf leftbind + output_8 + STRCAT_PRINT "m " + + WIN_TOP .125 + WIN_LEFT .100 + lfsr FSR2,letter + rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas - WIN_TOP .65 + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + GETCUSTOM8 d'46' ; color-code ppO2 warning [cBar] + mullw d'1' ; ppo2_warning_high*1 + movff PRODL,sub_b+0 + movff PRODH,sub_b+1 + 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 + bra gassetup_color_code_ppo2_2 +gassetup_color_code_ppo2_1: + call PLED_warnings_color +gassetup_color_code_ppo2_2: + call word_processor + call PLED_standard_color + + WIN_TOP .95 + WIN_LEFT .95 + lfsr FSR2,letter + movlw '+' + btfsc first_FA + movlw '-' + movwf POSTINC2 + call word_processor + +; Show MOD as "default" + WIN_TOP .155 + WIN_LEFT .78 + lfsr FSR2, letter + GETCUSTOM8 .18 ; ppO2 warnvalue in WREG + mullw d'10' + movff PRODL,xA+0 + movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 + + movf divemins+0,W + addlw 0x06 + movwf EEADR + call read_eeprom ; O2 value + movff EEDATA,xB+0 + clrf xB+1 + call div16x16 ; xA/xB=xC with xA as remainder + movlw d'10' + subwf xC+0,F ; Subtract 10m... + movff xC+0,lo + movlw d'0' + subwfb xC+1,F + movff xC+1,hi + + btfsc second_FA ; Is first gas? + clrf lo ; Yes, display 0m + btfsc second_FA ; Is first gas? + clrf hi ; Yes, display 0m + + output_16 + STRCAT_PRINT "m " + + WIN_TOP .35 WIN_LEFT .20 lfsr FSR2,letter OUTPUTTEXT .105 ; "Active Gas? " @@ -682,40 +787,6 @@ active_gas_display_end: call word_processor - WIN_TOP .95 - WIN_LEFT .20 - lfsr FSR2,letter - OUTPUTTEXT .88 ; First Gas? - PUTC ' ' - - movlw d'33' - movwf EEADR - call read_eeprom ; Get current startgas 1-5 # into EEDATA - decf EEDATA,W ; 0-4 - cpfseq decodata+0 ; =current displayed gas #? - bra menu_firstgas0 ; no, display three spaces - - OUTPUTTEXT .96 ; Yes - bra menu_firstgas1 - -menu_firstgas0: - STRCAT " " ; 3 spaces. - -menu_firstgas1: - call word_processor - - WIN_TOP .125 - WIN_LEFT .20 - lfsr FSR2,letter - OUTPUTTEXT .107 ; Change+ - call word_processor - - WIN_TOP .155 - WIN_LEFT .20 - lfsr FSR2,letter - OUTPUTTEXT .108 ; Change- - call word_processor - call wait_switches ; Waits until switches are released, resets flag if button stays pressed! call PLED_menu_cursor @@ -764,16 +835,16 @@ do_next_gas_page: dcfsnz menupos,F - bra next_gas - dcfsnz menupos,F bra toggle_active_gas dcfsnz menupos,F bra make_first_gas dcfsnz menupos,F - bra change_gas_depth_plus + bra change_gas_depth_plus_minus dcfsnz menupos,F - bra change_gas_depth_minus - bra exit_gassetup ; Exit menu + bra change_gas_depth_apply + dcfsnz menupos,F + bra change_gas_depth_default + bra next_gas make_first_gas: movff decodata+0,EEDATA ; current gas (0-4) into EEDATA @@ -798,7 +869,7 @@ bsf EEDATA,4 write_int_eeprom d'27' ; write flag register - movlw d'3' + movlw d'2' movwf menupos bra next_gas_page1 @@ -817,17 +888,21 @@ dcfsnz lo,F btg EEDATA,4 write_int_eeprom d'27' ; write flag register - movlw d'2' + movlw d'1' movwf menupos bra next_gas_page1 -change_gas_depth_plus: +change_gas_depth_apply: ; Apply +1 or -1m movf decodata+0,W ; read current value addlw d'28' ; offset in memory movwf EEADR call read_eeprom ; Low-value movff EEDATA,lo - + + btfsc first_FA ; Minus? + bra change_gas_depth_minus ; yes, minus! +; +1m + incf lo,F ; increase depth movlw d'100' ; Change depth limit + 1 cpfseq lo @@ -842,22 +917,43 @@ movwf menupos bra next_gas_page1 +change_gas_depth_minus: + decf lo,F ; decrease depth + btfss lo,7 ; 255? + bra change_gas_depth_plus2 ; no, exit + clrf lo + bra change_gas_depth_plus2 ; exit -change_gas_depth_minus: +change_gas_depth_plus_minus: + btg first_FA + movlw d'3' + movwf menupos + bra next_gas_page1 + +change_gas_depth_default: + GETCUSTOM8 .18 ; ppO2 warnvalue in WREG + mullw d'10' + movff PRODL,xA+0 + movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 + + movf divemins+0,W + addlw 0x06 + movwf EEADR + call read_eeprom ; O2 value + movff EEDATA,xB+0 + clrf xB+1 + call div16x16 ; xA/xB=xC with xA as remainder + movlw d'10' + subwf xC+0,F ; Subtract 10m... + movff xC+0,lo + movlw d'0' + subwfb xC+1,F + movff xC+1,hi + movf decodata+0,W ; read current value addlw d'28' ; offset in memory movwf EEADR call read_eeprom ; Low-value - movff EEDATA,lo - - decf lo,F ; decrease depth - movlw d'255' - cpfseq lo - bra change_gas_depth_minus2 - movlw d'0' - movwf lo - -change_gas_depth_minus2: movff lo,EEDATA ; write result call write_eeprom ; save result in EEPROM @@ -865,6 +961,7 @@ movwf menupos bra next_gas_page1 + ; Changed v1.44se gassetup_title_bar2: call PLED_topline_box @@ -1000,14 +1097,8 @@ call div16x16 ;xA/xB=xC with xA as remainder movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2 movff xC+1,hi - - WIN_LEFT .55 - WIN_TOP .35 - lfsr FSR2,letter - OUTPUTTEXT d'149' ; (ppO2: output_16dp d'3' - OUTPUTTEXT d'150' ; Bar: - call word_processor + OUTPUTTEXT d'150' ; bar: return ;============================================================================= diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Fri Apr 29 20:17:32 2011 +0200 @@ -324,7 +324,7 @@ movff SSPBUF,hi movff lo,xA+0 ; calculate y-scale for profile display movff hi,xA+1 - movlw d'164' ; 164pixel height available + movlw d'163' ; 163pixel height available movwf xB+0 clrf xB+1 call div16x16 ; does xA/xB=xC @@ -403,7 +403,7 @@ addwfc xC+1 ; xC:2 now holds total dive seconds! movff xC+0,xA+0 ; now calculate x-scale value movff xC+1,xA+1 - movlw d'159' ; 159pix width available + movlw d'154' ; 154pix width available movwf xB+0 clrf xB+1 call div16x16 ; xA/xB=xC diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Fri Apr 29 20:17:32 2011 +0200 @@ -1864,10 +1864,10 @@ movlw color_green ; Charge done. call PLED_set_color - movlw .177 + movlw .175 movff WREG,win_top ; row top (0-239) - movlw .192-.177 - movff WREG,win_height ; row bottom (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) diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/sleepmode.asm --- a/code_part1/OSTC_code_asm_part1/sleepmode.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm Fri Apr 29 20:17:32 2011 +0200 @@ -161,7 +161,6 @@ bcf switch_left bcf T0CON,TMR0ON ; Stop Timer 0 bcf sleepmode ; wake up! - bsf show_startup_screen ; ; Restart altimeter averaging, so next averaging starts right over... call altimeter_restart diff -r 2986e7cdb68c -r ceedf078b2d8 code_part1/OSTC_code_asm_part1/surfmode.asm --- a/code_part1/OSTC_code_asm_part1/surfmode.asm Thu Apr 28 18:51:48 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Fri Apr 29 20:17:32 2011 +0200 @@ -197,6 +197,8 @@ goto uart_store_tissues ; Yes! btfsc uart_115200_bootloader ; Look for 115200Baud bootloader? goto uart_115k_bootloader ; Yes! + btfsc uart_reset_battery_stats ; Reset Battery stats? + goto reset_battery_stats ; Yes! bra surfloop_loop ; loop surfacemode