Mercurial > public > hwos_code
changeset 354:043890f06bce
some cleanups
author | heinrichsweikamp |
---|---|
date | Wed, 29 Jul 2015 20:39:35 +0200 |
parents | 573f2251cf49 |
children | 093b32bf6db2 |
files | src/adc_lightsensor.asm src/comm.asm src/surfmode.asm |
diffstat | 3 files changed, 44 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Tue Jul 28 16:32:55 2015 +0200 +++ b/src/adc_lightsensor.asm Wed Jul 29 20:39:35 2015 +0200 @@ -243,7 +243,7 @@ banksel isr_backup ; Back to Bank0 ISR data movff opt_brightness,isr1_temp incf isr1_temp,F ; adjust 0-2 to 1-3 - movlw ambient_light_max_high_cr; cR hardware brightest setting + movlw ambient_light_max_high_cr; cR and 2 hardware brightest setting dcfsnz isr1_temp,F movlw ambient_light_max_eco ; brightest setting dcfsnz isr1_temp,F @@ -305,7 +305,7 @@ incf isr1_temp,F ; adjust 0-2 to 1-3 banksel common ; flag is in bank1 - movlw ambient_light_max_high_cr; cR hardware brightest setting + movlw ambient_light_max_high_cr; cR and 2 hardware brightest setting btfss rechargeable movlw ambient_light_max_high_15V; 1,5V battery brightest setting btfsc battery_is_36v ; 3,6V battery in use? @@ -369,7 +369,7 @@ clrf o2_mv_sensor1+1 clrf o2_mv_sensor1+0 get_analog_inputs2a: - ; Ignore 1,2mV noise for not-connected inputs + ; Ignore 1,9mV noise for not-connected inputs tstfsz o2_mv_sensor1+1 ; >25,5mV? bra get_analog_inputs2 ; Yes, skip here movlw .19 @@ -397,7 +397,7 @@ clrf o2_mv_sensor2+1 clrf o2_mv_sensor2+0 get_analog_inputs3a: - ; Ignore 1,2mV noise for not-connected inputs + ; Ignore 1,9mV noise for not-connected inputs tstfsz o2_mv_sensor2+1 ; >25,5mV? bra get_analog_inputs3 ; Yes, skip here movlw .19 @@ -425,7 +425,7 @@ clrf o2_mv_sensor3+1 clrf o2_mv_sensor3+0 get_analog_inputs4a: - ; Ignore 1,2mV noise for not-connected inputs + ; Ignore 1,9mV noise for not-connected inputs tstfsz o2_mv_sensor3+1 ; >25,5mV? bra get_analog_inputs4 ; Yes, skip here movlw .19
--- a/src/comm.asm Tue Jul 28 16:32:55 2015 +0200 +++ b/src/comm.asm Wed Jul 29 20:39:35 2015 +0200 @@ -143,25 +143,25 @@ comm_mode2b: ; Startbyte found - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0x4B movwf TXREG1 ; Send Answer ; Now, check comm command rcall comm_write_get_byte ; first byte - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movff RCREG1,TXREG1 ; Echo movlw UPPER comm_service_key cpfseq RCREG1 bra comm_mode1 ; Wrong -> Restart rcall comm_write_get_byte ; second byte - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movff RCREG1,TXREG1 ; Echo movlw HIGH (comm_service_key & 0xFFFF) cpfseq RCREG1 bra comm_mode1 ; Wrong -> Restart rcall comm_write_get_byte ; third byte - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movff RCREG1,TXREG1 ; Echo movlw LOW comm_service_key cpfseq RCREG1 @@ -186,7 +186,7 @@ WIN_SMALL comm_status3_column, comm_status3_row STRCPY_TEXT_PRINT tUsbExit ; Exited comm_service_exit_common: - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0xFF ; Reply FF movwf TXREG1 ; Send Answer @@ -219,7 +219,7 @@ comm_send_firmware: movlw 0x50 ; send echo movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART ; Read 5 bytes into buffer. lfsr FSR2,buffer @@ -245,7 +245,7 @@ movlw 0x4C ; send OK movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART ; Passed: goto second stage verification. ; NOTE: Bootloader is Bank0. With buffer at address 0x200. @@ -290,7 +290,7 @@ comm_erase_range4kb: movlw 0x42 ; send echo movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART bcf INTCON,GIE ; All interrups off! @@ -333,7 +333,7 @@ comm_write_range: ; Get 3 bytes start address movlw 0x30 ; send echo movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART bcf INTCON,GIE ; All interrups off! @@ -355,7 +355,7 @@ comm_send_range: ; Get 3 bytes start address and 3 bytes amount movlw 0x20 ; send echo movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART bcf INTCON,GIE ; All interrups off! @@ -396,7 +396,7 @@ call ext_flash_read_block ; Read one byte movwf TXREG1 ; Start new transmit comm_send_range24: - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART decfsz lo,F bra comm_send_range24_loop decf hi,F @@ -435,12 +435,12 @@ WIN_SMALL comm_status2_column, comm_status2_row STRCPY_TEXT_PRINT tUsbDownloadMode; Download mode enabled bsf INTCON,GIE ; All interrups on - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0xBB ; Command Echo movwf TXREG1 ; Send Answer comm_download_mode0: bsf INTCON,GIE ; All interrups on - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0x4C ; 4C in service mode btfss comm_service_enabled movlw 0x4D ; 4D in download mode @@ -595,7 +595,7 @@ comm_send_compact_headers4: movlw .13 movwf lo ; Counter - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART call ext_flash_read_block_start ; 1st byte movwf TXREG1 bra comm_send_compact_headers3 ; counter 24bit @@ -603,20 +603,20 @@ call ext_flash_read_block ; Read one byte movwf TXREG1 ; Start new transmit comm_send_compact_headers3: - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART decfsz lo,F bra comm_send_compact_headers_loop call ext_flash_read_block_stop movlw 0xFF ; Spare movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0xFF ; Spare movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movlw 0xFF ; Spare movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART bra comm_send_compact_headers2 ; continue @@ -653,7 +653,7 @@ comm_send_headers4: clrf lo ; Counter - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART call ext_flash_read_block_start ; 1st byte movwf TXREG1 bra comm_send_headers3 ; counter 24bit @@ -661,7 +661,7 @@ call ext_flash_read_block ; Read one byte movwf TXREG1 ; Start new transmit comm_send_headers3: - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART decfsz lo,F bra comm_send_headers_loop call ext_flash_read_block_stop @@ -680,12 +680,14 @@ comm_write_get_byte: goto rs232_get_byte ; returns... +comm_rs232_wait_tx: + goto rs232_wait_tx ; returns... comm_set_time: movlw "b" ; send echo movwf TXREG1 - call rs232_wait_tx ; wait for UART + rcall comm_rs232_wait_tx ; wait for UART rcall comm_write_get_byte btfsc rs232_recieve_overflow ; Got byte? bra comm_download_mode0 ; No, abort @@ -736,7 +738,7 @@ comm_set_custom_text: movlw "c" ; send echo movwf TXREG1 - call rs232_wait_tx ; wait for UART + rcall comm_rs232_wait_tx ; wait for UART lfsr FSR2,opt_name movlw opt_name_length movwf lo ; counter @@ -764,7 +766,7 @@ comm_identify: movlw "i" ; send echo movwf TXREG1 - call rs232_wait_tx ; wait for UART + rcall comm_rs232_wait_tx ; wait for UART ;---- Read serial from internal EEPROM address 0000 clrf EEADRH @@ -777,17 +779,17 @@ ;---- Emit serial number movff lo,TXREG1 - call rs232_wait_tx + rcall comm_rs232_wait_tx movff hi,TXREG1 - call rs232_wait_tx + rcall comm_rs232_wait_tx ;---- Emit fiwmware hi.lo movlw softwareversion_x movwf TXREG1 - call rs232_wait_tx + rcall comm_rs232_wait_tx movlw softwareversion_y movwf TXREG1 - call rs232_wait_tx + rcall comm_rs232_wait_tx ;---- Emit custom text movlw opt_name_length @@ -796,7 +798,7 @@ common_identify_loop: movff POSTINC2,TXREG1 - call rs232_wait_tx + rcall comm_rs232_wait_tx decfsz hi,F bra common_identify_loop @@ -809,7 +811,7 @@ comm_hardware_descriptor: movlw "j" ; send echo movwf TXREG1 - call rs232_wait_tx ; wait for UART + rcall comm_rs232_wait_tx ; wait for UART movff hardware_flag,TXREG1 bra comm_download_mode0 ; Done. @@ -873,7 +875,7 @@ comm_send_dive1: ; Send header clrf hi ; Counter - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART call ext_flash_read_block_start ; 1st byte movwf TXREG1 bra comm_send_dive_header @@ -881,7 +883,7 @@ call ext_flash_read_block ; Read one byte movwf TXREG1 ; Start new transmit comm_send_dive_header: - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART decfsz hi,F bra comm_send_dive_header2 call ext_flash_read_block_stop @@ -896,7 +898,7 @@ comm_send_dive_profile: call ext_flash_byte_read_plus_0x20 ; Read one byte into temp1, takes care of banking at 0x200000 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART movff temp1,TXREG1 ; Send a byte ; 24bit compare with end address @@ -1033,7 +1035,7 @@ bra comm_download_mode0 ; Done. Loop with timeout reset comm_read_setting_wait: - goto rs232_wait_tx ; Wait for UART (and return!) + bra comm_rs232_wait_tx ; Wait for UART (and return!) comm_read_gas1: movff opt_gas_O2_ratio+0, TXREG1 @@ -1405,7 +1407,7 @@ comm_send_string: movlw "n" ; send echo movwf TXREG1 - call rs232_wait_tx ; Wait for UART + rcall comm_rs232_wait_tx ; Wait for UART WIN_SMALL comm_string_column, comm_string_row movlw .16 movwf lo ; counter
--- a/src/surfmode.asm Tue Jul 28 16:32:55 2015 +0200 +++ b/src/surfmode.asm Wed Jul 29 20:39:35 2015 +0200 @@ -87,8 +87,10 @@ clrf ext_flash_address+1 clrf ext_flash_address+2 + movlw surface_sp ; in cbar + call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics btfsc rechargeable - call piezo_config ; Configure buttons + call piezo_config ; Configure buttons clrf timeout_counter2 clrf timeout_counter3 @@ -137,8 +139,6 @@ movwf TBLPTRU call color_image - movlw surface_sp ; in cbar - call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics call TFT_clock ; display time call update_surfloop60 call get_battery_voltage ; get battery voltage