mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[hal, wpilib] Update Addressable LED support (#8100)
This commit is contained in:
@@ -25,7 +25,6 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
wpi::SmallVector<LEDDisplayModel::Data, 64> dataBuf;
|
||||
auto data = model->GetData(dataBuf);
|
||||
int length = data.size();
|
||||
bool running = model->IsRunning();
|
||||
auto& storage = GetStorage();
|
||||
|
||||
int& numColumns = storage.GetInt("columns", 10);
|
||||
@@ -35,7 +34,6 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 7);
|
||||
ImGui::LabelText("Length", "%d", length);
|
||||
ImGui::LabelText("Running", "%s", running ? "Yes" : "No");
|
||||
ImGui::InputInt("Columns", &numColumns);
|
||||
{
|
||||
static const char* options[] = {"Row Major", "Column Major"};
|
||||
@@ -64,16 +62,9 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
if (length > static_cast<int>(iData->colors.size())) {
|
||||
iData->colors.resize(length);
|
||||
}
|
||||
if (!running) {
|
||||
iData->colors[0] = IM_COL32(128, 128, 128, 255);
|
||||
for (int j = 0; j < length; ++j) {
|
||||
iData->values[j] = -1;
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < length; ++j) {
|
||||
iData->values[j] = j + 1;
|
||||
iData->colors[j] = IM_COL32(data[j].r, data[j].g, data[j].b, 255);
|
||||
}
|
||||
for (int j = 0; j < length; ++j) {
|
||||
iData->values[j] = j + 1;
|
||||
iData->colors[j] = IM_COL32(data[j].r, data[j].g, data[j].b, 255);
|
||||
}
|
||||
|
||||
LEDConfig config;
|
||||
|
||||
@@ -30,15 +30,9 @@ void glass::DisplayPWM(PWMModel* model, int index, bool outputsEnabled) {
|
||||
wpi::format_to_n_c_str(label, sizeof(label), "PWM[{}]###name", index);
|
||||
}
|
||||
|
||||
int led = model->GetAddressableLED();
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 4);
|
||||
if (led >= 0) {
|
||||
ImGui::LabelText(label, "LED[%d]", led);
|
||||
} else {
|
||||
float val = outputsEnabled ? data->GetValue() : 0;
|
||||
data->LabelText(label, "%0.3f", val);
|
||||
}
|
||||
float val = outputsEnabled ? data->GetValue() : 0;
|
||||
data->LabelText(label, "%0.3f", val);
|
||||
if (PopupEditName("name", &name)) {
|
||||
data->SetName(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user