7 changed files with 69 additions and 59 deletions
-
7README.md
-
2app_protocols/zscanprotocol
-
28ucomponents/preportional_valve/preportional_valve_ctrl.cpp
-
2usrc/module/blower_controller.hpp
-
44usrc/module/proportional_valve_ctrl.cpp
-
43usrc/module/proportional_valve_ctrl.hpp
-
2usrc/project_configs.h
@ -1 +1 @@ |
|||
Subproject commit d11d41c1062568f629d5ec2bc6435319b7ea83e3 |
|||
Subproject commit 8a3aeaf8883a3c7d01594e0399fbe96bf8b9cf72 |
@ -0,0 +1,44 @@ |
|||
#include "proportional_valve_ctrl.hpp"
|
|||
|
|||
using namespace iflytop; |
|||
using namespace transmit_disfection_protocol; |
|||
|
|||
void ProportionalValveCtrl::initialize(UART_HandleTypeDef* huart) { |
|||
valve.initialize(huart); |
|||
m_isInitialized = true; |
|||
|
|||
BIND_FN(ProportionalValveCtrl, this, fn_proportional_set_valve); |
|||
BIND_FN(ProportionalValveCtrl, this, fn_proportional_read_pos); |
|||
BIND_FN(ProportionalValveCtrl, this, fn_proportional_is_busy); |
|||
} |
|||
|
|||
bool ProportionalValveCtrl::isInitialized() { return m_isInitialized; } |
|||
|
|||
void ProportionalValveCtrl::fn_proportional_set_valve(ProcessContext* cxt) { |
|||
int32_t err = valve.setValvePos(GET_PARAM(0), GET_PARAM(1)); |
|||
if (err) { |
|||
zcanbus_send_errorack(cxt->packet, err); |
|||
} else { |
|||
zcanbus_send_ack(cxt->packet, NULL, 0); |
|||
} |
|||
} |
|||
|
|||
void ProportionalValveCtrl::fn_proportional_read_pos(ProcessContext* cxt) { |
|||
int32_t pos = 0; |
|||
int32_t err = valve.getValvePos(GET_PARAM(0), &pos); |
|||
if (err) { |
|||
zcanbus_send_errorack(cxt->packet, err); |
|||
} else { |
|||
zcanbus_send_ack(cxt->packet, (uint8_t*)&pos, sizeof(pos)); |
|||
} |
|||
} |
|||
|
|||
void ProportionalValveCtrl::fn_proportional_is_busy(ProcessContext* cxt) { |
|||
int32_t busy = 0; |
|||
int32_t err = valve.isBusy(GET_PARAM(0), &busy); |
|||
if (err) { |
|||
zcanbus_send_errorack(cxt->packet, err); |
|||
} else { |
|||
zcanbus_send_ack(cxt->packet, (uint8_t*)&busy, sizeof(busy)); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue