|
|
@ -15,195 +15,15 @@ static CfgItermCache cfgcache; |
|
|
|
|
|
|
|
static bool m_scaning; |
|
|
|
|
|
|
|
// RCTRL->regOnReport([this](uint8_t* rx, int32_t len) {
|
|
|
|
// zble_proto_packet_t* packet = (zble_proto_packet_t*)rx;
|
|
|
|
// logevent(rx, len);
|
|
|
|
// if (packet->cmd == kzble_app_report_key_event) {
|
|
|
|
// int32_t keyEvent = *(int32_t*)packet->data;
|
|
|
|
// processKeyEventFromRemoter((hand_acid_remoter_key_event_t)keyEvent);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (packet->cmd == kzble_report_connected_event) {
|
|
|
|
// GSM->setRemoterS(true);
|
|
|
|
// } else if (packet->cmd == kzble_report_disconnect_event) {
|
|
|
|
// GSM->setRemoterS(false);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
void Page_muSettings::initialize() { //
|
|
|
|
IPageProcesser::initialize(); |
|
|
|
|
|
|
|
RCTRL->regOnReport([this](uint8_t* rx, int32_t len) { |
|
|
|
zble_proto_packet_t* packet = (zble_proto_packet_t*)rx; |
|
|
|
if (UIS->getNowPage() != PAGE) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (packet->cmd == kzble_app_report_key_event) { |
|
|
|
int32_t keyEvent = *(int32_t*)packet->data; |
|
|
|
if (keyEvent == hand_acid_remoter_kevent_add_liquid) { |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, "加液"); |
|
|
|
} |
|
|
|
if (keyEvent == hand_acid_remoter_kevent_change_next_mode) { |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, "模式切换"); |
|
|
|
} |
|
|
|
if (keyEvent == hand_acid_remoter_kevent_reflux) { |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, "液路回流"); |
|
|
|
} |
|
|
|
if (keyEvent == hand_acid_remoter_kevent_preFilling) { |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, "液路预充"); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
bool Page_muSettings::isBelongThisPage(int page) { return page == PAGE; } |
|
|
|
|
|
|
|
void Page_muSettings::updatePage() { |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, getCfgStr(kcfg_bleClientName)); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_irun0, zitoa(getMxIRun(0))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_irun1, zitoa(getMxIRun(1))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_irun2, zitoa(getMxIRun(2))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_irun3, zitoa(getMxIRun(3))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pumpCoef0, zfmt("%.4f", getMotorMLPR(0))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pumpCoef1, zfmt("%.4f", getMotorMLPR(1))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pumpCoef2, zfmt("%.4f", getMotorMLPR(2))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pumpCoef3, zfmt("%.4f", getMotorMLPR(3))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pipeLen0, zfmt("%.2f", getCfgPipeLengthML(0))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pipeLen1, zfmt("%.2f", getCfgPipeLengthML(1))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pipeLen2, zfmt("%.2f", getCfgPipeLengthML(2))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_pipeLen3, zfmt("%.2f", getCfgPipeLengthML(3))); |
|
|
|
// TODO:改成4个输入框
|
|
|
|
UIS->setTxt(PAGE, ob_muSettings_addAcidVel0, zitoa(getMxRunRPM(0))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_addAcidVel1, zitoa(getMxRunRPM(1))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_addAcidVel2, zitoa(getMxRunRPM(2))); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_addAcidVel3, zitoa(getMxRunRPM(3))); |
|
|
|
} |
|
|
|
|
|
|
|
void Page_muSettings::updatePage() {} |
|
|
|
void Page_muSettings::OnPageLoad(OnPageLoadContext* cxt) { //
|
|
|
|
updatePage(); |
|
|
|
}; |
|
|
|
void Page_muSettings::OnAppEvent(AppEvent_t* event) { |
|
|
|
if (event->type == kAppEvent_BleConnectEvent) { |
|
|
|
ZLOGI(TAG, "ble connect success"); |
|
|
|
UIS->setTxt(PAGE, ob_muSettings_bleCliName, "绑定成功"); |
|
|
|
CS->setcfgAndFlush(kcfg_bleClientName, event->d.bleName); |
|
|
|
m_scaning = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Page_muSettings::OnInputFieldContentChange(uint8_t bid, const char* text) { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* irunx * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
if (bid == ob_muSettings_irun0 || bid == ob_muSettings_irun1 || bid == ob_muSettings_irun2 || bid == ob_muSettings_irun3) { |
|
|
|
int irun = atoi(text); |
|
|
|
if (irun < 1 || irun > 31) { |
|
|
|
UIS->alert("IRUN需要限制在1..31"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (bid == ob_muSettings_irun0) { |
|
|
|
setMxIRun(0, atoi(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(0))); |
|
|
|
} else if (bid == ob_muSettings_irun1) { |
|
|
|
setMxIRun(1, atoi(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(1))); |
|
|
|
} else if (bid == ob_muSettings_irun2) { |
|
|
|
setMxIRun(2, atoi(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(2))); |
|
|
|
} else if (bid == ob_muSettings_irun3) { |
|
|
|
setMxIRun(3, atoi(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(3))); |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* pumpCoef * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pumpCoef0) { |
|
|
|
setMotorMLPR(0, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(0))); |
|
|
|
} else if (bid == ob_muSettings_pumpCoef1) { |
|
|
|
setMotorMLPR(1, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(1))); |
|
|
|
} else if (bid == ob_muSettings_pumpCoef2) { |
|
|
|
setMotorMLPR(2, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(2))); |
|
|
|
} else if (bid == ob_muSettings_pumpCoef3) { |
|
|
|
setMotorMLPR(3, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(3))); |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* pipeLen * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pipeLen0 || bid == ob_muSettings_pipeLen1 || bid == ob_muSettings_pipeLen2 || bid == ob_muSettings_pipeLen3) { |
|
|
|
float len = atof(text); |
|
|
|
if (len < 0.1) { |
|
|
|
UIS->alert("管道长度不能小于0.1"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pipeLen0) { |
|
|
|
setCfgPipeLengthML(0, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(0))); |
|
|
|
} |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pipeLen1) { |
|
|
|
setCfgPipeLengthML(1, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(1))); |
|
|
|
} |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pipeLen2) { |
|
|
|
setCfgPipeLengthML(2, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(2))); |
|
|
|
} |
|
|
|
|
|
|
|
if (bid == ob_muSettings_pipeLen3) { |
|
|
|
setCfgPipeLengthML(3, atof(text)); |
|
|
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(3))); |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* addAcidVel * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
// TODO改成4个输入框
|
|
|
|
if (bid == ob_muSettings_addAcidVel0 || bid == ob_muSettings_addAcidVel1 || bid == ob_muSettings_addAcidVel2 || bid == ob_muSettings_addAcidVel3) { |
|
|
|
int rpm = atoi(text); |
|
|
|
if (rpm < 300) { |
|
|
|
UIS->alert("转速不能小于300"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (rpm > 1000) { |
|
|
|
UIS->alert("转速不能大于1000"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
switch (bid) { |
|
|
|
case ob_muSettings_addAcidVel0: |
|
|
|
setMxRunRPM(0, rpm); |
|
|
|
break; |
|
|
|
case ob_muSettings_addAcidVel1: |
|
|
|
setMxRunRPM(1, rpm); |
|
|
|
break; |
|
|
|
case ob_muSettings_addAcidVel2: |
|
|
|
setMxRunRPM(2, rpm); |
|
|
|
break; |
|
|
|
case ob_muSettings_addAcidVel3: |
|
|
|
setMxRunRPM(3, rpm); |
|
|
|
break; |
|
|
|
} |
|
|
|
UIS->setTxt(bid, zitoa(rpm)); |
|
|
|
} |
|
|
|
|
|
|
|
updatePage(); |
|
|
|
} |
|
|
|
void Page_muSettings::OnAppEvent(AppEvent_t* event) {} |
|
|
|
void Page_muSettings::OnInputFieldContentChange(uint8_t bid, const char* text) {} |
|
|
|
void Page_muSettings::OnButton(uint8_t bid, uint8_t val) { |
|
|
|
if (bid == ob_muSettings_bak) { |
|
|
|
UIS->chpage(GSM->getMenuPage()); |
|
|
|