|
|
@ -41,7 +41,7 @@ void Page_main::updateRunModeState() { |
|
|
|
|
|
|
|
bool Page_main::isBelongThisPage(int page) { return page == PAGE; } |
|
|
|
|
|
|
|
void Page_main::OnPageLoad(OnPageLoadContext*cxt) { |
|
|
|
void Page_main::OnPageLoad(OnPageLoadContext* cxt) { |
|
|
|
// 只有管理员能够修改,酸液通道名称
|
|
|
|
if (GSM->isAdmin()) { |
|
|
|
UIS->setTouchEnableState(ob_main_acidname0, 1); |
|
|
@ -92,10 +92,54 @@ void Page_main::OnAppEvent(AppEvent_t* event) { |
|
|
|
if (event->type == kAppEvent_RemoterConnectStateChangeEvent) { |
|
|
|
UIS->setEnumComponentState(PAGE, ob_main_RemoterS, GSM->getRemoterS()); |
|
|
|
} |
|
|
|
|
|
|
|
if(event->type == kAppEvent_StateDisplayInfo){ |
|
|
|
UIS->setTxt(PAGE, ob_main_sysInfo, event->d.stateDisplayInfo); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
}; |
|
|
|
|
|
|
|
void Page_main::OnInputFieldContentChange(uint8_t bid, const char* text) { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 事件过滤 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
if (PumpCtrlService::ins()->isWorking()) { |
|
|
|
UIS->alert("工作中,请稍后再操作"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 运行间隔设定值
|
|
|
|
if (bid == ob_main_RunModeVal) { |
|
|
|
float distrIntervalSecond = atof(text); |
|
|
|
if (distrIntervalSecond <= 0) { |
|
|
|
UIS->alert("酸液间隔时间不能小于0"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (distrIntervalSecond > 30) { |
|
|
|
UIS->alert("酸液间隔时间不能大于30"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 加酸设定值过滤
|
|
|
|
if (bid == ob_main_acideval0 || //
|
|
|
|
bid == ob_main_acideval1 || //
|
|
|
|
bid == ob_main_acideval2 || //
|
|
|
|
bid == ob_main_acideval3) { |
|
|
|
float add_ml = atof(text); |
|
|
|
if (add_ml < 0.009) { |
|
|
|
UIS->alert("设定值不能小于0"); |
|
|
|
return; |
|
|
|
} else if (add_ml > CS->getInt(kcfg_echDitrUpLi)) { |
|
|
|
UIS->alert(fmt("设定值不能大于%d", CS->getInt(kcfg_echDitrUpLi))); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 业务逻辑 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
// 更新酸液每次分配设定值
|
|
|
|
if (bid == ob_main_acideval0) { |
|
|
|
processAcidevalUpdateEvent(bid, text, 0, kcfg_acideval0); |
|
|
@ -129,21 +173,31 @@ void Page_main::OnInputFieldContentChange(uint8_t bid, const char* text) { |
|
|
|
// 设置加酸间隔
|
|
|
|
if (bid == ob_main_RunModeVal) { |
|
|
|
float distrIntervalSecond = atof(text); |
|
|
|
if (distrIntervalSecond <= 0) { |
|
|
|
UIS->alert("酸液间隔时间不能小于0"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (distrIntervalSecond > 30) { |
|
|
|
UIS->alert("酸液间隔时间不能大于30"); |
|
|
|
return; |
|
|
|
} |
|
|
|
UIS->setTxt(PAGE, bid, zfmt("%.1f", distrIntervalSecond)); |
|
|
|
CS->setcfgAndFlush(kcfg_distrInterval, zfmt("%.1f", distrIntervalSecond)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Page_main::OnButton(uint8_t bid, uint8_t val) { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 事件过滤 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
if (bid == ob_main_RunMode || //
|
|
|
|
bid == ob_main_acidch0 || //
|
|
|
|
bid == ob_main_acidch1 || //
|
|
|
|
bid == ob_main_acidch2 || //
|
|
|
|
bid == ob_main_acidch3 || //
|
|
|
|
bid == ob_main_MenuButton //
|
|
|
|
) { |
|
|
|
if (PumpCtrlService::ins()->isWorking()) { |
|
|
|
UIS->alert("工作中,请稍后再操作"); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 业务逻辑 * |
|
|
|
***********************************************************************************************************************/ |
|
|
|
if (bid == ob_main_RunMode) { |
|
|
|
// 切换模式
|
|
|
|
GSM->changeToNextRunMode(); |
|
|
@ -169,17 +223,7 @@ void Page_main::OnButton(uint8_t bid, uint8_t val) { |
|
|
|
} |
|
|
|
|
|
|
|
void Page_main::processAcidevalUpdateEvent(uint8_t bid, const char* text, int ch, config_index_t cfgid) { |
|
|
|
float add_ml = atof(text); |
|
|
|
if (add_ml < 0) { |
|
|
|
UIS->alert("设定值不能小于0"); |
|
|
|
return; |
|
|
|
} else if (add_ml > CS->getInt(kcfg_echDitrUpLi)) { |
|
|
|
UIS->alert(fmt("设定值不能大于%d", CS->getInt(kcfg_echDitrUpLi))); |
|
|
|
return; |
|
|
|
} |
|
|
|
char reformattext[20]; |
|
|
|
sprintf(reformattext, "%.1f", add_ml); |
|
|
|
ZLOGI(TAG, "set acid ch%d:%s", ch, reformattext); |
|
|
|
UIS->setTxt(PAGE, bid, reformattext); |
|
|
|
CS->setcfgAndFlush(cfgid, reformattext); //
|
|
|
|
ZLOGI(TAG, "set acid ch%d:%s", ch, text); |
|
|
|
UIS->setTxt(PAGE, bid, refmt("%.1f", text)); |
|
|
|
CS->setcfgAndFlush(cfgid, refmt("%.1f", text)); |
|
|
|
} |