|
|
@ -27,8 +27,6 @@ using namespace iflytop; |
|
|
|
static MainWindow *m_mainWindow; |
|
|
|
static QTDataChannel G_QTDataChannel; |
|
|
|
|
|
|
|
static int PublicState_DeviceIDVal = 0; |
|
|
|
|
|
|
|
QT_REQUIRE_CONFIG(groupbox); |
|
|
|
|
|
|
|
#define TAG "MainWindow"
|
|
|
@ -233,8 +231,6 @@ MainWindow::~MainWindow() { delete ui; } |
|
|
|
void MainWindow::processException(const zexception &e) { //
|
|
|
|
ZQUI::ins()->ishow("%s", e.what()); |
|
|
|
} |
|
|
|
int32_t MainWindow::getDeviceId() { return PublicState_DeviceIDVal; } |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 泵机控制接口 * |
|
|
|
***********************************************************************************************************************/ |
|
|
@ -356,36 +352,98 @@ void MainWindow::constructDrawBarDisinfectionBoxTab() { // |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::construct_largeSpaceDisinfectionTab() { |
|
|
|
void MainWindow::construct_largeSpaceDisinfectionTab(bool smallSpace) { |
|
|
|
//
|
|
|
|
|
|
|
|
int targetId = kFixBoardId_LiquidCtrl; |
|
|
|
|
|
|
|
ZQVTabPage *tab = new ZQVTabPage(ui->buttonTabWidget, "大空间消毒机"); |
|
|
|
ZQVTabPage *tab; |
|
|
|
if (!smallSpace) { |
|
|
|
tab = new ZQVTabPage(ui->buttonTabWidget, "大空间消毒机"); |
|
|
|
} else { |
|
|
|
tab = new ZQVTabPage(ui->buttonTabWidget, "小空间消毒机"); |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
ZQFunctionListBox *minpowerboard_box = new ZQFunctionListBox(tab, "液路板", 4); |
|
|
|
ZQFunctionListBox *liquid_board = new ZQFunctionListBox(tab, "液路板", 4); |
|
|
|
|
|
|
|
constructPumpControlUI(liquid_board, kFixBoardId_LiquidCtrl); // 泵机控制接口
|
|
|
|
liquid_board->newFunc("压力传感器总线-读数据", {"subid"}, //
|
|
|
|
[this](int argn, const char **args) { |
|
|
|
int32_t val = IflytopCanbusMaster::ins()->pressure_sensor_bus_read_data(kFixBoardId_LiquidCtrl, atoi(args[0])); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
liquid_board->newFunc("压力传感器总线-设置上报周期", {"periodms"}, //
|
|
|
|
[this](int argn, const char **args) { IflytopCanbusMaster::ins()->pressure_sensor_bus_set_report_period_ms(kFixBoardId_LiquidCtrl, atoi(args[0])); }); |
|
|
|
liquid_board->newFunc("报警灯控制", {"r", "g", "b", "w"}, //
|
|
|
|
[this](int argn, const char **args) { IflytopCanbusMaster::ins()->triple_warning_light_ctl(kFixBoardId_LiquidCtrl, atoi(args[0]), atoi(args[1]), atoi(args[2]), atoi(args[3])); }); |
|
|
|
liquid_board->newFunc("读取-蒸发桶水浸传感器-状态", {}, //
|
|
|
|
[this](int argn, const char **args) { |
|
|
|
int state = IflytopCanbusMaster::ins()->evaporation_bin_water_sensor_read_state(kFixBoardId_LiquidCtrl); |
|
|
|
ZQUI::ins()->ishow("state:%d", state); |
|
|
|
}); |
|
|
|
liquid_board->newFunc("读取-设备底部水浸传感器-状态", {}, //
|
|
|
|
[this](int argn, const char **args) { |
|
|
|
int state = IflytopCanbusMaster::ins()->device_bottom_water_sensor_read_state(kFixBoardId_LiquidCtrl); |
|
|
|
ZQUI::ins()->ishow("state:%d", state); |
|
|
|
}); |
|
|
|
|
|
|
|
ZQFunctionListBox *powerboard = new ZQFunctionListBox(tab, "大功率板", 4); |
|
|
|
powerboard->newFunc("风机控制", {"power"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->blower_ctrl(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("风机安全阀控制", {"valve_state"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->blower_ctrl_safe_valve(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("风机读取电流", {}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->blower_read_electric_current(kFixBoardId_PowerControl); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
powerboard->newFunc("空压机控制", {"power"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->air_compressor_ctrl(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("空压机安全阀控制", {"valve_state"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->air_compressor_ctrl_safe_valve(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("空压机读取电流", {}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->air_compressor_read_electric_current(kFixBoardId_PowerControl); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
powerboard->newFunc("加热器控制", {"power"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->heater_ctrl(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("加热器安全阀控制", {"valve_state"}, [this](int argn, const char **args) { IflytopCanbusMaster::ins()->heater_ctrl_safe_valve(kFixBoardId_PowerControl, atoi(args[0])); }); |
|
|
|
powerboard->newFunc("加热器读取电流", {}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->heater_read_electric_current(kFixBoardId_PowerControl); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
powerboard->newFunc("加热器读取温度数据", {}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->heater_read_temperature_data(kFixBoardId_PowerControl); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
powerboard->newFunc("H2O2传感器读取校准日期", {}, [this](int argn, const char **args) { |
|
|
|
int32_t year, month, day; |
|
|
|
IflytopCanbusMaster::ins()->h2o2_sensor_read_calibration_date(kFixBoardId_PowerControl, &year, &month, &day); |
|
|
|
ZQUI::ins()->ishow("year:%d,month:%d,day:%d", year, month, day); |
|
|
|
}); |
|
|
|
powerboard->newFunc("H2O2传感器读取IC错误码", {}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->h2o2_sensor_read_sub_ic_errorcode(kFixBoardId_PowerControl); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
powerboard->newFunc("H2O2传感器读取IC寄存器", {"reg", "num"}, [this](int argn, const char **args) { |
|
|
|
uint8_t *val = IflytopCanbusMaster::ins()->h2o2_sensor_read_sub_ic_reg(kFixBoardId_PowerControl, atoi(args[0]), atoi(args[1])); |
|
|
|
ZQUI::ins()->ishow("val:%s", zhex2str(val, atoi(args[1]) * 2).c_str()); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::construct_H2O2ExtSensorBoardTab() { |
|
|
|
ZQVTabPage *tab; |
|
|
|
tab = new ZQVTabPage(ui->buttonTabWidget, "远端探头"); |
|
|
|
|
|
|
|
constructPumpControlUI(minpowerboard_box, targetId); // 泵机控制接口
|
|
|
|
minpowerboard_box->newFunc("压力传感器总线-读数据", {"subid"}, //
|
|
|
|
[this, targetId](int argn, const char **args) { |
|
|
|
int32_t val = IflytopCanbusMaster::ins()->pressure_sensor_bus_read_data(targetId, atoi(args[0])); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
minpowerboard_box->newFunc("压力传感器总线-设置上报周期", {"periodms"}, //
|
|
|
|
[this, targetId](int argn, const char **args) { IflytopCanbusMaster::ins()->pressure_sensor_bus_set_report_period_ms(targetId, atoi(args[0])); }); |
|
|
|
minpowerboard_box->newFunc("报警灯控制", {"r", "g", "b", "w"}, //
|
|
|
|
[this, targetId](int argn, const char **args) { IflytopCanbusMaster::ins()->triple_warning_light_ctl(targetId, atoi(args[0]), atoi(args[1]), atoi(args[2]), atoi(args[3])); }); |
|
|
|
minpowerboard_box->newFunc("读取-蒸发桶水浸传感器-状态", {}, //
|
|
|
|
[this, targetId](int argn, const char **args) { |
|
|
|
int state = IflytopCanbusMaster::ins()->evaporation_bin_water_sensor_read_state(targetId); |
|
|
|
ZQUI::ins()->ishow("state:%d", state); |
|
|
|
}); |
|
|
|
minpowerboard_box->newFunc("读取-设备底部水浸传感器-状态", {}, //
|
|
|
|
[this, targetId](int argn, const char **args) { |
|
|
|
int state = IflytopCanbusMaster::ins()->device_bottom_water_sensor_read_state(targetId); |
|
|
|
ZQUI::ins()->ishow("state:%d", state); |
|
|
|
}); |
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "远端探头板", 4); |
|
|
|
box->newFunc("H2O2传感器读取校准日期", {"boardid"}, [this](int argn, const char **args) { |
|
|
|
int32_t year, month, day; |
|
|
|
IflytopCanbusMaster::ins()->h2o2_sensor_read_calibration_date(atoi(args[0]), &year, &month, &day); |
|
|
|
ZQUI::ins()->ishow("year:%d,month:%d,day:%d", year, month, day); |
|
|
|
}); |
|
|
|
box->newFunc("H2O2传感器读取IC错误码", {"boardid"}, [this](int argn, const char **args) { |
|
|
|
int val = IflytopCanbusMaster::ins()->h2o2_sensor_read_sub_ic_errorcode(atoi(args[0])); |
|
|
|
ZQUI::ins()->ishow("val:%d", val); |
|
|
|
}); |
|
|
|
box->newFunc("H2O2传感器读取IC寄存器", {"boardid", "reg", "num"}, [this](int argn, const char **args) { |
|
|
|
uint8_t *val = IflytopCanbusMaster::ins()->h2o2_sensor_read_sub_ic_reg(atoi(args[0]), atoi(args[1]), atoi(args[2])); |
|
|
|
ZQUI::ins()->ishow("val:%s", zhex2str(val, atoi(args[2]) * 2).c_str()); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -393,7 +451,9 @@ void MainWindow::constructAppUI() { |
|
|
|
//
|
|
|
|
constructCommonOperationTab(); |
|
|
|
constructDrawBarDisinfectionBoxTab(); |
|
|
|
construct_largeSpaceDisinfectionTab(); |
|
|
|
construct_largeSpaceDisinfectionTab(false); // 大空间
|
|
|
|
construct_largeSpaceDisinfectionTab(true); // 小空间
|
|
|
|
construct_H2O2ExtSensorBoardTab(); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::processReportPacket(packet_type_t type, uint8_t from, uint8_t to, uint8_t *hex, uint32_t hexlen) { |
|
|
@ -425,8 +485,8 @@ void MainWindow::processReportPacket(packet_type_t type, uint8_t from, uint8_t t |
|
|
|
else if (frame->function_id == kreport_h2o2_sensor_data) { |
|
|
|
report_h2o2_data_t *ack = (report_h2o2_data_t *)frame->params; |
|
|
|
QString info; |
|
|
|
info.append(fmt("[H2O2 ][FROM:%03d] suid:%d,err:%d h2o2:%d (x10ppm),humid:%d (x10),temp:%d (x10),saturation:%d (x10)", //
|
|
|
|
from, ack->subid, ack->sensor_error, ack->h2o2, ack->humid, ack->temp, ack->saturation)); |
|
|
|
info.append(fmt("[H2O2 ][FROM:%03d] err:%d h2o2:%d (x10ppm),hum:%d (x10),temp:%d (x10),sat:%d (x10)", //
|
|
|
|
from, ack->sensor_error, ack->h2o2, ack->humid, ack->temp, ack->saturation)); |
|
|
|
ZQUI::ins()->rshow(info.toStdString().c_str()); |
|
|
|
} |
|
|
|
//
|
|
|
@ -441,8 +501,6 @@ void MainWindow::processReportPacket(packet_type_t type, uint8_t from, uint8_t t |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::on_PublicState_ConfirmKey_clicked() { PublicState_DeviceIDVal = ui->PublicState_DeviceID->toPlainText().toInt(); } |
|
|
|
|
|
|
|
void MainWindow::on_clearPreview_clicked() { |
|
|
|
// ZQUI()->
|
|
|
|
} |