fix bug on Influx when expName is Empty
This commit is contained in:
parent
e32cde9b4b
commit
0e28cfcd12
|
@ -1089,7 +1089,7 @@ void MainWindow::StartACQ(){
|
||||||
{//^=== elog and database
|
{//^=== elog and database
|
||||||
if( influx ){
|
if( influx ){
|
||||||
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
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->WriteData(dataBaseName.toStdString());
|
||||||
influx->ClearDataPointsBuffer();
|
influx->ClearDataPointsBuffer();
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1169,7 @@ void MainWindow::StopACQ(){
|
||||||
|
|
||||||
{//^=== elog and database
|
{//^=== elog and database
|
||||||
if( influx && elogName != "" ) {
|
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->WriteData(dataBaseName.toStdString());
|
||||||
influx->ClearDataPointsBuffer();
|
influx->ClearDataPointsBuffer();
|
||||||
}
|
}
|
||||||
|
@ -1493,10 +1493,10 @@ void MainWindow::OpenScope(){
|
||||||
if( scope ) {
|
if( scope ) {
|
||||||
if( onOff ) {
|
if( onOff ) {
|
||||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||||
if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
|
if( influx && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
|
||||||
}else{
|
}else{
|
||||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||||
if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
if( influx && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
||||||
}
|
}
|
||||||
if( influx ){
|
if( influx ){
|
||||||
influx->WriteData(dataBaseName.toStdString());
|
influx->WriteData(dataBaseName.toStdString());
|
||||||
|
|
22
Scope.cpp
22
Scope.cpp
|
@ -363,29 +363,30 @@ void Scope::StartScope(){
|
||||||
//TODO set other channel to be no trace;
|
//TODO set other channel to be no trace;
|
||||||
emit UpdateOtherPanels();
|
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
|
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]->GetData()->ClearData();
|
||||||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||||
|
|
||||||
|
readDataThread[iDigi]->SetScopeMode(true);
|
||||||
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
|
||||||
digi[iDigi]->StartACQ();
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
if( readDataThread[iDigi]->isRunning() ){
|
// if( readDataThread[iDigi]->isRunning() ){
|
||||||
readDataThread[iDigi]->quit();
|
// readDataThread[iDigi]->quit();
|
||||||
readDataThread[iDigi]->wait();
|
// readDataThread[iDigi]->wait();
|
||||||
}
|
// }
|
||||||
readDataThread[iDigi]->SetScopeMode(true);
|
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
|
||||||
readDataThread[iDigi]->start();
|
readDataThread[iDigi]->start();
|
||||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("=========================== 1\n");
|
|
||||||
|
|
||||||
updateTraceThread->start();
|
updateTraceThread->start();
|
||||||
updateScalarThread->start();
|
updateScalarThread->start();
|
||||||
printf("=========================== 2\n");
|
|
||||||
|
|
||||||
bnScopeStart->setEnabled(false);
|
bnScopeStart->setEnabled(false);
|
||||||
bnScopeStart->setStyleSheet("");
|
bnScopeStart->setStyleSheet("");
|
||||||
|
@ -393,7 +394,6 @@ void Scope::StartScope(){
|
||||||
bnScopeStop->setStyleSheet("background-color: red;");
|
bnScopeStop->setStyleSheet("background-color: red;");
|
||||||
|
|
||||||
EnableControl(false);
|
EnableControl(false);
|
||||||
printf("=========================== 3\n");
|
|
||||||
|
|
||||||
TellACQOnOff(true);
|
TellACQOnOff(true);
|
||||||
|
|
||||||
|
|
|
@ -117,18 +117,22 @@ void InfluxDB::CreateDatabase(std::string databaseName){
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfluxDB::AddDataPoint(std::string fullString){
|
void InfluxDB::AddDataPoint(std::string fullString){
|
||||||
|
// printf(" InfluxDB::%s |%s| \n", __func__, fullString.c_str());
|
||||||
dataPoints += fullString + "\n";
|
dataPoints += fullString + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfluxDB::ClearDataPointsBuffer(){
|
void InfluxDB::ClearDataPointsBuffer(){
|
||||||
|
// printf(" InfluxDB::%s \n", __func__);
|
||||||
dataPoints = "";
|
dataPoints = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfluxDB::PrintDataPoints(){
|
void InfluxDB::PrintDataPoints(){
|
||||||
|
// printf(" InfluxDB::%s \n", __func__);
|
||||||
printf("%s\n", dataPoints.c_str());
|
printf("%s\n", dataPoints.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfluxDB::WriteData(std::string databaseName){
|
void InfluxDB::WriteData(std::string databaseName){
|
||||||
|
// printf(" InfluxDB::%s \n", __func__);
|
||||||
if( dataPoints.length() == 0 ) return;
|
if( dataPoints.length() == 0 ) return;
|
||||||
//printf("|%s|\n", (databaseIP + "write?db=" + databaseName).c_str());
|
//printf("|%s|\n", (databaseIP + "write?db=" + databaseName).c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, (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(){
|
void InfluxDB::Execute(){
|
||||||
|
// printf(" InfluxDB::%s \n", __func__);
|
||||||
try{
|
try{
|
||||||
respond = curl_easy_perform(curl);
|
respond = curl_easy_perform(curl);
|
||||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode);
|
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){
|
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);
|
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||||
return size * nmemb;
|
return size * nmemb;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user