Made SensorBase a utility class and renamed it to SensorUtil (#813)

This commit is contained in:
Tyler Veness
2018-05-23 20:22:30 -07:00
committed by Peter Johnson
parent ba93f79d8b
commit ecfe95383c
72 changed files with 210 additions and 240 deletions

View File

@@ -13,6 +13,7 @@
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include "SensorUtil.h"
#include "SmartDashboard/SendableBuilder.h"
#include "WPIErrors.h"
@@ -77,7 +78,7 @@ double PowerDistributionPanel::GetTemperature() const {
double PowerDistributionPanel::GetCurrent(int channel) const {
int32_t status = 0;
if (!CheckPDPChannel(channel)) {
if (!SensorUtil::CheckPDPChannel(channel)) {
wpi::SmallString<32> str;
wpi::raw_svector_ostream buf(str);
buf << "PDP Channel " << channel;
@@ -174,7 +175,7 @@ void PowerDistributionPanel::ClearStickyFaults() {
void PowerDistributionPanel::InitSendable(SendableBuilder& builder) {
builder.SetSmartDashboardType("PowerDistributionPanel");
for (int i = 0; i < kPDPChannels; ++i) {
for (int i = 0; i < SensorUtil::kPDPChannels; ++i) {
builder.AddDoubleProperty("Chan" + wpi::Twine(i),
[=]() { return GetCurrent(i); }, nullptr);
}