|
|
@ -10,9 +10,7 @@ static TMC51X0* m_motors[4]; |
|
|
|
#define PUMP_NUM 4
|
|
|
|
|
|
|
|
static CfgItermCache cfgcache; |
|
|
|
#define APPEND_ML 10
|
|
|
|
|
|
|
|
|
|
|
|
// #define APPEND_ML 2
|
|
|
|
|
|
|
|
void PumpCtrlService::initialize() { |
|
|
|
m_motors[0] = AppHardware::ins()->getPump(0); |
|
|
@ -85,12 +83,13 @@ void PumpCtrlService::reflux() { |
|
|
|
m_thread.start( |
|
|
|
[this]() { |
|
|
|
ValveStateSyncService::ins()->setValveState(1); |
|
|
|
int32_t pipeLenML = getCfgInt(kcfg_pipeLengthML); |
|
|
|
// int32_t pipeLenML = getCfgInt(kcfg_pipeLengthML);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < PUMP_NUM; i++) { |
|
|
|
TMC51X0* cur_motor = m_motors[i]; |
|
|
|
cur_motor->stop(); |
|
|
|
cur_motor->setXACTUAL(0); |
|
|
|
float pipeLenML = getCfgPipeLengthML(i); |
|
|
|
ZLOGI(TAG, "pump %d move %f ml", i, -pipeLenML); |
|
|
|
cur_motor->moveBy((int32_t)-pipeLenML * 1000, getMxRunRPM(i)); |
|
|
|
} |
|
|
@ -115,12 +114,11 @@ void PumpCtrlService::acidPrefilling() { |
|
|
|
[this]() { |
|
|
|
ValveStateSyncService::ins()->setValveState(1); |
|
|
|
|
|
|
|
int32_t pipeLenML = getCfgInt(kcfg_pipeLengthML); |
|
|
|
|
|
|
|
for (size_t i = 0; i < PUMP_NUM; i++) { |
|
|
|
TMC51X0* cur_motor = m_motors[i]; |
|
|
|
cur_motor->stop(); |
|
|
|
cur_motor->setXACTUAL(0); |
|
|
|
float pipeLenML = getCfgPipeLengthML(i); |
|
|
|
ZLOGI(TAG, "pump %d move %f ml", i, pipeLenML); |
|
|
|
cur_motor->moveBy((int32_t)pipeLenML * 1000, getMxRunRPM(i)); |
|
|
|
} |
|
|
@ -135,7 +133,7 @@ void PumpCtrlService::acidPrefilling() { |
|
|
|
// śĚťŘÁ÷
|
|
|
|
for (size_t i = 0; i < PUMP_NUM; i++) { |
|
|
|
TMC51X0* cur_motor = m_motors[i]; |
|
|
|
cur_motor->moveBy(-(int32_t)(APPEND_ML) * 1000, getMxRunRPM(i)); |
|
|
|
cur_motor->moveBy(-(int32_t)(getPumpAppendMl(i) * 1000), getMxRunRPM(i)); |
|
|
|
} |
|
|
|
|
|
|
|
while (!isAllReachTarget()) { |
|
|
@ -198,7 +196,7 @@ void PumpCtrlService::doMoveOnce() { |
|
|
|
cur_motor->setXACTUAL(0); |
|
|
|
if (pumpselect) { |
|
|
|
ZLOGI(TAG, "pump %d move %f ml", i, distribut_ml); |
|
|
|
cur_motor->moveBy((int32_t)(distribut_ml + APPEND_ML) * 1000, getMxRunRPM(i)); |
|
|
|
cur_motor->moveBy((int32_t)(distribut_ml + getPumpAppendMl(i)) * 1000, getMxRunRPM(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -216,7 +214,7 @@ void PumpCtrlService::doMoveOnce() { |
|
|
|
cur_motor->stop(); |
|
|
|
cur_motor->setXACTUAL(0); |
|
|
|
if (pumpselect) { |
|
|
|
cur_motor->moveBy(-(int32_t)(APPEND_ML) * 1000, getMxRunRPM(i)); |
|
|
|
cur_motor->moveBy(-(int32_t)(getPumpAppendMl(i)* 1000) , getMxRunRPM(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|