few bugs fix. add RunTimeStamp.CSV
This commit is contained in:
parent
7ba39bcc5a
commit
f6bbf0bf79
|
@ -108,10 +108,10 @@ std::string Digitizer2Gen::ReadValue(const char * parameter, bool verbose){
|
||||||
//printf(" %s|%s \n", __func__, parameter);
|
//printf(" %s|%s \n", __func__, parameter);
|
||||||
ret = CAEN_FELib_GetValue(handle, parameter, retValue);
|
ret = CAEN_FELib_GetValue(handle, parameter, retValue);
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
printf("%-45s | read fail\n", parameter);
|
printf(" %s|%d|%-45s| read fail\n", __func__, serialNumber, parameter);
|
||||||
return ErrorMsg(__func__);
|
return ErrorMsg(__func__);
|
||||||
}else{
|
}else{
|
||||||
if( verbose ) printf("%-45s : %s\n", parameter, retValue);
|
if( verbose ) printf(" %s|%d|%-45s:%s\n", __func__, serialNumber, parameter, retValue);
|
||||||
}
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
|
||||||
|
|
||||||
bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){
|
bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){
|
||||||
if( !isConnected ) return false;
|
if( !isConnected ) return false;
|
||||||
|
//ReadValue(parameter, 1);
|
||||||
printf(" %s|%d|%-45s|%s|\n", __func__, serialNumber, parameter, value.c_str());
|
printf(" %s|%d|%-45s|%s|\n", __func__, serialNumber, parameter, value.c_str());
|
||||||
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
|
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
|
@ -776,7 +777,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( boardSettings[i].GetValue() == "" && boardSettings[i].GetPara() != "Gateway") break;
|
if( boardSettings[i].GetValue() == "" && boardSettings[i].GetPara() != "Gateway") break;
|
||||||
fprintf(saveFile, "%-45s|%d|%4d|%s\n", boardSettings[i].GetFullPara().c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", boardSettings[i].GetFullPara().c_str(),
|
||||||
boardSettings[i].ReadWrite(),
|
boardSettings[i].ReadWrite(),
|
||||||
8000 + i,
|
8000 + i,
|
||||||
boardSettings[i].GetValue().c_str());
|
boardSettings[i].GetValue().c_str());
|
||||||
|
@ -786,7 +787,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
for(int i = 0; i < 4 ; i ++){
|
for(int i = 0; i < 4 ; i ++){
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( VGASetting[i].GetValue() == "" ) break;
|
if( VGASetting[i].GetValue() == "" ) break;
|
||||||
fprintf(saveFile, "%-45s|%d|%4d|%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
||||||
VGASetting[i].ReadWrite(),
|
VGASetting[i].ReadWrite(),
|
||||||
9000 + i,
|
9000 + i,
|
||||||
VGASetting[i].GetValue().c_str());
|
VGASetting[i].GetValue().c_str());
|
||||||
|
@ -797,7 +798,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( chSettings[ch][i].GetValue() == "") break;
|
if( chSettings[ch][i].GetValue() == "") break;
|
||||||
fprintf(saveFile, "%-45s|%d|%4d|%s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
||||||
chSettings[ch][i].ReadWrite(),
|
chSettings[ch][i].ReadWrite(),
|
||||||
ch*100 + i,
|
ch*100 + i,
|
||||||
chSettings[ch][i].GetValue().c_str());
|
chSettings[ch][i].GetValue().c_str());
|
||||||
|
@ -847,7 +848,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
||||||
while(fgets(line, sizeof(line), loadFile) != NULL){
|
while(fgets(line, sizeof(line), loadFile) != NULL){
|
||||||
|
|
||||||
//printf("%s", line);
|
//printf("%s", line);
|
||||||
char* token = std::strtok(line, "|");
|
char* token = std::strtok(line, "!");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while( token != nullptr){
|
while( token != nullptr){
|
||||||
|
|
||||||
|
@ -866,7 +867,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
||||||
if( count > 3) break;
|
if( count > 3) break;
|
||||||
|
|
||||||
count ++;
|
count ++;
|
||||||
token = std::strtok(nullptr, "|");
|
token = std::strtok(nullptr, "!");
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = atoi(idStr);
|
int id = atoi(idStr);
|
||||||
|
|
|
@ -1662,7 +1662,9 @@ void DigiSettingsPanel::LoadSettings(){
|
||||||
fileDialog.setDirectory(digiSettingPath);
|
fileDialog.setDirectory(digiSettingPath);
|
||||||
fileDialog.setFileMode(QFileDialog::ExistingFile);
|
fileDialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
fileDialog.setNameFilter("Data file (*.dat);;Text file (*.txt);;All file (*.*)");
|
fileDialog.setNameFilter("Data file (*.dat);;Text file (*.txt);;All file (*.*)");
|
||||||
fileDialog.exec();
|
int result = fileDialog.exec();
|
||||||
|
|
||||||
|
if( ! (result == QDialog::Accepted) ) return;
|
||||||
|
|
||||||
if( fileDialog.selectedFiles().size() == 0 ) return; // when no file selected.
|
if( fileDialog.selectedFiles().size() == 0 ) return; // when no file selected.
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@ MainWindow::~MainWindow(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//^################################################################ ACQ control
|
//^################################################################ ACQ control
|
||||||
void MainWindow::StartACQ(){
|
int MainWindow::StartACQ(){
|
||||||
|
|
||||||
if( chkSaveRun->isChecked() ){
|
if( chkSaveRun->isChecked() ){
|
||||||
runID ++;
|
runID ++;
|
||||||
|
@ -363,7 +363,9 @@ void MainWindow::StartACQ(){
|
||||||
startComment = "Start Comment: " + startComment;
|
startComment = "Start Comment: " + startComment;
|
||||||
}else{
|
}else{
|
||||||
LogMsg("Start Run aborted. ");
|
LogMsg("Start Run aborted. ");
|
||||||
return;
|
runID --;
|
||||||
|
leRunID->setText(QString::number(runID));
|
||||||
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbAutoRun -> currentData().toInt() != 0 ){
|
if( cbAutoRun -> currentData().toInt() != 0 ){
|
||||||
|
@ -435,6 +437,8 @@ void MainWindow::StartACQ(){
|
||||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||||
scalarThread->start();
|
scalarThread->start();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::StopACQ(){
|
void MainWindow::StopACQ(){
|
||||||
|
@ -533,24 +537,26 @@ void MainWindow::StopACQ(){
|
||||||
void MainWindow::AutoRun(){
|
void MainWindow::AutoRun(){
|
||||||
|
|
||||||
if( chkSaveRun->isChecked() == false){
|
if( chkSaveRun->isChecked() == false){
|
||||||
StartACQ();
|
if( StartACQ() ){
|
||||||
bnStartACQ->setEnabled(false);
|
bnStartACQ->setEnabled(false);
|
||||||
bnStopACQ->setEnabled(true);
|
bnStopACQ->setEnabled(true);
|
||||||
bnComment->setEnabled(false);
|
bnComment->setEnabled(false);
|
||||||
bnOpenScope->setEnabled(false);
|
bnOpenScope->setEnabled(false);
|
||||||
chkSaveRun->setEnabled(false);
|
chkSaveRun->setEnabled(false);
|
||||||
cbAutoRun->setEnabled(false);
|
cbAutoRun->setEnabled(false);
|
||||||
if( digiSetting ) digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
needManualComment = true;
|
needManualComment = true;
|
||||||
|
int isRun = 0;
|
||||||
///=========== infinite single run
|
///=========== infinite single run
|
||||||
if( cbAutoRun->currentData().toInt() == 0 ){
|
if( cbAutoRun->currentData().toInt() == 0 ){
|
||||||
StartACQ();
|
isRun = StartACQ();
|
||||||
disconnect(runTimer, &QTimer::timeout, nullptr, nullptr);
|
disconnect(runTimer, &QTimer::timeout, nullptr, nullptr);
|
||||||
}else{
|
}else{
|
||||||
StartACQ();
|
isRun = StartACQ();
|
||||||
connect(runTimer, &QTimer::timeout, this, [=](){
|
connect(runTimer, &QTimer::timeout, this, [=](){
|
||||||
StopACQ();
|
StopACQ();
|
||||||
if( cbAutoRun->currentData().toInt() > 0 ) {
|
if( cbAutoRun->currentData().toInt() > 0 ) {
|
||||||
|
@ -569,6 +575,8 @@ void MainWindow::AutoRun(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( isRun == 0 ) return;
|
||||||
|
|
||||||
int timeMiliSec = cbAutoRun->currentData().toInt() * 60 * 1000;
|
int timeMiliSec = cbAutoRun->currentData().toInt() * 60 * 1000;
|
||||||
|
|
||||||
///=========== single timed run
|
///=========== single timed run
|
||||||
|
@ -624,7 +632,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||||
|
|
||||||
//*------ search for settings_XXXX.dat
|
//*------ search for settings_XXXX.dat
|
||||||
QString settingFile = analysisPath + "/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat";
|
QString settingFile = analysisPath + "/working/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + ".dat";
|
||||||
if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){
|
if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){
|
||||||
LogMsg("Found setting file <b>" + settingFile + "</b> and loading. please wait.");
|
LogMsg("Found setting file <b>" + settingFile + "</b> and loading. please wait.");
|
||||||
digi[i]->SetSettingFileName(settingFile.toStdString());
|
digi[i]->SetSettingFileName(settingFile.toStdString());
|
||||||
|
@ -2029,19 +2037,35 @@ void MainWindow::AppendElog(QString appendHtmlText, int screenID){
|
||||||
|
|
||||||
void MainWindow::WriteRunTimeStampDat(bool isStartRun){
|
void MainWindow::WriteRunTimeStampDat(bool isStartRun){
|
||||||
|
|
||||||
QFile file(dataPath + "/" + expName + "/RunTimeStampe.dat");
|
QFile file(dataPath + "/" + expName + "/RunTimeStamp.dat");
|
||||||
|
|
||||||
file.open(QIODevice::Text | QIODevice::WriteOnly | QIODevice::Append);
|
|
||||||
|
|
||||||
QString dateTime = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss");
|
QString dateTime = QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss");
|
||||||
|
if( file.open(QIODevice::Text | QIODevice::WriteOnly | QIODevice::Append) ){
|
||||||
|
|
||||||
if( isStartRun ){
|
if( isStartRun ){
|
||||||
file.write(("Start Run | " + dateTime + " | " + startComment + "\n").toStdString().c_str());
|
file.write(("Start Run | " + QString::number(runID) + " | " + dateTime + " | " + startComment + "\n").toStdString().c_str());
|
||||||
}else{
|
}else{
|
||||||
file.write((" Stop Run | " + dateTime + " | " + stopComment + "\n").toStdString().c_str());
|
file.write((" Stop Run | " + QString::number(runID) + " | " + dateTime + " | " + stopComment + "\n").toStdString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QFile fileCSV(dataPath + "/" + expName + "/RunTimeStamp.csv");
|
||||||
|
|
||||||
|
if( fileCSV.open(QIODevice::Text | QIODevice::WriteOnly | QIODevice::Append) ){
|
||||||
|
|
||||||
|
QTextStream out(&fileCSV);
|
||||||
|
|
||||||
|
if( isStartRun){
|
||||||
|
out << QString::number(runID) + "," + dateTime + "," + startComment;
|
||||||
|
}else{
|
||||||
|
out << "," + dateTime + "," + stopComment + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
fileCSV.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ private slots:
|
||||||
void OpenSOLARISpanel();
|
void OpenSOLARISpanel();
|
||||||
bool CheckSOLARISpanelOK();
|
bool CheckSOLARISpanelOK();
|
||||||
|
|
||||||
void StartACQ();
|
int StartACQ(); // return 1 when ACQ start
|
||||||
void StopACQ();
|
void StopACQ();
|
||||||
void AutoRun();
|
void AutoRun();
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,14 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
layout->addWidget(cbScopeCh, rowID, 1);
|
layout->addWidget(cbScopeCh, rowID, 1);
|
||||||
|
|
||||||
connect(cbScopeDigi, &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbScopeDigi, &RComboBox::currentIndexChanged, this, [=](){
|
||||||
//if( allowChange ) StopScope();
|
|
||||||
int index = cbScopeDigi->currentIndex();
|
int index = cbScopeDigi->currentIndex();
|
||||||
if( index == -1 ) return;
|
if( index == -1 ) return;
|
||||||
|
allowChange = false;
|
||||||
|
cbScopeCh->clear();
|
||||||
for( int i = 0; i < digi[index]->GetNChannels(); i++){
|
for( int i = 0; i < digi[index]->GetNChannels(); i++){
|
||||||
cbScopeCh->addItem("ch-" + QString::number(i), i);
|
cbScopeCh->addItem("ch-" + QString::number(i), i);
|
||||||
}
|
}
|
||||||
//if( allowChange )StartScope(index);
|
allowChange = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(cbScopeCh, &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbScopeCh, &RComboBox::currentIndexChanged, this, [=](){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user