mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Rename kAddressableLEDLength to all caps
This commit is contained in:
@@ -209,7 +209,7 @@ Java_org_wpilib_hardware_hal_simulation_AddressableLEDDataJNI_getData
|
||||
(JNIEnv* env, jclass, jint start, jint length)
|
||||
{
|
||||
auto data =
|
||||
std::make_unique<HAL_AddressableLEDData[]>(HAL_kAddressableLEDMaxLength);
|
||||
std::make_unique<HAL_AddressableLEDData[]>(HAL_ADDRESSABLE_LED_MAX_LEN);
|
||||
length = HALSIM_GetAddressableLEDData(start, length, data.get());
|
||||
return MakeJByteArray(
|
||||
env, std::span(reinterpret_cast<jbyte*>(data.get()), length * 3));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/hal/Types.h"
|
||||
|
||||
/** max length of LED strip supported by device. */
|
||||
#define HAL_kAddressableLEDMaxLength 1024
|
||||
#define HAL_ADDRESSABLE_LED_MAX_LEN 1024
|
||||
|
||||
/** structure for holding one LED's color data. */
|
||||
struct HAL_AddressableLEDData {
|
||||
|
||||
@@ -79,13 +79,13 @@ void HAL_SetAddressableLEDStart(HAL_AddressableLEDHandle handle, int32_t start,
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
if (start > HAL_kAddressableLEDMaxLength || start < 0) {
|
||||
if (start > HAL_ADDRESSABLE_LED_MAX_LEN || start < 0) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
wpi::hal::SetLastError(
|
||||
status,
|
||||
fmt::format(
|
||||
"LED start must be less than or equal to {}. {} was requested",
|
||||
HAL_kAddressableLEDMaxLength, start));
|
||||
HAL_ADDRESSABLE_LED_MAX_LEN, start));
|
||||
return;
|
||||
}
|
||||
SimAddressableLEDData[port->channel].start = start;
|
||||
@@ -99,13 +99,13 @@ void HAL_SetAddressableLEDLength(HAL_AddressableLEDHandle handle,
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
if (length > HAL_kAddressableLEDMaxLength || length < 0) {
|
||||
if (length > HAL_ADDRESSABLE_LED_MAX_LEN || length < 0) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
wpi::hal::SetLastError(
|
||||
status,
|
||||
fmt::format(
|
||||
"LED length must be less than or equal to {}. {} was requested",
|
||||
HAL_kAddressableLEDMaxLength, length));
|
||||
HAL_ADDRESSABLE_LED_MAX_LEN, length));
|
||||
return;
|
||||
}
|
||||
SimAddressableLEDData[port->channel].length = length;
|
||||
|
||||
@@ -29,8 +29,8 @@ void AddressableLEDData::ResetData() {
|
||||
|
||||
void AddressableLEDDataBuffer::SetData(int32_t start, int32_t len,
|
||||
const HAL_AddressableLEDData* d) {
|
||||
if ((start + len) > HAL_kAddressableLEDMaxLength) {
|
||||
len = HAL_kAddressableLEDMaxLength - start;
|
||||
if ((start + len) > HAL_ADDRESSABLE_LED_MAX_LEN) {
|
||||
len = HAL_ADDRESSABLE_LED_MAX_LEN - start;
|
||||
}
|
||||
if (len <= 0) {
|
||||
return;
|
||||
@@ -44,8 +44,8 @@ void AddressableLEDDataBuffer::SetData(int32_t start, int32_t len,
|
||||
|
||||
int32_t AddressableLEDDataBuffer::GetData(int32_t start, int32_t len,
|
||||
HAL_AddressableLEDData* d) {
|
||||
if ((start + len) > HAL_kAddressableLEDMaxLength) {
|
||||
len = HAL_kAddressableLEDMaxLength - start;
|
||||
if ((start + len) > HAL_ADDRESSABLE_LED_MAX_LEN) {
|
||||
len = HAL_ADDRESSABLE_LED_MAX_LEN - start;
|
||||
}
|
||||
if (len <= 0) {
|
||||
return 0;
|
||||
|
||||
@@ -31,7 +31,7 @@ class AddressableLEDDataBuffer {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(Data)
|
||||
|
||||
wpi::util::recursive_spinlock m_dataMutex;
|
||||
HAL_AddressableLEDData m_data[HAL_kAddressableLEDMaxLength];
|
||||
HAL_AddressableLEDData m_data[HAL_ADDRESSABLE_LED_MAX_LEN];
|
||||
|
||||
public:
|
||||
void SetData(int32_t start, int32_t len, const HAL_AddressableLEDData* d);
|
||||
|
||||
@@ -39,7 +39,7 @@ struct AddressableLEDs {
|
||||
"raw", {.periodic = 0.005, .sendAll = true})} {}
|
||||
|
||||
wpi::nt::RawPublisher rawPub;
|
||||
uint8_t s_buffer[HAL_kAddressableLEDMaxLength * 3];
|
||||
uint8_t s_buffer[HAL_ADDRESSABLE_LED_MAX_LEN * 3];
|
||||
};
|
||||
|
||||
static AddressableLEDs* leds;
|
||||
@@ -173,8 +173,8 @@ void HAL_SetAddressableLEDData(int32_t start, int32_t length,
|
||||
HAL_AddressableLEDColorOrder colorOrder,
|
||||
const struct HAL_AddressableLEDData* data,
|
||||
int32_t* status) {
|
||||
if (start < 0 || start >= HAL_kAddressableLEDMaxLength || length < 0 ||
|
||||
(start + length) >= HAL_kAddressableLEDMaxLength) {
|
||||
if (start < 0 || start >= HAL_ADDRESSABLE_LED_MAX_LEN || length < 0 ||
|
||||
(start + length) >= HAL_ADDRESSABLE_LED_MAX_LEN) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ int32_t SmartIo::SetLedStart(int32_t start) {
|
||||
if (currentMode != SmartIoMode::AddressableLED) {
|
||||
return INCOMPATIBLE_STATE;
|
||||
}
|
||||
if (start < 0 || start >= HAL_kAddressableLEDMaxLength) {
|
||||
if (start < 0 || start >= HAL_ADDRESSABLE_LED_MAX_LEN) {
|
||||
return PARAMETER_OUT_OF_RANGE;
|
||||
}
|
||||
ledoffsetPublisher.Set(start);
|
||||
@@ -212,7 +212,7 @@ int32_t SmartIo::SetLedLength(int32_t length) {
|
||||
if (currentMode != SmartIoMode::AddressableLED) {
|
||||
return INCOMPATIBLE_STATE;
|
||||
}
|
||||
if (length < 0 || length >= HAL_kAddressableLEDMaxLength) {
|
||||
if (length < 0 || length >= HAL_ADDRESSABLE_LED_MAX_LEN) {
|
||||
return PARAMETER_OUT_OF_RANGE;
|
||||
}
|
||||
ledcountPublisher.Set(length);
|
||||
|
||||
@@ -36,7 +36,7 @@ class AddressableLEDModel : public wpi::glass::LEDDisplayModel {
|
||||
private:
|
||||
int32_t m_channel;
|
||||
|
||||
HAL_AddressableLEDData m_data[HAL_kAddressableLEDMaxLength];
|
||||
HAL_AddressableLEDData m_data[HAL_ADDRESSABLE_LED_MAX_LEN];
|
||||
};
|
||||
|
||||
class AddressableLEDsModel : public wpi::glass::LEDDisplaysModel {
|
||||
|
||||
Reference in New Issue
Block a user