zhaohe 8 months ago
parent
commit
0a3a107147
  1. 2
      uappbase/bean/appevent.hpp
  2. 32
      uappbase/bean/appevent_type.hpp
  3. 2
      uappbase/bean/dbtype/acid_channel_cfg.hpp
  4. 8
      uappbase/bean/dbtype/acid_use_record.hpp
  5. 33
      uappbase/service/app_event_bus.cpp
  6. 14
      uappbase/service/app_event_bus.hpp
  7. 30
      uappbase/service/gstate_mgr.cpp
  8. 82
      uappbase/service/gstate_mgr.hpp
  9. 2
      usrc/db/dao/acid_distrubt_record_dao.hpp
  10. 4
      usrc/db/dao/acid_use_record_dao.cpp
  11. 2
      usrc/db/dao/acid_use_record_dao.hpp
  12. 11
      usrc/service/pump_ctrl_service.cpp
  13. 57
      usrc/service/remote_controler_event_processer.cpp
  14. 2
      usrc/uicontroler/event_proceesser/button_event_processer.cpp
  15. 25
      usrc/uicontroler/page/home_page.cpp
  16. 12
      usrc/uicontroler/page/mupage/MuAcidDistMgrPage.cpp
  17. 16
      usrc/uicontroler/page/mupage/muAcidUseMgr_page.cpp
  18. 6
      usrc/uicontroler/page/mupage/muCHSetting_page.cpp
  19. 14
      usrc/uicontroler/tjc/ui_event.h
  20. 12
      usrc/uicontroler/ui_controler.cpp
  21. 2
      usrc/uicontroler/ui_controler.hpp

2
uappbase/bean/appevent.hpp

@ -42,4 +42,6 @@ class AppEvent {
void setOnFnc(std::function<void()> fnc) { onfnc = fnc; }
int getBufSize() { return sizeof(buf); }
AcidStateChangeEvent_t* getAcidStateChangeEvent() { return (AcidStateChangeEvent_t*)buf; }
};

32
uappbase/bean/appevent_type.hpp

