diff --git a/Example/Example.cpp b/Example/Example.cpp index 5f73bdae..e613fb5e 100644 --- a/Example/Example.cpp +++ b/Example/Example.cpp @@ -37,20 +37,21 @@ class AutomatedFunctions { } - std::string voltage_change_func(const char* key){ + std::string voltage_1_change_func(const char* new_value_string){ - float new_value = DAQ_inter->sc_vars[key]->GetValue(); + float new_value = atof(new_value_string); + // < add code here to change the hardware value of 'voltage_1' to new_value > + std::string ret = "Changed channel 1 voltage to new setpoint "+std::to_string(new_value); + std::cout< - } else if(strcmp(key,"voltage_3")==0){ - // < add code here to change the hardware value of 'voltage_3' to new_value > - } else { - std::string ret = std::string{"unknown key "}+key+" passed to callback 'voltage_change_func'"; - return ret; - } + } + + std::string voltage_3_change_func(const char* new_value_string){ - std::string ret = "Changed "+std::string{key}+ " to new setpoint "+std::to_string(new_value); + float new_value = atof(new_value_string); + // < add code here to change the hardware value of 'voltage_3' to new_value > + std::string ret = "Changed channel 3 voltage to new setpoint "+std::to_string(new_value); std::cout<SetValue("0"); if(verbose) std::cout<<"Done"<SetMin(0); DAQ_inter.sc_vars["voltage_1"]->SetMax(5000); @@ -158,10 +159,10 @@ int main(){ DAQ_inter.sc_vars["voltage_2"]->SetValue(4000); if(verbose) std::cout<<"Done"<SetMin(0); DAQ_inter.sc_vars["voltage_3"]->SetMax(5000); diff --git a/Testing/Test.cpp b/Testing/Test.cpp index fbb63854..8be606f6 100644 --- a/Testing/Test.cpp +++ b/Testing/Test.cpp @@ -48,7 +48,7 @@ int main(){ // to be able to send a device config we need to have a corresponding device. // libDAQInterface doesn't provide a function to create a device, but we can do it manually - ok = DAQ_inter.SQLQuery("INSERT INTO devices ( name ) VALUES ( '"+device_name+"' ) ON CONFLICT DO NOTHING",tmp); + ok = DAQ_inter.SQLQuery("INSERT INTO devices ( name, author_id ) VALUES ( '"+device_name+"', 1 ) ON CONFLICT DO NOTHING",tmp); if(!ok) std::cout<