btm
This commit is contained in:
parent
bfaf00aeda
commit
a267f071cb
19
third_party/message/can_atp_req.go
vendored
19
third_party/message/can_atp_req.go
vendored
@ -1,6 +1,10 @@
|
|||||||
package message
|
package message
|
||||||
|
|
||||||
import "log/slog"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
//应答器传输模块BTM与车载ATP通信协议定义
|
//应答器传输模块BTM与车载ATP通信协议定义
|
||||||
|
|
||||||
@ -72,6 +76,19 @@ func NewAtpRequestFrame(sn byte) *AtpRequestFrame {
|
|||||||
FId: *NewCanFrameId(CAN_ADDR_REQ_BTM, CAN_ADDR_REQ_ATP, CAN_FRAME_ATP_REQ, sn),
|
FId: *NewCanFrameId(CAN_ADDR_REQ_BTM, CAN_ADDR_REQ_ATP, CAN_FRAME_ATP_REQ, sn),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (f *AtpRequestFrame) String() string {
|
||||||
|
sb := strings.Builder{}
|
||||||
|
sb.WriteString(fmt.Sprintf("AtpRequestFrame ID1 = 0x%0x, ID2 = 0x%0x, ID3 = 0x%0x, ID4 = 0x%0x,",
|
||||||
|
f.FId.ID1, f.FId.ID2, f.FId.ID3, f.FId.ID4))
|
||||||
|
sb.WriteString(fmt.Sprintf("PowerAmplifierTurnOn = %t", f.PowerAmplifierTurnOn))
|
||||||
|
sb.WriteString(fmt.Sprintf(",PowerAmplifierControlledByAtp = %t", f.PowerAmplifierControlledByAtp))
|
||||||
|
sb.WriteString(fmt.Sprintf(",ResendRequest = %d", f.ResendRequest))
|
||||||
|
sb.WriteString(fmt.Sprintf(",Speed = %d", f.Speed))
|
||||||
|
sb.WriteString(fmt.Sprintf(",Time = %d", f.Time))
|
||||||
|
sb.WriteString(fmt.Sprintf(",Crc16 = %d", f.Crc16))
|
||||||
|
sb.WriteString(fmt.Sprintf(",Crc16CheckOk = %t", f.Crc16CheckOk))
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
func (f *AtpRequestFrame) Decode(cf *CanetFrame) bool {
|
func (f *AtpRequestFrame) Decode(cf *CanetFrame) bool {
|
||||||
f.FId = cf.CanId
|
f.FId = cf.CanId
|
||||||
//
|
//
|
||||||
|
2
third_party/message/can_net.go
vendored
2
third_party/message/can_net.go
vendored
@ -62,7 +62,7 @@ func (p *CanetFrame) Decode(buf []byte) {
|
|||||||
}
|
}
|
||||||
func (p *CanetFrame) String() string {
|
func (p *CanetFrame) String() string {
|
||||||
sb := strings.Builder{}
|
sb := strings.Builder{}
|
||||||
sb.WriteString(fmt.Sprintf("FF = %t, RTR = %t, CanLen = %d, ID1 = 0x%0x, ID2 = 0x%0x, ID3 = 0x%0x, ID4 = 0x%0x,", p.FF, p.RTR, p.CanLen,
|
sb.WriteString(fmt.Sprintf("CanetFrame FF = %t, RTR = %t, CanLen = %d, ID1 = 0x%0x, ID2 = 0x%0x, ID3 = 0x%0x, ID4 = 0x%0x,", p.FF, p.RTR, p.CanLen,
|
||||||
p.CanId.ID1, p.CanId.ID2, p.CanId.ID3, p.CanId.ID4))
|
p.CanId.ID1, p.CanId.ID2, p.CanId.ID3, p.CanId.ID4))
|
||||||
sb.WriteString("CanData = ")
|
sb.WriteString("CanData = ")
|
||||||
for _, d := range p.CanData {
|
for _, d := range p.CanData {
|
||||||
|
Loading…
Reference in New Issue
Block a user