diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index e162f5a..2a29f5b 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -1089,7 +1089,7 @@ void MainWindow::StartACQ(){ {//^=== elog and database if( influx ){ influx->AddDataPoint("RunID value=" + std::to_string(runID)); - if( elogName != "" ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); + if( !elogName.isEmpty() ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); influx->WriteData(dataBaseName.toStdString()); influx->ClearDataPointsBuffer(); } @@ -1169,7 +1169,7 @@ void MainWindow::StopACQ(){ {//^=== elog and database if( influx && elogName != "" ) { - influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); + if( !elogName.isEmpty() ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); influx->WriteData(dataBaseName.toStdString()); influx->ClearDataPointsBuffer(); } @@ -1493,10 +1493,10 @@ void MainWindow::OpenScope(){ if( scope ) { if( onOff ) { lbScalarACQStatus->setText("ACQ On"); - if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); + if( influx && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); }else{ lbScalarACQStatus->setText("ACQ Off"); - if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); + if( influx && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); } if( influx ){ influx->WriteData(dataBaseName.toStdString()); diff --git a/Scope.cpp b/Scope.cpp index 77d171f..5db57ec 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -363,29 +363,30 @@ void Scope::StartScope(){ //TODO set other channel to be no trace; emit UpdateOtherPanels(); - for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){ + for( int iDigi = (int)nDigi-1 ; iDigi >= 0; iDigi --){ traceOn[iDigi] = digi[iDigi]->IsRecordTrace(); //remember setting + SendLogMsg("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()) + " is starting ACQ." ); + digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1); digi[iDigi]->GetData()->ClearData(); digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1); + + readDataThread[iDigi]->SetScopeMode(true); + readDataThread[iDigi]->SetSaveData(false); + digi[iDigi]->StartACQ(); // printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning()); - if( readDataThread[iDigi]->isRunning() ){ - readDataThread[iDigi]->quit(); - readDataThread[iDigi]->wait(); - } - readDataThread[iDigi]->SetScopeMode(true); - readDataThread[iDigi]->SetSaveData(false); + // if( readDataThread[iDigi]->isRunning() ){ + // readDataThread[iDigi]->quit(); + // readDataThread[iDigi]->wait(); + // } readDataThread[iDigi]->start(); // printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning()); } - printf("=========================== 1\n"); - updateTraceThread->start(); updateScalarThread->start(); - printf("=========================== 2\n"); bnScopeStart->setEnabled(false); bnScopeStart->setStyleSheet(""); @@ -393,7 +394,6 @@ void Scope::StartScope(){ bnScopeStop->setStyleSheet("background-color: red;"); EnableControl(false); - printf("=========================== 3\n"); TellACQOnOff(true); diff --git a/influxdb.cpp b/influxdb.cpp index f440532..430a007 100644 --- a/influxdb.cpp +++ b/influxdb.cpp @@ -117,18 +117,22 @@ void InfluxDB::CreateDatabase(std::string databaseName){ } void InfluxDB::AddDataPoint(std::string fullString){ + // printf(" InfluxDB::%s |%s| \n", __func__, fullString.c_str()); dataPoints += fullString + "\n"; } void InfluxDB::ClearDataPointsBuffer(){ + // printf(" InfluxDB::%s \n", __func__); dataPoints = ""; } void InfluxDB::PrintDataPoints(){ + // printf(" InfluxDB::%s \n", __func__); printf("%s\n", dataPoints.c_str()); } void InfluxDB::WriteData(std::string databaseName){ + // printf(" InfluxDB::%s \n", __func__); if( dataPoints.length() == 0 ) return; //printf("|%s|\n", (databaseIP + "write?db=" + databaseName).c_str()); curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "write?db=" + databaseName).c_str()); @@ -140,6 +144,7 @@ void InfluxDB::WriteData(std::string databaseName){ void InfluxDB::Execute(){ + // printf(" InfluxDB::%s \n", __func__); try{ respond = curl_easy_perform(curl); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode); @@ -152,6 +157,7 @@ void InfluxDB::Execute(){ } size_t InfluxDB::WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){ + // printf(" InfluxDB::%s \n", __func__); ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; }