mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-01 03:55:03 +01:00
Sensor Broadcast Exrail
Nonreal (eg id 200) Sensor broadcasting to wifi via Exrail Latch/Unlatch
This commit is contained in:
parent
bd9a04572d
commit
cf0807d3c7
|
@ -49,6 +49,7 @@
|
|||
#include "WiThrottle.h"
|
||||
#include "DCCEXParser.h"
|
||||
#include "Turnouts.h"
|
||||
#include "Sensors.h" // Sensor feedback an rocrail senden
|
||||
#include "CommandDistributor.h"
|
||||
|
||||
|
||||
|
@ -624,10 +625,12 @@ void RMFT2::loop2() {
|
|||
|
||||
case OPCODE_LATCH:
|
||||
setFlag(operand,LATCH_FLAG);
|
||||
Sensor::call(operand, 1); // sesor aktiv senden
|
||||
break;
|
||||
|
||||
case OPCODE_UNLATCH:
|
||||
setFlag(operand,0,LATCH_FLAG);
|
||||
Sensor::call(operand, 0); // sensor inaktiv senden
|
||||
break;
|
||||
|
||||
case OPCODE_SET:
|
||||
|
|
20
Sensors.cpp
20
Sensors.cpp
|
@ -189,6 +189,26 @@ void Sensor::printAll(Print *stream){
|
|||
} // loop over all sensors
|
||||
} // Sensor::printAll
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Static Function to call Sensor object.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Sensor *Sensor::call(int snum, int pullUp){
|
||||
Sensor *tt;
|
||||
if (pullUp == 0)
|
||||
CommandDistributor::broadcastSensor(readingSensor->data.snum=snum,readingSensor->active);
|
||||
else
|
||||
CommandDistributor::broadcastSensor(readingSensor->data.snum=snum,readingSensor->latchDelay = minReadCount );
|
||||
// minReadCount could be better defind to always inactive??
|
||||
|
||||
return tt ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Static Function to create/find Sensor object.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user