diff --git a/expirament.cpp b/expirament.cpp index 538967bc64aa8226fa2088ce51fc813e879dbae8..5689cd8d7aeb3f73ae23839be18b39a7d4e2a00d 100644 --- a/expirament.cpp +++ b/expirament.cpp @@ -58,9 +58,15 @@ bool Expirament::preparePsu() std::this_thread::sleep_for(std::chrono::seconds(2)); ret = psu->getStatus(status); - if(!ret || status.curent_limited) + if(!ret) + { + Log(Log::ERROR)<<"Unable to read psu state, abort"; + psu->setEnabled(false); + return false; + } + else if(status.curent_limited) { - Log(Log::ERROR)<<"Psu is overcurrent, abort"; + Log(Log::ERROR)<<"Psu is overcurrent at "<<status.current<<" abort"; psu->setEnabled(false); return false; } diff --git a/test.cpp b/test.cpp index 51fd2036a166f931e9e87c9033bd93aeba85bc24..f9b4cfc8709f3103d5585bd0613067746596e6ce 100644 --- a/test.cpp +++ b/test.cpp @@ -53,9 +53,16 @@ bool preparePsu(Vcpps* psu, float voltage, float current) std::this_thread::sleep_for(std::chrono::seconds(2)); ret = psu->getStatus(status); - if(!ret || status.curent_limited) + ret = psu->getStatus(status); + if(!ret) + { + Log(Log::ERROR)<<"Unable to read psu state, abort"; + psu->setEnabled(false); + return false; + } + else if(status.curent_limited) { - Log(Log::ERROR, true, false)<<"Psu is overcurrent, abort"; + Log(Log::ERROR)<<"Psu is overcurrent at "<<status.current<<" abort"; psu->setEnabled(false); return false; }