|
|
@ -45,12 +45,6 @@ DP600PressureSensor m_dp600PressureSensor4; |
|
|
|
ZGPIO IO_PD13_IN; |
|
|
|
ZGPIO IO_PC7_IN; |
|
|
|
|
|
|
|
#define PROCESS_CMD(cmd, _subcmdid, id) \
|
|
|
|
if ((cmdheader->cmdid == (uint16_t)cmd) && (cmdheader->subcmdid == _subcmdid) && cmdheader->data[0] == id) { \ |
|
|
|
matching = true; \ |
|
|
|
} \ |
|
|
|
if ((cmdheader->cmdid == (uint16_t)cmd) && (cmdheader->subcmdid == _subcmdid) && cmdheader->data[0] == id) |
|
|
|
|
|
|
|
void setmotor(TMC5130 *motor, int16_t acc_rpm2, int16_t rpm, int16_t idlepower, int16_t power) { |
|
|
|
int32_t ppm = rpm / 60.0 * 51200; |
|
|
|
int32_t acc = acc_rpm2 / 60.0 * 51200; |
|
|
@ -135,7 +129,7 @@ void packet_kcmd_read_huacheng_pressure_sensor_data(int id, DP600PressureSensor: |
|
|
|
|
|
|
|
int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int32_t len, uint8_t *receipt, int32_t &receiptsize, bool &matching) { |
|
|
|
Cmdheader_t *cmdheader = (Cmdheader_t *)packet; |
|
|
|
printf("rx: cmdid:%d subcmdid:%d id:%d\n", cmdheader->cmdid, cmdheader->subcmdid, cmdheader->data[0]); |
|
|
|
if (fromwhere == kuart) printf("rx: cmdid:%d subcmdid:%d id:%d\n", cmdheader->cmdid, cmdheader->subcmdid, cmdheader->data[0]); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Ping |
|
|
@ -167,7 +161,7 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
/**
|
|
|
|
* @brief 控制加液泵 |
|
|
|
*/ |
|
|
|
PROCESS_CMD(kcmd_peristaltic_pump_ctl, 0, 1) { |
|
|
|
PROCESS_CMD(kcmd_peristaltic_pump_ctl, 1, 1) { |
|
|
|
int16_t acc = *(int16_t *)(&cmdheader->data[2]); |
|
|
|
int16_t rpm = *(int16_t *)(&cmdheader->data[4]); |
|
|
|
int16_t idlepower = cmdheader->data[6]; |
|
|
@ -184,7 +178,7 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
/**
|
|
|
|
* @brief 控制-喷液泵 |
|
|
|
*/ |
|
|
|
PROCESS_CMD(kcmd_peristaltic_pump_ctl, 0, 2) { |
|
|
|
PROCESS_CMD(kcmd_peristaltic_pump_ctl, 1, 2) { |
|
|
|
int16_t acc = *(int16_t *)(&cmdheader->data[2]); |
|
|
|
int16_t rpm = *(int16_t *)(&cmdheader->data[4]); |
|
|
|
int16_t idlepower = cmdheader->data[6]; |
|
|
|