Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wpilibc] Fix missing symbols on Windows #7140

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wpilibc/src/main/native/cpp/DigitalOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ void DigitalOutput::DisablePWM() {
int32_t status = 0;

// Disable the output by routing to a dead bit.
HAL_SetDigitalPWMOutputChannel(m_pwmGenerator, SensorUtil::kDigitalChannels,
&status);
HAL_SetDigitalPWMOutputChannel(m_pwmGenerator,
SensorUtil::GetNumDigitalChannels(), &status);
FRC_CheckErrorStatus(status, "Channel {}", m_channel);

HAL_FreeDigitalPWM(m_pwmGenerator);
Expand Down
12 changes: 7 additions & 5 deletions wpilibc/src/main/native/cpp/LEDPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ LEDPattern LEDPattern::Blink(units::second_t onTime, units::second_t offTime) {
if (wpi::Now() % totalMicros < onMicros) {
self.ApplyTo(data, writer);
} else {
LEDPattern::kOff.ApplyTo(data, writer);
LEDPattern::Off().ApplyTo(data, writer);
}
}};
}
Expand All @@ -118,7 +118,7 @@ LEDPattern LEDPattern::SynchronizedBlink(std::function<bool()> signal) {
if (signal()) {
self.ApplyTo(data, writer);
} else {
LEDPattern::kOff.ApplyTo(data, writer);
LEDPattern::Off().ApplyTo(data, writer);
}
}};
}
Expand Down Expand Up @@ -198,7 +198,9 @@ LEDPattern LEDPattern::AtBrightness(double relativeBrightness) {

// Static constants and functions

LEDPattern LEDPattern::kOff = LEDPattern::Solid(Color::kBlack);
LEDPattern LEDPattern::Off() {
return LEDPattern::Solid(Color::kBlack);
}

LEDPattern LEDPattern::Solid(const Color color) {
return LEDPattern{[=](auto data, auto writer) {
Expand Down Expand Up @@ -228,7 +230,7 @@ LEDPattern LEDPattern::ProgressMaskLayer(
LEDPattern LEDPattern::Steps(std::span<const std::pair<double, Color>> steps) {
if (steps.size() == 0) {
// no colors specified
return LEDPattern::kOff;
return LEDPattern::Off();
}
if (steps.size() == 1 && steps[0].first == 0) {
// only one color specified, just show a static color
Expand Down Expand Up @@ -264,7 +266,7 @@ LEDPattern LEDPattern::Steps(
LEDPattern LEDPattern::Gradient(std::span<const Color> colors) {
if (colors.size() == 0) {
// no colors specified
return LEDPattern::kOff;
return LEDPattern::Off();
}
if (colors.size() == 1) {
// only one color specified, just show a static color
Expand Down
26 changes: 20 additions & 6 deletions wpilibc/src/main/native/cpp/SensorUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@

using namespace frc;

const int SensorUtil::kDigitalChannels = HAL_GetNumDigitalChannels();
const int SensorUtil::kAnalogInputs = HAL_GetNumAnalogInputs();
const int SensorUtil::kAnalogOutputs = HAL_GetNumAnalogOutputs();
const int SensorUtil::kPwmChannels = HAL_GetNumPWMChannels();
const int SensorUtil::kRelayChannels = HAL_GetNumRelayHeaders();

int SensorUtil::GetDefaultCTREPCMModule() {
return 0;
}
Expand Down Expand Up @@ -46,3 +40,23 @@ bool SensorUtil::CheckAnalogInputChannel(int channel) {
bool SensorUtil::CheckAnalogOutputChannel(int channel) {
return HAL_CheckAnalogOutputChannel(channel);
}

int SensorUtil::GetNumDigitalChannels() {
return HAL_GetNumDigitalChannels();
}

int SensorUtil::GetNumAnalogInputs() {
return HAL_GetNumAnalogInputs();
}

int SensorUtil::GetNumAnalogOuputs() {
return HAL_GetNumAnalogOutputs();
}

int SensorUtil::GetNumPwmChannels() {
return HAL_GetNumPWMChannels();
}

int SensorUtil::GetNumRelayChannels() {
return HAL_GetNumRelayHeaders();
}
2 changes: 1 addition & 1 deletion wpilibc/src/main/native/include/frc/LEDPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class LEDPattern {
LEDPattern AtBrightness(double relativeBrightness);

/** A pattern that turns off all LEDs. */
static LEDPattern kOff;
static LEDPattern Off();

/**
* Creates a pattern that displays a single static color along the entire
Expand Down
10 changes: 5 additions & 5 deletions wpilibc/src/main/native/include/frc/SensorUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ class SensorUtil final {
*/
static bool CheckAnalogOutputChannel(int channel);

static const int kDigitalChannels;
static const int kAnalogInputs;
static const int kAnalogOutputs;
static const int kPwmChannels;
static const int kRelayChannels;
static int GetNumDigitalChannels();
static int GetNumAnalogInputs();
static int GetNumAnalogOuputs();
static int GetNumPwmChannels();
static int GetNumRelayChannels();
};

} // namespace frc
Loading