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

Turn out changes for WiThrottle

This commit is contained in:
Asbelos 2020-08-20 12:38:09 +01:00
parent 55d175adb0
commit f7557f1436
2 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@
if (tt==NULL) return false; if (tt==NULL) return false;
tt->activate(state); tt->activate(state);
if(n>0) EEPROM.put(n,tt->data.tStatus); if(n>0) EEPROM.put(n,tt->data.tStatus);
turnoutlistHash++;
return true; return true;
} }
@ -68,6 +69,7 @@ bool Turnout::remove(int n){
pp->nextTurnout=tt->nextTurnout; pp->nextTurnout=tt->nextTurnout;
free(tt); free(tt);
turnoutlistHash++;
return true; return true;
} }
@ -150,8 +152,11 @@ Turnout *Turnout::create(int id){
firstTurnout=tt; firstTurnout=tt;
tt->data.id=id; tt->data.id=id;
} }
turnoutlistHash++;
return tt; return tt;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
Turnout *Turnout::firstTurnout=NULL; Turnout *Turnout::firstTurnout=NULL;
int Turnout::turnoutlistHash=0; //bump on every change so clients know when to refresh their lists

View File

@ -36,6 +36,7 @@ struct TurnoutData {
class Turnout { class Turnout {
public: public:
static Turnout *firstTurnout; static Turnout *firstTurnout;
static int turnoutlistHash;
TurnoutData data; TurnoutData data;
Turnout *nextTurnout; Turnout *nextTurnout;
static bool activate(int n, bool state); static bool activate(int n, bool state);