some fixes.

This commit is contained in:
Martin Preuss
2025-05-04 03:34:48 +02:00
parent 46b24bf442
commit 2ac090cf14

View File

@@ -97,28 +97,27 @@ NETMSG_ValueWriteResponse:
; @clobbers R16 (R17, R18, R19, R20, R21)
netMsgValueWrite:
st X+, r16 ; dest address
ldi r16, 14 ; msg code+src address+12 payload bytes
st X+, r16 ; msg len
st X+, r23 ; msg code
st X+, r16 ; dest address 0
ldi r16, 14 ; msg code+src address+12 payload bytes
st X+, r16 ; msg len 1
; begin of payload
st X+, r23 ; msg code 2
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
adiw xh:xl, 4 ; skip uid (4 bytes), msg/ref id (2 bytes)
st X+, r24 ; msg id (low)
st X+, r25 ; msg id (high)
st X+, r17 ; value id
st X+, r22 ; value type
st X+, r18 ; value (low)
st X+, r19 ; value (high)
st X+, r20 ; denom (low)
st X+, r21 ; denom (high)
st X+, r16 ; src address 3
adiw xh:xl, 4 ; skip uid (4 bytes) 4
st X+, r24 ; msg id (low) 8
st X+, r25 ; msg id (high) 9
st X+, r17 ; value id 10
st X+, r22 ; value type 11
st X+, r18 ; value (low) 12
st X+, r19 ; value (high) 13
st X+, r20 ; denom (low) 14
st X+, r21 ; denom (high) 15
; 16
sbiw xh:xl, 12 ; go back to UID (12=16 back, 4 forward)
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
clr r16
st X+, r16 ; msg id (low)
st X+, r16 ; msg id (high)
sbiw xh:xl, 10 ; go back to beginning of message
sbiw xh:xl, 8 ; go back to beginning of message
; finish msg
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 17 ; go back to beginning of message