Browse Source

update

master
zhaohe 1 year ago
parent
commit
3e4d2f9020
  1. 2
      README.md
  2. 2
      iflytop_canbus_protocol
  3. 18
      usrc/protocol_impl/protocol_impl_service.cpp

2
README.md

@ -4,4 +4,6 @@
```
V2:
完成需求
```

2
iflytop_canbus_protocol

@ -1 +1 @@
Subproject commit 0d30adef26695d979d4f62a051d896aab1354734
Subproject commit 147a3d04808e51599910a6e47f082ae91a8bc8f0

18
usrc/protocol_impl/protocol_impl_service.cpp

@ -235,6 +235,24 @@ static void pump_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t
int32_t regval = Hardware::ins().motor(subindex)->readInt(regadd);
zcanbus_send_ack(packet, (uint8_t*)&regval, sizeof(regval));
}
// ping
else if (packet->function_id == kcmd_pump_get_subic_reg) {
CHECK_PARAM_LEN(paramNum, 1);
int32_t subindex = GET_PARAM(packet->params, 0);
if (subindex >= Hardware::ins().motorNum()) {
zcanbus_send_errorack(packet, kerr_invalid_param);
return;
}
if (!Hardware::ins().motor(subindex)->ping()) {
zcanbus_send_errorack(packet, kerr_motor_subdevice_offline);
return;
}
zcanbus_send_ack(packet, NULL, 0);
}
}
static void others_func_impl(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t len) {

Loading…
Cancel
Save