[wpilibc] Fix GetUsbId on ExpansionHub in C++ (#8704)

This commit is contained in:
Thad House
2026-03-29 20:40:06 -07:00
committed by GitHub
parent f3757bdeae
commit d74644283b
2 changed files with 5 additions and 2 deletions

View File

@@ -69,6 +69,10 @@ bool ExpansionHub::IsHubConnected() const {
return m_dataStore->m_hubConnectedSubscriber.Get(false);
}
int ExpansionHub::GetUsbId() const {
return m_dataStore->m_usbId;
}
bool ExpansionHub::CheckAndReserveServo(int channel) {
int mask = 1 << channel;
std::scoped_lock lock{m_dataStore->m_reservedLock};

View File

@@ -62,7 +62,7 @@ class ExpansionHub {
*
* @return The USB ID
*/
int GetUsbId() const { return m_usbId; }
int GetUsbId() const;
static constexpr int NumUsbPorts = 4;
static constexpr int NumServoPorts = 6;
@@ -81,7 +81,6 @@ class ExpansionHub {
friend class DataStore;
std::shared_ptr<DataStore> m_dataStore;
int m_usbId;
static wpi::util::mutex m_handleLock;
static std::weak_ptr<DataStore> m_storeMap[4];