GrpcPrint/PrintS/Communication/PowderSupplySimpleClient.cpp

1956 lines
78 KiB
C++

#include "PowderSupplySimpleClient.h"
#include "S7Command.h"
#include "../SystemInfo.h"
#include "../external/imgui/imgui_custom.h"
#include "../LanguageManager.h"
#include "../config/ConfigManager.h"
#include <atlbase.h>
#include "../Toast.h"
//#include "../ScannerCtrl/BaseCtrl.h"
#include "../utils/DataByte.h"
PowderSupplySimpleClient::PowderSupplySimpleClient(CommunicationCfg* pconfig) :S7Client(pconfig)
{
m_RunCfg = ConfigManager::GetInstance()->GetRunCfg();
m_ExtCfg = ConfigManager::GetInstance()->GetExtCfg();
m_PowderEstimateCfg = ConfigManager::GetInstance()->GetPowderEstimateCfg();
IOCfgWrapper* iw = ConfigManager::GetInstance()->GetIoCfgWrapper();
m_IOCfgWrapper = iw;
m_AutoSupplyThread = INVALID_HANDLE_VALUE;
m_AutoSupplyFlag = false;
m_InfoTick = GetTickCount64();
size_t ptrSize = sizeof(nullptr); //指针大小
void* startPtr = &m_ClientState.m_startFlag + 1;
size_t count = ((size_t)&m_ClientState.m_endFlag - (size_t)startPtr) / ptrSize;
InsertMp(startPtr, count);
startPtr = &m_ShowAssist.m_startFlag + 1;
count = ((size_t)&m_ShowAssist.m_endFlag - (size_t)startPtr) / ptrSize;
InsertMp(startPtr, count);
}
PowderSupplySimpleClient::~PowderSupplySimpleClient()
{
m_AutoSupplyFlag = false;
if (m_AutoSupplyThread != INVALID_HANDLE_VALUE) {
if (WaitForSingleObject(m_AutoSupplyThread, 500) == WAIT_TIMEOUT)
{
TerminateThread(m_AutoSupplyThread, 1);
}
CloseHandle(m_AutoSupplyThread);
m_AutoSupplyThread = INVALID_HANDLE_VALUE;
}
RequestSupplyStop();
Sleep(500);
Shutdown();
}
void PowderSupplySimpleClient::InitCommand()
{
S7Command* pcommand = new S7Command(S7_COMMAND_READ_INFO, READ_ITEM_COUNT);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].WordLen = S7WLByte;
items[0].DBNumber = 1;
items[0].Start = 0;
items[0].Amount = 3;
items[0].pdata = new unsigned char[3];
items[1].Area = S7AreaDB;
items[1].WordLen = S7WLByte;
items[1].DBNumber = 1;
items[1].Start = 105;
items[1].Amount = 1;
items[1].pdata = new unsigned char[1];
items[2].Area = S7AreaDB;
items[2].WordLen = S7WLByte;
items[2].DBNumber = 1;
items[2].Start = 200;
items[2].Amount = 35;
items[2].pdata = new unsigned char[35];
pcommand->m_Ref = this;
pcommand->m_Fun = &PowderSupplySimpleClient::ProcReadInfo;
pcommand->isNeedDel = false;
//写压力
S7Command* pressureCom = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* dataItem = pressureCom->getDataItems();
dataItem[0].Area = S7AreaDB;
dataItem[0].DBNumber = 1;
dataItem[0].Start = 226;
dataItem[0].WordLen = S7WLByte;
dataItem[0].Amount = 4;
unsigned char* pfloat = new unsigned char[4];
S7FLOATDATA fdata;
fdata.fValue = g_SystemInfo->m_EnvState.m_PowderJarCabinPressureVoltage;
pfloat[0] = fdata.data[3];
pfloat[1] = fdata.data[2];
pfloat[2] = fdata.data[1];
pfloat[3] = fdata.data[0];
dataItem[0].pdata = pfloat;
//char* temp= (char*)dataItem[0].pdata;
m_PressureWriteValue = ((unsigned char*)dataItem[0].pdata);
pressureCom->m_Ref = this;
//pressureCom->m_Fun = &PowderSupplySimpleClient::ProcWriteValueXT;
pressureCom->isNeedDel = false;
pressureCom->m_PreWrite = &PowderSupplySimpleClient::ProcSetPressureValue;
m_CycleCommands.push_back(pcommand);
m_CycleCommands.push_back(pressureCom);
}
void PowderSupplySimpleClient::ProcSetPressureValue(void *pobject, Command* pcommand)
{
if (pobject == NULL)return;
PowderSupplySimpleClient* ppw = (PowderSupplySimpleClient*)pobject;
S7FLOATDATA fdata;
g_SystemInfo->LockInfo();
fdata.fValue = g_SystemInfo->m_EnvState.m_PowderJarCabinPressureVoltage;
g_SystemInfo->UnlockInfo();
unsigned char* pfloat = new unsigned char[4];
pfloat[0] = fdata.data[3];
pfloat[1] = fdata.data[2];
pfloat[2] = fdata.data[1];
pfloat[3] = fdata.data[0];
ppw->m_PressureWriteValue = (unsigned char*)pfloat;
}
void PowderSupplySimpleClient::ProcReadInfo(void *pobject, Command* pcommand)
{
S7Command* s7Command = (S7Command*)pcommand;
TS7DataItem* pdataItems = s7Command->getDataItems();
unsigned int itemcount = s7Command->getItemCount();
if (pobject == NULL || itemcount != READ_ITEM_COUNT)return;
PowderSupplySimpleClient* ppw = (PowderSupplySimpleClient*)pobject;
TS7DataItem pReq = pdataItems[0];
TS7DataItem pNet = pdataItems[1];
TS7DataItem pCtrl = pdataItems[2];
EnterCriticalSection(&ppw->m_ValueCS);
if (pReq.Result == 0) {
unsigned char* data = (unsigned char*)pReq.pdata;
ppw->m_ClientState.m_RequestDropPowder->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_DropPowderEnable->SetValue(((data[0] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_OpenDropPowderValve->SetValue(((data[0] & 04) > 0 ? true : false));
ppw->m_ClientState.m_SupplyBlockAlarm->SetValue(((data[2] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_SupplyFilterBlockAlarm->SetValue(((data[2] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_SupplyJarHangUpPowderAlarm->SetValue(((data[2] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_OxygenOverLimitAlarm->SetValue(((data[2] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_DeoxygenStartupFailed->SetValue(((data[2] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_SupplyPowderStartupFailed->SetValue(((data[2] & 0x20) > 0 ? true : false));
ppw->m_ClientState.m_OxygenDetectorOfflineAlarm->SetValue(((data[2] & 0x40) > 0 ? true : false));
ppw->m_ClientState.m_FanForceRunAlarm->SetValue(((data[2] & 0x80) > 0 ? true : false));
}
if (pNet.Result == 0)
{
unsigned char* data = (unsigned char*)pNet.pdata;
ppw->m_ClientState.m_DeoxygenActive->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_RequestSupplyPowder->SetValue(((data[0] & 0x2) > 0 ? true : false));
}
if (pCtrl.Result == 0)
{
unsigned char* data = (unsigned char*)pCtrl.pdata;
S7FLOATDATA machineOxygenTarge;
S7FLOATDATA machineOxygenAlarm;
S7FLOATDATA machineOxygenRealtime;
S7FLOATDATA pressureDif;
ppw->m_ClientState.m_PcCtrlSupply->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_ReactiveMetals->SetValue(((data[0] & 0x2) > 0 ? true : false));
// ppw->m_ClientState.m_SupplyBlockAlarm ->SetValue( ((data[0] & 0x4) > 0 ? true : false);
// ppw->m_ClientState.m_SupplyFilterBlockAlarm ->SetValue( ((data[0] & 0x8) > 0 ? true : false);
ppw->m_ClientState.m_EnableHammer->SetValue(!((data[0] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_EnableNewPowderDorpFreq->SetValue(((data[0] & 0x20) > 0 ? true : false));
machineOxygenTarge.data[0] = data[7];
machineOxygenTarge.data[1] = data[6];
machineOxygenTarge.data[2] = data[5];
machineOxygenTarge.data[3] = data[4];
machineOxygenAlarm.data[0] = data[11];
machineOxygenAlarm.data[1] = data[10];
machineOxygenAlarm.data[2] = data[9];
machineOxygenAlarm.data[3] = data[8];
machineOxygenRealtime.data[0] = data[15];
machineOxygenRealtime.data[1] = data[14];
machineOxygenRealtime.data[2] = data[13];
machineOxygenRealtime.data[3] = data[12];
ppw->m_ClientState.m_PowderValveOpenTime->SetValue((float)((data[16] & 0xff) << 8) + (data[17] & 0xff) / 10.0f);
ppw->m_ClientState.m_PowderValveCloseTime->SetValue((float)((data[18] & 0xff) << 8) + (data[19] & 0xff) / 10.0f);
ppw->m_ClientState.m_AirHammerOpenTime->SetValue((float)((data[20] & 0xff) << 8) + (data[21] & 0xff) / 10.0f);
ppw->m_ClientState.m_AirHammerCloseTime->SetValue((float)((data[22] & 0xff) << 8) + (data[23] & 0xff) / 10.0f);
pressureDif.data[0] = data[29];
pressureDif.data[1] = data[28];
pressureDif.data[2] = data[27];
pressureDif.data[3] = data[26];
ppw->m_ClientState.m_MachineOxygenTarge->SetValue(machineOxygenTarge.fValue);
ppw->m_ClientState.m_MachineOxygenAlarm->SetValue(machineOxygenAlarm.fValue);
ppw->m_ClientState.m_MachineOxygenRealtime->SetValue(machineOxygenRealtime.fValue);
ppw->m_ClientState.m_PressureDif->SetValue(pressureDif.fValue);
ppw->m_ClientState.m_SupplyBlockStopMinute->SetValue(((data[30] & 0xff) << 8) + (data[31] & 0xff));
ppw->m_ClientState.m_FanWorkTiming->SetValue(data[32]);
ppw->m_ClientState.m_FanWorkStopTime->SetValue(data[33]);
ppw->m_ClientState.m_FanCoolTime->SetValue(data[34]);
}
LeaveCriticalSection(&ppw->m_ValueCS);
}
void PowderSupplySimpleClient::GetStat(PowderSupplySimpleStat& stat)
{
EnterCriticalSection(&m_ValueCS);
memcpy_s(&stat, sizeof(PowderSupplySimpleStat), &m_ClientState, sizeof(PowderSupplySimpleStat));
LeaveCriticalSection(&m_ValueCS);
}
void PowderSupplySimpleClient::SetBit(int dindex, bool flag)
{
if (!IsServerConnected())return;
EnterCriticalSection(&m_RtcCS);
S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* items = pcommand->getDataItems();
//items[0].Area = S7AreaMK;
items[0].Area = S7AreaDB;
items[0].DBNumber = 1;
items[0].Start = dindex;
items[0].WordLen = S7WLBit;
items[0].Amount = 1;
bool* tempv = new bool[1];
tempv[0] = flag;
items[0].pdata = tempv;
pcommand->m_Ref = this;
pcommand->m_waitTime = 0;
m_RTCommands.push(pcommand);
LeaveCriticalSection(&m_RtcCS);
}
void PowderSupplySimpleClient::RequestSupplyStart()
{
SetBit(0, true);
}
void PowderSupplySimpleClient::RequestSupplyStop()
{
SetBit(0, false);
}
void PowderSupplySimpleClient::AutoSupply()
{
//if (!m_PowderPositon1 || !m_PowderPositon2 || !m_PowderPositon3 || !m_PowderPositon4 || !m_PowderPositon5)return;
//if (m_Stat.m_PowderInhaleActive)return;
if (!IsServerConnected() || !IsSignalConnected())return;
if (!m_IOCfgWrapper->IsSafeDoorClose())return;
if (!m_ClientState.m_DropPowderEnable) {
uint64_t tnow = GetTickCount64();
if (tnow - m_InfoTick > 20000) {
g_Toast->AddToast(new ToastBean(g_LngManager->Toast_SimpleSupplyDisable->ShowText(), 5000, Toast::COLOR_ORANGE));
m_InfoTick = tnow;
}
return;
}
if (m_AutoSupplyThread != INVALID_HANDLE_VALUE) return;
m_AutoSupplyFlag = true;
m_AutoSupplyThread = AtlCreateThread(AutoSupplyProc, this);
}
DWORD WINAPI PowderSupplySimpleClient::AutoSupplyProc(PowderSupplySimpleClient* _this)
{
if (_this) {
_this->AutoSupplyRun();
CloseHandle(_this->m_AutoSupplyThread);
_this->m_AutoSupplyThread = INVALID_HANDLE_VALUE;
_this->m_AutoSupplyFlag = false;
}
return 0;
}
void PowderSupplySimpleClient::StopAutoSupply()
{
m_AutoSupplyFlag = false;
if (m_AutoSupplyThread != INVALID_HANDLE_VALUE) {
if (WaitForSingleObject(m_AutoSupplyThread, 500) == WAIT_TIMEOUT)
{
TerminateThread(m_AutoSupplyThread, 1);
}
CloseHandle(m_AutoSupplyThread);
m_AutoSupplyThread = INVALID_HANDLE_VALUE;
}
RequestSupplyStop();
}
void PowderSupplySimpleClient::AutoSupplyRun()
{
g_Toast->AddToast(new ToastBean(g_LngManager->Toast_StartAutoSupplyInfo->ShowText(), 5000, Toast::COLOR_GREEN));
RequestStart();
bool isfinish = false;
uint64_t tbegin = GetTickCount64();
unsigned int autoSupplyRunTime = 0;
int disconnectTimes = 0;
bool isDisconnect = false;
bool isDoorOpen = false;
while (m_AutoSupplyFlag) {
//if (!BaseCtrl::IsStart()) {
// break;
//}
if (!m_ClientState.m_DropPowderEnable) {
break;
}
if (IsPowderEnough()) {
isfinish = true;
break;
}
uint64_t tnow = GetTickCount64();
autoSupplyRunTime =(unsigned int) tnow - tbegin;
if (autoSupplyRunTime > m_PowderEstimateCfg->m_AutoSupplyTimeoutMinute * 60 * 1000) {
isfinish = true;
break;
}
if (!IsServerConnected()) {
disconnectTimes++;
if (disconnectTimes > 120) {
isDisconnect = true;
break;
}
}
else {
disconnectTimes = 0;
}
if (!m_IOCfgWrapper->IsSafeDoorClose()) {
isDoorOpen = true;
break;
}
Sleep(500);
}
if (isDisconnect) {
g_Toast->AddToast(new ToastBean(g_LngManager->Toast_AutoSupplyDisconnectError->ShowText(), 5000, Toast::COLOR_RED));
}
if (isDoorOpen) {
g_Toast->AddToast(new ToastBean(u8"舱门打开终止送粉", 5000, Toast::COLOR_RED));
}
RequestSupplyStop();
Sleep(500);
if (isfinish) {
g_Toast->AddToast(new ToastBean(g_LngManager->Toast_SupplyFinishInfo->ShowText(), 5000, Toast::COLOR_GREEN));
}
}
bool PowderSupplySimpleClient::IsPowderEnough()
{
bool rel = true;
if (m_ExtCfg->m_UsePowderStick) {
if (g_SystemInfo->GetPowderQty()*100.0f < m_PowderEstimateCfg->m_StopSupplyQty) {
rel = false;
}
}
else {
for (size_t i = m_PowderEstimateCfg->m_StopSupplyPos; i < m_PowderEstimateCfg->m_PEVec.size(); i++) {
if (!m_PowderEstimateCfg->m_PEVec[i]->m_PosSensor->IsActive()) {
rel = false;
break;
}
}
}
return rel;
}
bool PowderSupplySimpleClient::IsAutoSuppling()
{
return (m_AutoSupplyThread != INVALID_HANDLE_VALUE);
}
void PowderSupplySimpleClient::SetReactiveMetals(bool enable)
{
SetBit(200 * 8 + 1, enable);
}
void PowderSupplySimpleClient::SetDeoxygenActive(bool enable)
{
SetBit(105 * 8, enable);
}
void PowderSupplySimpleClient::SetSupplyEnable(bool enable)
{
SetBit(105 * 8 + 1, enable);
}
void PowderSupplySimpleClient::SetPCCtrlSupply(bool enable)
{
SetBit(200 * 8, enable);
}
void PowderSupplySimpleClient::SetOpenDropPowderValve(bool enable)
{
SetBit(2, enable);
}
void PowderSupplySimpleClient::SetStartHammer(bool enable)
{
SetBit(200 * 8 + 4, enable);
}
void PowderSupplySimpleClient::SetStartNewPowderDorpFreq(bool enable)
{
SetBit(200 * 8 + 5, enable);
}
void PowderSupplySimpleClient::SetDBFloat(int dindex, float fvalue)
{
EnterCriticalSection(&m_RtcCS);
S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].DBNumber = 1;
items[0].Start = dindex;
items[0].WordLen = S7WLByte;
items[0].Amount = 4;
unsigned char* pfloat = new unsigned char[4];
S7FLOATDATA fdata;
fdata.fValue = fvalue;
pfloat[0] = fdata.data[3];
pfloat[1] = fdata.data[2];
pfloat[2] = fdata.data[1];
pfloat[3] = fdata.data[0];
items[0].pdata = pfloat;
pcommand->m_Ref = this;
//pcommand->m_Fun = &PurifierClient::ProcWriteValueXT;
m_RTCommands.push(pcommand);
LeaveCriticalSection(&m_RtcCS);
}
void PowderSupplySimpleClient::SetDBWord(int dindex, unsigned short fvalue)
{
EnterCriticalSection(&m_RtcCS);
S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].DBNumber = 1;
items[0].Start = dindex;
items[0].WordLen = S7WLByte;
items[0].Amount = 2;
unsigned char* pfloat = new unsigned char[2];
S7WORDDATA fdata;
fdata.wValue = fvalue;
pfloat[0] = fdata.data[1];
pfloat[1] = fdata.data[0];
items[0].pdata = pfloat;
pcommand->m_Ref = this;
//pcommand->m_Fun = &PurifierClient::ProcWriteValueXT;
m_RTCommands.push(pcommand);
LeaveCriticalSection(&m_RtcCS);
}
void PowderSupplySimpleClient::SetDBByte(int dindex, unsigned char fvalue)
{
EnterCriticalSection(&m_RtcCS);
S7Command* pcommand = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].DBNumber = 1;
items[0].Start = dindex;
items[0].WordLen = S7WLByte;
items[0].Amount = 1;
unsigned char* pfloat = new unsigned char[1];
// S7WORDDATA fdata;
// fdata.usValue = fvalue;
pfloat[0] = fvalue;
items[0].pdata = pfloat;
pcommand->m_Ref = this;
//pcommand->m_Fun = &PurifierClient::ProcWriteValueXT;
m_RTCommands.push(pcommand);
LeaveCriticalSection(&m_RtcCS);
}
void PowderSupplySimpleClient::SetMachineDeoxygenTarge(float fvalue)
{
SetDBFloat(204, fvalue);
}
void PowderSupplySimpleClient::SetMachineOxygenAlarm(float fvalue)
{
SetDBFloat(208, fvalue);
}
void PowderSupplySimpleClient::SetPowderValveOpenTime(unsigned short fvalue)
{
SetDBWord(216, fvalue);
}
void PowderSupplySimpleClient::SetPowderValveCloseTime(unsigned short fvalue)
{
SetDBWord(218, fvalue);
}
void PowderSupplySimpleClient::SetAirHammerOpenTime(unsigned short fvalue)
{
SetDBWord(220, fvalue);
}
void PowderSupplySimpleClient::SetAirHammerCloseTime(unsigned short fvalue)
{
SetDBWord(222, fvalue);
}
void PowderSupplySimpleClient::SetSupplyBlockStopMinute(unsigned short value)
{
SetDBWord(230, value);
}
void PowderSupplySimpleClient::SetFanWorkTiming(unsigned char value)
{
SetDBByte(232, value);
}
void PowderSupplySimpleClient::SetFanCoolTime(unsigned char value)
{
SetDBByte(234, value);
}
void PowderSupplySimpleClient::SetFanWorkStopTime(unsigned char value)
{
SetDBByte(233, value);
}
//void PowderSupplySimpleClient::DrawUI(bool* isshow)
//{
// PowderSupplySimpleStat powderSupplyStat;
// GetStat(powderSupplyStat);
// //ImGui::SetNextWindowSize(ImVec2(780, 420));
// ImGui::Begin(_(u8"供粉状态").c_str(), isshow, ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_AlwaysAutoResize);
// ImGui::BeginGroup();
//
// if (IsServerConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉端口连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉端口连接:断开").c_str());
// if (IsSignalConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉通讯连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉通讯连接:断开").c_str());
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// ImGui::Checkbox(_(u8"打印自动送粉").c_str(), &m_PowderEstimateCfg->m_AutoSupplyEnable);
// ImGui::Text(_(u8"自动送粉状态:%s").c_str(), IsAutoSuppling() ? _(u8"启动").c_str() : _(u8"停止").c_str());
// if (IsAutoSuppling()) {
// if (ImGui::Button(_(u8"中断自动送粉").c_str(), ImVec2(150, 0))) {
// StopAutoSupply();
// }
// }
//
// ImGui::Text(_(u8"自动送粉超时分钟:").c_str()); ImGui::SameLine();
// ImGui::PushID("AutoSupplyTimeoutMinute");
// ImGui::PushItemWidth(40);
// ImGui::InputScalar("", ImGuiDataType_U32, &m_PowderEstimateCfg->m_AutoSupplyTimeoutMinute, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
// ImGui::PopItemWidth();
// ImGui::PopID();
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// m_ShowAssist.m_RequestDropPowder = powderSupplyStat.m_RequestDropPowder;
// if (ImGui::Checkbox(_(u8"请求供粉").c_str(), &m_ShowAssist.m_RequestDropPowder)) {
// if (m_ShowAssist.m_RequestDropPowder) RequestSupplyStart();
// else RequestSupplyStop();
// }
//
// ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
// m_ShowAssist.m_DropPowderEnable = powderSupplyStat.m_DropPowderEnable;
// ImGui::Checkbox(_(u8"允许供粉").c_str(), &m_ShowAssist.m_DropPowderEnable);
// ImGui::PopItemFlag();
//
// m_ShowAssist.m_OpenDropPowderValve = powderSupplyStat.m_OpenDropPowderValve;
// if (ImGui::Checkbox(_(u8"开启下粉阀").c_str(), &m_ShowAssist.m_OpenDropPowderValve)) {
// SetOpenDropPowderValve(m_ShowAssist.m_OpenDropPowderValve);
// }
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// m_ShowAssist.m_DeoxygenActive = powderSupplyStat.m_DeoxygenActive;
// if (ImGui::Checkbox(_(u8"送粉机除氧").c_str(), &m_ShowAssist.m_DeoxygenActive)) {
// SetDeoxygenActive(m_ShowAssist.m_DeoxygenActive);
// }
//
// m_ShowAssist.m_RequestSupplyPowder = powderSupplyStat.m_RequestSupplyPowder;
// if (ImGui::Checkbox(_(u8"启动送粉").c_str(), &m_ShowAssist.m_RequestSupplyPowder)) {
// SetSupplyEnable(m_ShowAssist.m_RequestSupplyPowder);
// }
//
// m_ShowAssist.m_PcCtrlSupply = powderSupplyStat.m_PcCtrlSupply;
// if (ImGui::Checkbox(_(u8"PC控制送粉").c_str(), &m_ShowAssist.m_PcCtrlSupply)) {
// SetPCCtrlSupply(m_ShowAssist.m_PcCtrlSupply);
// }
//
// m_ShowAssist.m_ReactiveMetals = powderSupplyStat.m_ReactiveMetals;
// if (ImGui::Checkbox(_(u8"活性金属").c_str(), &m_ShowAssist.m_ReactiveMetals)) {
// SetReactiveMetals(m_ShowAssist.m_ReactiveMetals);
// }
//
// m_ShowAssist.m_EnableHammer = powderSupplyStat.m_EnableHammer;
// if (ImGui::Checkbox(_(u8"启动气锤").c_str(), &m_ShowAssist.m_EnableHammer)) {
// SetStartHammer(!m_ShowAssist.m_EnableHammer);
// }
//
// m_ShowAssist.m_EnableNewPowderDorpFreq = powderSupplyStat.m_EnableNewPowderDorpFreq;
// if (ImGui::Checkbox(_(u8"启用新粉下粉阀频率").c_str(), &m_ShowAssist.m_EnableNewPowderDorpFreq)) {
// SetStartNewPowderDorpFreq(m_ShowAssist.m_EnableNewPowderDorpFreq);
// }
//
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
// ImGui::PushItemWidth(120);
// m_ShowAssist.m_MachineOxygenTarge = powderSupplyStat.m_MachineOxygenTarge;
// if (ImGui::InputFloat(_(u8"送粉机除氧目标值").c_str(), &m_ShowAssist.m_MachineOxygenTarge, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineDeoxygenTarge(m_ShowAssist.m_MachineOxygenTarge);
// }
//
// m_ShowAssist.m_MachineOxygenAlarm = powderSupplyStat.m_MachineOxygenAlarm;
// if (ImGui::InputFloat(_(u8"送粉机氧报警值").c_str(), &m_ShowAssist.m_MachineOxygenAlarm, 0.0f, 0.0f, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineOxygenAlarm(m_ShowAssist.m_MachineOxygenAlarm);
// }
//
// m_ShowAssist.m_MachineOxygenRealtime = powderSupplyStat.m_MachineOxygenRealtime;
// ImGui::InputFloat(_(u8"送粉机氧含量").c_str(), &m_ShowAssist.m_MachineOxygenRealtime, 0.0f, 0.0f, "%.2f", ImGuiInputTextFlags_ReadOnly);
//
// m_ShowAssist.m_PowderValveOpenTime = powderSupplyStat.m_PowderValveOpenTime;
// if (ImGui::InputFloat(_(u8"下粉阀打开时间(s)").c_str(), &m_ShowAssist.m_PowderValveOpenTime, 0.0f, 0.0f, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPowderValveOpenTime(m_ShowAssist.m_PowderValveOpenTime * 10);
// }
//
// m_ShowAssist.m_PowderValveCloseTime = powderSupplyStat.m_PowderValveCloseTime;
// if (ImGui::InputFloat(_(u8"下粉阀关闭时间(s)").c_str(), &m_ShowAssist.m_PowderValveCloseTime, 0.0f, 0.0f, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPowderValveCloseTime(m_ShowAssist.m_PowderValveCloseTime * 10);
// }
//
// m_ShowAssist.m_AirHammerOpenTime = powderSupplyStat.m_AirHammerOpenTime;
// if (ImGui::InputFloat(_(u8"气锤打开时间(s)").c_str(), &m_ShowAssist.m_AirHammerOpenTime, 0.0f, 0.0f, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetAirHammerOpenTime(m_ShowAssist.m_AirHammerOpenTime * 10);
// }
//
// m_ShowAssist.m_AirHammerCloseTime = powderSupplyStat.m_AirHammerCloseTime;
// if (ImGui::InputFloat(_(u8"气锤关闭时间(s)").c_str(), &m_ShowAssist.m_AirHammerCloseTime, 0.0f, 0.0f, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetAirHammerCloseTime(m_ShowAssist.m_AirHammerCloseTime * 10);
// }
//
// m_ShowAssist.m_SupplyBlockStopMinute = powderSupplyStat.m_SupplyBlockStopMinute;
// if (ImGui::InputScalar(_(u8"送粉堵塞停止时间(min)").c_str(), ImGuiDataType_U16, &m_ShowAssist.m_SupplyBlockStopMinute, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyBlockStopMinute(m_ShowAssist.m_SupplyBlockStopMinute);
// }
//
// m_ShowAssist.m_FanWorkTiming = powderSupplyStat.m_FanWorkTiming;
// if (ImGui::InputScalar(_(u8"运行风机计时(min)").c_str(), ImGuiDataType_U8, &m_ShowAssist.m_FanWorkTiming, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFanWorkTiming(m_ShowAssist.m_FanWorkTiming);
// }
//
// m_ShowAssist.m_FanWorkStopTime = powderSupplyStat.m_FanWorkStopTime;
// if (ImGui::InputScalar(_(u8"风机运行停机时间(min)").c_str(), ImGuiDataType_U8, &m_ShowAssist.m_FanWorkStopTime, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFanWorkStopTime(m_ShowAssist.m_FanWorkStopTime);
// }
//
//
// m_ShowAssist.m_FanCoolTime = powderSupplyStat.m_FanCoolTime;
// if (ImGui::InputScalar(_(u8"强制风机冷却时间(min)").c_str(), ImGuiDataType_U8, &m_ShowAssist.m_FanCoolTime, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFanCoolTime(m_ShowAssist.m_FanCoolTime);
// }
// ImGui::PopItemWidth();
//
//
// //ImGui::Text(_(u8"风机运行停机时间(min)").c_str(), powderSupplyStat.m_FanWorkStopTime);
//
// ImGui::Dummy(ImVec2(0, 10));
// ImGui::PushItemWidth(130);
//
// if (m_ExtCfg->m_UsePowderStick) {
// if (ImGui::InputFloat(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StartSupplyQty < 0.0f)m_PowderEstimateCfg->m_StartSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StartSupplyQty = m_PowderEstimateCfg->m_StopSupplyQty;
// }
// if (ImGui::InputFloat(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StopSupplyQty < 0.0f)m_PowderEstimateCfg->m_StopSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StopSupplyQty = m_PowderEstimateCfg->m_StartSupplyQty;
// }
// }
// else {
// char buffer[512];
// int bufferoffset = 0;
// for (size_t i = 0; i < m_PowderEstimateCfg->m_PEVec.size(); i++) {
// bufferoffset += sprintf_s(buffer + bufferoffset, sizeof(buffer) - bufferoffset, "%s", m_PowderEstimateCfg->m_PEVec[i]->m_PosSensor->m_ShowContent.c_str());
// bufferoffset += 1;
// }
// string str(buffer, bufferoffset);
// if (ImGui::Combo(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StartSupplyPos = m_PowderEstimateCfg->m_StopSupplyPos - 1;
// }
// if (ImGui::Combo(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StopSupplyPos = m_PowderEstimateCfg->m_StartSupplyPos + 1;
// }
// }
// ImGui::PopItemWidth();
// ImGui::EndGroup();
//
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
// ImGui::Text(_(u8"送粉堵塞报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉滤芯堵塞报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyFilterBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"加粉罐挂粉报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarHangUpPowderAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"氧含量越限报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_OxygenOverLimitAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"除氧功能启动失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_DeoxygenStartupFailed) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉功能启动失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyPowderStartupFailed) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"测氧仪离线报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_OxygenDetectorOfflineAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"冷却风机强制运行报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanForceRunAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// ImGui::Text(_(u8"压差模拟量:%.2f").c_str(), g_SystemInfo->m_EnvState.m_PowderJarCabinPressureVoltage);
//
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::Spacing();
//
// ImGui::End();
//}
void PowderSupplySimpleClient2::InitCommand()
{
S7Command* pcommand = new S7Command(S7_COMMAND_READ_INFO, READ_ITEM_COUNT);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].WordLen = S7WLByte;
items[0].DBNumber = 1;
items[0].Start = 0;
items[0].Amount = 4;
items[0].pdata = new unsigned char[4];
items[1].Area = S7AreaDB;
items[1].WordLen = S7WLByte;
items[1].DBNumber = 1;
items[1].Start = 105;
items[1].Amount = 1;
items[1].pdata = new unsigned char[1];
items[2].Area = S7AreaDB;
items[2].WordLen = S7WLByte;
items[2].DBNumber = 1;
items[2].Start = 200;
items[2].Amount = 76;
items[2].pdata = new unsigned char[76];
items[3].Area = S7AreaDB;
items[3].WordLen = S7WLByte;
items[3].DBNumber = 1;
items[3].Start = 316;
items[3].Amount = 19;
items[3].pdata = new unsigned char[19];
pcommand->m_Ref = this;
pcommand->m_Fun = &PowderSupplySimpleClient2::ProcReadInfo;
pcommand->isNeedDel = false;
//写压力
S7Command* pressureCom = new S7Command(S7_COMMAND_WRITE, 1);
TS7DataItem* dataItem = pressureCom->getDataItems();
dataItem[0].Area = S7AreaDB;
dataItem[0].DBNumber = 1;
dataItem[0].Start = 226;
dataItem[0].WordLen = S7WLByte;
dataItem[0].Amount = 4;
unsigned char* pfloat = new unsigned char[4];
S7FLOATDATA fdata;
fdata.fValue = g_SystemInfo->m_EnvState.m_PowderJarCabinPressureVoltage; //ad4 压差
pfloat[0] = fdata.data[3];
pfloat[1] = fdata.data[2];
pfloat[2] = fdata.data[1];
pfloat[3] = fdata.data[0];
dataItem[0].pdata = pfloat;
//m_PressureWriteValue = (unsigned char*)dataItem[0].pdata;
m_PressureWriteValue = (unsigned char*)pfloat;
pressureCom->m_Ref = this;
//pressureCom->m_Fun = &PowderSupplySimpleClient::ProcWriteValueXT;
pressureCom->isNeedDel = false;
pressureCom->m_PreWrite = &PowderSupplySimpleClient::ProcSetPressureValue;
m_CycleCommands.push_back(pcommand);
m_CycleCommands.push_back(pressureCom);
}
void PowderSupplySimpleClient2::ProcReadInfo(void *pobject, Command* pcommand)
{
S7Command* s7Command = (S7Command*)pcommand;
TS7DataItem* pdataItems = s7Command->getDataItems();
unsigned int itemcount = s7Command->getItemCount();
if (pobject == NULL || itemcount != READ_ITEM_COUNT)return;
PowderSupplySimpleClient2* ppw = (PowderSupplySimpleClient2*)pobject;
TS7DataItem pReq = pdataItems[0];
TS7DataItem pNet = pdataItems[1];
TS7DataItem pCtrl = pdataItems[2];
TS7DataItem pTime = pdataItems[3];
EnterCriticalSection(&ppw->m_ValueCS);
if (pReq.Result == 0) {
unsigned char* data = (unsigned char*)pReq.pdata;
ppw->m_ClientState.m_RequestDropPowder->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_DropPowderEnable->SetValue(((data[0] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_OpenDropPowderValve->SetValue(((data[0] & 04) > 0 ? true : false));
ppw->m_ClientState.m_SupplyBlockAlarm->SetValue(((data[2] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_SupplyFilterBlockAlarm->SetValue(((data[2] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_SupplyJarHangUpPowderAlarm->SetValue(((data[2] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_OxygenOverLimitAlarm->SetValue(((data[2] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_DeoxygenStartupFailed->SetValue(((data[2] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_SupplyPowderStartupFailed->SetValue(((data[2] & 0x20) > 0 ? true : false));
ppw->m_ClientState.m_OxygenDetectorOfflineAlarm->SetValue(((data[2] & 0x40) > 0 ? true : false));
ppw->m_ClientState.m_FanForceRunAlarm->SetValue(((data[2] & 0x80) > 0 ? true : false));
ppw->m_ClientState.m_FanOverHeatAlarm->SetValue(((data[3] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_SupplyPowderTempAlarm->SetValue(((data[3] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_NewJarNoPowerAlarm->SetValue(((data[3] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_SupplyPowderFilterAlarm->SetValue(((data[3] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_AddPowderJarFullBlowbackAlarm->SetValue(((data[3] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_FanBlowbackAlarm->SetValue(((data[3] & 0x20) > 0 ? true : false));
}
if (pNet.Result == 0)
{
unsigned char* data = (unsigned char*)pNet.pdata;
ppw->m_ClientState.m_DeoxygenActive->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_RequestSupplyPowder->SetValue(((data[0] & 0x2) > 0 ? true : false));
}
if (pCtrl.Result == 0)
{
unsigned char* data = (unsigned char*)pCtrl.pdata;
S7FLOATDATA machineOxygenTarge;
S7FLOATDATA machineOxygenAlarm;
S7FLOATDATA machineOxygenRealtime;
S7FLOATDATA pressureDif;
S7FLOATDATA OxygenSensorUpLimit;
S7FLOATDATA SupplyPowderPressureDifUpLimit;
S7FLOATDATA SupplyPowderPressureDifDownLimit;
S7FLOATDATA SupplyPowderPressureDifValue;
S7FLOATDATA FilterPressureDifUpLimit;
S7FLOATDATA FilterPressureDifDownLimit;
S7FLOATDATA FilterPressureDifValue;
S7FLOATDATA SupplyPowderBlockPressureValue;
S7FLOATDATA FilterBlockPressureValue;
S7FLOATDATA SupplyPowderBlockWarnValue;
//ppw->m_ClientState.m_PcCtrlSupply ->SetValue( ((data[0] & 0x1) > 0 ? true : false);
ppw->m_ClientState.m_SupplyPowderDeoxygenEnable->SetValue(((data[0] & 0x2) > 0 ? true : false));
// ppw->m_ClientState.m_SupplyBlockAlarm ->SetValue( ((data[0] & 0x4) > 0 ? true : false);
// ppw->m_ClientState.m_SupplyFilterBlockAlarm ->SetValue( ((data[0] & 0x8) > 0 ? true : false);
ppw->m_ClientState.m_EnableHammer->SetValue(!((data[0] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_EnableNewPowderDorpFreq->SetValue(((data[0] & 0x20) > 0 ? true : false));
ppw->m_ClientState.m_DorpPowderPressureCompensateEnable->SetValue(((data[0] & 0x40) > 0 ? true : false));
machineOxygenTarge.data[0] = data[7];
machineOxygenTarge.data[1] = data[6];
machineOxygenTarge.data[2] = data[5];
machineOxygenTarge.data[3] = data[4];
machineOxygenAlarm.data[0] = data[11];
machineOxygenAlarm.data[1] = data[10];
machineOxygenAlarm.data[2] = data[9];
machineOxygenAlarm.data[3] = data[8];
machineOxygenRealtime.data[0] = data[15];
machineOxygenRealtime.data[1] = data[14];
machineOxygenRealtime.data[2] = data[13];
machineOxygenRealtime.data[3] = data[12];
ppw->m_ClientState.m_PowderValveOpenTime->SetValue((float)((data[16] & 0xff) << 8) + (data[17] & 0xff) / 10.0f);
ppw->m_ClientState.m_PowderValveCloseTime->SetValue((float)((data[18] & 0xff) << 8) + (data[19] & 0xff) / 10.0f);
ppw->m_ClientState.m_AirHammerOpenTime->SetValue((float)((data[20] & 0xff) << 8) + (data[21] & 0xff) / 10.0f);
ppw->m_ClientState.m_AirHammerCloseTime->SetValue((float)((data[22] & 0xff) << 8) + (data[23] & 0xff) / 10.0f);
pressureDif.data[0] = data[29];
pressureDif.data[1] = data[28];
pressureDif.data[2] = data[27];
pressureDif.data[3] = data[26];
ppw->m_ClientState.m_MachineOxygenTarge->SetValue(machineOxygenTarge.fValue);
ppw->m_ClientState.m_MachineOxygenAlarm->SetValue(machineOxygenAlarm.fValue);
ppw->m_ClientState.m_MachineOxygenRealtime->SetValue(machineOxygenRealtime.fValue);
ppw->m_ClientState.m_PressureDif->SetValue(pressureDif.fValue);
ppw->m_ClientState.m_SupplyBlockStopMinute->SetValue(((data[30] & 0xff) << 8) + (data[31] & 0xff));
ppw->m_ClientState.m_BlowbackTimes->SetValue(((data[32] & 0xff) << 8) + (data[33] & 0xff));
ppw->m_ClientState.m_BlowbackValveOpenTime->SetValue((float)((data[34] & 0xff) << 8) + (data[35] & 0xff) / 10.0f);
OxygenSensorUpLimit.data[0] = data[39];
OxygenSensorUpLimit.data[1] = data[38];
OxygenSensorUpLimit.data[2] = data[37];
OxygenSensorUpLimit.data[3] = data[36];
SupplyPowderPressureDifUpLimit.data[0] = data[43];
SupplyPowderPressureDifUpLimit.data[1] = data[42];
SupplyPowderPressureDifUpLimit.data[2] = data[41];
SupplyPowderPressureDifUpLimit.data[3] = data[40];
SupplyPowderPressureDifDownLimit.data[0] = data[47];
SupplyPowderPressureDifDownLimit.data[1] = data[46];
SupplyPowderPressureDifDownLimit.data[2] = data[45];
SupplyPowderPressureDifDownLimit.data[3] = data[44];
SupplyPowderPressureDifValue.data[0] = data[51];
SupplyPowderPressureDifValue.data[1] = data[50];
SupplyPowderPressureDifValue.data[2] = data[49];
SupplyPowderPressureDifValue.data[3] = data[48];
FilterPressureDifUpLimit.data[0] = data[55];
FilterPressureDifUpLimit.data[1] = data[54];
FilterPressureDifUpLimit.data[2] = data[53];
FilterPressureDifUpLimit.data[3] = data[52];
FilterPressureDifDownLimit.data[0] = data[59];
FilterPressureDifDownLimit.data[1] = data[58];
FilterPressureDifDownLimit.data[2] = data[57];
FilterPressureDifDownLimit.data[3] = data[56];
FilterPressureDifValue.data[0] = data[63];
FilterPressureDifValue.data[1] = data[62];
FilterPressureDifValue.data[2] = data[61];
FilterPressureDifValue.data[3] = data[60];
SupplyPowderBlockPressureValue.data[0] = data[67];
SupplyPowderBlockPressureValue.data[1] = data[66];
SupplyPowderBlockPressureValue.data[2] = data[65];
SupplyPowderBlockPressureValue.data[3] = data[64];
FilterBlockPressureValue.data[0] = data[71];
FilterBlockPressureValue.data[1] = data[70];
FilterBlockPressureValue.data[2] = data[69];
FilterBlockPressureValue.data[3] = data[68];
SupplyPowderBlockWarnValue.data[0] = data[75];
SupplyPowderBlockWarnValue.data[1] = data[74];
SupplyPowderBlockWarnValue.data[2] = data[73];
SupplyPowderBlockWarnValue.data[3] = data[72];
ppw->m_ClientState.m_OxygenSensorUpLimit->SetValue(OxygenSensorUpLimit.fValue);
ppw->m_ClientState.m_SupplyPowderPressureDifUpLimit->SetValue(SupplyPowderPressureDifUpLimit.fValue);
ppw->m_ClientState.m_SupplyPowderPressureDifDownLimit->SetValue(SupplyPowderPressureDifDownLimit.fValue);
ppw->m_ClientState.m_SupplyPowderPressureDifValue->SetValue(SupplyPowderPressureDifValue.fValue);
ppw->m_ClientState.m_FilterPressureDifUpLimit->SetValue(FilterPressureDifUpLimit.fValue);
ppw->m_ClientState.m_FilterPressureDifDownLimit->SetValue(FilterPressureDifDownLimit.fValue);
ppw->m_ClientState.m_FilterPressureDifValue->SetValue(FilterPressureDifValue.fValue);
ppw->m_ClientState.m_SupplyPowderBlockPressureValue->SetValue(SupplyPowderBlockPressureValue.fValue);
ppw->m_ClientState.m_FilterBlockPressureValue->SetValue(FilterBlockPressureValue.fValue);
ppw->m_ClientState.m_SupplyPowderBlockWarnValue->SetValue(SupplyPowderBlockWarnValue.fValue);
}
if (pTime.Result == 0)
{
unsigned char* data = (unsigned char*)pTime.pdata;
ppw->m_ClientState.m_PocketAerateTime->SetValue((float)((data[0] & 0xff) << 8) + (data[1] & 0xff) / 10.0f);
ppw->m_ClientState.m_WorkFanStopDelayTime->SetValue((float)((data[2] & 0xff) << 8) + (data[3] & 0xff) / 10.0f);
ppw->m_ClientState.m_DropPowderValveOpenKeepTime->SetValue((float)((data[4] & 0xff) << 8) + (data[5] & 0xff) / 10.0f);
ppw->m_ClientState.m_AddPowderUpLimitSenseTime->SetValue((float)((data[6] & 0xff) << 8) + (data[7] & 0xff) / 10.0f);
ppw->m_ClientState.m_Version->SetValue(data[18]); //版本
}
LeaveCriticalSection(&ppw->m_ValueCS);
}
//void PowderSupplySimpleClient2::DrawUI(bool* isshow)
//{
// PowderSupplySimpleStat powderSupplyStat;
// GetStat(powderSupplyStat);
// //ImGui::SetNextWindowSize(ImVec2(780, 420));
// ImGui::Begin(_(u8"供粉状态").c_str(), isshow, ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_AlwaysAutoResize);
// ImGui::BeginGroup();
//
// if (IsServerConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉端口连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉端口连接:断开").c_str());
// if (IsSignalConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉通讯连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉通讯连接:断开").c_str());
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// ImGui::Checkbox(_(u8"打印自动送粉").c_str(), &m_PowderEstimateCfg->m_AutoSupplyEnable);
// ImGui::Text(_(u8"自动送粉状态:%s").c_str(), IsAutoSuppling() ? _(u8"启动").c_str() : _(u8"停止").c_str());
// if (IsAutoSuppling()) {
// if (ImGui::Button(_(u8"中断自动送粉").c_str(), ImVec2(150, 0))) {
// StopAutoSupply();
// }
// }
//
// ImGui::Text(_(u8"自动送粉超时分钟:").c_str()); ImGui::SameLine();
// ImGui::PushID("AutoSupplyTimeoutMinute");
// ImGui::PushItemWidth(40);
// ImGui::InputScalar("", ImGuiDataType_U32, &m_PowderEstimateCfg->m_AutoSupplyTimeoutMinute, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
// ImGui::PopItemWidth();
// ImGui::PopID();
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// m_ShowAssist.m_RequestDropPowder = powderSupplyStat.m_RequestDropPowder;
// if (ImGui::Checkbox(_(u8"请求供粉").c_str(), &m_ShowAssist.m_RequestDropPowder)) {
// if (m_ShowAssist.m_RequestDropPowder) RequestSupplyStart();
// else RequestSupplyStop();
// }
//
// ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
// m_ShowAssist.m_DropPowderEnable = powderSupplyStat.m_DropPowderEnable;
// ImGui::Checkbox(_(u8"允许供粉").c_str(), &m_ShowAssist.m_DropPowderEnable);
// ImGui::PopItemFlag();
//
// m_ShowAssist.m_OpenDropPowderValve = powderSupplyStat.m_OpenDropPowderValve;
// if (ImGui::Checkbox(_(u8"开启下粉阀").c_str(), &m_ShowAssist.m_OpenDropPowderValve)) {
// SetOpenDropPowderValve(m_ShowAssist.m_OpenDropPowderValve);
// }
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// m_ShowAssist.m_DeoxygenActive = powderSupplyStat.m_DeoxygenActive;
// if (ImGui::Checkbox(_(u8"送粉机除氧").c_str(), &m_ShowAssist.m_DeoxygenActive)) {
// SetDeoxygenActive(m_ShowAssist.m_DeoxygenActive);
// }
//
// m_ShowAssist.m_RequestSupplyPowder = powderSupplyStat.m_RequestSupplyPowder;
// if (ImGui::Checkbox(_(u8"启动送粉").c_str(), &m_ShowAssist.m_RequestSupplyPowder)) {
// SetSupplyEnable(m_ShowAssist.m_RequestSupplyPowder);
// }
//
// m_ShowAssist.m_EnableHammer = powderSupplyStat.m_EnableHammer;
// if (ImGui::Checkbox(_(u8"启动气锤").c_str(), &m_ShowAssist.m_EnableHammer)) {
// SetStartHammer(!m_ShowAssist.m_EnableHammer);
// }
//
// m_ShowAssist.m_EnableNewPowderDorpFreq = powderSupplyStat.m_EnableNewPowderDorpFreq;
// if (ImGui::Checkbox(_(u8"启用新粉下粉阀频率").c_str(), &m_ShowAssist.m_EnableNewPowderDorpFreq)) {
// SetStartNewPowderDorpFreq(m_ShowAssist.m_EnableNewPowderDorpFreq);
// }
//
// m_ShowAssist.m_DorpPowderPressureCompensateEnable = powderSupplyStat.m_DorpPowderPressureCompensateEnable;
// if (ImGui::Checkbox(_(u8"启用下粉补压").c_str(), &m_ShowAssist.m_DorpPowderPressureCompensateEnable)) {
// SetStartDorpPowderPressureCompensateEnable(m_ShowAssist.m_DorpPowderPressureCompensateEnable);
// }
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
// ImGui::PushItemWidth(100);
// m_ShowAssist.m_MachineOxygenTarge = powderSupplyStat.m_MachineOxygenTarge;
// if (ImGui::InputFloat(_(u8"送粉机除氧目标值").c_str(), &m_ShowAssist.m_MachineOxygenTarge, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineDeoxygenTarge(m_ShowAssist.m_MachineOxygenTarge);
// }
//
// m_ShowAssist.m_MachineOxygenAlarm = powderSupplyStat.m_MachineOxygenAlarm;
// if (ImGui::InputFloat(_(u8"送粉机氧报警值").c_str(), &m_ShowAssist.m_MachineOxygenAlarm, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineOxygenAlarm(m_ShowAssist.m_MachineOxygenAlarm);
// }
//
// m_ShowAssist.m_MachineOxygenRealtime = powderSupplyStat.m_MachineOxygenRealtime;
// ImGui::InputFloat(_(u8"送粉机氧含量").c_str(), &m_ShowAssist.m_MachineOxygenRealtime, 0, 0, "%.2f", ImGuiInputTextFlags_ReadOnly);
//
// m_ShowAssist.m_OxygenSensorUpLimit = powderSupplyStat.m_OxygenSensorUpLimit;
// if (ImGui::InputFloat(_(u8"送粉机测氧仪上限(%)").c_str(), &m_ShowAssist.m_OxygenSensorUpLimit, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetOxygenSensorUpLimit(m_ShowAssist.m_OxygenSensorUpLimit);
// }
//
// m_ShowAssist.m_SupplyPowderPressureDifUpLimit = powderSupplyStat.m_SupplyPowderPressureDifUpLimit;
// if (ImGui::InputFloat(_(u8"送粉压差上限(kpa)").c_str(), &m_ShowAssist.m_SupplyPowderPressureDifUpLimit, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyPowderPressureDifUpLimit(m_ShowAssist.m_SupplyPowderPressureDifUpLimit);
// }
//
// m_ShowAssist.m_SupplyPowderPressureDifDownLimit = powderSupplyStat.m_SupplyPowderPressureDifDownLimit;
// if (ImGui::InputFloat(_(u8"送粉压差下限(kpa)").c_str(), &m_ShowAssist.m_SupplyPowderPressureDifDownLimit, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyPowderPressureDifDownLimit(m_ShowAssist.m_SupplyPowderPressureDifDownLimit);
// }
//
// m_ShowAssist.m_SupplyPowderPressureDifValue = powderSupplyStat.m_SupplyPowderPressureDifValue;
// ImGui::InputFloat(_(u8"送粉压差实际值(kpa)").c_str(), &m_ShowAssist.m_SupplyPowderPressureDifValue, 0, 0, "%.2f", ImGuiInputTextFlags_ReadOnly);
//
// ImGui::PopItemWidth();
//
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
//
// ImGui::PushItemWidth(100);
// m_ShowAssist.m_FilterPressureDifUpLimit = powderSupplyStat.m_FilterPressureDifUpLimit;
// if (ImGui::InputFloat(_(u8"滤芯压差上限(kpa)").c_str(), &m_ShowAssist.m_FilterPressureDifUpLimit, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFilterPressureDifUpLimit(m_ShowAssist.m_FilterPressureDifUpLimit);
// }
//
// m_ShowAssist.m_FilterPressureDifDownLimit = powderSupplyStat.m_FilterPressureDifDownLimit;
// if (ImGui::InputFloat(_(u8"滤芯压差下限(kpa)").c_str(), &m_ShowAssist.m_FilterPressureDifDownLimit, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFilterPressureDifDownLimit(m_ShowAssist.m_FilterPressureDifDownLimit);
// }
//
// m_ShowAssist.m_FilterPressureDifValue = powderSupplyStat.m_FilterPressureDifValue;
// ImGui::InputFloat(_(u8"滤压差实际值(kpa)").c_str(), &m_ShowAssist.m_FilterPressureDifValue, 0, 0, "%.2f", ImGuiInputTextFlags_ReadOnly);
//
// m_ShowAssist.m_SupplyPowderBlockPressureValue = powderSupplyStat.m_SupplyPowderBlockPressureValue;
// if (ImGui::InputFloat(_(u8"送粉堵塞压力值(kpa)").c_str(), &m_ShowAssist.m_SupplyPowderBlockPressureValue, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyPowderBlockPressureValue(m_ShowAssist.m_SupplyPowderBlockPressureValue);
// }
//
// m_ShowAssist.m_FilterBlockPressureValue = powderSupplyStat.m_FilterBlockPressureValue;
// if (ImGui::InputFloat(_(u8"滤芯堵塞压力值(kpa)").c_str(), &m_ShowAssist.m_FilterBlockPressureValue, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetFilterBlockPressureValue(m_ShowAssist.m_FilterBlockPressureValue);
// }
//
// m_ShowAssist.m_SupplyPowderBlockWarnValue = powderSupplyStat.m_SupplyPowderBlockWarnValue;
// if (ImGui::InputFloat(_(u8"送粉堵塞预警值(kpa)").c_str(), &m_ShowAssist.m_SupplyPowderBlockWarnValue, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyPowderBlockWarnValue(m_ShowAssist.m_SupplyPowderBlockWarnValue);
// }
//
// m_ShowAssist.m_PowderValveOpenTime = powderSupplyStat.m_PowderValveOpenTime;
// if (ImGui::InputFloat(_(u8"下粉阀打开时间(s)").c_str(), &m_ShowAssist.m_PowderValveOpenTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPowderValveOpenTime(m_ShowAssist.m_PowderValveOpenTime * 10);
// }
//
// m_ShowAssist.m_PowderValveCloseTime = powderSupplyStat.m_PowderValveCloseTime;
// if (ImGui::InputFloat(_(u8"下粉阀关闭时间(s)").c_str(), &m_ShowAssist.m_PowderValveCloseTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPowderValveCloseTime(m_ShowAssist.m_PowderValveCloseTime * 10);
// }
//
// m_ShowAssist.m_AirHammerOpenTime = powderSupplyStat.m_AirHammerOpenTime;
// if (ImGui::InputFloat(_(u8"气锤打开时间(s)").c_str(), &m_ShowAssist.m_AirHammerOpenTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetAirHammerOpenTime(m_ShowAssist.m_AirHammerOpenTime * 10);
// }
//
// m_ShowAssist.m_AirHammerCloseTime = powderSupplyStat.m_AirHammerCloseTime;
// if (ImGui::InputFloat(_(u8"气锤关闭时间(s)").c_str(), &m_ShowAssist.m_AirHammerCloseTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetAirHammerCloseTime(m_ShowAssist.m_AirHammerCloseTime * 10);
// }
//
// m_ShowAssist.m_SupplyBlockStopMinute = powderSupplyStat.m_SupplyBlockStopMinute;
// if (ImGui::InputScalar(_(u8"送粉堵塞停止时间(min)").c_str(), ImGuiDataType_U16, &m_ShowAssist.m_SupplyBlockStopMinute, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyBlockStopMinute(m_ShowAssist.m_SupplyBlockStopMinute);
// }
//
// m_ShowAssist.m_BlowbackTimes = powderSupplyStat.m_BlowbackTimes;
// if (ImGui::InputScalar(_(u8"反吹次数").c_str(), ImGuiDataType_U16, &m_ShowAssist.m_BlowbackTimes, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetBlowbackTimes(m_ShowAssist.m_BlowbackTimes);
// }
//
// m_ShowAssist.m_BlowbackValveOpenTime = powderSupplyStat.m_BlowbackValveOpenTime;
// if (ImGui::InputFloat(_(u8"反吹阀打开时间(s)").c_str(), &m_ShowAssist.m_BlowbackValveOpenTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetBlowbackValveOpenTime(m_ShowAssist.m_BlowbackValveOpenTime * 10);
// }
//
// m_ShowAssist.m_PocketAerateTime = powderSupplyStat.m_PocketAerateTime;
// if (ImGui::InputFloat(_(u8"气包充气时间(s)").c_str(), &m_ShowAssist.m_PocketAerateTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPocketAerateTime(m_ShowAssist.m_PocketAerateTime * 10);
// }
//
// m_ShowAssist.m_WorkFanStopDelayTime = powderSupplyStat.m_WorkFanStopDelayTime;
// if (ImGui::InputFloat(_(u8"运行风机停止延时(s)").c_str(), &m_ShowAssist.m_WorkFanStopDelayTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetWorkFanStopDelayTime(m_ShowAssist.m_WorkFanStopDelayTime * 10);
// }
//
// m_ShowAssist.m_DropPowderValveOpenKeepTime = powderSupplyStat.m_DropPowderValveOpenKeepTime;
// if (ImGui::InputFloat(_(u8"加粉下粉阀打开保持时间(s)").c_str(), &m_ShowAssist.m_DropPowderValveOpenKeepTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetDropPowderValveOpenKeepTime(m_ShowAssist.m_DropPowderValveOpenKeepTime * 10);
// }
//
// m_ShowAssist.m_AddPowderUpLimitSenseTime = powderSupplyStat.m_AddPowderUpLimitSenseTime;
// if (ImGui::InputFloat(_(u8"加粉上限感应时间(s)").c_str(), &m_ShowAssist.m_AddPowderUpLimitSenseTime, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetAddPowderUpLimitSenseTime(m_ShowAssist.m_AddPowderUpLimitSenseTime * 10);
// }
//
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
// if (m_ExtCfg->m_UsePowderStick) {
// if (ImGui::InputFloat(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StartSupplyQty < 0.0f)m_PowderEstimateCfg->m_StartSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StartSupplyQty = m_PowderEstimateCfg->m_StopSupplyQty;
// }
// if (ImGui::InputFloat(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StopSupplyQty < 0.0f)m_PowderEstimateCfg->m_StopSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StopSupplyQty = m_PowderEstimateCfg->m_StartSupplyQty;
// }
// }
// else {
// char buffer[512];
// int bufferoffset = 0;
// for (size_t i = 0; i < m_PowderEstimateCfg->m_PEVec.size(); i++) {
// bufferoffset += sprintf_s(buffer + bufferoffset, sizeof(buffer) - bufferoffset, "%s", m_PowderEstimateCfg->m_PEVec[i]->m_PosSensor->m_Content.c_str());
// bufferoffset += 1;
// }
// string str(buffer, bufferoffset);
// if (ImGui::Combo(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StartSupplyPos = m_PowderEstimateCfg->m_StopSupplyPos - 1;
// }
// if (ImGui::Combo(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StopSupplyPos = m_PowderEstimateCfg->m_StartSupplyPos + 1;
// }
// }
// ImGui::PopItemWidth();
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
//
//
// ImGui::Text(_(u8"送粉堵塞报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉滤芯堵塞报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyFilterBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"加粉罐挂粉报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarHangUpPowderAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"氧含量越限报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_OxygenOverLimitAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"除氧功能启动失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_DeoxygenStartupFailed) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉功能启动失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyPowderStartupFailed) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"测氧仪离线报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_OxygenDetectorOfflineAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"冷却风机强制运行报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanForceRunAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"风机过热报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanOverHeatAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉温度报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyPowderTempAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"新粉罐无粉报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_NewJarNoPowerAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉滤芯报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyPowderFilterAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"粉罐满粉无法反吹报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_AddPowderJarFullBlowbackAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"风机反吹报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanBlowbackAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
// ImGui::Text(_(u8"压差模拟量:%.2f").c_str(), g_SystemInfo->m_EnvState.m_PowderJarCabinPressureVoltage);
// ImGui::Text(_(u8"版本:%d").c_str(), powderSupplyStat.m_Version);
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::Spacing();
// ImGui::End();
//}
void PowderSupplySimpleClient2::SetStartDorpPowderPressureCompensateEnable(bool enable)
{
SetBit(200 * 8 + 6, enable);
}
void PowderSupplySimpleClient2::SetOxygenSensorUpLimit(float fvalue)
{
SetDBFloat(236, fvalue);
}
void PowderSupplySimpleClient2::SetSupplyPowderPressureDifUpLimit(float fvalue) {
SetDBFloat(240, fvalue);
}
void PowderSupplySimpleClient2::SetSupplyPowderPressureDifDownLimit(float fvalue) {
SetDBFloat(244, fvalue);
}
void PowderSupplySimpleClient2::SetFilterPressureDifUpLimit(float fvalue) {
SetDBFloat(252, fvalue);
}
void PowderSupplySimpleClient2::SetFilterPressureDifDownLimit(float fvalue) {
SetDBFloat(256, fvalue);
}
void PowderSupplySimpleClient2::SetSupplyPowderBlockPressureValue(float fvalue) {
SetDBFloat(264, fvalue);
}
void PowderSupplySimpleClient2::SetFilterBlockPressureValue(float fvalue) {
SetDBFloat(268, fvalue);
}
void PowderSupplySimpleClient2::SetSupplyPowderBlockWarnValue(float fvalue) {
SetDBFloat(272, fvalue);
}
void PowderSupplySimpleClient2::SetBlowbackTimes(unsigned short svalue) {
SetDBWord(232, svalue);
}
void PowderSupplySimpleClient2::SetBlowbackValveOpenTime(unsigned short svalue) {
SetDBWord(234, svalue);
}
void PowderSupplySimpleClient2::SetPocketAerateTime(unsigned short svalue) {
SetDBWord(316, svalue);
}
void PowderSupplySimpleClient2::SetWorkFanStopDelayTime(unsigned short svalue) {
SetDBWord(318, svalue);
}
void PowderSupplySimpleClient2::SetDropPowderValveOpenKeepTime(unsigned short svalue) {
SetDBWord(320, svalue);
}
void PowderSupplySimpleClient2::SetAddPowderUpLimitSenseTime(unsigned short svalue) {
SetDBWord(322, svalue);
}
void PowderSupplySimpleClient3::InitCommand()
{
S7Command* pcommand = new S7Command(S7_COMMAND_READ_INFO, READ_ITEM_COUNT);
TS7DataItem* items = pcommand->getDataItems();
items[0].Area = S7AreaDB;
items[0].WordLen = S7WLByte;
items[0].DBNumber = 1;
items[0].Start = 30;
items[0].Amount = 24;
items[0].pdata = new unsigned char[24];
items[1].Area = S7AreaDB;
items[1].WordLen = S7WLByte;
items[1].DBNumber = 1;
items[1].Start = 82;
items[1].Amount = 4;
items[1].pdata = new unsigned char[4];
items[2].Area = S7AreaDB;
items[2].WordLen = S7WLByte;
items[2].DBNumber = 1;
items[2].Start = 116;
items[2].Amount = 8;
items[2].pdata = new unsigned char[8];
items[3].Area = S7AreaDB;
items[3].WordLen = S7WLByte;
items[3].DBNumber = 1;
items[3].Start = 136;
items[3].Amount = 4;
items[3].pdata = new unsigned char[4];
items[4].Area = S7AreaDB;
items[4].WordLen = S7WLByte;
items[4].DBNumber = 1;
items[4].Start = 201;
items[4].Amount = 35;
items[4].pdata = new unsigned char[35];
items[5].Area = S7AreaDB;
items[5].WordLen = S7WLByte;
items[5].DBNumber = 1;
items[5].Start = 397;
items[5].Amount = 2;
items[5].pdata = new unsigned char[2];
pcommand->m_Ref = this;
pcommand->m_Fun = &PowderSupplySimpleClient3::ProcReadInfo;
pcommand->isNeedDel = false;
m_CycleCommands.push_back(pcommand);
}
void PowderSupplySimpleClient3::ProcReadInfo(void *pobject, Command* pcommand)
{
S7Command* s7Command = (S7Command*)pcommand;
TS7DataItem* pdataItems = s7Command->getDataItems();
unsigned int itemcount = s7Command->getItemCount();
if (pobject == NULL || itemcount != READ_ITEM_COUNT)return;
PowderSupplySimpleClient3* ppw = (PowderSupplySimpleClient3*)pobject;
TS7DataItem sec0 = pdataItems[0];
TS7DataItem sec1 = pdataItems[1];
TS7DataItem sec2 = pdataItems[2];
TS7DataItem sec3 = pdataItems[3];
TS7DataItem sec4 = pdataItems[4];
TS7DataItem sec5 = pdataItems[5];
EnterCriticalSection(&ppw->m_ValueCS);
if (sec0.Result == 0) {
unsigned char* data = (unsigned char*)sec0.pdata;
ppw->m_ClientState.m_SupplyBlockPreProcValue->SetValue(FLOATDATA(false, &data[0]).fValue);
ppw->m_ClientState.m_MachineOxygenTarge->SetValue(FLOATDATA(false, &data[4]).fValue);
ppw->m_ClientState.m_MachineOxygenAlarm->SetValue(FLOATDATA(false, &data[8]).fValue);
ppw->m_ClientState.m_PowerCarNoPowderValue->SetValue(FLOATDATA(false, &data[12]).fValue);
ppw->m_ClientState.m_SupplyReleasePressureValue->SetValue(FLOATDATA(false, &data[16]).fValue);
ppw->m_ClientState.m_SupplyStopReleasePressureValue->SetValue(FLOATDATA(false, &data[20]).fValue);
}
if (sec1.Result == 0)
{
unsigned char* data = (unsigned char*)sec1.pdata;
ppw->m_ClientState.m_InverterFreqSetValue->SetValue(FLOATDATA(false, &data[0]).fValue);
}
if (sec2.Result == 0)
{
unsigned char* data = (unsigned char*)sec2.pdata;
ppw->m_ClientState.m_DropPowderNeedDeoxygenValue->SetValue(FLOATDATA(false, &data[0]).fValue);
ppw->m_ClientState.m_DropPowderDeoxygenTargetValue->SetValue(FLOATDATA(false, &data[4]).fValue);
}
if (sec3.Result == 0)
{
unsigned char* data = (unsigned char*)sec3.pdata;
ppw->m_ClientState.m_SupplyDifPressureWarnValue->SetValue(FLOATDATA(false, &data[0]).fValue);
}
if (sec4.Result==0) {
unsigned char* data = (unsigned char*)sec4.pdata;
ppw->m_ClientState.m_DeoxygenActive->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_RequestSupplyPowder->SetValue(((data[0] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_BlowbackActive->SetValue(((data[0] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_OpenDropPowderValve->SetValue(((data[0] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_DropPowderEnable->SetValue(((data[0] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_SupplyPressure->SetValue(FLOATDATA(false, &data[1]).fValue);
ppw->m_ClientState.m_SupplyJarPressure->SetValue(FLOATDATA(false, &data[5]).fValue);
ppw->m_ClientState.m_MachineOxygenRealtime->SetValue(FLOATDATA(false, &data[9]).fValue);
ppw->m_ClientState.m_PowderCarWeight->SetValue(FLOATDATA(false, &data[13]).fValue);
ppw->m_ClientState.m_WorkGasPressure->SetValue(FLOATDATA(false, &data[17]).fValue);
ppw->m_ClientState.m_CompressGasPressure->SetValue(FLOATDATA(false, &data[21]).fValue);
ppw->m_ClientState.m_SupplyDifPressure->SetValue(FLOATDATA(false, &data[27]).fValue);
ppw->m_ClientState.m_DropDifPressure->SetValue(FLOATDATA(false, &data[31]).fValue);
}
if (sec5.Result == 0) {
unsigned char* data = (unsigned char*)sec5.pdata;
ppw->m_ClientState.m_SupplyJarEnterValveOpenAlarm->SetValue(((data[0] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_SupplyJarReturnValveOpenAlarm->SetValue(((data[0] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_ExhaustOpenAlarm->SetValue(((data[0] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_FanRevTurnAlarm->SetValue(((data[0] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_StopButtonPressDown->SetValue(((data[0] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_NoDropPowderWarn->SetValue(((data[0] & 0x20) > 0 ? true : false));
ppw->m_ClientState.m_CompressGasPressureLeakAlarm->SetValue(((data[1] & 0x1) > 0 ? true : false));
ppw->m_ClientState.m_WorkGasPressureLeakAlarm->SetValue(((data[1] & 0x2) > 0 ? true : false));
ppw->m_ClientState.m_NoPowderWarn->SetValue(((data[1] & 0x4) > 0 ? true : false));
ppw->m_ClientState.m_InverterAlarm->SetValue(((data[1] & 0x8) > 0 ? true : false));
ppw->m_ClientState.m_SupplyJarFilterBlockAlarm->SetValue(((data[1] & 0x10) > 0 ? true : false));
ppw->m_ClientState.m_SupplyBlockAlarm->SetValue(((data[1] & 0x20) > 0 ? true : false));
ppw->m_ClientState.m_FanEnterValveOpenAlarm->SetValue(((data[1] & 0x40) > 0 ? true : false));
ppw->m_ClientState.m_SupplyJarDropValveCloseAlarm->SetValue(((data[1] & 0x80) > 0 ? true : false));
}
LeaveCriticalSection(&ppw->m_ValueCS);
}
void PowderSupplySimpleClient3::SetDeoxygenActive(bool enable)
{
SetBit(201 * 8, enable);
}
void PowderSupplySimpleClient3::SetSupplyEnable(bool enable)
{
SetBit(201 * 8+1, enable);
}
void PowderSupplySimpleClient3::SetBlowbackActive(bool enable)
{
SetBit(201 * 8 + 2, enable);
}
void PowderSupplySimpleClient3::SetOpenDropPowderValve(bool enable)
{
SetBit(201 * 8 + 3, enable);
}
void PowderSupplySimpleClient3::ResetAlarm()
{
SetBit(201 * 8 + 5,true);
}
void PowderSupplySimpleClient3::SetSupplyBlockPreProcValue(float fvalue)
{
SetDBFloat(30, fvalue);
}
void PowderSupplySimpleClient3::SetMachineDeoxygenTarge(float fvalue)
{
SetDBFloat(34, fvalue);
}
void PowderSupplySimpleClient3::SetMachineOxygenAlarm(float fvalue)
{
SetDBFloat(38, fvalue);
}
void PowderSupplySimpleClient3::SetPowerCarNoPowderValue(float fvalue)
{
SetDBFloat(42, fvalue);
}
void PowderSupplySimpleClient3::SetSupplyReleasePressureValue(float fvalue)
{
SetDBFloat(46, fvalue);
}
void PowderSupplySimpleClient3::SetSupplyStopReleasePressureValue(float fvalue)
{
SetDBFloat(50, fvalue);
}
void PowderSupplySimpleClient3::SetInverterFreqSetValue(float fvalue)
{
SetDBFloat(82, fvalue);
}
void PowderSupplySimpleClient3::SetDropPowderNeedDeoxygenValue(float fvalue)
{
SetDBFloat(116, fvalue);
}
void PowderSupplySimpleClient3::SetDropPowderDeoxygenTargetValue(float fvalue)
{
SetDBFloat(120, fvalue);
}
void PowderSupplySimpleClient3::SetSupplyDifPressureWarnValue(float fvalue)
{
SetDBFloat(136, fvalue);
}
void PowderSupplySimpleClient3::RequestStart()
{
if (!m_ClientState.m_RequestSupplyPowder) {
SetSupplyEnable(true);
Sleep(500);
}
}
void PowderSupplySimpleClient3::RequestSupplyStop()
{
SetSupplyEnable(false);
}
//void PowderSupplySimpleClient3::DrawUI(bool* isshow)
//{
// PowderSupplySimpleStat powderSupplyStat;
// GetStat(powderSupplyStat);
// //ImGui::SetNextWindowSize(ImVec2(780, 420));
// ImGui::Begin(_(u8"供粉状态").c_str(), isshow, ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_AlwaysAutoResize);
// ImGui::BeginGroup();
//
// if (IsServerConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉端口连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉端口连接:断开").c_str());
// if (IsSignalConnected())ImGui::TextColored(ImVec4(0.0, 1.0, 0.0, 1.0), _(u8"供粉通讯连接:正常").c_str());
// else ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), _(u8"供粉通讯连接:断开").c_str());
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// ImGui::Checkbox(_(u8"打印自动送粉").c_str(), &m_PowderEstimateCfg->m_AutoSupplyEnable);
// ImGui::Text(_(u8"自动送粉状态:%s").c_str(), IsAutoSuppling() ? _(u8"启动").c_str() : _(u8"停止").c_str());
// if (IsAutoSuppling()) {
// if (ImGui::Button(_(u8"中断自动送粉").c_str(), ImVec2(150, 0))) {
// StopAutoSupply();
// }
// }
//
// ImGui::Text(_(u8"自动送粉超时分钟:").c_str()); ImGui::SameLine();
// ImGui::PushID("AutoSupplyTimeoutMinute");
// ImGui::PushItemWidth(40);
// ImGui::InputScalar("", ImGuiDataType_U32, &m_PowderEstimateCfg->m_AutoSupplyTimeoutMinute, 0, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
// ImGui::PopItemWidth();
// ImGui::PopID();
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
//
// ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
// m_ShowAssist.m_DropPowderEnable = powderSupplyStat.m_DropPowderEnable;
// ImGui::Checkbox(_(u8"允许供粉").c_str(), &m_ShowAssist.m_DropPowderEnable);
// ImGui::PopItemFlag();
//
// m_ShowAssist.m_DeoxygenActive = powderSupplyStat.m_DeoxygenActive;
// if (ImGui::Checkbox(_(u8"送粉机除氧").c_str(), &m_ShowAssist.m_DeoxygenActive)) {
// SetDeoxygenActive(m_ShowAssist.m_DeoxygenActive);
// }
//
// m_ShowAssist.m_RequestSupplyPowder = powderSupplyStat.m_RequestSupplyPowder;
// if (ImGui::Checkbox(_(u8"启动送粉").c_str(), &m_ShowAssist.m_RequestSupplyPowder)) {
// SetSupplyEnable(m_ShowAssist.m_RequestSupplyPowder);
// }
//
// m_ShowAssist.m_BlowbackActive = powderSupplyStat.m_BlowbackActive;
// if (ImGui::Checkbox(_(u8"反吹启动").c_str(), &m_ShowAssist.m_BlowbackActive)) {
// SetBlowbackActive(!m_ShowAssist.m_BlowbackActive);
// }
//
// m_ShowAssist.m_OpenDropPowderValve = powderSupplyStat.m_OpenDropPowderValve;
// if (ImGui::Checkbox(_(u8"开启下粉阀").c_str(), &m_ShowAssist.m_OpenDropPowderValve)) {
// SetOpenDropPowderValve(m_ShowAssist.m_OpenDropPowderValve);
// }
//
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
// ImGui::Text(_(u8"送粉压力:%.1f KPa").c_str(), powderSupplyStat.m_SupplyPressure);
// ImGui::Text(_(u8"上加粉罐压力:%.1f KPa").c_str(), powderSupplyStat.m_SupplyJarPressure);
// ImGui::Text(_(u8"送粉机氧含量:%.1f PPM").c_str(), powderSupplyStat.m_MachineOxygenRealtime);
// ImGui::Text(_(u8"小车称重:%.1f Kg").c_str(), powderSupplyStat.m_PowderCarWeight);
// ImGui::Text(_(u8"工作气压力:%.1f MPa").c_str(), powderSupplyStat.m_WorkGasPressure);
// ImGui::Text(_(u8"压缩气压力:%.1f MPa").c_str(), powderSupplyStat.m_CompressGasPressure);
// ImGui::Text(_(u8"送粉压差值:%.1f KPa").c_str(), powderSupplyStat.m_SupplyDifPressure);
// ImGui::Text(_(u8"落粉压差值:%.1f KPa").c_str(), powderSupplyStat.m_DropDifPressure);
//
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
//
// ImGui::PushItemWidth(100);
//
// m_ShowAssist.m_SupplyBlockPreProcValue = powderSupplyStat.m_SupplyBlockPreProcValue;
// if (ImGui::InputFloat(_(u8"送粉堵塞预处理KPa").c_str(), &m_ShowAssist.m_SupplyBlockPreProcValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyBlockPreProcValue(m_ShowAssist.m_SupplyBlockPreProcValue);
// }
//
// m_ShowAssist.m_MachineOxygenTarge = powderSupplyStat.m_MachineOxygenTarge;
// if (ImGui::InputFloat(_(u8"送粉机除氧目标值").c_str(), &m_ShowAssist.m_MachineOxygenTarge, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineDeoxygenTarge(m_ShowAssist.m_MachineOxygenTarge);
// }
//
// m_ShowAssist.m_MachineOxygenAlarm = powderSupplyStat.m_MachineOxygenAlarm;
// if (ImGui::InputFloat(_(u8"送粉机氧报警值").c_str(), &m_ShowAssist.m_MachineOxygenAlarm, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetMachineOxygenAlarm(m_ShowAssist.m_MachineOxygenAlarm);
// }
//
// m_ShowAssist.m_PowerCarNoPowderValue = powderSupplyStat.m_PowerCarNoPowderValue;
// if (ImGui::InputFloat(_(u8"小车无粉值").c_str(), &m_ShowAssist.m_PowerCarNoPowderValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetPowerCarNoPowderValue(m_ShowAssist.m_PowerCarNoPowderValue);
// }
//
// m_ShowAssist.m_SupplyReleasePressureValue = powderSupplyStat.m_SupplyReleasePressureValue;
// if (ImGui::InputFloat(_(u8"供粉机泄压值KPA").c_str(), &m_ShowAssist.m_SupplyReleasePressureValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyReleasePressureValue(m_ShowAssist.m_SupplyReleasePressureValue);
// }
//
// m_ShowAssist.m_SupplyStopReleasePressureValue = powderSupplyStat.m_SupplyStopReleasePressureValue;
// if (ImGui::InputFloat(_(u8"供粉机压力停止泄压值").c_str(), &m_ShowAssist.m_SupplyStopReleasePressureValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyStopReleasePressureValue(m_ShowAssist.m_SupplyStopReleasePressureValue);
// }
//
// m_ShowAssist.m_InverterFreqSetValue = powderSupplyStat.m_InverterFreqSetValue;
// if (ImGui::InputFloat(_(u8"变频器频率设定值Hz").c_str(), &m_ShowAssist.m_InverterFreqSetValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetInverterFreqSetValue(m_ShowAssist.m_InverterFreqSetValue);
// }
//
// m_ShowAssist.m_DropPowderNeedDeoxygenValue = powderSupplyStat.m_DropPowderNeedDeoxygenValue;
// if (ImGui::InputFloat(_(u8"下粉时需要除氧值PPM").c_str(), &m_ShowAssist.m_DropPowderNeedDeoxygenValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetDropPowderNeedDeoxygenValue(m_ShowAssist.m_DropPowderNeedDeoxygenValue);
// }
//
// m_ShowAssist.m_DropPowderDeoxygenTargetValue = powderSupplyStat.m_DropPowderDeoxygenTargetValue;
// if (ImGui::InputFloat(_(u8"下粉除氧目标值PPM").c_str(), &m_ShowAssist.m_DropPowderDeoxygenTargetValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetDropPowderDeoxygenTargetValue(m_ShowAssist.m_DropPowderDeoxygenTargetValue);
// }
//
// m_ShowAssist.m_SupplyDifPressureWarnValue = powderSupplyStat.m_SupplyDifPressureWarnValue;
// if (ImGui::InputFloat(_(u8"送粉压差堵塞预警值KPA").c_str(), &m_ShowAssist.m_SupplyDifPressureWarnValue, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
// {
// SetSupplyDifPressureWarnValue(m_ShowAssist.m_SupplyDifPressureWarnValue);
// }
//
// ImGui::Dummy(ImVec2(0.0f, 15.0f));
// if (m_ExtCfg->m_UsePowderStick) {
// if (ImGui::InputFloat(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StartSupplyQty < 0.0f)m_PowderEstimateCfg->m_StartSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StartSupplyQty = m_PowderEstimateCfg->m_StopSupplyQty;
// }
// if (ImGui::InputFloat(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyQty, 0, 0, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue)) {
// if (m_PowderEstimateCfg->m_StopSupplyQty < 0.0f)m_PowderEstimateCfg->m_StopSupplyQty = 0.0f;
// if (m_PowderEstimateCfg->m_StartSupplyQty > m_PowderEstimateCfg->m_StopSupplyQty)m_PowderEstimateCfg->m_StopSupplyQty = m_PowderEstimateCfg->m_StartSupplyQty;
// }
// }
// else {
// char buffer[512];
// int bufferoffset = 0;
// for (size_t i = 0; i < m_PowderEstimateCfg->m_PEVec.size(); i++) {
// bufferoffset += sprintf_s(buffer + bufferoffset, sizeof(buffer) - bufferoffset, "%s", m_PowderEstimateCfg->m_PEVec[i]->m_PosSensor->m_ShowContent.c_str());
// bufferoffset += 1;
// }
// string str(buffer, bufferoffset);
// if (ImGui::Combo(_(u8"开始补粉位").c_str(), &m_PowderEstimateCfg->m_StartSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StartSupplyPos = m_PowderEstimateCfg->m_StopSupplyPos - 1;
// }
// if (ImGui::Combo(_(u8"结束补粉位").c_str(), &m_PowderEstimateCfg->m_StopSupplyPos, str.data()))
// {
// if (m_PowderEstimateCfg->m_StartSupplyPos >= m_PowderEstimateCfg->m_StopSupplyPos)m_PowderEstimateCfg->m_StopSupplyPos = m_PowderEstimateCfg->m_StartSupplyPos + 1;
// }
// }
// ImGui::PopItemWidth();
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
// ImGui::SameLine();
//
// ImGui::BeginGroup();
//
//
// ImGui::Text(_(u8"上加粉罐进粉阀打开失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarEnterValveOpenAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"上加粉罐回气阀打开失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarReturnValveOpenAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"排气挡板打开失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_ExhaustOpenAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"风机反转报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanRevTurnAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"压缩气压力不足报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_CompressGasPressureLeakAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"工作气压力不足:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_WorkGasPressureLeakAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"无粉警告:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_NoPowderWarn) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"变频器报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_InverterAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"加粉罐滤芯堵塞:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarFilterBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"送粉堵塞报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyBlockAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
//
// ImGui::Text(_(u8"风机进风阀打开失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanEnterValveOpenAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"风机进风阀打开失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_FanEnterValveOpenAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"上加粉罐落粉阀关闭失败报警:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_SupplyJarDropValveCloseAlarm) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"紧急开关已按下:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_StopButtonPressDown) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// ImGui::Text(_(u8"无落粉警告:").c_str()); ImGui::SameLine();
// if (powderSupplyStat.m_NoDropPowderWarn) {
// ImGui::TextColored(Toast::COLOR_RED, _(u8"是").c_str());
// }
// else ImGui::TextColored(Toast::COLOR_GREEN, _(u8"否").c_str());
//
// if (ImGui::Button(_(u8"报警复位").c_str()))
// {
// ResetAlarm();
// }
//
// ImGui::EndGroup();
// ImGui::SameLine(0, 20);
// ImGui::Spacing();
// ImGui::End();
//}