|
|
@ -131,16 +131,25 @@ void Hardware::initialize(int deviceId) { |
|
|
|
triLight_Y.initAsOutput(PD9, ZGPIO::kMode_nopull, true, false); |
|
|
|
triLight_BEEP.initAsOutput(PD10, ZGPIO::kMode_nopull, true, false); |
|
|
|
|
|
|
|
#if 0
|
|
|
|
m_PreportionalValveHost.initialize(&huart2); |
|
|
|
|
|
|
|
#if 1
|
|
|
|
m_dp600PressureSensor2.initialize(&huart3, 2); |
|
|
|
m_dp600PressureSensor3.initialize(&huart3, 3); |
|
|
|
m_dp600PressureSensor4.initialize(&huart3, 4); |
|
|
|
|
|
|
|
OUT_PD14.initAsOutput(PD14, ZGPIO::kMode_nopull, false, true); |
|
|
|
OUT_PD15.initAsOutput(PD15, ZGPIO::kMode_nopull, true, false); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
void air_compressor_ch_select(int32_t val) { |
|
|
|
if (val == 2) { // 内管路
|
|
|
|
OUT_PD15.setState(1); |
|
|
|
} else if (val == 1) { // 空气
|
|
|
|
OUT_PD15.setState(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void dumpdp600data(DP600PressureSensor::sensor_data_t *data) { |
|
|
|
ZLOGI(TAG, "value:%d", data->value); |
|
|
|
ZLOGI(TAG, "zero_point:%d", data->zero_point); |
|
|
@ -235,15 +244,16 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
receipt[0] = cmdheader->data[0]; |
|
|
|
receiptsize = 1; |
|
|
|
} |
|
|
|
|
|
|
|
if ((cmdheader->cmdid == (uint16_t)kcmd_air_compressor_valve1_set) && (cmdheader->subcmdid == 0)) { |
|
|
|
uint32_t val = *(uint32_t *)(&cmdheader->data[0]); |
|
|
|
ZLOGI(TAG, "kcmd_air_compressor_valve1_set:%d", val); |
|
|
|
OUT_PD14.setState(val != 0); |
|
|
|
matching = true; |
|
|
|
} |
|
|
|
|
|
|
|
if ((cmdheader->cmdid == (uint16_t)kcmd_air_compressor_valve2_set) && (cmdheader->subcmdid == 0)) { |
|
|
|
uint32_t val = *(uint32_t *)(&cmdheader->data[0]); |
|
|
|
ZLOGI(TAG, "kcmd_air_compressor_valve2_set:%d", val); |
|
|
|
OUT_PD14.setState(val != 0); |
|
|
|
matching = true; |
|
|
|
} |
|
|
@ -262,6 +272,7 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
if ((cmdheader->cmdid == (uint16_t)kcmd_set_proportional_valve) && (cmdheader->subcmdid == 0)) { |
|
|
|
int32_t para0 = *(int32_t *)(&cmdheader->data[0]); |
|
|
|
int32_t para1 = *(int32_t *)(&cmdheader->data[4]); |
|
|
|
|
|
|
|
if (para0 == 1) { |
|
|
|
matching = true; |
|
|
|
m_PreportionalValveHost.setValvePos(1, para1); |
|
|
@ -270,6 +281,11 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
m_PreportionalValveHost.setValvePos(2, para1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ((cmdheader->cmdid == (uint16_t)kcmd_air_compressor_ch_select) && (cmdheader->subcmdid == 0)) { |
|
|
|
int32_t para0 = *(int32_t *)(&cmdheader->data[0]); |
|
|
|
air_compressor_ch_select(para0); |
|
|
|
} |
|
|
|
static DP600PressureSensor::sensor_data_t dp600data; |
|
|
|
if ((cmdheader->cmdid == (uint16_t)kcmd_air_compressor_read_pressure) && (cmdheader->subcmdid == 0)) { |
|
|
|
matching = true; |
|
|
|