1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00
CommandStation-EX/EXRAILSensor.h
Asbelos 4aa97e1731 Squashed commit of the following:
commit 3fc90c916c
Merge: 132e2d0 91e60b3
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Apr 12 15:08:49 2024 +0100

    Merge branch 'devel' into devel_chris

commit 132e2d0de2
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Apr 12 15:07:31 2024 +0100

    Revert "Merge branch 'master' into devel_chris"

    This reverts commit 23845f2df2, reversing
    changes made to 76755993f1.

commit 23845f2df2
Merge: 7675599 28d60d4
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Apr 12 14:38:22 2024 +0100

    Merge branch 'master' into devel_chris

commit 76755993f1
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Apr 12 14:37:34 2024 +0100

    ONSENSOR/ONBUTTON

commit 8987d622e6
Author: Asbelos <asbelos@btinternet.com>
Date:   Tue Apr 9 20:44:47 2024 +0100

    doc note

commit 8f0a5c1ec0
Author: Asbelos <asbelos@btinternet.com>
Date:   Thu Apr 4 09:45:58 2024 +0100

    Exrail notes

commit 94083b9ab8
Merge: 72ef199 02bf50b
Author: Asbelos <asbelos@btinternet.com>
Date:   Thu Apr 4 09:08:26 2024 +0100

    Merge branch 'devel' into devel_chris

commit 72ef199315
Author: Asbelos <asbelos@btinternet.com>
Date:   Thu Apr 4 09:06:50 2024 +0100

    TOGGLE_TURNOUT

commit e69b777a2f
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Apr 3 15:17:40 2024 +0100

    BLINK command

commit c7ed47400d
Author: Asbelos <asbelos@btinternet.com>
Date:   Tue Apr 2 10:12:45 2024 +0100

    FTOGGLE,XFTOGGLE

commit 7a93cf7be8
Author: Asbelos <asbelos@btinternet.com>
Date:   Fri Mar 29 13:21:35 2024 +0000

    EXRAIL STEALTH_GLOBAL

commit 28d60d4984
Author: Peter Akers <akersp62@gmail.com>
Date:   Fri Feb 16 18:02:40 2024 +1000

    Update README.md

commit 3b162996ad
Author: peteGSX <peteracole@outlook.com.au>
Date:   Sun Jan 21 07:13:53 2024 +1000

    EX-IO fixes in version

commit fb414a7a50
Author: Harald Barth <haba@kth.se>
Date:   Thu Jan 18 08:20:33 2024 +0100

    Bugfix: allocate enough bytes for digital pins. Add more sanity checks when allocating memory

commit 818e05b425
Author: Harald Barth <haba@kth.se>
Date:   Wed Jan 10 08:37:54 2024 +0100

    version 5.0.8

commit c5168f030f
Author: Harald Barth <haba@kth.se>
Date:   Wed Jan 10 08:15:30 2024 +0100

    Do not crash on turnouts without description

commit 387ea019bd
Author: Harald Barth <haba@kth.se>
Date:   Mon Nov 6 22:11:56 2023 +0100

    version 5.0.7

commit a981f83bb9
Author: Harald Barth <haba@kth.se>
Date:   Mon Nov 6 22:11:31 2023 +0100

    Only flag 2.2.0.0-dev as broken, not 2.2.0.0

commit 749a859db5
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Nov 1 20:13:05 2023 +0000

    Bugfix TURNOUTL

commit 659c58b307
Author: Harald Barth <haba@kth.se>
Date:   Sat Oct 28 19:20:33 2023 +0200

    version 5.0.5

commit 0b9ec7460b
Author: Harald Barth <haba@kth.se>
Date:   Sat Oct 28 19:18:59 2023 +0200

    Bugfix version detection logic and better message
2024-04-13 08:12:35 +01:00

50 lines
1.7 KiB
C++

/*
* © 2024 Chris Harlow
* All rights reserved.
*
* This file is part of CommandStation-EX
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* It is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef EXRAILSensor_h
#define EXRAILSensor_h
#include "IODevice.h"
class EXRAILSensor {
static EXRAILSensor * firstSensor;
static EXRAILSensor * readingSensor;
static unsigned long lastReadCycle;
public:
static void checkAll();
EXRAILSensor(VPIN _pin, int _progCounter, bool _onChange);
bool check();
private:
static const unsigned int cycleInterval = 10000; // min time between consecutive reads of each sensor in microsecs.
// should not be less than device scan cycle time.
static const byte minReadCount = 4; // number of additional scans before acting on change
// E.g. 1 means that a change is ignored for one scan and actioned on the next.
// Max value is 63
EXRAILSensor* nextSensor;
VPIN pin;
int progCounter;
bool active;
bool inputState;
bool onChange;
byte latchDelay;
};
#endif