@ -1,5 +1,8 @@
#pragma once
#include <stdint.h>
enum AppEventType {
KAE_callOnAppEventBusLoop,
@ -14,8 +17,33 @@ enum AppEventType {
kAE_unLoginEvent,
KAE_PageChangeEvent,
kAE_AcidStatChangeEvent, // 统计数据变化事件
kAE_RemoterConnectedEvent, // 遥控器连接成功
kAE_RemoterDisConnectedEvent, // 遥控器断开连接
/**
* @brief
*/
kAE_AcidStatDisplayChangeEvent, // 统计数据显示数值变化
kAE_AcidStatChangeEvent, // 使用
};
enum AcidStatChangeEventType {
kACID_USE,
kACID_STORAGE,
};
typedef enum AppEventType AppEventType_t;
struct AcidStateChangeEvent {
enum AcidStatChangeEventType subtype;
// 添加
uint8_t addCh;
float addChVal;
// 使用
float useVal[4];
};
typedef enum AppEventType AppEventType_t;
typedef enum AcidStatChangeEventType AcidStatChangeEventType_t;
typedef struct AcidStateChangeEvent AcidStateChangeEvent_t;

2
uappbase/bean/dbtype/acid_channel_cfg.hpp

@ -8,7 +8,7 @@ typedef struct {
// 基础参数
char acidChooseName[MAX_ACID_NAME_LENGTH]; // 酸液0 选择的名字
float acidEachDistriVal; // 酸液0 distribution
float acidEachDistriVal; // 酸液0 distribution ml
uint16_t pumpDefVel; // 泵机默认速度r/min RPM
float pipeLengthML; // 酸液管路长度
float chAppendMl; // 通道每次小回流的液体长度

8
uappbase/bean/dbtype/acid_use_record.hpp

@ -9,10 +9,10 @@ typedef struct {
zdate_t date;
uint8_t usrid;
uint16_t ch0take; // 0.1ml
uint16_t ch1take; // 0.1ml
uint16_t ch2take; // 0.1ml
uint16_t ch3take; // 0.1ml
uint16_t ch0take0p1ml; // 0.1ml
uint16_t ch1take0p1ml; // 0.1ml
uint16_t ch2take0p1ml; // 0.1ml
uint16_t ch3take0p1ml; // 0.1ml
} acid_use_record_t;
} // namespace iflytop

33
uappbase/service/app_event_bus.cpp

@ -1,6 +1,8 @@
#include "app_event_bus.hpp"
extern "C" {
#include "cmsis_os.h"
}
using namespace iflytop;
using namespace std;
static QueueHandle_t xQueue;
@ -10,7 +12,9 @@ static AppEvent eventtxcache;
void AppEventBus::initialize() {
lock.init();
thread.init("AppEventBus", 1024);
xQueue = xQueueCreate(20, sizeof(AppEvent));
int AppEventSize = sizeof(AppEvent);
xQueue = xQueueCreate(20, AppEventSize);
thread.start([this]() {
static AppEvent eventrxcache;
@ -67,7 +71,30 @@ void AppEventBus::callFnInEventBus(function<void()> onfnc) {
void AppEventBus::pushStateDisplayInfoEvent(const char* info) {
zlock_guard lck(lock);
eventtxcache.type = kAppEvent_StateDisplayInfo;
// strncpy(event.getStateDisplayInfo(), info, event.getBufSize());
eventtxcache.setStateDisplayInfo(info);
pushEvent(eventtxcache);
}
void AppEventBus::pushAcidStatStorageEvent(uint8_t ch, float chVal) {
zlock_guard lck(lock);
eventtxcache.type = kAE_AcidStatChangeEvent;
eventtxcache.getAcidStateChangeEvent()->subtype = kACID_STORAGE;
eventtxcache.getAcidStateChangeEvent()->addCh = ch;
eventtxcache.getAcidStateChangeEvent()->addChVal = chVal;
pushEvent(eventtxcache);
}
void AppEventBus::pushAcidStatDisplayChangeEvent() {
zlock_guard lck(lock);
eventtxcache.type = kAE_AcidStatDisplayChangeEvent;
pushEvent(eventtxcache);
}
void AppEventBus::pushAcidStatUseEvent(float ch1, float ch2, float ch3, float ch4) {
zlock_guard lck(lock);
eventtxcache.type = kAE_AcidStatChangeEvent;
eventtxcache.getAcidStateChangeEvent()->subtype = kACID_USE;
eventtxcache.getAcidStateChangeEvent()->useVal[0] = ch1;
eventtxcache.getAcidStateChangeEvent()->useVal[1] = ch2;
eventtxcache.getAcidStateChangeEvent()->useVal[2] = ch3;
eventtxcache.getAcidStateChangeEvent()->useVal[3] = ch4;
pushEvent(eventtxcache);
}

14
uappbase/service/app_event_bus.hpp

@ -1,7 +1,9 @@
#pragma once
#include "../appdep.hpp"
#include "uappbase/appcfg/appcfg.hpp"
#include "uappbase/bean/bean.hpp"
#include "stm32basic\mutex.hpp"
#include "stm32basic\zthread.hpp"
#include "uappbase\bean\appevent.hpp"
//
namespace iflytop {
@ -30,7 +32,11 @@ class AppEventBus {
void pushPageChangeEvent(uint8_t toPage);
void callFnInEventBus(function<void()> onfnc);
void pushStateDisplayInfoEvent(const char* info) ;
void pushStateDisplayInfoEvent(const char* info);
void pushAcidStatUseEvent(float ch1, float ch2, float ch3, float ch4);
void pushAcidStatStorageEvent(uint8_t ch, float chVal);
void pushAcidStatDisplayChangeEvent();
};
} // namespace iflytop

30
uappbase/service/gstate_mgr.cpp

@ -46,14 +46,10 @@ int GStateMgr::getUserId() {
//
void GStateMgr::setAcidState(int32_t state) {
zlock_guard l(m_mutex);
m_AcidState = state;
}
void GStateMgr::setRemoterS(int32_t state, const char* name) {
zlock_guard l(m_mutex);
AppEvent appevent;
AppEvent appevent;
m_RemoterS = state;
if (state) {
@ -86,10 +82,6 @@ void GStateMgr::changeToNextRunMode() {
}
}
int32_t GStateMgr::getAcidState() {
zlock_guard l(m_mutex);
return m_AcidState;
}
int32_t GStateMgr::getRemoterS() {
zlock_guard l(m_mutex);
return m_RemoterS;
@ -101,11 +93,11 @@ hand_acid_mode_t GStateMgr::getRunMode() {
void GStateMgr::setPumpSelectState(int32_t index, bool state) {
zlock_guard l(m_mutex);
pumpSelectState[index] = state;
m_pumpSelectState[index] = state;
}
bool GStateMgr::getPumpSelectState(int32_t index) {
zlock_guard l(m_mutex);
return pumpSelectState[index];
return m_pumpSelectState[index];
}
void GStateMgr::resetAcidUsed() {
@ -131,20 +123,22 @@ float GStateMgr::getAcidRemain(int32_t index) {
zlock_guard l(m_mutex);
return acidRemain[index]; // add 0.5 for force change to int
}
void GStateMgr::decreaseAcidRemain(int32_t index, float val) {
zlock_guard l(m_mutex);
acidRemain[index] -= val;
}
bool GStateMgr::isHasPumpSelect() {
zlock_guard l(m_mutex);
for (int i = 0; i < 4; i++) {
if (pumpSelectState[i]) {
if (m_pumpSelectState[i]) {
return true;
}
}
return false;
}
void GStateMgr::setMenuPage(int32_t page) { m_menuPage = page; }
int32_t GStateMgr::getMenuPage() { return m_menuPage; }
void GStateMgr::decreaseAcidRemain(int32_t index, float val) {
zlock_guard l(m_mutex);
acidRemain[index] -= val;
}

82
uappbase/service/gstate_mgr.hpp

@ -13,21 +13,29 @@ using namespace std;
class GStateMgr {
private:
/* data */
/**
* @brief
*/
char m_loginUsr[MAX_USR_NAME_SIZE + 1];
int m_loginUsrId = -1;
user_role_t m_loginUsrType = kuser;
bool m_isLogin = false;
/**
* @brief
*/
int32_t m_RemoterS; // 遥控器状态 1:在线,0:离线
char m_RemoterName[20];
int32_t m_AcidState; // 酸液桶状态 1:在线,0:离线
hand_acid_mode_t m_RunMode = khand_acid_m_jog_mode; // 运行模式
int32_t m_menuPage = 0;
bool pumpSelectState[CH_NUM] = {false};
/**
* @brief
*/
hand_acid_mode_t m_RunMode = khand_acid_m_jog_mode; // 运行模式
bool m_pumpSelectState[CH_NUM] = {false}; // 选择的泵
/**
* @brief
*/
float acidUsed[CH_NUM] = {0.0};
float acidRemain[CH_NUM] = {0.0};
@ -41,40 +49,70 @@ class GStateMgr {
void initialize();
// loginUsrState
/**
* @brief
*/
void setLogin(int loginUsrId, const char* usrName, user_role_t role);
void setUnLogin();
bool isLogin();
user_role_t getLoginUsrType();
const char* getLoginUsr();
int getUserId();
int getUserId();
/**
* @brief
*/
//
void setAcidState(int32_t state);
void setRemoterS(int32_t state, const char* name);
/**
* @brief
*/
void setRunMode(hand_acid_mode_t mode);
void changeToNextRunMode();
void setPumpSelectState(int32_t index, bool state);
void setMenuPage(int32_t page);
int32_t getAcidState();
int32_t getRemoterS();
hand_acid_mode_t getRunMode();
int32_t getMenuPage();
bool isHasPumpSelect();
void setPumpSelectState(int32_t index, bool state);
bool getPumpSelectState(int32_t index);
bool isHasPumpSelect();
bool getPumpSelectState(int32_t index);
/**
* @brief
*/
/**
* @brief
*
*
* 1.:
* .
* .
*
* 2.使:
* .
* .使
* .
*
*
* .
* .使
*
* 1.
*
*/
void initAcidStat();
void resetAcidUsed();
float getAcidUsed(int32_t index);
void appendAcidUsed(int32_t index, float val);
void setAcidRemain(int32_t index, float val);
float getAcidRemain(int32_t index);
void decreaseAcidRemain(int32_t index, float val);
float getAcidUsed(int32_t index);
float getAcidRemain(int32_t index);
};
} // namespace iflytop

2
usrc/db/dao/acid_distrubt_record_dao.hpp

@ -21,7 +21,7 @@ typedef struct {
uint32_t version;
uint32_t maxid;
int recordNum;
acid_distrubt_record_t record[ACID_DISTRUBT_RECORD_NUM];
acid_distrubt_record_t record[ACID_DISTRUBT_RECORD_NUM + 1];
uint32_t end;
} acid_distrubt_record_table_t;

4
usrc/db/dao/acid_use_record_dao.cpp

@ -47,7 +47,7 @@ void AcidUseRecordDao::init() {
// ZLOGI(TAG, "record: %d/%d/%d %02d:%02d:%02d %d %d %d %d %d", //
// record->date.year, record->date.month, record->date.day, record->date.hours, record->date.minutes, record->date.seconds, //
// record->usrid, record->ch0take, record->ch1take, record->ch2take, record->ch3take);
// record->usrid, record->ch0take0p1ml, record->ch1take0p1ml, record->ch2take0p1ml, record->ch3take0p1ml);
// }
ZLOGI(TAG, "init success");
@ -68,7 +68,7 @@ void AcidUseRecordDao::addRecord(const acid_use_record_t& record) {
ZLOGI(TAG, "add record %d/%d/%d %02d:%02d:%02d %d %d %d %d %d (%d/%d)", //
record.date.year, record.date.month, record.date.day, record.date.hours, record.date.minutes, record.date.seconds, //
record.usrid, record.ch0take, record.ch1take, record.ch2take, record.ch3take, //
record.usrid, record.ch0take0p1ml, record.ch1take0p1ml, record.ch2take0p1ml, record.ch3take0p1ml, //
acid_use_record_table->recordNum, ACIDUSERCORD_RECORD_NUM);
}

2
usrc/db/dao/acid_use_record_dao.hpp

@ -21,7 +21,7 @@ typedef struct {
uint32_t version;
uint32_t maxid;
int recordNum;
acid_use_record_t record[ACIDUSERCORD_RECORD_NUM];
acid_use_record_t record[ACIDUSERCORD_RECORD_NUM + 1];
uint32_t end;
} acid_use_record_table_t;

11
usrc/service/pump_ctrl_service.cpp

@ -285,15 +285,19 @@ void PumpCtrlService::setCurrentPosAsZero(int32_t mid) {
}
void PumpCtrlService::doMotorsMoveByOnce() {
int32_t step[MOTOR_NUM] = {0};
int32_t step[MOTOR_NUM] = {0};
float distriVal[MOTOR_NUM] = {0};
for (size_t i = 0; i < MOTOR_NUM; i++) {
step[i] = AcidChCfgDao::getCfg(i)->acidEachDistriVal * 1000 + AcidChCfgDao::getCfg(i)->chAppendMl * 1000;
step[i] = AcidChCfgDao::getCfg(i)->acidEachDistriVal * 1000 + AcidChCfgDao::getCfg(i)->chAppendMl * 1000;
distriVal[i] = AcidChCfgDao::getCfg(i)->acidEachDistriVal;
if (!GSM->getPumpSelectState(i)) {
step[i] = 0;
step[i] = 0;
distriVal[i] = 0;
}
}
AppEventBus::ins()->pushAcidStatUseEvent(distriVal[0], distriVal[1], distriVal[2], distriVal[3]);
ZLOGI(TAG, "doMotorsMoveByOnce, moveBy %d %d %d %d", step[0], step[1], step[2], step[3]);
moveBy(step[0], step[1], step[2], step[3]);
}
@ -339,6 +343,7 @@ void PumpCtrlService::doMotorsLittleRefluxOnce() {
step3 = GSM->getPumpSelectState(3) ? step3 : 0;
ZLOGI(TAG, "doMotorsLittleRefluxOnce, moveBy %d %d %d %d", step0, step1, step2, step3);
moveBy(step0, step1, step2, step3);
}

57
usrc/service/remote_controler_event_processer.cpp

@ -1,5 +1,6 @@
#include "remote_controler_event_processer.hpp"
#include "db/dao/acid_distrubt_record_dao.hpp"
#include "db/dao/device_setting_dao.hpp"
//
@ -93,7 +94,43 @@ void RemoteControlerEventProcesser::processKeyEventInHomePage(hand_acid_remoter_
/**
* @brief
*/
if (keyEvent == hand_acid_remoter_kevent_add_liquid) {
if (keyEvent == hand_acid_remoter_kevent_change_next_mode) {
/**
* @brief
*/
if (GSM->getRunMode() == khand_acid_m_jog_mode) {
GSM->setRunMode(khand_acid_m_continuous_mode);
} else if (GSM->getRunMode() == khand_acid_m_continuous_mode) {
GSM->setRunMode(khand_acid_m_jog_mode);
}
} else if (keyEvent == hand_acid_remoter_kevent_preFilling) {
/**
* @brief
*/
if (AcidDistrubtRecordDao::isFull()) {
UIS->popWarningWin("酸液分配记录已满,请清空后再操作");
return;
}
if (!GSM->isHasPumpSelect()) {
UIS->popWarningWin("请至少选中一个通道");
return;
}
PUMPCS->acidPrefilling();
} else if (keyEvent == hand_acid_remoter_kevent_add_liquid) {
/**
* @brief
*/
if (AcidDistrubtRecordDao::isFull()) {
UIS->popWarningWin("酸液分配记录已满,请清空后再操作");
return;
}
//
if (!GSM->isHasPumpSelect()) {
UIS->popWarningWin("请至少选中一个通道");
@ -105,23 +142,11 @@ void RemoteControlerEventProcesser::processKeyEventInHomePage(hand_acid_remoter_
} else if (GSM->getRunMode() == khand_acid_m_continuous_mode) {
PUMPCS->autoMoveMutiTimes();
}
} else if (keyEvent == hand_acid_remoter_kevent_change_next_mode) {
// 修改工作模式
if (GSM->getRunMode() == khand_acid_m_jog_mode) {
GSM->setRunMode(khand_acid_m_continuous_mode);
} else if (GSM->getRunMode() == khand_acid_m_continuous_mode) {
GSM->setRunMode(khand_acid_m_jog_mode);
}
} else if (keyEvent == hand_acid_remoter_kevent_reflux) {
// 回流
/**
* @brief
*/
PUMPCS->reflux();
} else if (keyEvent == hand_acid_remoter_kevent_preFilling) {
// 管路填充
if (!GSM->isHasPumpSelect()) {
UIS->popWarningWin("请至少选中一个通道");
return;
}
PUMPCS->acidPrefilling();
}
}

2
usrc/uicontroler/event_proceesser/button_event_processer.cpp

@ -5,5 +5,5 @@ void ButtonEventProcesser::process(uint8_t* indata, size_t len, UIEvent* result)
result->eventId = indata[0];
result->pid = indata[1];
result->bid = indata[2];
result->butEventType = (button_event_t)indata[3];
result->butEventType = (jtc_button_event_t)indata[3];
}

25
usrc/uicontroler/page/home_page.cpp

@ -81,8 +81,6 @@ class HomePage : public IPageProcesser {
}
}
// virtual void onClickRelease(uint8_t bid, uint8_t val, const char* text) { return; };
virtual void onClickRelease(uint8_t bid, uint8_t val, const char* text) override {
ZLOGI(TAG, "OnButton bid:%d val:%d", bid, val);
if (PumpCtrlService::ins()->isWorking()) {
@ -90,6 +88,23 @@ class HomePage : public IPageProcesser {
return;
}
/**
* @brief
*/
if (bid == ob_home_acideval0) {
UIControler::ins()->popNumKeyBoard(thisPage, bid, 3, "%.1f", AcidChCfgDao::getCfg(0)->acidEachDistriVal);
} else if (bid == ob_home_acideval1) {
UIControler::ins()->popNumKeyBoard(thisPage, bid, 3, "%.1f", AcidChCfgDao::getCfg(1)->acidEachDistriVal);
} else if (bid == ob_home_acideval2) {
UIControler::ins()->popNumKeyBoard(thisPage, bid, 3, "%.1f", AcidChCfgDao::getCfg(2)->acidEachDistriVal);
} else if (bid == ob_home_acideval3) {
UIControler::ins()->popNumKeyBoard(thisPage, bid, 3, "%.1f", AcidChCfgDao::getCfg(3)->acidEachDistriVal);
}
/**
* @brief
*/
if (bid == ob_home_SelCH0) {
setPumpSelectState(0, !GStateMgr::ins()->getPumpSelectState(0));
} else if (bid == ob_home_SelCH1) {
@ -109,12 +124,10 @@ class HomePage : public IPageProcesser {
} else if (event->type == kAE_RemoterDisConnectedEvent) {
syncBleState(); // 同步蓝牙状态
UIS->setTxt(thisPage, ob_home_sysInfo, "断开手柄连接");
} else if (event->type == kAE_RunModeChangeEvent) {
syncMode(); // 初始化设备模式
UIS->setTxt(thisPage, ob_home_sysInfo, "切换模式");
} else if (event->type == kAE_AcidStatChangeEvent) {
} else if (event->type == kAE_AcidStatDisplayChangeEvent) {
syncStat(); // 初始化统计数据
} else if (event->type == kAppEvent_StateDisplayInfo) {
UIS->setTxt(thisPage, ob_home_sysInfo, event->getStateDisplayInfo());
@ -192,7 +205,7 @@ class HomePage : public IPageProcesser {
UIControler::ins()->setTxt(thisPage, ob_home_RunModeVal, "", DeviceSettingDao::get()->distrIntervalS);
} else if (nowMode == khand_acid_m_continuous_mode) {
UIControler::ins()->setPicturePicNum(thisPage, ob_home_RunMode, ob_home_RunMode0);
UIControler::ins()->setTxt(thisPage, ob_home_RunModeVal, "%.1f", DeviceSettingDao::get()->distrIntervalS);
UIControler::ins()->setTxt(thisPage, ob_home_RunModeVal, "%.2f", DeviceSettingDao::get()->distrIntervalS);
}
}

12
usrc/uicontroler/page/mupage/MuAcidDistMgrPage.cpp

@ -73,6 +73,12 @@ class MuAcidDistMgrPage : public IPageProcesser {
virtual void onChangePageEvent() override {
resetForm();
updateTableVolume();
if (GStateMgr::ins()->getLoginUsrType() == kadmin) {
visEx(ob_muAcidDistMgr_clearRecord, true);
} else {
visEx(ob_muAcidDistMgr_clearRecord, false);
}
}
virtual void onClickRelease(uint8_t bid, uint8_t val, const char* text) override {
/***********************************************************************************************************************
@ -90,6 +96,11 @@ class MuAcidDistMgrPage : public IPageProcesser {
}
if (bid == ob_muAcidDistMgr_addNew) {
if (AcidDistrubtRecordDao::getRecordNum() >= ACID_DISTRUBT_RECORD_NUM) {
UIControler::ins()->popWarningWin("领酸记录已满,请联系管理员,导出数据后清空,再添加");
return;
}
if (m_volumeVal <= 0) {
UIControler::ins()->popWarningWin("请输入容量");
return;
@ -116,6 +127,7 @@ class MuAcidDistMgrPage : public IPageProcesser {
DeviceAcidVolume::updateAcidVolume(m_chId, m_volumeVal);
GStateMgr::ins()->setAcidRemain(m_chId, m_volumeVal);
AppEventBus::ins()->pushAcidStatStorageEvent(m_chId, m_volumeVal);
resetForm();
}
}

16
usrc/uicontroler/page/mupage/muAcidUseMgr_page.cpp

@ -88,10 +88,10 @@ class MuAcidUseMgrPage : public IPageProcesser {
record.date.seconds = 30;
record.usrid = 0;
record.ch0take = 100;
record.ch1take = 110;
record.ch2take = 120;
record.ch3take = 130;
record.ch0take0p1ml = 100;
record.ch1take0p1ml = 110;
record.ch2take0p1ml = 120;
record.ch3take0p1ml = 130;
AcidUseRecordDao::addRecord(record);
}
AcidUseRecordDao::sync();
@ -103,10 +103,10 @@ class MuAcidUseMgrPage : public IPageProcesser {
for (int i = 0; i < page.recordNum; i++) {
setText(cfgbid_table[i + 1].val[0], "%d/%d/%d %02d:%02d:%02d", page.record[i]->date.year, page.record[i]->date.month, page.record[i]->date.day, page.record[i]->date.hours, page.record[i]->date.minutes, page.record[i]->date.seconds);
setText(cfgbid_table[i + 1].val[1], "%s", UserDao::getUserByIdNotNull(page.record[i]->usrid)->name);
setText(cfgbid_table[i + 1].val[2], "%.1f", page.record[i]->ch0take / 10.0);
setText(cfgbid_table[i + 1].val[3], "%.1f", page.record[i]->ch0take / 10.0);
setText(cfgbid_table[i + 1].val[4], "%.1f", page.record[i]->ch0take / 10.0);
setText(cfgbid_table[i + 1].val[5], "%.1f", page.record[i]->ch0take / 10.0);
setText(cfgbid_table[i + 1].val[2], "%.1f", page.record[i]->ch0take0p1ml / 10.0);
setText(cfgbid_table[i + 1].val[3], "%.1f", page.record[i]->ch0take0p1ml / 10.0);
setText(cfgbid_table[i + 1].val[4], "%.1f", page.record[i]->ch0take0p1ml / 10.0);
setText(cfgbid_table[i + 1].val[5], "%.1f", page.record[i]->ch0take0p1ml / 10.0);
}
for (int i = page.recordNum; i < 8; i++) {

6
usrc/uicontroler/page/mupage/muCHSetting_page.cpp

@ -144,6 +144,7 @@ class MuChSetting : public IPageProcesser {
UIControler::ins()->popNumKeyBoard(thisPage, bid, 4, fmt(PRECISION, AcidChCfgDao::getCfg(0)->pipeLengthML));
} else if (MLPR_BIND_CFG && bid == MLPR_BIND_CFG->cfgbid) { // 转速转换系数
UIControler::ins()->popNumKeyBoard(thisPage, bid, 4, fmt(PRECISION, AcidChCfgDao::getCfg(0)->mLPR));
} else if (CH_APPEND_ML_BIND_CFG && bid == CH_APPEND_ML_BIND_CFG->cfgbid) { // 防滴液体积
UIControler::ins()->popNumKeyBoard(thisPage, bid, 4, fmt(PRECISION, AcidChCfgDao::getCfg(0)->chAppendMl));
}
@ -198,6 +199,7 @@ class MuChSetting : public IPageProcesser {
return;
}
AcidChCfgDao::getCfg(m_chId)->irun = setval;
PumpCtrlService::ins()->updateMotorSetting();
setText(bid, "%d", setval);
} else if (PUMP_DEF_VEL_BIND_CFG && bid == PUMP_DEF_VEL_BIND_CFG->cfgbid) {
/**
@ -209,6 +211,7 @@ class MuChSetting : public IPageProcesser {
return;
}
AcidChCfgDao::getCfg(m_chId)->pumpDefVel = setval;
PumpCtrlService::ins()->updateMotorSetting();
setText(bid, "%d", setval);
} else if (PIPE_LENGTH_ML_BIND_CFG && bid == PIPE_LENGTH_ML_BIND_CFG->cfgbid) {
/**
@ -220,6 +223,7 @@ class MuChSetting : public IPageProcesser {
return;
}
AcidChCfgDao::getCfg(m_chId)->pipeLengthML = setval;
PumpCtrlService::ins()->updateMotorSetting();
setText(bid, PRECISION, setval);
} else if (MLPR_BIND_CFG && bid == MLPR_BIND_CFG->cfgbid) {
/**
@ -231,6 +235,7 @@ class MuChSetting : public IPageProcesser {
return;
}
AcidChCfgDao::getCfg(m_chId)->mLPR = setval;
PumpCtrlService::ins()->updateMotorSetting();
setText(bid, PRECISION, setval);
} else if (CH_APPEND_ML_BIND_CFG && bid == CH_APPEND_ML_BIND_CFG->cfgbid) {
/**
@ -242,6 +247,7 @@ class MuChSetting : public IPageProcesser {
return;
}
AcidChCfgDao::getCfg(m_chId)->chAppendMl = setval;
PumpCtrlService::ins()->updateMotorSetting();
setText(bid, PRECISION, setval);
}
}

14
usrc/uicontroler/tjc/ui_event.h

@ -53,19 +53,11 @@ typedef enum {
kpt_inputfield_content_selected_change_event = 0xAD, //
kpt_page_back_event = 0xB0, // 退
kpt_usr_def_clik_release_event = 0xB1, //
kpt_usr_def_clik_release_event = 0xB1 //
} tjc_packet_type_t;
typedef enum {
kbutton_release = 0,
kbutton_press = 1,
} button_event_t;
typedef enum {
k_button_release_event = 1,
k_input_confirm_event = 2,
} usr_event_type_t;
typedef enum { kbutton_release = 0, kbutton_press = 1 } jtc_button_event_t;
typedef struct {
int32_t eventId;
@ -73,7 +65,7 @@ typedef struct {
uint8_t bid;
// content
button_event_t butEventType; //
jtc_button_event_t butEventType; //
int32_t val; //
char text[TJC_MAX_PACKET_SIZE]; //
} UIEvent;

12
usrc/uicontroler/ui_controler.cpp

@ -482,12 +482,20 @@ void UIControler::popPasswdKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitL
chpage(pg_keyPasswd, false);
}
void UIControler::popNumKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength, const char* initval) {
void UIControler::popNumKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength, const char* initval,...) {
zlock_guard lg(m_cmdlock);
static char buf[60];
va_list args;
va_start(args, initval);
vsnprintf(buf, sizeof(buf), initval, args);
va_end(args);
sendcmd("p[%d].b[%d].val=%d", pg_keybdB, ob_keybdB_loadpageid, fromPid);
sendcmd("p[%d].b[%d].val=%d", pg_keybdB, ob_keybdB_loadcmpid, fromBid);
sendcmd("p[%d].b[%d].txt=\"%s\"", pg_keybdB, ob_keybdB_show, initval);
sendcmd("p[%d].b[%d].txt=\"%s\"", pg_keybdB, ob_keybdB_show, buf);
sendcmd("p[%d].b[%d].pw=0", pg_keybdB, ob_keybdB_show);
sendcmd("p[%d].b[%d].val=%d", pg_keybdB, ob_keybdB_inputlenth, limitLength);
chpage(pg_keybdB, false);

2
usrc/uicontroler/ui_controler.hpp

@ -99,7 +99,7 @@ class UIControler {
void popFullKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength, const char* initval);
void popPasswdKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength);
void popNumKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength, const char* initval);
void popNumKeyBoard(uint8_t fromPid, uint8_t fromBid, int limitLength, const char* initval,...);
void popKeyBMutSel(uint8_t fromPid, uint8_t fromBid, int selectvalindex, const char** selectvals);
void popKeyBMutSel(uint8_t fromPid, uint8_t fromBid, int selectvalindex, const char* selectvals);

Loading…
Cancel
Save