1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Merge branch 'PORTX_HAL' of https://github.com/DCC-EX/CommandStation-EX into PORTX_HAL

This commit is contained in:
Harald Barth 2022-08-05 19:54:29 +02:00
commit 7551c2d2f6
3 changed files with 10 additions and 0 deletions

View File

@ -82,6 +82,7 @@ void CommandDistributor::parse(byte clientId,byte * buffer, RingStream * stream
} }
void CommandDistributor::forget(byte clientId) { void CommandDistributor::forget(byte clientId) {
if (clients[clientId]==WITHROTTLE_TYPE) WiThrottle::forget(clientId);
clients[clientId]=NONE_TYPE; clients[clientId]=NONE_TYPE;
} }
#endif #endif

View File

@ -69,6 +69,14 @@ WiThrottle* WiThrottle::getThrottle( int wifiClient) {
return new WiThrottle( wifiClient); return new WiThrottle( wifiClient);
} }
void WiThrottle::forget( byte clientId) {
for (WiThrottle* wt=firstThrottle; wt!=NULL ; wt=wt->nextThrottle)
if (wt->clientid==clientId) {
delete wt;
break;
}
}
bool WiThrottle::isThrottleInUse(int cab) { bool WiThrottle::isThrottleInUse(int cab) {
for (WiThrottle* wt=firstThrottle; wt!=NULL ; wt=wt->nextThrottle) for (WiThrottle* wt=firstThrottle; wt!=NULL ; wt=wt->nextThrottle)
if (wt->areYouUsingThrottle(cab)) return true; if (wt->areYouUsingThrottle(cab)) return true;

View File

@ -37,6 +37,7 @@ class WiThrottle {
void parse(RingStream * stream, byte * cmd); void parse(RingStream * stream, byte * cmd);
static WiThrottle* getThrottle( int wifiClient); static WiThrottle* getThrottle( int wifiClient);
static void markForBroadcast(int cab); static void markForBroadcast(int cab);
static void forget(byte clientId);
private: private:
WiThrottle( int wifiClientId); WiThrottle( int wifiClientId);