Mercurial > public > hwos_code
diff src/tft_outputs.asm @ 145:e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
author | heinrichsweikamp |
---|---|
date | Tue, 05 Aug 2014 16:55:09 +0200 |
parents | e0b758865e91 |
children | fdd4e30846ae |
line wrap: on
line diff
--- a/src/tft_outputs.asm Mon Aug 04 12:10:35 2014 +0200 +++ b/src/tft_outputs.asm Tue Aug 05 16:55:09 2014 +0200 @@ -951,6 +951,9 @@ global TFT_hud_voltages TFT_hud_voltages: ; Show HUD details WIN_SMALL .5,dive_hud_data_row + call TFT_standard_color + btfss use_02_sensor1 + call TFT_warnings_color movff o2_mv_sensor1+0,lo movff o2_mv_sensor1+1,hi bsf leftbind @@ -958,6 +961,9 @@ bcf leftbind STRCAT_PRINT "mV " WIN_SMALL .55,dive_hud_data_row + call TFT_standard_color + btfss use_02_sensor2 + call TFT_warnings_color movff o2_mv_sensor2+0,lo movff o2_mv_sensor2+1,hi bsf leftbind @@ -965,12 +971,16 @@ bcf leftbind STRCAT_PRINT "mV " WIN_SMALL .105,dive_hud_data_row + call TFT_standard_color + btfss use_02_sensor3 + call TFT_warnings_color movff o2_mv_sensor3+0,lo movff o2_mv_sensor3+1,hi bsf leftbind output_16dp .4 ; x.xx bcf leftbind STRCAT_PRINT "mV " + call TFT_standard_color return global TFT_update_hud ; Update HUD data @@ -1284,294 +1294,86 @@ STRCAT_PRINT "!" return - global TFT_update_raw_data -TFT_update_raw_data: - call TFT_standard_color - WIN_TINY .0,.0 - STRCPY "pres:" - SAFE_2BYTE_COPY amb_pressure, lo - movlw .5 ;>1280mbar - cpfslt hi - call TFT_warnings_color - bsf leftbind - output_16 - STRCAT_PRINT "mbar " - WIN_TINY .80,.0 - STRCPY "temp:" - SAFE_2BYTE_COPY temperature, lo - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - movlw d'3' - movwf ignore_digits - output_16dp d'2' ; temperature - STRCAT_PRINT "°C " - - call TFT_standard_color - call get_battery_voltage ; get battery voltage - WIN_TINY .0,.18 - STRCPY "AN06:" - movff ADRESL,lo - movff ADRESH,hi - output_16 - STRCAT_PRINT "" - WIN_TINY .80,.18 - STRCPY "BATT:" - movff batt_voltage+0,lo - movff batt_voltage+1,hi - output_16 - STRCAT_PRINT "mV " - - call get_ambient_level ; get ambient light level - WIN_TINY .0,.36 - STRCPY "AN07:" - movff ADRESL,lo - movff ADRESH,hi - output_16 - STRCAT_PRINT " " - WIN_TINY .80,.36 - STRCPY "Amb.:" - movff ambient_light+0,lo - movff ambient_light+1,hi - output_16 - STRCAT_PRINT " " - -; call get_rssi_level ; get rssi level -; WIN_TINY .0,.54 -; STRCPY "AN17:" +; global TFT_update_raw_data +;TFT_update_raw_data: +; call TFT_standard_color +; WIN_TINY .0,.0 +; STRCPY "pres:" +; SAFE_2BYTE_COPY amb_pressure, lo +; movlw .5 ;>1280mbar +; cpfslt hi +; call TFT_warnings_color +; bsf leftbind +; output_16 +; STRCAT_PRINT "mbar " +; WIN_TINY .80,.0 +; STRCPY "temp:" +; SAFE_2BYTE_COPY temperature, lo +; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +; movlw d'3' +; movwf ignore_digits +; output_16dp d'2' ; temperature +; STRCAT_PRINT "°C " +; +; call TFT_standard_color +; call get_battery_voltage ; get battery voltage +; WIN_TINY .0,.18 +; STRCPY "AN06:" +; movff ADRESL,lo +; movff ADRESH,hi +; output_16 +; STRCAT_PRINT "" +; WIN_TINY .80,.18 +; STRCPY "BATT:" +; movff batt_voltage+0,lo +; movff batt_voltage+1,hi +; output_16 +; STRCAT_PRINT "mV " +; +; call get_ambient_level ; get ambient light level +; WIN_TINY .0,.36 +; STRCPY "AN07:" ; movff ADRESL,lo ; movff ADRESH,hi ; output_16 ; STRCAT_PRINT " " -; WIN_TINY .80,.54 -; STRCPY "RSSI:" -; movff rssi_value,lo -; output_8 -; STRCAT_PRINT " " - - WIN_TINY .0,.72 - STRCPY "HUD_Status:" - movff hud_status_byte,lo - output_8 - STRCAT_PRINT " " - WIN_TINY .80,.72 - STRCPY "HUD_BATT:" - movff hud_battery_mv+0,lo - movff hud_battery_mv+1,hi - output_16 - STRCAT_PRINT "mV " - -; call disable_ir -; bsf mcp_power -; btfss mcp_power -; bra $-4 -; call get_analog_inputs - WIN_TINY .0,.90 - STRCPY "Sens1.:" - movff o2_mv_sensor1+0,lo - movff o2_mv_sensor1+1,hi - output_16dp d'4' - STRCAT_PRINT "mV " - WIN_TINY .80,.90 - STRCPY "Sens2:" - movff o2_mv_sensor2+0,lo - movff o2_mv_sensor2+1,hi - output_16dp d'4' - STRCAT_PRINT "mV " - - WIN_TINY .0,.108 - STRCPY "Sens3.:" - movff o2_mv_sensor3+0,lo - movff o2_mv_sensor3+1,hi - output_16dp d'4' - STRCAT_PRINT "mV " - WIN_TINY .80,.108 ; Space - - WIN_TINY .0,.128 - STRCPY "ccDX:" - movff compass_DX_f+0,lo ; Display calibrated data - movff compass_CX_f+0,WREG ; by substracting compass_CX_f - subwf lo,F ; lo := lo - W - movff compass_DX_f+1,hi - movff compass_CX_f+1,WREG - subwfb hi,F - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT " " - WIN_TINY .80,.128 - STRCPY "ccDY:" - movff compass_DY_f+0,lo - movff compass_CY_f+0,WREG - subwf lo,F - movff compass_DY_f+1,hi - movff compass_CY_f+1,WREG - subwfb hi,F - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT " " - WIN_TINY .0,.146 - STRCPY "ccDZ:" - movff compass_DZ_f+0,lo - movff compass_CZ_f+0,WREG - subwf lo,F - movff compass_DZ_f+1,hi - movff compass_CZ_f+1,WREG - subwfb hi,F - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT " " - WIN_TINY .80,.146 ; Space - - WIN_TINY .0,.164 - STRCPY "AcDX:" - movff accel_DX_f+0,lo - movff accel_DX_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT "mg " - WIN_TINY .80,.164 - STRCPY "AcDY:" - movff accel_DY_f+0,lo - movff accel_DY_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT "mg " - WIN_TINY .0,.182 - STRCPY "AcDZ:" - movff accel_DZ_f+0,lo - movff accel_DZ_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT "mg " - - WIN_TINY .80,.182 - STRCPY "Head:" - movff compass_heading+0,lo - movff compass_heading+1,hi - - btfsc hi,7 ; Uncalibrated compass ? - bra TFT_update_compass_1 - - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT " " - bra TFT_update_compass_2 - -TFT_update_compass_1: - STRCAT_PRINT "---" - -TFT_update_compass_2: - WIN_TINY .0,.200 - STRCPY "calX:" - movff compass_CX_f+0,lo - movff compass_CX_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT ", " - movff compass_CY_f+0,lo - movff compass_CY_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT ", " - movff compass_CZ_f+0,lo - movff compass_CZ_f+1,hi - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - output_16 - STRCAT_PRINT " " - - WIN_TINY .0,.218 - STRCPY "Roll:" - movff compass_roll+0,lo - movff compass_roll+1,hi - call TFT_convert_signed_16bit - output_16 - STRCAT_PRINT " " - - WIN_TINY .80, .218 - STRCPY "Pitch:" - movff compass_pitch+0,lo - movff compass_pitch+1,hi - call TFT_convert_signed_16bit - output_16 - STRCAT_PRINT " " - - ; call TFT_serial - bcf leftbind - return - - global TFT_update_raw_data2 -TFT_update_raw_data2: - call TFT_standard_color - WIN_TINY .0,.0 - STRCPY "pres:" - SAFE_2BYTE_COPY amb_pressure, lo - movlw .5 ;>1280mbar - cpfslt hi - call TFT_warnings_color - bsf leftbind - output_16 - STRCAT_PRINT "mbar " - WIN_TINY .80,.0 - STRCPY "temp:" - SAFE_2BYTE_COPY temperature, lo - call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required - movlw d'3' - movwf ignore_digits - output_16dp d'2' ; temperature - STRCAT_PRINT "°C " - - call TFT_standard_color - WIN_TINY .0,.18 - STRCPY "D1:" - movff D1+0,lo - movff D1+1,hi - output_16 - STRCAT_PRINT "" - WIN_TINY .80,.18 - STRCPY "D2:" - movff D2+0,lo - movff D2+1,hi - output_16 - STRCAT_PRINT "" - - ; C1-C6 - WIN_TINY .0,.36 - STRCPY "C1:" - movff C1+0,lo - movff C1+1,hi - output_16 - STRCAT_PRINT "" - WIN_TINY .80,.36 - STRCPY "C2:" - movff C2+0,lo - movff C2+1,hi - output_16 - STRCAT_PRINT "" - - WIN_TINY .0,.54 - STRCPY "C3:" - movff C3+0,lo - movff C3+1,hi - output_16 - STRCAT_PRINT "" - WIN_TINY .80,.54 - STRCPY "C4:" - movff C4+0,lo - movff C4+1,hi - output_16 - STRCAT_PRINT "" - - WIN_TINY .0,.72 - STRCPY "C5:" - movff C5+0,lo - movff C5+1,hi - output_16 - STRCAT_PRINT "" - WIN_TINY .80,.72 - STRCPY "C6:" - movff C6+0,lo - movff C6+1,hi - output_16 - STRCAT_PRINT "" - +; WIN_TINY .80,.36 +; STRCPY "Amb.:" +; movff ambient_light+0,lo +; movff ambient_light+1,hi +; output_16 +; STRCAT_PRINT " " +; +;; call get_rssi_level ; get rssi level +;; WIN_TINY .0,.54 +;; STRCPY "AN17:" +;; movff ADRESL,lo +;; movff ADRESH,hi +;; output_16 +;; STRCAT_PRINT " " +;; WIN_TINY .80,.54 +;; STRCPY "RSSI:" +;; movff rssi_value,lo +;; output_8 +;; STRCAT_PRINT " " +; +; WIN_TINY .0,.72 +; STRCPY "HUD_Status:" +; movff hud_status_byte,lo +; output_8 +; STRCAT_PRINT " " +; WIN_TINY .80,.72 +; STRCPY "HUD_BATT:" +; movff hud_battery_mv+0,lo +; movff hud_battery_mv+1,hi +; output_16 +; STRCAT_PRINT "mV " +; +;; call disable_ir +;; bsf mcp_power +;; btfss mcp_power +;; bra $-4 +;; call get_analog_inputs ; WIN_TINY .0,.90 ; STRCPY "Sens1.:" ; movff o2_mv_sensor1+0,lo @@ -1655,6 +1457,18 @@ ; movff compass_heading+0,lo ; movff compass_heading+1,hi ; +; btfsc hi,7 ; Uncalibrated compass ? +; bra TFT_update_compass_1 +; +; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +; output_16 +; STRCAT_PRINT " " +; bra TFT_update_compass_2 +; +;TFT_update_compass_1: +; STRCAT_PRINT "---" +; +;TFT_update_compass_2: ; WIN_TINY .0,.200 ; STRCPY "calX:" ; movff compass_CX_f+0,lo @@ -1688,11 +1502,207 @@ ; call TFT_convert_signed_16bit ; output_16 ; STRCAT_PRINT " " - - call TFT_serial - bcf leftbind - return - +; +; ; call TFT_serial +; bcf leftbind +; return +; +; global TFT_update_raw_data2 +;TFT_update_raw_data2: +; call TFT_standard_color +; WIN_TINY .0,.0 +; STRCPY "pres:" +; SAFE_2BYTE_COPY amb_pressure, lo +; movlw .5 ;>1280mbar +; cpfslt hi +; call TFT_warnings_color +; bsf leftbind +; output_16 +; STRCAT_PRINT "mbar " +; WIN_TINY .80,.0 +; STRCPY "temp:" +; SAFE_2BYTE_COPY temperature, lo +; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +; movlw d'3' +; movwf ignore_digits +; output_16dp d'2' ; temperature +; STRCAT_PRINT "°C " +; +; call TFT_standard_color +; WIN_TINY .0,.18 +; STRCPY "D1:" +; movff D1+0,lo +; movff D1+1,hi +; output_16 +; STRCAT_PRINT "" +; WIN_TINY .80,.18 +; STRCPY "D2:" +; movff D2+0,lo +; movff D2+1,hi +; output_16 +; STRCAT_PRINT "" +; +; ; C1-C6 +; WIN_TINY .0,.36 +; STRCPY "C1:" +; movff C1+0,lo +; movff C1+1,hi +; output_16 +; STRCAT_PRINT "" +; WIN_TINY .80,.36 +; STRCPY "C2:" +; movff C2+0,lo +; movff C2+1,hi +; output_16 +; STRCAT_PRINT "" +; +; WIN_TINY .0,.54 +; STRCPY "C3:" +; movff C3+0,lo +; movff C3+1,hi +; output_16 +; STRCAT_PRINT "" +; WIN_TINY .80,.54 +; STRCPY "C4:" +; movff C4+0,lo +; movff C4+1,hi +; output_16 +; STRCAT_PRINT "" +; +; WIN_TINY .0,.72 +; STRCPY "C5:" +; movff C5+0,lo +; movff C5+1,hi +; output_16 +; STRCAT_PRINT "" +; WIN_TINY .80,.72 +; STRCPY "C6:" +; movff C6+0,lo +; movff C6+1,hi +; output_16 +; STRCAT_PRINT "" +; +;; WIN_TINY .0,.90 +;; STRCPY "Sens1.:" +;; movff o2_mv_sensor1+0,lo +;; movff o2_mv_sensor1+1,hi +;; output_16dp d'4' +;; STRCAT_PRINT "mV " +;; WIN_TINY .80,.90 +;; STRCPY "Sens2:" +;; movff o2_mv_sensor2+0,lo +;; movff o2_mv_sensor2+1,hi +;; output_16dp d'4' +;; STRCAT_PRINT "mV " +;; +;; WIN_TINY .0,.108 +;; STRCPY "Sens3.:" +;; movff o2_mv_sensor3+0,lo +;; movff o2_mv_sensor3+1,hi +;; output_16dp d'4' +;; STRCAT_PRINT "mV " +;; WIN_TINY .80,.108 ; Space +;; +;; WIN_TINY .0,.128 +;; STRCPY "ccDX:" +;; movff compass_DX_f+0,lo ; Display calibrated data +;; movff compass_CX_f+0,WREG ; by substracting compass_CX_f +;; subwf lo,F ; lo := lo - W +;; movff compass_DX_f+1,hi +;; movff compass_CX_f+1,WREG +;; subwfb hi,F +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT " " +;; WIN_TINY .80,.128 +;; STRCPY "ccDY:" +;; movff compass_DY_f+0,lo +;; movff compass_CY_f+0,WREG +;; subwf lo,F +;; movff compass_DY_f+1,hi +;; movff compass_CY_f+1,WREG +;; subwfb hi,F +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT " " +;; WIN_TINY .0,.146 +;; STRCPY "ccDZ:" +;; movff compass_DZ_f+0,lo +;; movff compass_CZ_f+0,WREG +;; subwf lo,F +;; movff compass_DZ_f+1,hi +;; movff compass_CZ_f+1,WREG +;; subwfb hi,F +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT " " +;; WIN_TINY .80,.146 ; Space +;; +;; WIN_TINY .0,.164 +;; STRCPY "AcDX:" +;; movff accel_DX_f+0,lo +;; movff accel_DX_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT "mg " +;; WIN_TINY .80,.164 +;; STRCPY "AcDY:" +;; movff accel_DY_f+0,lo +;; movff accel_DY_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT "mg " +;; WIN_TINY .0,.182 +;; STRCPY "AcDZ:" +;; movff accel_DZ_f+0,lo +;; movff accel_DZ_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT "mg " +;; +;; WIN_TINY .80,.182 +;; STRCPY "Head:" +;; movff compass_heading+0,lo +;; movff compass_heading+1,hi +;; +;; WIN_TINY .0,.200 +;; STRCPY "calX:" +;; movff compass_CX_f+0,lo +;; movff compass_CX_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT ", " +;; movff compass_CY_f+0,lo +;; movff compass_CY_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT ", " +;; movff compass_CZ_f+0,lo +;; movff compass_CZ_f+1,hi +;; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required +;; output_16 +;; STRCAT_PRINT " " +;; +;; WIN_TINY .0,.218 +;; STRCPY "Roll:" +;; movff compass_roll+0,lo +;; movff compass_roll+1,hi +;; call TFT_convert_signed_16bit +;; output_16 +;; STRCAT_PRINT " " +;; +;; WIN_TINY .80, .218 +;; STRCPY "Pitch:" +;; movff compass_pitch+0,lo +;; movff compass_pitch+1,hi +;; call TFT_convert_signed_16bit +;; output_16 +;; STRCAT_PRINT " " +; +; call TFT_serial +; bcf leftbind +; return +; global TFT_surface_decosettings ; Show all deco settings TFT_surface_decosettings: @@ -2207,12 +2217,7 @@ STRCAT_TEXT tLogTunitC bra TFT_temp_divemode_common ; Done. -TFT_active_setpoint: ; Show setpoint - WIN_STD active_gas_column,active_gas_row - call TFT_standard_color - btfsc is_bailout ; =1: Bailout - bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint - +TFT_active_setpoint2: movff char_I_const_ppO2,lo TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo clrf hi @@ -2224,6 +2229,36 @@ bra $+4 PUTC "*" STRCAT_PRINT "" + return + +TFT_active_setpoint: ; Show setpoint + WIN_STD active_gas_column,active_gas_row + call TFT_standard_color + btfsc is_bailout ; =1: Bailout + bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint + + rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) + + btfss setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure + bra TFT_active_setpoint_diluent ; Done. + btg blinking_setpoint ; Toggle blink bit... + btfss blinking_setpoint ; blink now? + bra TFT_active_setpoint_diluent ; Done. + + movlw color_yellow ; Blink in yellow + call TFT_set_color + WIN_STD_INVERT active_gas_column,active_gas_row + movff char_I_const_ppO2,lo + clrf hi + bsf leftbind + output_16dp d'3' + bcf leftbind + STRCAT_TEXT tbar + TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor + bra $+4 + PUTC "*" + STRCAT_PRINT "" + WIN_INVERT .0 ; Init new Wordprocessor TFT_active_setpoint_diluent: call TFT_standard_color @@ -3387,6 +3422,19 @@ call TFT_standard_color return + global TFT_warning_fallback +TFT_warning_fallback: ; Show fallback warning + rcall TFT_warning_set_window ; Sets the row and column for the current warning + tstfsz WREG ; Is there room for the warning? + return ; No + call TFT_warnings_color + STRCPY_TEXT tDiveFallback ; "Fallback!" + movlw warning_length ; Divemode string length + rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) + STRCAT_PRINT "" + call TFT_standard_color + return + global TFT_warning_gf TFT_warning_gf: ;GF rcall TFT_warning_set_window ; Sets the row and column for the current warning