Skip to content

Commit

Permalink
Merge pull request #148 from nlesc-recruit/145-psconfig-sensorpair
Browse files Browse the repository at this point in the history
Print sensor pair numbers in psconfig output.
  • Loading branch information
loostrum authored Oct 23, 2023
2 parents b96d1b0 + f0c6e72 commit 4740efc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions host/src/psconfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ void print() {

// get string values before printing the output so any warnings are readable
std::string type = powerSensor->getType(sensor);
std::string pairName = powerSensor->getPairName(sensor / 2); // div by 2 to convert to pair ID
int pair = sensor / 2; // there are 2 sensors per pair
std::string pairName = powerSensor->getPairName(pair);

std::cout << "sensor " << sensor << " (" << sensorType << "): "
std::cout << "sensor " << sensor << ", pair " << pair << " (" << sensorType << "): "
"type: " << type << ", "
"name: " << pairName << ", "
"Vref: " << powerSensor->getVref(sensor) << " V, " <<
Expand All @@ -162,7 +163,8 @@ void print() {
for (unsigned int pair = 0; pair < PowerSensor3::MAX_PAIRS; pair++) {
double usage = Watt(startState, stopState, pair);
totalUsage += usage;
std::cout << "Current usage pair " << pair << ": " << usage << " W" << std::endl;
std::cout << "Current usage pair " << pair << " (sensors " << 2 * pair << ", ";
std::cout << 2 * pair + 1<< "): " << usage << " W" << std::endl;
}
std::cout << "Total usage: " << totalUsage << " W" << std::endl;
}
Expand Down

0 comments on commit 4740efc

Please sign in to comment.