2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2015-06-25 15:07:55 -04:00
|
|
|
/* Copyright (c) FIRST 2008. All Rights Reserved.
|
|
|
|
|
*/
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "PWM.h"
|
|
|
|
|
|
2014-01-06 10:12:21 -05:00
|
|
|
//#include "NetworkCommunication/UsageReporting.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "Resource.h"
|
|
|
|
|
#include "Utility.h"
|
|
|
|
|
#include "WPIErrors.h"
|
2014-08-08 17:05:49 -04:00
|
|
|
#include "HAL/HAL.hpp"
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
constexpr float PWM::kDefaultPwmPeriod;
|
|
|
|
|
constexpr float PWM::kDefaultPwmCenter;
|
|
|
|
|
const int32_t PWM::kDefaultPwmStepsDown;
|
|
|
|
|
const int32_t PWM::kPwmDisabled;
|
|
|
|
|
|
|
|
|
|
/**
|
2014-06-13 17:45:10 -04:00
|
|
|
* Initialize PWMs given a channel.
|
|
|
|
|
*
|
2015-06-25 15:07:55 -04:00
|
|
|
* This method is private and is the common path for all the constructors for
|
|
|
|
|
* creating PWM
|
2014-06-13 17:45:10 -04:00
|
|
|
* instances. Checks channel value range and allocates the appropriate channel.
|
2015-06-25 15:07:55 -04:00
|
|
|
* The allocation is only done to help users ensure that they don't double
|
|
|
|
|
* assign channels.
|
|
|
|
|
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP
|
|
|
|
|
* port
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::InitPWM(uint32_t channel) {
|
|
|
|
|
char buf[64];
|
2014-06-13 17:45:10 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
if (!CheckPWMChannel(channel)) {
|
|
|
|
|
snprintf(buf, 64, "PWM Channel %d", channel);
|
|
|
|
|
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
int32_t status = 0;
|
|
|
|
|
allocatePWMChannel(m_pwm_ports[channel], &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
m_channel = channel;
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
setPWM(m_pwm_ports[m_channel], kPwmDisabled, &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
m_eliminateDeadband = false;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
HALReport(HALUsageReporting::kResourceType_PWM, channel);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-06-13 17:45:10 -04:00
|
|
|
* Allocate a PWM given a channel number.
|
|
|
|
|
*
|
|
|
|
|
* @param channel The PWM channel.
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
PWM::PWM(uint32_t channel) { InitPWM(channel); }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Free the PWM channel.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* Free the resource associated with the PWM channel and set the value to 0.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
PWM::~PWM() {
|
|
|
|
|
int32_t status = 0;
|
2014-08-05 17:27:43 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
setPWM(m_pwm_ports[m_channel], kPwmDisabled, &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
freePWMChannel(m_pwm_ports[m_channel], &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Optionally eliminate the deadband from a speed controller.
|
2015-06-25 15:07:55 -04:00
|
|
|
* @param eliminateDeadband If true, set the motor curve on the Jaguar to
|
|
|
|
|
* eliminate
|
|
|
|
|
* the deadband in the middle of the range. Otherwise, keep the full range
|
|
|
|
|
* without
|
2013-12-15 18:30:16 -05:00
|
|
|
* modifying any values.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::EnableDeadbandElimination(bool eliminateDeadband) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
m_eliminateDeadband = eliminateDeadband;
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the bounds on the PWM values.
|
2015-06-25 15:07:55 -04:00
|
|
|
* This sets the bounds on the PWM values for a particular each type of
|
|
|
|
|
* controller. The values
|
2013-12-15 18:30:16 -05:00
|
|
|
* determine the upper and lower speeds as well as the deadband bracket.
|
|
|
|
|
* @param max The Minimum pwm value
|
|
|
|
|
* @param deadbandMax The high end of the deadband range
|
|
|
|
|
* @param center The center speed (off)
|
|
|
|
|
* @param deadbandMin The low end of the deadband range
|
|
|
|
|
* @param min The minimum pwm value
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetBounds(int32_t max, int32_t deadbandMax, int32_t center,
|
|
|
|
|
int32_t deadbandMin, int32_t min) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
m_maxPwm = max;
|
|
|
|
|
m_deadbandMaxPwm = deadbandMax;
|
|
|
|
|
m_centerPwm = center;
|
|
|
|
|
m_deadbandMinPwm = deadbandMin;
|
|
|
|
|
m_minPwm = min;
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the bounds on the PWM pulse widths.
|
2015-06-25 15:07:55 -04:00
|
|
|
* This sets the bounds on the PWM values for a particular type of controller.
|
|
|
|
|
* The values
|
2013-12-15 18:30:16 -05:00
|
|
|
* determine the upper and lower speeds as well as the deadband bracket.
|
|
|
|
|
* @param max The max PWM pulse width in ms
|
|
|
|
|
* @param deadbandMax The high end of the deadband range pulse width in ms
|
|
|
|
|
* @param center The center (off) pulse width in ms
|
|
|
|
|
* @param deadbandMin The low end of the deadband pulse width in ms
|
|
|
|
|
* @param min The minimum pulse width in ms
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetBounds(double max, double deadbandMax, double center,
|
|
|
|
|
double deadbandMin, double min) {
|
|
|
|
|
// calculate the loop time in milliseconds
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
double loopTime =
|
|
|
|
|
getLoopTiming(&status) / (kSystemClockTicksPerMicrosecond * 1e3);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
|
|
|
|
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
|
|
|
|
|
m_maxPwm = (int32_t)((max - kDefaultPwmCenter) / loopTime +
|
|
|
|
|
kDefaultPwmStepsDown - 1);
|
|
|
|
|
m_deadbandMaxPwm = (int32_t)((deadbandMax - kDefaultPwmCenter) / loopTime +
|
|
|
|
|
kDefaultPwmStepsDown - 1);
|
|
|
|
|
m_centerPwm = (int32_t)((center - kDefaultPwmCenter) / loopTime +
|
|
|
|
|
kDefaultPwmStepsDown - 1);
|
|
|
|
|
m_deadbandMinPwm = (int32_t)((deadbandMin - kDefaultPwmCenter) / loopTime +
|
|
|
|
|
kDefaultPwmStepsDown - 1);
|
|
|
|
|
m_minPwm = (int32_t)((min - kDefaultPwmCenter) / loopTime +
|
|
|
|
|
kDefaultPwmStepsDown - 1);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the PWM value based on a position.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* This is intended to be used by servos.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @pre SetMaxPositivePwm() called.
|
|
|
|
|
* @pre SetMinNegativePwm() called.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param pos The position to set the servo between 0.0 and 1.0.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetPosition(float pos) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
if (pos < 0.0) {
|
|
|
|
|
pos = 0.0;
|
|
|
|
|
} else if (pos > 1.0) {
|
|
|
|
|
pos = 1.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// note, need to perform the multiplication below as floating point before
|
|
|
|
|
// converting to int
|
|
|
|
|
unsigned short rawValue =
|
|
|
|
|
(int32_t)((pos * (float)GetFullRangeScaleFactor()) + GetMinNegativePwm());
|
|
|
|
|
// printf("MinNegPWM: %d FullRangeScaleFactor: %d Raw value: %5d Input
|
|
|
|
|
//value: %4.4f\n", GetMinNegativePwm(), GetFullRangeScaleFactor(), rawValue,
|
|
|
|
|
//pos);
|
|
|
|
|
|
|
|
|
|
// wpi_assert((rawValue >= GetMinNegativePwm()) && (rawValue <=
|
|
|
|
|
//GetMaxPositivePwm()));
|
|
|
|
|
wpi_assert(rawValue != kPwmDisabled);
|
|
|
|
|
|
|
|
|
|
// send the computed pwm value to the FPGA
|
|
|
|
|
SetRaw((unsigned short)rawValue);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the PWM value in terms of a position.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* This is intended to be used by servos.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @pre SetMaxPositivePwm() called.
|
|
|
|
|
* @pre SetMinNegativePwm() called.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @return The position the servo is set to between 0.0 and 1.0.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
float PWM::GetPosition() const {
|
|
|
|
|
if (StatusIsFatal()) return 0.0;
|
|
|
|
|
int32_t value = GetRaw();
|
|
|
|
|
if (value < GetMinNegativePwm()) {
|
|
|
|
|
return 0.0;
|
|
|
|
|
} else if (value > GetMaxPositivePwm()) {
|
|
|
|
|
return 1.0;
|
|
|
|
|
} else {
|
|
|
|
|
return (float)(value - GetMinNegativePwm()) /
|
|
|
|
|
(float)GetFullRangeScaleFactor();
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the PWM value based on a speed.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* This is intended to be used by speed controllers.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @pre SetMaxPositivePwm() called.
|
|
|
|
|
* @pre SetMinPositivePwm() called.
|
|
|
|
|
* @pre SetCenterPwm() called.
|
|
|
|
|
* @pre SetMaxNegativePwm() called.
|
|
|
|
|
* @pre SetMinNegativePwm() called.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param speed The speed to set the speed controller between -1.0 and 1.0.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetSpeed(float speed) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
// clamp speed to be in the range 1.0 >= speed >= -1.0
|
|
|
|
|
if (speed < -1.0) {
|
|
|
|
|
speed = -1.0;
|
|
|
|
|
} else if (speed > 1.0) {
|
|
|
|
|
speed = 1.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// calculate the desired output pwm value by scaling the speed appropriately
|
|
|
|
|
int32_t rawValue;
|
|
|
|
|
if (speed == 0.0) {
|
|
|
|
|
rawValue = GetCenterPwm();
|
|
|
|
|
} else if (speed > 0.0) {
|
|
|
|
|
rawValue = (int32_t)(speed * ((float)GetPositiveScaleFactor()) +
|
|
|
|
|
((float)GetMinPositivePwm()) + 0.5);
|
|
|
|
|
} else {
|
|
|
|
|
rawValue = (int32_t)(speed * ((float)GetNegativeScaleFactor()) +
|
|
|
|
|
((float)GetMaxNegativePwm()) + 0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the above should result in a pwm_value in the valid range
|
|
|
|
|
wpi_assert((rawValue >= GetMinNegativePwm()) &&
|
|
|
|
|
(rawValue <= GetMaxPositivePwm()));
|
|
|
|
|
wpi_assert(rawValue != kPwmDisabled);
|
|
|
|
|
|
|
|
|
|
// send the computed pwm value to the FPGA
|
|
|
|
|
SetRaw(rawValue);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the PWM value in terms of speed.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* This is intended to be used by speed controllers.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @pre SetMaxPositivePwm() called.
|
|
|
|
|
* @pre SetMinPositivePwm() called.
|
|
|
|
|
* @pre SetMaxNegativePwm() called.
|
|
|
|
|
* @pre SetMinNegativePwm() called.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @return The most recently set speed between -1.0 and 1.0.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
float PWM::GetSpeed() const {
|
|
|
|
|
if (StatusIsFatal()) return 0.0;
|
|
|
|
|
int32_t value = GetRaw();
|
|
|
|
|
if (value == PWM::kPwmDisabled) {
|
|
|
|
|
return 0.0;
|
|
|
|
|
} else if (value > GetMaxPositivePwm()) {
|
|
|
|
|
return 1.0;
|
|
|
|
|
} else if (value < GetMinNegativePwm()) {
|
|
|
|
|
return -1.0;
|
|
|
|
|
} else if (value > GetMinPositivePwm()) {
|
|
|
|
|
return (float)(value - GetMinPositivePwm()) /
|
|
|
|
|
(float)GetPositiveScaleFactor();
|
|
|
|
|
} else if (value < GetMaxNegativePwm()) {
|
|
|
|
|
return (float)(value - GetMaxNegativePwm()) /
|
|
|
|
|
(float)GetNegativeScaleFactor();
|
|
|
|
|
} else {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the PWM value directly to the hardware.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* Write a raw value to a PWM channel.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2014-06-04 11:06:37 -04:00
|
|
|
* @param value Raw PWM value.
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetRaw(unsigned short value) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
int32_t status = 0;
|
|
|
|
|
setPWM(m_pwm_ports[m_channel], value, &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the PWM value directly from the hardware.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* Read a raw value from a PWM channel.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2014-06-04 11:06:37 -04:00
|
|
|
* @return Raw PWM control value.
|
2013-12-15 18:30:16 -05:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
unsigned short PWM::GetRaw() const {
|
|
|
|
|
if (StatusIsFatal()) return 0;
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
int32_t status = 0;
|
|
|
|
|
unsigned short value = getPWM(m_pwm_ports[m_channel], &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2014-07-21 16:32:36 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
return value;
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Slow down the PWM signal for old devices.
|
2014-06-13 17:45:10 -04:00
|
|
|
*
|
2013-12-15 18:30:16 -05:00
|
|
|
* @param mult The period multiplier to apply to this channel
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetPeriodMultiplier(PeriodMultiplier mult) {
|
|
|
|
|
if (StatusIsFatal()) return;
|
|
|
|
|
|
|
|
|
|
int32_t status = 0;
|
|
|
|
|
|
|
|
|
|
switch (mult) {
|
|
|
|
|
case kPeriodMultiplier_4X:
|
|
|
|
|
setPWMPeriodScale(m_pwm_ports[m_channel], 3,
|
|
|
|
|
&status); // Squelch 3 out of 4 outputs
|
|
|
|
|
break;
|
|
|
|
|
case kPeriodMultiplier_2X:
|
|
|
|
|
setPWMPeriodScale(m_pwm_ports[m_channel], 1,
|
|
|
|
|
&status); // Squelch 1 out of 2 outputs
|
|
|
|
|
break;
|
|
|
|
|
case kPeriodMultiplier_1X:
|
|
|
|
|
setPWMPeriodScale(m_pwm_ports[m_channel], 0,
|
|
|
|
|
&status); // Don't squelch any outputs
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
wpi_assert(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::SetZeroLatch() {
|
|
|
|
|
if (StatusIsFatal()) return;
|
2014-09-26 17:20:57 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
int32_t status = 0;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
latchPWMZero(m_pwm_ports[m_channel], &status);
|
|
|
|
|
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PWM::ValueChanged(ITable* source, const std::string& key, EntryValue value,
|
|
|
|
|
bool isNew) {
|
|
|
|
|
SetSpeed(value.f);
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PWM::UpdateTable() {
|
2015-06-23 04:49:51 -07:00
|
|
|
if (m_table != nullptr) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_table->PutNumber("Value", GetSpeed());
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PWM::StartLiveWindowMode() {
|
2015-06-25 15:07:55 -04:00
|
|
|
SetSpeed(0);
|
2015-06-23 04:49:51 -07:00
|
|
|
if (m_table != nullptr) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_table->AddTableListener("Value", this, true);
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PWM::StopLiveWindowMode() {
|
2015-06-25 15:07:55 -04:00
|
|
|
SetSpeed(0);
|
2015-06-23 04:49:51 -07:00
|
|
|
if (m_table != nullptr) {
|
2015-06-25 15:07:55 -04:00
|
|
|
m_table->RemoveTableListener(this);
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
std::string PWM::GetSmartDashboardType() const { return "Speed Controller"; }
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
void PWM::InitTable(ITable* subTable) {
|
|
|
|
|
m_table = subTable;
|
|
|
|
|
UpdateTable();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
ITable* PWM::GetTable() const { return m_table; }
|