Browse Source

update

master
zhaohe 1 year ago
parent
commit
b18c372bec
  1. 2
      iflytop_canbus_protocol
  2. 15
      usrc/protocol_impl/protocol_impl_service.cpp

2
iflytop_canbus_protocol

@ -1 +1 @@
Subproject commit 7cf64770e1e06e66488e778a994d128870852a37
Subproject commit 26cce0d53b0e3332d7a658f0032779a18ce97128

15
usrc/protocol_impl/protocol_impl_service.cpp

@ -106,8 +106,7 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t
zcanbus_send_errorack(packet, kerr_invalid_param);
return;
}
m_motor[subindex].rotate(GET_PARAM(packet->params, velocity));
m_motor[subindex].rotate(velocity);
zcanbus_send_ack(packet, NULL, 0);
}
@ -127,12 +126,12 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t
}
// 设置电流/保持电流/IDELAY
else if (packet->function_id == kcmd_pump_set_irun_ihold) {
else if (packet->function_id == kcmd_pump_set_ihold_irun_idelay) {
CHECK_PARAM_LEN(paramNum, 4);
int32_t subindex = GET_PARAM(packet->params, 0);
int32_t irun = GET_PARAM(packet->params, 1);
int32_t ihold = GET_PARAM(packet->params, 2);
int32_t ihold = GET_PARAM(packet->params, 1);
int32_t irun = GET_PARAM(packet->params, 2);
int32_t idelay = GET_PARAM(packet->params, 3);
if (subindex > ZARRAY_SIZE(m_motor)) {
@ -140,7 +139,7 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t
return;
}
m_motor[subindex].setIHOLD_IRUN(irun, ihold, idelay);
m_motor[subindex].setIHOLD_IRUN(ihold, irun, idelay);
zcanbus_send_ack(packet, NULL, 0);
} else if (packet->function_id == kcmd_pump_set_acc) {
CHECK_PARAM_LEN(paramNum, 2);
@ -203,10 +202,12 @@ static void onPacketRxThreadStart(void const* argument) {
}
static void zcanbus_on_rx(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t len) { //
zcanbus_packet_t* packet = (zcanbus_packet_t*)rawpacket;
ZLOGI(TAG, "rx packet from %d to %d, function_id %d, len %d", from, to, packet->function_id, len);
ZLOGI(TAG, "process packet from %d to %d, function_id %d, len %d", from, to, packet->function_id, len);
basic_func_impl(from, to, rawpacket, len);
pump_func_impl(from, to, rawpacket, len);
ZLOGI(TAG, "process end");
}
static void zcanbus_on_connected(bool connected) {

Loading…
Cancel
Save