11 changed files with 429 additions and 12 deletions
-
3README.md
-
4usrc/service/page/page_processer.hpp
-
72usrc/service/page/submenu/Page_muBleHandSett.cpp
-
30usrc/service/page/submenu/Page_muBleHandSett.hpp
-
72usrc/service/page/submenu/Page_muMotorSett.cpp
-
30usrc/service/page/submenu/Page_muMotorSett.hpp
-
152usrc/service/page/submenu/Page_muPumpSett.cpp
-
30usrc/service/page/submenu/Page_muPumpSett.hpp
-
11usrc/service/page/submenu/Page_muSettings.cpp
-
29usrc/service/page/utils/page_bak_router.cpp
-
8usrc/service/page/utils/page_bak_router.hpp
@ -0,0 +1,72 @@ |
|||||
|
#include "Page_muBleHandSett.hpp"
|
||||
|
|
||||
|
#include "service/remote_controler.hpp"
|
||||
|
|
||||
|
using namespace iflytop; |
||||
|
|
||||
|
/**
|
||||
|
* @brief |
||||
|
* 酸类修改页面 |
||||
|
*/ |
||||
|
|
||||
|
#define PAGE pg_muBleHandSett
|
||||
|
#define TAG "Page_muBleHandSett"
|
||||
|
static CfgItermCache cfgcache; |
||||
|
|
||||
|
static bool m_scaning; |
||||
|
void Page_muBleHandSett::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_muBleHandSett_bleCliName, "加液"); |
||||
|
} |
||||
|
if (keyEvent == hand_acid_remoter_kevent_change_next_mode) { |
||||
|
UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, "模式切换"); |
||||
|
} |
||||
|
if (keyEvent == hand_acid_remoter_kevent_reflux) { |
||||
|
UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, "液路回流"); |
||||
|
} |
||||
|
if (keyEvent == hand_acid_remoter_kevent_preFilling) { |
||||
|
UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, "液路预充"); |
||||
|
} |
||||
|
return; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
bool Page_muBleHandSett::isBelongThisPage(int page) { return page == PAGE; } |
||||
|
void Page_muBleHandSett::updatePage() { UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, getCfgStr(kcfg_bleClientName)); } |
||||
|
void Page_muBleHandSett::OnPageLoad(OnPageLoadContext* cxt) { //
|
||||
|
updatePage(); |
||||
|
}; |
||||
|
void Page_muBleHandSett::OnAppEvent(AppEvent_t* event) { |
||||
|
if (event->type == kAppEvent_BleConnectEvent) { |
||||
|
ZLOGI(TAG, "ble connect success"); |
||||
|
UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, "绑定成功"); |
||||
|
CS->setcfgAndFlush(kcfg_bleClientName, event->d.bleName); |
||||
|
m_scaning = false; |
||||
|
} |
||||
|
} |
||||
|
void Page_muBleHandSett::OnInputFieldContentChange(uint8_t bid, const char* text) { updatePage(); } |
||||
|
void Page_muBleHandSett::OnButton(uint8_t bid, uint8_t val) { |
||||
|
static CfgItermCache usrpasswdcache; |
||||
|
ZLOGI(TAG, "bid:%d", bid); |
||||
|
if (bid == ob_muBleHandSett_bak) { |
||||
|
if (m_scaning) { |
||||
|
RCTRL->startScan("XXXXXXXXX", false); // 相当于停止扫描
|
||||
|
} |
||||
|
UIS->chpage(getBakPage(PAGE)); |
||||
|
} else if (bid == ob_muBleHandSett_bleScan) { |
||||
|
ZLOGI(TAG, "bleScan"); |
||||
|
bool suc = RCTRL->startScan(BLENAME, true); |
||||
|
if (suc) UIS->setTxt(PAGE, ob_muBleHandSett_bleCliName, "扫描中..."); |
||||
|
m_scaning = true; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
// muAcidType
|
@ -0,0 +1,30 @@ |
|||||
|
#pragma once
|
||||
|
//
|
||||
|
#include "../page_processer.hpp"
|
||||
|
namespace iflytop { |
||||
|
using namespace std; |
||||
|
// page: keybAcidCh
|
||||
|
class Page_muBleHandSett : public IPageProcesser { |
||||
|
private: |
||||
|
/* data */ |
||||
|
|
||||
|
public: |
||||
|
static Page_muBleHandSett* ins() { |
||||
|
static Page_muBleHandSett instance; |
||||
|
return &instance; |
||||
|
} |
||||
|
virtual void initialize() override; |
||||
|
|
||||
|
private: |
||||
|
virtual bool isBelongThisPage(int page) override; |
||||
|
|
||||
|
virtual void OnPageLoad(OnPageLoadContext* cxt) override; |
||||
|
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) override; |
||||
|
virtual void OnButton(uint8_t bid, uint8_t val) override; |
||||
|
virtual void OnAppEvent(AppEvent_t* event) override; |
||||
|
|
||||
|
private: |
||||
|
void updatePage(); |
||||
|
}; |
||||
|
|
||||
|
} // namespace iflytop
|
@ -0,0 +1,72 @@ |
|||||
|
#include "Page_muMotorSett.hpp"
|
||||
|
|
||||
|
#include "service/remote_controler.hpp"
|
||||
|
|
||||
|
using namespace iflytop; |
||||
|
|
||||
|
/**
|
||||
|
* @brief |
||||
|
* 酸类修改页面 |
||||
|
*/ |
||||
|
|
||||
|
#define PAGE pg_muMotorSett
|
||||
|
#define TAG "Page_muMotorSett"
|
||||
|
static CfgItermCache cfgcache; |
||||
|
|
||||
|
static bool m_scaning; |
||||
|
void Page_muMotorSett::initialize() { //
|
||||
|
IPageProcesser::initialize(); |
||||
|
} |
||||
|
bool Page_muMotorSett::isBelongThisPage(int page) { return page == PAGE; } |
||||
|
|
||||
|
void Page_muMotorSett::updatePage() { |
||||
|
UIS->setTxt(PAGE, ob_muMotorSett_irun0, zitoa(getMxIRun(0))); |
||||
|
UIS->setTxt(PAGE, ob_muMotorSett_irun1, zitoa(getMxIRun(1))); |
||||
|
UIS->setTxt(PAGE, ob_muMotorSett_irun2, zitoa(getMxIRun(2))); |
||||
|
UIS->setTxt(PAGE, ob_muMotorSett_irun3, zitoa(getMxIRun(3))); |
||||
|
} |
||||
|
|
||||
|
void Page_muMotorSett::OnPageLoad(OnPageLoadContext* cxt) { //
|
||||
|
updatePage(); |
||||
|
}; |
||||
|
void Page_muMotorSett::OnAppEvent(AppEvent_t* event) {} |
||||
|
void Page_muMotorSett::OnInputFieldContentChange(uint8_t bid, const char* text) { |
||||
|
/***********************************************************************************************************************
|
||||
|
* irunx * |
||||
|
***********************************************************************************************************************/ |
||||
|
|
||||
|
if (bid == ob_muMotorSett_irun0 || bid == ob_muMotorSett_irun1 || bid == ob_muMotorSett_irun2 || bid == ob_muMotorSett_irun3) { |
||||
|
int irun = atoi(text); |
||||
|
if (irun < 1 || irun > 31) { |
||||
|
UIS->alert("IRUN需要限制在1..31"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (bid == ob_muMotorSett_irun0) { |
||||
|
setMxIRun(0, atoi(text)); |
||||
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(0))); |
||||
|
} else if (bid == ob_muMotorSett_irun1) { |
||||
|
setMxIRun(1, atoi(text)); |
||||
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(1))); |
||||
|
} else if (bid == ob_muMotorSett_irun2) { |
||||
|
setMxIRun(2, atoi(text)); |
||||
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(2))); |
||||
|
} else if (bid == ob_muMotorSett_irun3) { |
||||
|
setMxIRun(3, atoi(text)); |
||||
|
UIS->setTxt(bid, zfmt("%d", getMxIRun(3))); |
||||
|
} |
||||
|
|
||||
|
/***********************************************************************************************************************
|
||||
|
* addAcidVel * |
||||
|
***********************************************************************************************************************/ |
||||
|
|
||||
|
updatePage(); |
||||
|
} |
||||
|
void Page_muMotorSett::OnButton(uint8_t bid, uint8_t val) { |
||||
|
if (bid == ob_muMotorSett_bak) { |
||||
|
UIS->chpage(getBakPage(PAGE)); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
// muAcidType
|
@ -0,0 +1,30 @@ |
|||||
|
#pragma once
|
||||
|
//
|
||||
|
#include "../page_processer.hpp"
|
||||
|
namespace iflytop { |
||||
|
using namespace std; |
||||
|
// page: keybAcidCh
|
||||
|
class Page_muMotorSett : public IPageProcesser { |
||||
|
private: |
||||
|
/* data */ |
||||
|
|
||||
|
public: |
||||
|
static Page_muMotorSett* ins() { |
||||
|
static Page_muMotorSett instance; |
||||
|
return &instance; |
||||
|
} |
||||
|
virtual void initialize() override; |
||||
|
|
||||
|
private: |
||||
|
virtual bool isBelongThisPage(int page) override; |
||||
|
|
||||
|
virtual void OnPageLoad(OnPageLoadContext* cxt) override; |
||||
|
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) override; |
||||
|
virtual void OnButton(uint8_t bid, uint8_t val) override; |
||||
|
virtual void OnAppEvent(AppEvent_t* event) override; |
||||
|
|
||||
|
private: |
||||
|
void updatePage(); |
||||
|
}; |
||||
|
|
||||
|
} // namespace iflytop
|
@ -0,0 +1,152 @@ |
|||||
|
#include "Page_muPumpSett.hpp"
|
||||
|
|
||||
|
#include "service/remote_controler.hpp"
|
||||
|
|
||||
|
using namespace iflytop; |
||||
|
|
||||
|
/**
|
||||
|
* @brief |
||||
|
* 酸类修改页面 |
||||
|
*/ |
||||
|
|
||||
|
#define PAGE pg_muPumpSett
|
||||
|
#define TAG "Page_muPumpSett"
|
||||
|
static CfgItermCache cfgcache; |
||||
|
|
||||
|
static bool m_scaning; |
||||
|
void Page_muPumpSett::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; |
||||
|
|
||||
|
return; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
bool Page_muPumpSett::isBelongThisPage(int page) { return page == PAGE; } |
||||
|
|
||||
|
void Page_muPumpSett::updatePage() { |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pumpCoef0, zfmt("%.4f", getMotorMLPR(0))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pumpCoef1, zfmt("%.4f", getMotorMLPR(1))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pumpCoef2, zfmt("%.4f", getMotorMLPR(2))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pumpCoef3, zfmt("%.4f", getMotorMLPR(3))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pipeLen0, zfmt("%.2f", getCfgPipeLengthML(0))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pipeLen1, zfmt("%.2f", getCfgPipeLengthML(1))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pipeLen2, zfmt("%.2f", getCfgPipeLengthML(2))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_pipeLen3, zfmt("%.2f", getCfgPipeLengthML(3))); |
||||
|
// TODO:改成4个输入框
|
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_addAcidVel0, zitoa(getMxRunRPM(0))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_addAcidVel1, zitoa(getMxRunRPM(1))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_addAcidVel2, zitoa(getMxRunRPM(2))); |
||||
|
UIS->setTxt(PAGE, ob_muPumpSett_addAcidVel3, zitoa(getMxRunRPM(3))); |
||||
|
} |
||||
|
|
||||
|
void Page_muPumpSett::OnPageLoad(OnPageLoadContext* cxt) { //
|
||||
|
updatePage(); |
||||
|
}; |
||||
|
void Page_muPumpSett::OnAppEvent(AppEvent_t* event) {} |
||||
|
|
||||
|
void Page_muPumpSett::OnInputFieldContentChange(uint8_t bid, const char* text) { |
||||
|
/***********************************************************************************************************************
|
||||
|
* irunx * |
||||
|
***********************************************************************************************************************/ |
||||
|
|
||||
|
/***********************************************************************************************************************
|
||||
|
* pumpCoef * |
||||
|
***********************************************************************************************************************/ |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pumpCoef0) { |
||||
|
setMotorMLPR(0, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(0))); |
||||
|
} else if (bid == ob_muPumpSett_pumpCoef1) { |
||||
|
setMotorMLPR(1, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(1))); |
||||
|
} else if (bid == ob_muPumpSett_pumpCoef2) { |
||||
|
setMotorMLPR(2, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(2))); |
||||
|
} else if (bid == ob_muPumpSett_pumpCoef3) { |
||||
|
setMotorMLPR(3, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.4f", getMotorMLPR(3))); |
||||
|
} |
||||
|
|
||||
|
/***********************************************************************************************************************
|
||||
|
* pipeLen * |
||||
|
***********************************************************************************************************************/ |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pipeLen0 || bid == ob_muPumpSett_pipeLen1 || bid == ob_muPumpSett_pipeLen2 || bid == ob_muPumpSett_pipeLen3) { |
||||
|
float len = atof(text); |
||||
|
if (len < 0.1) { |
||||
|
UIS->alert("管道长度不能小于0.1"); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pipeLen0) { |
||||
|
setCfgPipeLengthML(0, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(0))); |
||||
|
} |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pipeLen1) { |
||||
|
setCfgPipeLengthML(1, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(1))); |
||||
|
} |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pipeLen2) { |
||||
|
setCfgPipeLengthML(2, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(2))); |
||||
|
} |
||||
|
|
||||
|
if (bid == ob_muPumpSett_pipeLen3) { |
||||
|
setCfgPipeLengthML(3, atof(text)); |
||||
|
UIS->setTxt(bid, zfmt("%.2f", getCfgPipeLengthML(3))); |
||||
|
} |
||||
|
|
||||
|
/***********************************************************************************************************************
|
||||
|
* addAcidVel * |
||||
|
***********************************************************************************************************************/ |
||||
|
// TODO改成4个输入框
|
||||
|
if (bid == ob_muPumpSett_addAcidVel0 || bid == ob_muPumpSett_addAcidVel1 || bid == ob_muPumpSett_addAcidVel2 || bid == ob_muPumpSett_addAcidVel3) { |
||||
|
int rpm = atoi(text); |
||||
|
if (rpm < 300) { |
||||
|
UIS->alert("转速不能小于300"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (rpm > 1000) { |
||||
|
UIS->alert("转速不能大于1000"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
switch (bid) { |
||||
|
case ob_muPumpSett_addAcidVel0: |
||||
|
setMxRunRPM(0, rpm); |
||||
|
break; |
||||
|
case ob_muPumpSett_addAcidVel1: |
||||
|
setMxRunRPM(1, rpm); |
||||
|
break; |
||||
|
case ob_muPumpSett_addAcidVel2: |
||||
|
setMxRunRPM(2, rpm); |
||||
|
break; |
||||
|
case ob_muPumpSett_addAcidVel3: |
||||
|
setMxRunRPM(3, rpm); |
||||
|
break; |
||||
|
} |
||||
|
UIS->setTxt(bid, zitoa(rpm)); |
||||
|
} |
||||
|
|
||||
|
updatePage(); |
||||
|
} |
||||
|
void Page_muPumpSett::OnButton(uint8_t bid, uint8_t val) { |
||||
|
if (bid == ob_muPumpSett_bak) { |
||||
|
UIS->chpage(getBakPage(PAGE)); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
// muAcidType
|
@ -0,0 +1,30 @@ |
|||||
|
#pragma once
|
||||
|
//
|
||||
|
#include "../page_processer.hpp"
|
||||
|
namespace iflytop { |
||||
|
using namespace std; |
||||
|
// page: keybAcidCh
|
||||
|
class Page_muPumpSett : public IPageProcesser { |
||||
|
private: |
||||
|
/* data */ |
||||
|
|
||||
|
public: |
||||
|
static Page_muPumpSett* ins() { |
||||
|
static Page_muPumpSett instance; |
||||
|
return &instance; |
||||
|
} |
||||
|
virtual void initialize() override; |
||||
|
|
||||
|
private: |
||||
|
virtual bool isBelongThisPage(int page) override; |
||||
|
|
||||
|
virtual void OnPageLoad(OnPageLoadContext* cxt) override; |
||||
|
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) override; |
||||
|
virtual void OnButton(uint8_t bid, uint8_t val) override; |
||||
|
virtual void OnAppEvent(AppEvent_t* event) override; |
||||
|
|
||||
|
private: |
||||
|
void updatePage(); |
||||
|
}; |
||||
|
|
||||
|
} // namespace iflytop
|
@ -0,0 +1,29 @@ |
|||||
|
#include "page_bak_router.hpp"
|
||||
|
using namespace iflytop; |
||||
|
|
||||
|
namespace iflytop { |
||||
|
int getBakPage(int nowPage) { |
||||
|
if ( |
||||
|
|
||||
|
nowPage == pg_muInterval || //
|
||||
|
nowPage == pg_muUsrMgr || //
|
||||
|
nowPage == pg_muTmrMgr || //
|
||||
|
nowPage == pg_muAcidType || //
|
||||
|
nowPage == pg_muDeviceInfo || //
|
||||
|
nowPage == pg_muSettings || //
|
||||
|
nowPage == pg_muAudit //
|
||||
|
) { |
||||
|
return GSM->getMenuPage(); |
||||
|
} |
||||
|
|
||||
|
if (nowPage == pg_muPumpTest || //
|
||||
|
nowPage == pg_muBleHandSett || //
|
||||
|
nowPage == pg_muMotorSett || //
|
||||
|
nowPage == pg_muPumpSett //
|
||||
|
) { |
||||
|
return pg_muSettings; |
||||
|
} |
||||
|
return pg_main; |
||||
|
} |
||||
|
|
||||
|
} // namespace iflytop
|
@ -0,0 +1,8 @@ |
|||||
|
#pragma once
|
||||
|
#include "apphardware/apphardware.hpp"
|
||||
|
#include "uappbase/base.hpp"
|
||||
|
#include "service\front_end_controler.hpp"
|
||||
|
|
||||
|
namespace iflytop { |
||||
|
int getBakPage(int nowPage); |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue