Revert "avr: Try to fix a bug (not respecting DENY_ADDRESS)."
This reverts commit 07f99b7050.
This commit is contained in:
@@ -41,8 +41,7 @@ cproAddressOnTimerTable:
|
||||
.dw cproHandle1sSendingHaveAddress ; CPRO_MODE_SENDING_HAVE_ADDR
|
||||
.dw cproHandle1sSendReclaimAddr ; CPRO_MODE_SEND_RECLAIM_ADDR
|
||||
.dw cproHandle1sReclaimingAddr ; CPRO_MODE_RECLAIMING_ADDR
|
||||
.dw cproHandle1sSendDenyAddr1 ; CPRO_MODE_SEND_DENY_ADDR1
|
||||
.dw cproHandle1sSendDenyAddr2 ; CPRO_MODE_SEND_DENY_ADDR2
|
||||
.dw cproHandle1sSendDenyAddr ; CPRO_MODE_SEND_DENY_ADDR
|
||||
|
||||
|
||||
cproHandle1sSendingHaveAddress:
|
||||
@@ -71,24 +70,11 @@ cproHandle1sNeedAddr_okay:
|
||||
|
||||
|
||||
|
||||
cproHandle1sSendDenyAddr1:
|
||||
cproHandle1sSendDenyAddr:
|
||||
rcall CPRO_SendDenyAddress
|
||||
brcs cproHandle1sSendDenyAddr1_okay
|
||||
brcs cproHandle1sSendDenyAddr_okay
|
||||
rjmp cproAddressSetTimer1s ; could not send, restart timer 1s and retry later
|
||||
cproHandle1sSendDenyAddr1_okay:
|
||||
ldi r16, CPRO_MODE_SEND_DENY_ADDR2 ; DENY_ADDR sent, send 2nd later
|
||||
sts cproMode, r16
|
||||
ldi r18, LOW(CPRO_WAITTIME_SENDDENY2) ; set timeout
|
||||
ldi r19, HIGH(CPRO_WAITTIME_SENDDENY2) ; set timeout
|
||||
rjmp cproAddressSetTimer
|
||||
ret
|
||||
|
||||
|
||||
cproHandle1sSendDenyAddr2:
|
||||
rcall CPRO_SendDenyAddress
|
||||
brcs cproHandle1sSendDenyAddr2_okay
|
||||
rjmp cproAddressSetTimer1s ; could not send, restart timer 1s and retry later
|
||||
cproHandle1sSendDenyAddr2_okay:
|
||||
cproHandle1sSendDenyAddr_okay:
|
||||
ldi r16, CPRO_MODE_NORMAL ; DENY_ADDR sent, back to normal
|
||||
sts cproMode, r16
|
||||
ret
|
||||
|
||||
@@ -39,42 +39,38 @@ CPRO_Address_OnPacketReceived:
|
||||
ld r16, x
|
||||
sbiw xh:xl, COM2_MSG_OFFS_CMD
|
||||
|
||||
cpi r16, CPRO_CMD_DENY_ADDRESS
|
||||
breq CPRO_Address_OnPacketReceived_denyAddr
|
||||
|
||||
cpi r16, CPRO_CMD_CLAIM_ADDRESS
|
||||
breq CPRO_Address_OnPacketReceived_claimAddr
|
||||
|
||||
rjmp CPRO_Address_OnPacketReceived_nc
|
||||
|
||||
cpi r16, CPRO_CMD_NEED_ADDRESS
|
||||
brcs CPRO_Address_OnPacketReceived_nc ; smaller than 60
|
||||
|
||||
|
||||
cpi r16, (CPRO_CMD_ADDRESS_RANGE+1)
|
||||
brcc CPRO_Address_OnPacketReceived_nc
|
||||
|
||||
subi r16, CPRO_CMD_NEED_ADDRESS
|
||||
ldi r17, (cproPacketTypeHandleTableEnd-cproPacketTypeHandleTableBegin)
|
||||
ldi zl, LOW(cproPacketTypeHandleTableBegin)
|
||||
ldi zh, HIGH(cproPacketTypeHandleTableBegin)
|
||||
CPRO_Address_OnPacketReceived_debug2:
|
||||
ldi r17, (cproPacketTypeTransTableEnd-cproPacketTypeTransTableBegin)*2
|
||||
ldi zl, LOW(cproPacketTypeTransTableBegin)
|
||||
ldi zh, HIGH(cproPacketTypeTransTableBegin)
|
||||
rcall Utils_FindBytePositionInTable
|
||||
brcc CPRO_Address_OnPacketReceived_nc
|
||||
|
||||
ldi r17, (cproPacketTypeTransTableEnd-cproPacketTypeTransTableBegin)*2
|
||||
ldi zl, LOW(cproPacketTypeHandleTable)
|
||||
ldi zh, HIGH(cproPacketTypeHandleTable)
|
||||
rcall Utils_TableJump
|
||||
sec
|
||||
ret
|
||||
|
||||
CPRO_Address_OnPacketReceived_denyAddr:
|
||||
rjmp cproHandleDenyAddr
|
||||
CPRO_Address_OnPacketReceived_claimAddr:
|
||||
rjmp cproHandleClaimAddr
|
||||
CPRO_Address_OnPacketReceived_nc:
|
||||
clc
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; fixed position from CPRO_CMD_NEED_ADDRESS to CPRO_CMD_ADDRESS_RANGE!!
|
||||
cproPacketTypeHandleTableBegin:
|
||||
.dw cproHandleNeedAddr, cproHandleHaveAddr, cproHandleClaimAddr, cproHandleDenyAddr, cproHandleAddrRange
|
||||
cproPacketTypeHandleTableEnd:
|
||||
cproPacketTypeTransTableBegin:
|
||||
.db CPRO_CMD_NEED_ADDRESS, CPRO_CMD_HAVE_ADDRESS, CPRO_CMD_ADDRESS_RANGE, CPRO_CMD_DENY_ADDRESS, CPRO_CMD_CLAIM_ADDRESS, CPRO_CMD_PING
|
||||
cproPacketTypeTransTableEnd:
|
||||
|
||||
; position within table must be in same order as in table above!
|
||||
cproPacketTypeHandleTable:
|
||||
.dw cproHandleNeedAddr, cproHandleHaveAddr, cproHandleAddrRange, cproHandleDenyAddr, cproHandleClaimAddr, cproHandlePing
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +136,7 @@ cproHandleClaimAddr:
|
||||
breq cproHandleClaimAddr_done ; we have no address, yet
|
||||
cp r16, r17
|
||||
brne cproHandleClaimAddr_done ; not our address
|
||||
ldi r16, CPRO_MODE_SEND_DENY_ADDR1
|
||||
ldi r16, CPRO_MODE_SEND_DENY_ADDR
|
||||
sts cproMode, r16
|
||||
rcall cproAddressSetTimer1s
|
||||
|
||||
@@ -151,9 +147,6 @@ cproHandleClaimAddr_done:
|
||||
|
||||
|
||||
cproHandleDenyAddr:
|
||||
; debug
|
||||
; cbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; on
|
||||
|
||||
; check mode
|
||||
lds r17, cproMode
|
||||
cpi r17, CPRO_MODE_CLAIMING_ADDR1
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
.equ CPRO_WAITTIME_GETADDR = 1300
|
||||
.equ CPRO_WAITTIME_CLAIMADDR = 170
|
||||
.equ CPRO_WAITTIME_RECLAIMADDR = 100
|
||||
.equ CPRO_WAITTIME_SENDDENY2 = 50
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
@@ -94,9 +93,8 @@
|
||||
.equ CPRO_MODE_SENDING_HAVE_ADDR = 0x08 ; waiting for our turn to send HAVE_ADDRESS packet
|
||||
.equ CPRO_MODE_SEND_RECLAIM_ADDR = 0x09 ; send CLAIM_ADDRESS as part of reclaiming procedure
|
||||
.equ CPRO_MODE_RECLAIMING_ADDR = 0x0a ; CLAIM_ADDRESS with the previously used address sent after bootup
|
||||
.equ CPRO_MODE_SEND_DENY_ADDR1 = 0x0b ; someone claimed our address, send a DENY_ADDR message
|
||||
.equ CPRO_MODE_SEND_DENY_ADDR2 = 0x0c ; someone claimed our address, send a DENY_ADDR message
|
||||
.equ CPRO_MODE_NEXT_FREE = 0x0d ; next free mode
|
||||
.equ CPRO_MODE_SEND_DENY_ADDR = 0x0b ; someone claimed our address, send a DENY_ADDR message
|
||||
.equ CPRO_MODE_NEXT_FREE = 0x0c ; next free mode
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user