acu print stats

This commit is contained in:
Jakob Meier
2021-12-17 10:45:55 +01:00
parent 4dee8658fd
commit 2ed0bdf132
7 changed files with 71 additions and 5 deletions

View File

@ -266,3 +266,44 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ACUHandler::deviceSpecificCommand(DeviceCommandId_t cmd) {
switch(cmd) {
case PRINT_CHANNEL_STATS: {
printChannelStats();
return RETURN_OK;
}
default: {
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
}
}
void ACUHandler::printChannelStats() {
PoolReadGuard pg(&acuHkTableDataset);
sif::info << "ACU Info: Stats, Current [mA], Voltage [mV]" << std::endl;
sif::info << std::setw(30) << std::left << "Ch0" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel0.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel0.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch1" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel1.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel1.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch2" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel2.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel2.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch3" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel3.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel3.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch4" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel4.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel4.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch5" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel5.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel5.value << ", "
<< std::setw(4) << std::endl;
}