GrpcPrint/PrintC/Machine/Machine.cpp
2024-04-01 18:26:14 +08:00

112 lines
4.2 KiB
C++

#include "Machine.h"
#include "../external/imgui/imgui.h"
#include "../external/imgui/imgui_internal.h"
#include "HBD1000.h"
#include "HBD1200.h"
#include "HBD1200OLD.h"
#include "HBD1500.h"
#include "HBDE1000.h"
Machine::Machine(MachineTypeCfg::MachineTypeId type) {
}
Machine::~Machine() {
}
Machine* Machine::CreateInstance(int type)
{
Machine* machine = nullptr;
if (type == MachineTypeCfg::HBD_1000) {
machine = new HBD1000(MachineTypeCfg::MachineTypeId(type));
}
else if (type == MachineTypeCfg::HBD_1500) {
machine = new HBD1500(MachineTypeCfg::MachineTypeId(type));
}
else if (type == MachineTypeCfg::HBD_1200_OLD) {
machine = new HBD1200OLD(MachineTypeCfg::MachineTypeId(type));
}
else if (type == MachineTypeCfg::HBD_1200) {
machine = new HBD1200(MachineTypeCfg::MachineTypeId(type));
}
else if (type == MachineTypeCfg::HBD_E1000) {
machine = new HBDE1000(MachineTypeCfg::MachineTypeId(type));
}
return machine;
}
void Machine::DrawAnalogExt()
{
EnvUIAssist* ui = m_SysParamWrapper->GetEnvUIAssist();
ImGui::SameLine();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::InputFloat(_(u8"清粉箱除氧设定值").c_str(), ui->m_CleanBoxDeoxygenSetValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanBoxDeoxygenSetValue->SetValue(ui->m_CleanBoxDeoxygenSetValue->GetValue());
}
if (ImGui::InputFloat(_(u8"清粉箱测氧仪下限").c_str(), ui->m_CleanBoxOxygenDownLimit->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanBoxOxygenDownLimit->SetValue(ui->m_CleanBoxOxygenDownLimit->GetValue());
}
if (ImGui::InputFloat(_(u8"清粉箱测氧仪上限").c_str(), ui->m_CleanBoxOxygenUpLimit->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanBoxOxygenUpLimit->SetValue(ui->m_CleanBoxOxygenUpLimit->GetValue());
}
if (ImGui::InputFloat(_(u8"清粉箱泄压值").c_str(), ui->m_CleanBoxPressureReleaseValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanBoxPressureReleaseValue->SetValue(ui->m_CleanBoxPressureReleaseValue->GetValue());
}
if (ImGui::InputFloat(_(u8"打印小车1报警重量").c_str(), ui->m_PrintCar1AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_PrintCar1AlarmWeight->SetValue(ui->m_PrintCar1AlarmWeight->GetValue());
}
if (ImGui::InputFloat(_(u8"打印小车2报警重量").c_str(), ui->m_PrintCar2AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_PrintCar2AlarmWeight->SetValue(ui->m_PrintCar2AlarmWeight->GetValue());
}
if (ImGui::InputFloat(_(u8"清粉小车1报警重量").c_str(), ui->m_CleanCar1AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanCar1AlarmWeight->SetValue(ui->m_CleanCar1AlarmWeight->GetValue());
}
if (ImGui::InputFloat(_(u8"清粉小车2报警重量").c_str(), ui->m_CleanCar2AlarmWeight->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_CleanCar2AlarmWeight->SetValue(ui->m_CleanCar2AlarmWeight->GetValue());
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::InputFloat(_(u8"料位棒长度").c_str(), ui->m_PowderLevelLength->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_PowderLevelLength->SetValue(ui->m_PowderLevelLength->GetValue());
}
//wxxtest
//if (ImGui::InputFloat(_(u8"料位棒计算长度").c_str(), &m_RunCfg->m_PowderStickCalcLength, 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
//{
// if (m_RunCfg->m_PowderStickCalcLength <= 0.0f) {
// m_RunCfg->m_PowderStickCalcLength = 1.0f;
// }
//}
if (ImGui::InputFloat(_(u8"料位棒当前值").c_str(), ui->m_PowderLevelValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_PowderLevelValue->SetValue(ui->m_PowderLevelValue->GetValue());
}
if (ImGui::InputFloat(_(u8"打印室换气泄压值").c_str(), ui->m_PrintAirRenewalPresRelValue->GetUIValue(), 0, 0, "%.2f", ImGuiInputTextFlags_EnterReturnsTrue))
{
ui->m_PrintAirRenewalPresRelValue->SetValue(ui->m_PrintAirRenewalPresRelValue->GetValue());
}
ImGui::EndGroup();
}