#include "adjust_page.h" #include "ui_adjust_page.h" #include "IMEKeyBoard/keyboard_num.h" #include "Common/mymessagebox.h" #include "Common/classxml.h" Adjust_Page::Adjust_Page(QWidget *parent,Work_Thread *thread) : customDialog(parent), ui(new Ui::Adjust_Page) { ui->setupUi(this); work_thread = thread; ui->btn_start_discharge->setEnabled(true); ui->btn_stop->setEnabled(false); intCurrInput = false; extCurrInput = false; onlineVolInput = false; groupVolInput = false; intCurrSlope = 1.0000; extCurrSlope = 1.0000; onlineVolSlope = 1.0000; groupVolSlope = 1.0000; showifwrite = false; work_type = 0;//放电 ClassXML::ReadAdjParamXml(adjParam); adjParamNew = adjParam; set_btn_beep(ui->tabWidget,SIGNAL(currentChanged(int))); set_btn_beep(ui->tabWidget_2,SIGNAL(currentChanged(int))); set_btn_beep(ui->ledit_olvol,SIGNAL(custom_click())); set_btn_beep(ui->ledit_gvol,SIGNAL(custom_click())); set_btn_beep(ui->ledit_incurr,SIGNAL(custom_click())); set_btn_beep(ui->ledit_extcurr,SIGNAL(custom_click())); set_btn_beep(ui->ledit_temp,SIGNAL(custom_click())); // set_btn_beep(ui->ledit_relaytest,SIGNAL(custom_click())); set_btn_beep(ui->btn_adjust_online,SIGNAL(pressed())); set_btn_beep(ui->btn_reset_onlinevol,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_group,SIGNAL(pressed())); set_btn_beep(ui->btn_reset_groupvol,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_inner,SIGNAL(pressed())); set_btn_beep(ui->btn_reset_dischage,SIGNAL(pressed())); set_btn_beep(ui->btn_clear_dischage,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_exter,SIGNAL(pressed())); set_btn_beep(ui->btn_reset_clamp,SIGNAL(pressed())); set_btn_beep(ui->btn_clear_clamp,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_temp,SIGNAL(pressed())); set_btn_beep(ui->btn_start_discharge,SIGNAL(pressed())); set_btn_beep(ui->btn_stop,SIGNAL(pressed())); set_btn_beep(ui->pushButton_Exit,SIGNAL(pressed())); set_btn_beep(ui->pushButton_Exit_2,SIGNAL(pressed())); set_btn_beep(ui->btn_start_charge,SIGNAL(pressed())); // set_btn_beep(ui->btn_relay_test,SIGNAL(pressed())); // set_btn_beep(ui->btn_relay_teststop,SIGNAL(pressed())); connect(ui->ledit_olvol,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_gvol,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_incurr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_extcurr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_temp,SIGNAL(custom_click()),this,SLOT(leditAction())); // connect(ui->ledit_relaytest,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_adjust_online,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_reset_onlinevol,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_group,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_reset_groupvol,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_inner,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_reset_dischage,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_clear_dischage,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_exter,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_reset_clamp,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_clear_clamp,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_temp,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_start_discharge,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_stop,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->pushButton_Exit,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->pushButton_Exit_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_start_charge,SIGNAL(released()),this,SLOT(BtnReleased())); // connect(ui->btn_relay_test,SIGNAL(released()),this,SLOT(BtnReleased())); // connect(ui->btn_relay_teststop,SIGNAL(released()),this,SLOT(BtnReleased())); //TAB1 //tab1 set_btn_beep(ui->ledit_zeroVol,SIGNAL(custom_click())); set_btn_beep(ui->ledit_vol,SIGNAL(custom_click())); set_btn_beep(ui->btn_zeroVol,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_vol,SIGNAL(pressed())); connect(ui->ledit_zeroVol,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_vol,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_zeroVol,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_vol,SIGNAL(released()),this,SLOT(BtnReleased())); //tab2 set_btn_beep(ui->ledit_zeroVol_2,SIGNAL(custom_click())); set_btn_beep(ui->ledit_vol2,SIGNAL(custom_click())); set_btn_beep(ui->btn_zeroVol_2,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_vol2,SIGNAL(pressed())); set_btn_beep(ui->btn_clearGRAdj,SIGNAL(pressed())); set_btn_beep(ui->btn_clearONAdj,SIGNAL(pressed())); connect(ui->ledit_zeroVol_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_vol2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_zeroVol_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_vol2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_clearGRAdj,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_clearONAdj,SIGNAL(released()),this,SLOT(BtnReleased())); //tab3 set_btn_beep(ui->ledit_setDisCurr,SIGNAL(custom_click())); set_btn_beep(ui->ledit_trueCurr,SIGNAL(custom_click())); set_btn_beep(ui->ledit_zeroCurr,SIGNAL(custom_click())); set_btn_beep(ui->btn_startDis,SIGNAL(pressed())); set_btn_beep(ui->btn_stopDis,SIGNAL(pressed())); set_btn_beep(ui->btn_adjustCurr,SIGNAL(pressed())); set_btn_beep(ui->btn_zeroCurr,SIGNAL(pressed())); set_btn_beep(ui->ledit_OnLinVolOffset,SIGNAL(custom_click())); set_btn_beep(ui->ledit_GpVolOffset,SIGNAL(custom_click())); set_btn_beep(ui->edit_NowFre,SIGNAL(custom_click())); set_btn_beep(ui->edit_AdjFre,SIGNAL(custom_click())); set_btn_beep(ui->edit_NowAddr,SIGNAL(custom_click())); set_btn_beep(ui->edit_AdjAddr,SIGNAL(custom_click())); set_btn_beep(ui->ledit_monid_2,SIGNAL(custom_click())); set_btn_beep(ui->ledit_monvol_2,SIGNAL(custom_click())); set_btn_beep(ui->btn_OnLinVolOffset,SIGNAL(pressed())); set_btn_beep(ui->btn_GpVolAdjOffset,SIGNAL(pressed())); set_btn_beep(ui->Btn_Addr,SIGNAL(pressed())); set_btn_beep(ui->Btn_fre,SIGNAL(pressed())); set_btn_beep(ui->btn_adjust_monvol_2,SIGNAL(pressed())); set_btn_beep(ui->Btn_clear,SIGNAL(pressed())); connect(ui->ledit_OnLinVolOffset,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_GpVolOffset,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->edit_NowFre,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->edit_AdjFre,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->edit_NowAddr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->edit_AdjAddr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_monid_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_monvol_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_OnLinVolOffset,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_GpVolAdjOffset,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->Btn_Addr,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->Btn_fre,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjust_monvol_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->Btn_clear,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->ledit_setDisCurr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_zeroCurr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_trueCurr,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_zeroCurr,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_startDis,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_stopDis,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjustCurr,SIGNAL(released()),this,SLOT(BtnReleased())); //tab4 set_btn_beep(ui->ledit_setDisCurr_2,SIGNAL(custom_click())); set_btn_beep(ui->ledit_trueCurr_2,SIGNAL(custom_click())); set_btn_beep(ui->ledit_zeroCurr_2,SIGNAL(custom_click())); set_btn_beep(ui->btn_startDis_2,SIGNAL(pressed())); set_btn_beep(ui->btn_stopDis_2,SIGNAL(pressed())); set_btn_beep(ui->btn_adjustCurr_2,SIGNAL(pressed())); set_btn_beep(ui->btn_zeroCurr_2,SIGNAL(pressed())); connect(ui->ledit_setDisCurr_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_zeroCurr_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_trueCurr_2,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_zeroCurr_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_startDis_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_stopDis_2,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjustCurr_2,SIGNAL(released()),this,SLOT(BtnReleased())); //tab5 set_btn_beep(ui->ledit_zeroCurr_3,SIGNAL(custom_click())); set_btn_beep(ui->ledit_trueCurr_3,SIGNAL(custom_click())); set_btn_beep(ui->btn_zeroCurr_3,SIGNAL(pressed())); set_btn_beep(ui->btn_adjustCurr_3,SIGNAL(pressed())); connect(ui->ledit_zeroCurr_3,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_trueCurr_3,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->btn_zeroCurr_3,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_adjustCurr_3,SIGNAL(released()),this,SLOT(BtnReleased())); //tab6 ui->edit_monaddr->setText("0"); set_btn_beep(ui->btn_monoffset,SIGNAL(pressed())); set_btn_beep(ui->btn_monslope,SIGNAL(pressed())); set_btn_beep(ui->btn_clearmonadj,SIGNAL(pressed())); set_btn_beep(ui->ledit_mon_offset,SIGNAL(custom_click())); set_btn_beep(ui->ledit_mon_slope,SIGNAL(custom_click())); set_btn_beep(ui->ledit_mon_offsetshow,SIGNAL(custom_click())); set_btn_beep(ui->ledit_mon_slopeshow,SIGNAL(custom_click())); set_btn_beep(ui->edit_monaddr,SIGNAL(custom_click())); connect(ui->btn_monoffset,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_monslope,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->btn_clearmonadj,SIGNAL(released()),this,SLOT(BtnReleased())); connect(ui->ledit_mon_offset,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_mon_slope,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_mon_offsetshow,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->ledit_mon_slopeshow,SIGNAL(custom_click()),this,SLOT(leditAction())); connect(ui->edit_monaddr,SIGNAL(custom_click()),this,SLOT(leditAction())); qRegisterMetaType("ADJ_PARAM_XML"); connect(this,SIGNAL(SendAdjParam(ADJ_PARAM_XML)),work_thread,SLOT(RecvAdjParam(ADJ_PARAM_XML))); connect(this,SIGNAL(SendCurrAdjCMD(int,int)),work_thread,SLOT(RecvCurrAdjCMD(int,int))); connect(this,SIGNAL(SendPowerCtrlCMD(int,QString)),work_thread,SLOT(RecvSysCtrlCMD(int,QString))); connect(this,SIGNAL(SendAdjCmd(int,quint16)),work_thread,SLOT(RecvAdjCmd(int,quint16))); connect(this,SIGNAL(setMonAddrandFre(int,quint16,quint16)),work_thread,SLOT(RecvMonAddrandFre(int,quint16,quint16))); connect(work_thread,SIGNAL(sendAddrFreResult(int,int)),this,SLOT(RecvAddrFreResult(int,int))); ui->tabWidget_2->removeTab(2); { ui->tabWidget->removeTab(1); } memset(&monAdj,0,sizeof(monAdj)); ClassXML::ReadSetMonData(&monAdj,sizeof(monAdj)); monomerAdjIndex = 0; monomerDataUpdate = true; monAdj.NowFre = work_thread->sysParam.monomer_fre; monAdj.NowAddr = 1; monAdj.AdjAddr = 1; monAdj.AdjFre = 0; AdjPageData(); initpage(); ShowMonData(); timer = new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(AdjPageData())); timer->setInterval(500); timer->start(); // if(work_thread->localData.SoftVersion == 0) // { // ui->tabWidget_2->setTabEnabled(0,false); // ui->tabWidget_2->setTabEnabled(1,false); // ui->tabWidget_2->setTabEnabled(2,false); // } if(work_thread->sysParam.OnlineOffVol!=0) ui->btn_clearONAdj->setEnabled(true); else ui->btn_clearONAdj->setEnabled(false); if(work_thread->sysParam.GroupOffVol!=0) ui->btn_clearGRAdj->setEnabled(true); else ui->btn_clearGRAdj->setEnabled(false); connect(ui->tabWidget_2,SIGNAL(currentChanged(int)),this,SLOT(tabwidget_2currentChanged(int))); } Adjust_Page::~Adjust_Page() { qDebug("adjust page delete!"); delete timer; delete ui; } void Adjust_Page::BtnReleased() { QPushButton *pb = dynamic_cast(sender()); if(pb == ui->pushButton_Exit || pb == ui->pushButton_Exit_2) { if( work_type == 1) emit SendPowerCtrlCMD(work_thread->CMD_Adj_StopDis,NULL); else if( work_type == 2) emit SendPowerCtrlCMD(work_thread->CMD_Adj_StopChr,NULL); work_type = 0; work_thread->set_readmode(MODE_CYCLE); closeCustom(false); } else if(pb == ui->btn_adjust_online) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } /* adjParam.onlinevol_slope = adjParamNew.onlinevol_slope; emit SendAdjParam(adjParam); ClassXML::ModifyAdjParamXml(adjParam); ui->ledit_olvol->setStyleSheet("color:black"); */ int slope = (int)(onlineVolSlope*10000); onlineVolSlope = 1.0000; if(true == onlineVolInput) { onlineVolInput = false; emit SendCurrAdjCMD(work_thread->CMD_SetOnlineVolSlope,slope); } ui->ledit_olvol->setStyleSheet("color:black"); } else if(pb == ui->btn_reset_onlinevol) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } onlineVolSlope = 1.0000; int slope = (int)(onlineVolSlope*10000); emit SendCurrAdjCMD(work_thread->CMD_SetOnlineVolSlope,slope); ui->ledit_olvol->setStyleSheet("color:black"); } else if(pb == ui->btn_adjust_group) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } /* adjParam.groupvol_slope = adjParamNew.groupvol_slope; emit SendAdjParam(adjParam); ClassXML::ModifyAdjParamXml(adjParam); ui->ledit_gvol->setStyleSheet("color:black"); */ int slope = (int)(groupVolSlope*10000); groupVolSlope = 1.0000; if(true == groupVolInput) { groupVolInput = false; emit SendCurrAdjCMD(work_thread->CMD_SetGroupVolSlope,slope); } ui->ledit_gvol->setStyleSheet("color:black"); } else if(pb == ui->btn_reset_groupvol) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } groupVolSlope = 1.0000; int slope = (int)(groupVolSlope*10000); emit SendCurrAdjCMD(work_thread->CMD_SetGroupVolSlope,slope); ui->ledit_gvol->setStyleSheet("color:black"); } else if(pb == ui->btn_adjust_temp) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } adjParam.temp_slope = adjParamNew.temp_slope; emit SendAdjParam(adjParam); ClassXML::ModifyAdjParamXml(adjParam); ui->ledit_temp->setStyleSheet("color:black"); } else if(pb == ui->btn_clear_dischage) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } emit SendCurrAdjCMD(work_thread->CMD_SetIntCurrZero,0); } else if(pb == ui->btn_adjust_inner) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } int slope = (int)(intCurrSlope*10000); intCurrSlope = 1.0000; if(true == intCurrInput) { intCurrInput = false; emit SendCurrAdjCMD(work_thread->CMD_SetIntCurrSlope,slope); } ui->ledit_incurr->setStyleSheet("color:black"); } else if(pb == ui->btn_reset_dischage) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } intCurrSlope = 1.0000; int slope = (int)(intCurrSlope*10000); emit SendCurrAdjCMD(work_thread->CMD_SetIntCurrSlope,slope); ui->ledit_incurr->setStyleSheet("color:black"); } else if(pb == ui->btn_clear_clamp) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } emit SendCurrAdjCMD(work_thread->CMD_SetExtCurrZero,0); } else if(pb == ui->btn_adjust_exter) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } int slope = (int)(extCurrSlope*10000); extCurrSlope = 1.0000; if(true == extCurrInput) { extCurrInput = false; emit SendCurrAdjCMD(work_thread->CMD_SetExtCurrSlope,slope); } ui->ledit_extcurr->setStyleSheet("color:black"); } else if(pb == ui->btn_reset_clamp) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } extCurrSlope = 1.0000; int slope = (int)(extCurrSlope*10000); emit SendCurrAdjCMD(work_thread->CMD_SetExtCurrSlope,slope); ui->ledit_extcurr->setStyleSheet("color:black"); } else if(pb == ui->btn_start_discharge || pb == ui->btn_startDis) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(pb == ui->btn_start_discharge) { IF_NewDis = false; } else { IF_NewDis = true; } if(work_thread->localData.RLY_OK & IGBT_VALUE)//ROK1为1 FO未闭合 { if(work_thread->localData.GroupVol>F0VOL) { MessageBox box( this, QMessageBox::Question, MB_Caption, tr("请合上F0!"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread ); if(box.exec()!=QMessageBox::Yes) return; else { if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->localData.GroupVol>F0VOL)) { popBox(tr("F0未闭合!")); return; } } } else { MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认F0已闭合!"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread ); if(box.exec()!=QMessageBox::Yes) return; } } if((work_thread->localData.GroupVollocalData.GroupVol>VolTooHigh )) { popBox(tr("线缆连接错误!")); return; } emit SendPowerCtrlCMD(work_thread->CMD_StartFanWork,0); if(work_thread->ctrlJDQ()!=0) return; MessageBox box( this, QMessageBox::Question, MB_Caption, tr("请确认风扇是否正常运转?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread); if(box.exec()!=QMessageBox::Yes){ emit SendPowerCtrlCMD(work_thread->CMD_StopFanWork,0); return; } emit SendAdjCmd(work_thread->CMD_SetDisCur,discur); if(CONTROL_TKQ){ emit SendPowerCtrlCMD(work_thread->CMD_PowerSwithOn,0); popBox(tr("请合上F1!")); } QTimer::singleShot(1000,this,SLOT(DischargeWaitF1())); } else if(pb == ui->btn_start_charge || pb ==ui->btn_startDis_2) { if(pb == ui->btn_start_charge) { IF_NewChr = false; } else { IF_NewChr = true; } if(work_thread->localData.RLY_OK & IGBT_VALUE)//ROK1为1 FO未闭合 { if(work_thread->localData.GroupVol>F0VOL) { MessageBox box( this, QMessageBox::Question, MB_Caption, tr("请合上F0!"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread ); if(box.exec()!=QMessageBox::Yes) return; else { if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->localData.GroupVol>F0VOL)) { popBox(tr("F0未闭合!")); return; } } } else { MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认F0已闭合!"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread ); if(box.exec()!=QMessageBox::Yes) return; } } if((work_thread->localData.GroupVollocalData.GroupVol>VolTooHigh )) { popBox(tr("线缆连接错误!")); return; } emit SendPowerCtrlCMD(work_thread->CMD_StartFanWork,0); MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认风扇是否正常运转?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes, work_thread ); if(box.exec()!=QMessageBox::Yes){ emit SendPowerCtrlCMD(work_thread->CMD_StopFanWork,0); return; } if(CONTROL_TKQ){ emit SendPowerCtrlCMD(work_thread->CMD_PowerSwithOn,0); popBox(tr("请合上F1!")); } QTimer::singleShot(1000,this,SLOT(ChargeWaitF1())); } else if(pb == ui->btn_stop || pb == ui->btn_stopDis || pb == ui->btn_stopDis_2) { if( work_type == 1) emit SendPowerCtrlCMD(work_thread->CMD_Adj_StopDis,NULL); else if( work_type == 2) emit SendPowerCtrlCMD(work_thread->CMD_Adj_StopChr,NULL); work_type = 0; ui->btn_start_discharge->setEnabled(true); ui->btn_startDis->setEnabled(true); ui->btn_start_charge->setEnabled(true); ui->btn_startDis_2->setEnabled(true); ui->btn_stop->setEnabled(false); ui->btn_stopDis->setEnabled(false); ui->btn_stopDis_2->setEnabled(false); ui->tabWidget->setTabEnabled(0,true); ui->tabWidget->setTabEnabled(1,true); ui->tabWidget_2->setTabEnabled(1,true); ui->tabWidget_2->setTabEnabled(2,true); } //tab1 else if(pb == ui->btn_zeroVol) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(onlvolZero != 0) { emit SendAdjCmd(work_thread->CMD_SetOnlVolZero,onlvolZero); ui->ledit_zeroVol->setStyleSheet("color:black"); } } else if(pb == ui->btn_adjust_vol) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(onlvolslope != 0) { emit SendAdjCmd(work_thread->CMD_SetOnlVolSlope,onlvolslope); ui->ledit_vol->setStyleSheet("color:black"); } } else if(pb == ui->btn_zeroVol_2) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(grpvolZero != 0) { emit SendAdjCmd(work_thread->CMD_SetGrpVolZero,grpvolZero); ui->ledit_zeroVol_2->setStyleSheet("color:black"); } } else if(pb == ui->btn_adjust_vol2) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(grpvolslope != 0) { emit SendAdjCmd(work_thread->CMD_SetGrpVolSlope,grpvolslope); ui->ledit_vol2->setStyleSheet("color:black"); } } else if(pb == ui->btn_zeroCurr) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(discurzero != 0) { emit SendAdjCmd(work_thread->CMD_SetDisCurrZero,discurzero); ui->ledit_zeroCurr->setStyleSheet("color:black"); } } else if(pb == ui->btn_adjustCurr) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(discurslope != 0) { emit SendAdjCmd(work_thread->CMD_SetDisCurrSlope,discurslope); ui->ledit_trueCurr->setStyleSheet("color:black"); } } else if(pb == ui->btn_zeroCurr_2) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(chrcurzero != 0) { emit SendAdjCmd(work_thread->CMD_SetChrCurrZero,chrcurzero); ui->ledit_zeroCurr_2->setStyleSheet("color:black"); } } else if(pb == ui->btn_adjustCurr_2) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(chrcurslope != 0) { emit SendAdjCmd(work_thread->CMD_SetChrCurrSlope,chrcurslope); ui->ledit_trueCurr_2->setStyleSheet("color:black"); } } else if(pb == ui->btn_zeroCurr_3) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(Ecurzero != 0) { emit SendAdjCmd(work_thread->CMD_SetECurrZero,Ecurzero); ui->ledit_zeroCurr_3->setStyleSheet("color:black"); } } else if(pb == ui->btn_adjustCurr_3) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(Ecurslope != 0) { emit SendAdjCmd(work_thread->CMD_SetECurrSlope,Ecurslope); ui->ledit_trueCurr_3->setStyleSheet("color:black"); } } else if(pb == ui->btn_OnLinVolOffset) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } quint16 vol = work_thread->localData.OnlineVol;//原始值 int tmp =(int)(OnLineVolOffset - vol); work_thread->sysParam.OnlineOffVol = tmp + work_thread->sysParam.OnlineOffVol ; if((work_thread->sysParam.OnlineOffVol > 30)||(work_thread->sysParam.OnlineOffVol < -30)) { work_thread->sysParam.OnlineOffVol = 0; } ClassXML::ModifySysParamXml(work_thread->sysParam); pb->setEnabled(false); ui->ledit_OnLinVolOffset->setStyleSheet("color:black"); if(work_thread->sysParam.OnlineOffVol!=0) ui->btn_clearONAdj->setEnabled(true); } else if(pb == ui->btn_GpVolAdjOffset) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } quint16 vol = work_thread->localData.GroupVol; int tmp =(int)(GroupVolOffset - vol); work_thread->sysParam.GroupOffVol = tmp + work_thread->sysParam.GroupOffVol ; if((work_thread->sysParam.GroupOffVol > 30)||(work_thread->sysParam.GroupOffVol < -30)) { work_thread->sysParam.GroupOffVol = 0; } ClassXML::ModifySysParamXml(work_thread->sysParam); pb->setEnabled(false); ui->ledit_GpVolOffset->setStyleSheet("color:black"); if(work_thread->sysParam.GroupOffVol!=0) ui->btn_clearGRAdj->setEnabled(true); } else if(pb == ui->Btn_Addr) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } IF_Duplicate = AddrIsUsed(monAdj.AdjAddr); if(IF_Duplicate) { MessageBox box( this, QMessageBox::Question, MB_Caption, tr("地址重复,是否确认修改?"), QMessageBox::No|QMessageBox::Yes); if(box.exec()!=QMessageBox::Yes) { return; } } int addr = ui->edit_AdjAddr->text().toInt(); int fre = ui->edit_NowFre->text().toInt(); if(fre+addr>79){ popBox("单体地址与频段之和不能≥80"); }else{ emit setMonAddrandFre(0,monAdj.NowAddr,monAdj.AdjAddr); } } else if(pb == ui->Btn_fre) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } int addr = ui->edit_NowAddr->text().toInt(); int fre = ui->edit_AdjFre->text().toInt(); if(fre+addr<=79){ emit setMonAddrandFre(1,monAdj.NowAddr,monAdj.AdjFre); } } else if(pb == ui->btn_adjust_monvol_2) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } if(false == monomerDataUpdate) { if(monomerAdjIndex == 0) { emit SendCurrAdjCMD(work_thread->CMD_SetMadjIndex,monomerAdjIndex); } emit SendCurrAdjCMD(work_thread->CMD_SetMonomerAdj,monomerAdjVol); monomerDataUpdate = true; } //ui->ledit_monvol->setStyleSheet("color:black"); } else if(pb == ui->Btn_clear) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } MessageBox box( this, QMessageBox::Question, MB_Caption, tr("确定清除所有配置?"), QMessageBox::No|QMessageBox::Yes); if(box.exec()!=QMessageBox::Yes) { return; } memset(monAdj.historyAddr,0,sizeof(monAdj.historyAddr)); monAdj.AddrLength = 0; ClassXML::ModifySetMonData(&monAdj,sizeof(monAdj)); ShowMonData(); } else if(pb == ui->btn_clearGRAdj) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } work_thread->sysParam.GroupOffVol = 0; ClassXML::ModifySysParamXml(work_thread->sysParam); pb->setEnabled(false); } else if(pb == ui->btn_clearONAdj) { if((!work_thread->IF_J9Close)&&JT_VALUE) { QString msg = tr("设备处于紧急停止状态,请检查并断电重启!"); popBox(msg); return; } work_thread->sysParam.OnlineOffVol = 0; ClassXML::ModifySysParamXml(work_thread->sysParam); pb->setEnabled(false); } //tab6 else if(pb == ui->btn_clearmonadj){ showifwrite = false; ui->ledit_mon_offset->setStyleSheet("color:black"); ui->ledit_mon_offsetshow->setStyleSheet("color:black"); ui->ledit_mon_slope->setStyleSheet("color:black"); ui->ledit_mon_slopeshow->setStyleSheet("color:black"); int moduleaddr = ui->edit_monaddr->text().toInt(); int res = work_thread->adj_mon_vol(CMD_SetADJOffSet,moduleaddr,0); if(res) res = work_thread->adj_mon_vol(CMD_SetADJSlope,moduleaddr,10000); if(res) popBox(tr("清零成功")); else popBox(tr("清零失败")); } else if(pb == ui->btn_monoffset){ showifwrite = false; ui->ledit_mon_offset->setStyleSheet("color:black"); ui->ledit_mon_offsetshow->setStyleSheet("color:black"); int moduleaddr = ui->edit_monaddr->text().toInt(); double value = ui->ledit_mon_offset->text().toDouble(); double show = ui->ledit_mon_offsetshow->text().toDouble(); int adjvalue = (show-value)*1000; qDebug("adjvalue1 = %d",adjvalue); int res = work_thread->adj_mon_vol(CMD_SetADJOffSet,moduleaddr,adjvalue); if(res) popBox(tr("偏移量校准成功")); else popBox(tr("偏移量校准失败")); } else if(pb == ui->btn_monslope){ showifwrite = false; ui->ledit_mon_slope->setStyleSheet("color:black"); ui->ledit_mon_slopeshow->setStyleSheet("color:black"); int moduleaddr = ui->edit_monaddr->text().toInt(); double value = ui->ledit_mon_slope->text().toDouble(); double show = ui->ledit_mon_slopeshow->text().toDouble(); int adjvalue; if(value != 0) adjvalue = value/show*10000; else adjvalue = 10000; qDebug("adjvalue2 = %d",adjvalue); int res = work_thread->adj_mon_vol(CMD_SetADJSlope,moduleaddr,adjvalue); if(res) popBox(tr("斜率校准成功")); else popBox(tr("斜率校准失败")); } } void Adjust_Page::leditAction() { Custom_LineEdit *le = dynamic_cast(sender()); if(le == ui->ledit_olvol) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(400,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { if(work_thread->localData.OnlineVol > 10) { double tmpdata = kbdata.set_text.toDouble(); tmpdata *= 10; tmpdata /= work_thread->localData.OnlineVol; if(tmpdata>=0.8000 && tmpdata<=1.2000) { onlineVolSlope = tmpdata; onlineVolInput = true; } } } else { le->setStyleSheet("color:black"); } } else if(le == ui->ledit_gvol) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(400,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { if(work_thread->localData.GroupVol > 10) { double tmpdata = kbdata.set_text.toDouble(); tmpdata *= 10; tmpdata /= work_thread->localData.GroupVol; if(tmpdata>=0.8000 && tmpdata<=1.2000) { groupVolSlope = tmpdata; groupVolInput = true; } } } else { le->setStyleSheet("color:black"); } } else if(le == ui->ledit_temp) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(400,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { if(work_thread->localData.Temp > 5) { double tmpdata = kbdata.set_text.toInt(); tmpdata *= adjParam.temp_slope; tmpdata /= work_thread->localData.Temp; if(tmpdata>=0.5000 && tmpdata<=1.500) { adjParamNew.temp_slope = tmpdata; } } } else { le->setStyleSheet("color:black"); } } else if(le == ui->ledit_incurr) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(400,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { if(work_thread->localData.InnerCurrVal > 10) { double tmpdata = kbdata.set_text.toDouble(); tmpdata *= 10; tmpdata /= work_thread->localData.InnerCurrVal; if(tmpdata>=0.8000 && tmpdata<=1.2000) { intCurrSlope = tmpdata; intCurrInput = true; } } } else { le->setStyleSheet("color:black"); } } else if(le == ui->ledit_extcurr) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(400,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { if(work_thread->localData.ExterCurrVal > 10) { double tmpdata = kbdata.set_text.toDouble(); tmpdata *= 10; tmpdata /= work_thread->localData.ExterCurrVal; if(tmpdata>=0.8000 && tmpdata<=1.2000) { extCurrSlope = tmpdata; extCurrInput = true; } } } else { le->setStyleSheet("color:black"); } } //tab1 else if(le == ui->ledit_zeroVol) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); onlvolZero = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_vol) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); onlvolslope = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_zeroVol_2) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(100,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); grpvolZero = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_vol2) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(100,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); grpvolslope = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_setDisCurr) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); discur = input*10; le->setText(QString::number(input,'f',1)); emit SendAdjCmd(work_thread->CMD_SetDisCur,discur); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_zeroCurr) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); discurzero = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_trueCurr) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); discurslope = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_setDisCurr_2){ QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); discur = input*10; le->setText(QString::number(input,'f',1)); emit SendAdjCmd(work_thread->CMD_SetChrCur,discur); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_zeroCurr_2) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); chrcurzero = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_trueCurr_2) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); chrcurslope = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_zeroCurr_3) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); Ecurzero = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_trueCurr_3) { QString origcolor = le->styleSheet(); le->setStyleSheet("color:blue"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); le->setStyleSheet("color:red"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); Ecurslope = input*10; le->setText(QString::number(input,'f',1)); } else { le->setStyleSheet(origcolor); } } else if(le == ui->ledit_OnLinVolOffset) { if(setEditInput(le, 4, work_thread->localData.OnlineVol*0.1-5, work_thread->localData.OnlineVol*0.1+5, 1, &OnLineVolOffset)) { ui->btn_OnLinVolOffset->setEnabled(true); } } else if(le == ui->ledit_GpVolOffset) { if(setEditInput(le, 2, work_thread->localData.GroupVol*0.1-5, work_thread->localData.GroupVol*0.1+5, 1, &GroupVolOffset)) { ui->btn_GpVolAdjOffset->setEnabled(true); } } else if(ui->edit_NowAddr == le) { setEditInput(le,2,0,75,0,&monAdj.NowAddr); ui->edit_NowAddr->setStyleSheet("color:dark"); } else if(ui->edit_NowFre == le) { if(setEditInput(le,2,1,16,0,&monAdj.NowFre)) { monAdj.NowFre--; ui->edit_NowFre->setStyleSheet("color:dark"); emit setMonAddrandFre(2,0,monAdj.NowFre); } } else if(ui->edit_AdjAddr == le) { if(setEditInput(le,2,0,75,0,&monAdj.AdjAddr)) { int addr = le->text().toInt(); int fre = ui->edit_NowFre->text().toInt(); // qDebug()<<"adjAddr ===fre="<79){ popBox("单体地址与频段之和不能≥80"); } } } else if(ui->edit_AdjFre == le) { if(setEditInput(le,2,1,16,0,&monAdj.AdjFre)) { monAdj.AdjFre--; int addr = ui->edit_NowAddr->text().toInt(); int fre = le->text().toInt(); // qDebug()<<"edit_AdjFre ===fre="<79){ popBox("单体地址与频段之和不能≥80"); } } } else if(le == ui->ledit_monid_2) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_ALLNO,work_thread); keyboard.setGeometry(270,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { le->setStyleSheet("color:black"); int idx = kbdata.set_text.toInt(); if(idx < 1) idx = 1; else if(idx > MONOMER_NUM_MAX) idx = MONOMER_NUM_MAX; monomerAdjIndex = idx-1; monomerDataUpdate = true; DspMonomerData(); emit SendCurrAdjCMD(work_thread->CMD_SetMadjIndex,monomerAdjIndex); } else { le->setStyleSheet("color:black"); } } else if(le == ui->ledit_monvol_2) { le->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA,work_thread); keyboard.setGeometry(430,60,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { double vol = kbdata.set_text.toDouble(); if(vol>0 && vol<20) { monomerDataUpdate = false; monomerAdjVol = (quint16)(vol*1000); DspMonomerData(); } else { le->setStyleSheet("color:black"); } } else { le->setStyleSheet("color:black"); } } else if(le == ui->edit_monaddr){ setEditInput2(le,2,0,75,0); work_thread->set_addrsingle(le->text().toInt()); le->setStyleSheet("color:dark"); } else if(le == ui->ledit_mon_offset){ setEditInput2(le,2,0,20,3); } else if(le == ui->ledit_mon_slope){ setEditInput2(le,2,0,20,3); } else if(le == ui->ledit_mon_offsetshow){ showifwrite = true; setEditInput2(le,2,0,20,3); } else if(le == ui->ledit_mon_slopeshow){ showifwrite = true; setEditInput2(le,2,0,20,3); } } void Adjust_Page::DspMonomerData(void) { ui->ledit_monid_2->setText(QString::number(monomerAdjIndex+1)); if(true == monomerDataUpdate) { int montype = work_thread->get_mon_source(); monomerAdjVol = ClassXML::getMonomerVol(montype,work_thread->fboData.SingleVol[monomerAdjIndex]); ui->btn_adjust_monvol_2->setEnabled(false); } else { ui->btn_adjust_monvol_2->setEnabled(true); } double tmpdata = monomerAdjVol/1000.0; // ui->ledit_monvol->setText(QString::number(tmpdata,'f',3)); ui->ledit_monvol_2->setText(QString::number(tmpdata,'f',3)); } void Adjust_Page::AdjPageData() { double tmpdata = work_thread->localData.OnlineVol; tmpdata /= 10.0; tmpdata *= onlineVolSlope; ui->ledit_olvol->setText(QString::number(tmpdata,'f',1)); tmpdata = work_thread->localData.GroupVol; tmpdata /= 10.0; tmpdata *= groupVolSlope; ui->ledit_gvol->setText(QString::number(tmpdata,'f',1)); tmpdata = work_thread->localData.Temp; tmpdata /= adjParam.temp_slope; tmpdata *= adjParamNew.temp_slope; ui->ledit_temp->setText(QString::number(tmpdata)); tmpdata = work_thread->localData.InnerCurrVal; tmpdata /= 10.0; tmpdata *= intCurrSlope; ui->ledit_incurr->setText(QString::number(tmpdata,'f',1)); tmpdata = work_thread->localData.ExterCurrVal; tmpdata /= 10.0; tmpdata *= extCurrSlope; ui->ledit_extcurr->setText(QString::number(tmpdata,'f',1)); DspMonomerData(); UpdateDataShow(); if(work_thread->iconState.monomerState){ if(work_thread->get_mon_source()==MONO_TYPE_WIRED) { ui->label_MON->setStyleSheet("image: url(:/new/prefix1/1.png);"); } else { if(mon_use_type == 2) ui->label_MON->setStyleSheet("border-image: url(:/new/prefix1/lora_mon.png);"); else ui->label_MON->setStyleSheet("border-image: url(:/new/prefix1/mon.png);"); } } else ui->label_MON->setStyleSheet(""); //TAB1 ui->volvalue->setText(QString::number((float)work_thread->localData.OnlineVol/10,'f',1)); ui->volvalue_2->setText(QString::number((float)work_thread->localData.GroupVol/10,'f',1)); ui->ledit_disCurr->setText(QString::number((float)work_thread->localData.InnerCurrVal/10,'f',1)); ui->ledit_ChrCur->setText(QString::number((float)work_thread->localData.InnerCurrVal/10,'f',1)); ui->ledit_Cur->setText(QString::number((float)work_thread->localData.ExterCurrVal/10,'f',1)); //TAB6 QString str; int moduleaddr = ui->edit_monaddr->text().toInt(); // if(moduleaddr == 0) { qint16 index = (moduleaddr-1)*4; if((index+3)getmodulevol(module0vol); str.sprintf("%03d#:%1.3f",index+1, 0.001*module0vol[0]); ui->label_monvol1_2->setText(str); if(!showifwrite){ ui->ledit_mon_offsetshow->setText(QString::number((double)0.001*module0vol[0],'f',3)); ui->ledit_mon_slopeshow->setText(QString::number((double)0.001*module0vol[0],'f',3)); } str.sprintf("%03d#:%1.3f",index+2, 0.001*module0vol[1]); ui->label_monvol2_2->setText(str); str.sprintf("%03d#:%1.3f",index+3, 0.001*module0vol[2]); ui->label_monvol3_2->setText(str); str.sprintf("%03d#:%1.3f",index+4, 0.001*module0vol[3]); ui->label_monvol4_2->setText(str); } } ui->label_version->setText(work_thread->get_loraversion()); } void Adjust_Page::popBox(QString msg) { MessageBox box( this, QMessageBox::Warning,MB_Caption, msg, QMessageBox::Ok, QMessageBox::Ok, work_thread); box.exec(); } void Adjust_Page::DischargeWaitF1() { if(work_thread->localData.RLY_OK & TKQ_VALUE) { emit SendPowerCtrlCMD(work_thread->CMD_PowerSwithOff,0); popBox(tr("F1未闭合!")); return; } else { ui->btn_start_discharge->setEnabled(false); ui->btn_startDis->setEnabled(false); ui->btn_start_charge->setEnabled(false); ui->btn_startDis_2->setEnabled(false); ui->btn_stop->setEnabled(true); ui->btn_stopDis->setEnabled(true); if(IF_NewDis == true) { ui->tabWidget->setTabEnabled(1,false); ui->tabWidget->setTabEnabled(0,true); } else { ui->tabWidget->setTabEnabled(1,true); ui->tabWidget->setTabEnabled(0,false); } ui->tabWidget_2->setTabEnabled(2,false); work_type = 1; //emit sendStart(work_thread->CMD_StartDischarge,batteryName+"/"); emit SendPowerCtrlCMD(work_thread->CMD_Adj_StartDis,NULL); } } void Adjust_Page::ChargeWaitF1() { if(work_thread->localData.RLY_OK & TKQ_VALUE) { emit SendPowerCtrlCMD(work_thread->CMD_PowerSwithOff,0); popBox(tr("F1未闭合!")); return; } else { ui->btn_start_discharge->setEnabled(false); ui->btn_startDis->setEnabled(false); ui->btn_start_charge->setEnabled(false); ui->btn_startDis_2->setEnabled(false); ui->btn_stop->setEnabled(true); ui->btn_stopDis_2->setEnabled(true); if(IF_NewChr == true) { ui->tabWidget->setTabEnabled(1,false); ui->tabWidget->setTabEnabled(0,true); } else { ui->tabWidget->setTabEnabled(1,true); ui->tabWidget->setTabEnabled(0,false); } ui->tabWidget_2->setTabEnabled(1,false); work_type = 2; //emit sendStart(work_thread->CMD_StartCharge,batteryName+"/"); emit SendPowerCtrlCMD(work_thread->CMD_Adj_StartChr,NULL); } } void Adjust_Page::initpage() { onlvolZero = 0; ui->ledit_zeroVol->setText(QString::number(onlvolZero)); onlvolslope = 0; ui->ledit_vol->setText(QString::number(onlvolslope)); grpvolZero = 0; ui->ledit_zeroVol_2->setText(QString::number(grpvolZero)); grpvolslope = 0; ui->ledit_vol2->setText(QString::number(grpvolslope)); discur = 100; ui->ledit_setDisCurr->setText(QString::number((float)discur/10,'f',1)); emit SendAdjCmd(work_thread->CMD_SetDisCur,discur); discurzero = 0; ui->ledit_zeroCurr->setText(QString::number(discurzero)); discurslope = 0; ui->ledit_trueCurr->setText(QString::number(discurslope)); chrcur = 0; ui->ledit_setDisCurr_2->setText(QString::number(chrcur)); chrcurzero = 0; ui->ledit_zeroCurr_2->setText(QString::number(chrcurzero)); chrcurslope = 0; ui->ledit_trueCurr_2->setText(QString::number(chrcurslope)); Ecurzero = 0; ui->ledit_zeroCurr_3->setText(QString::number(Ecurzero)); Ecurslope = 0; ui->ledit_trueCurr_3->setText(QString::number(Ecurslope)); ui->btn_stopDis->setEnabled(false); ui->btn_stopDis_2->setEnabled(false); IF_NewDis = true; IF_NewChr = true; } bool Adjust_Page::setEditInput(Custom_LineEdit *edit, int pos, float min, float max, int floatNum, quint16 *param_data) { QString origcolor = edit->styleSheet(); edit->setStyleSheet("color:red"); KeyBoard_Num keyboard(this); if(0 == pos) keyboard.setGeometry(240,100,300,350); else if(1 == pos) keyboard.setGeometry(340,100,300,350); else if(2 == pos) keyboard.setGeometry(480,100,300,350); else if(3 == pos) keyboard.setGeometry(400,100,300,350); keyboard.execKeyboard(); DATA_KB_RTN kbdata = keyboard.get_kb_data(); bool isEdited = false; if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); if(input>=min && input<=max) { input += 0.00001; edit->setText(QString::number(input,'f',floatNum)); isEdited = true; if(param_data) { if(floatNum == 0) *param_data = input; else if(floatNum == 1) *param_data = input*10; else if(floatNum == 2) *param_data = input*100; else if(floatNum == 3) *param_data = input*1000; } } } if(!isEdited) edit->setStyleSheet(origcolor); return isEdited; } bool Adjust_Page::setEditInput2(Custom_LineEdit *edit, int pos, float min, float max, int floatNum) { edit->setStyleSheet("color:red"); KeyBoard_Num keyboard(this,INPUT_DATA); if(0 == pos) keyboard.setGeometry(240,100,300,350); else if(1 == pos) keyboard.setGeometry(340,100,300,350); else if(2 == pos) keyboard.setGeometry(480,100,300,350); else if(3 == pos) keyboard.setGeometry(400,100,300,350); keyboard.execKeyboard(); edit->setStyleSheet("color:black"); DATA_KB_RTN kbdata = keyboard.get_kb_data(); if(kbdata.If_OK) { float input = kbdata.set_text.toFloat(); if(input>=min && input<=max) { edit->setText(QString::number(input,'f',floatNum)); } else { popBox(tr("当前输入范围:")+QString::number(min,'f',floatNum)+("~")+QString::number(max,'f',floatNum)); } } return kbdata.If_OK; } void Adjust_Page::ShowMonData(void) { ui->edit_NowAddr->setText(QString::number(monAdj.NowAddr)); ui->edit_NowFre->setText(QString::number(monAdj.NowFre+1)); ui->edit_AdjAddr->setText(QString::number(monAdj.AdjAddr)); ui->edit_AdjFre->setText(QString::number(monAdj.AdjFre+1)); if(monAdj.AddrLength > 0) { QString str = tr("已配置完成模块地址如下:\n"); for(int i=0;itextEdit->setText(str); ui->Btn_clear->setVisible(true); } else { ui->textEdit->setText(""); ui->Btn_clear->setVisible(false); } } bool Adjust_Page::AddrIsUsed(const quint16 Addr) { for(int i=0;iindex) { monAdj.historyAddr[Count] = monAdj.historyAddr[Count-1]; Count--; } monAdj.historyAddr[index] = Value; monAdj.AddrLength += 1; } ClassXML::ModifySetMonData(&monAdj,sizeof(monAdj)); } void Adjust_Page::RecvAddrFreResult(int type,int result) { if(type==0)//修改地址 { if(result==0) { SaveAddrData(); ShowMonData(); popBox(tr("地址修改成功!")); } else { popBox(tr("地址修改失败!")); } ui->edit_AdjAddr->setStyleSheet("color:dark"); } else if(type == 1)//修改频率 { if(result) { popBox(tr("频段修改失败!")); } else { memset(monAdj.historyAddr,0,sizeof(monAdj.historyAddr)); monAdj.historyAddr[0] = monAdj.NowAddr; monAdj.AddrLength = 1; monAdj.NowFre = monAdj.AdjFre; ClassXML::ModifySetMonData(&monAdj,sizeof(monAdj)); ShowMonData(); emit setMonAddrandFre(2,0,monAdj.NowFre); popBox(tr("频段修改成功!")); } ui->edit_AdjFre->setStyleSheet("color:dark"); } } void Adjust_Page::UpdateDataShow(void) { quint16 battVolData[MONOMER_NUM_MAX]; work_thread->GetBattVolData(battVolData); QString str; if(monAdj.NowAddr > 0) { quint16 index = (monAdj.NowAddr-1)*4; int montype = work_thread->get_mon_source(); str.sprintf("%03d#:%1.3f",index+1, 0.001*ClassXML::getMonomerVol(montype,battVolData[index])); ui->label_monvol1->setText(str); str.sprintf("%03d#:%1.3f",index+2, 0.001*ClassXML::getMonomerVol(montype,battVolData[index+1])); ui->label_monvol2->setText(str); str.sprintf("%03d#:%1.3f",index+3, 0.001*ClassXML::getMonomerVol(montype,battVolData[index+2])); ui->label_monvol3->setText(str); str.sprintf("%03d#:%1.3f",index+4, 0.001*ClassXML::getMonomerVol(montype,battVolData[index+3])); ui->label_monvol4->setText(str); } else { str = "---#:----"; ui->label_monvol1->setText(str); ui->label_monvol2->setText(str); ui->label_monvol3->setText(str); ui->label_monvol4->setText(str); } } void Adjust_Page::tabwidget_2currentChanged(int index){ if(index == 4){ work_thread->set_addrsingle(ui->edit_monaddr->text().toInt()); work_thread->set_readmode(MODE_SINGLE); } else { work_thread->set_readmode(MODE_CYCLE); } } void Adjust_Page::on_tabWidget_currentChanged(int index) { if(index == 0){ IF_NewDis = IF_NewChr = true; } else{ IF_NewDis = IF_NewChr = false; } }