mirror of
https://gitlab.com/wirelos/sprocket-plugin-gpio.git
synced 2025-12-14 13:26:48 +01:00
overridable input check, startup delay
This commit is contained in:
@@ -23,7 +23,7 @@ class DigitalInputPlugin : public Plugin {
|
||||
GpioConfig config;
|
||||
DigitalInputPlugin(GpioConfig cfg);
|
||||
void activate(Scheduler* userScheduler);
|
||||
void checkInput();
|
||||
virtual void checkInput();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
void PirInputPlugin::checkInput()
|
||||
{
|
||||
|
||||
if(startupDelay > millis()){
|
||||
return;
|
||||
}
|
||||
val = digitalRead(config.pin); // read input value
|
||||
if (val == HIGH)
|
||||
{ // check if the input is HIGH
|
||||
|
||||
@@ -22,6 +22,7 @@ class PirInputPlugin : public DigitalInputPlugin {
|
||||
PirInputPlugin(GpioConfig cfg) : DigitalInputPlugin(cfg){}
|
||||
int pirState = LOW; // we start, assuming no motion detected
|
||||
int val = 0;
|
||||
int startupDelay = 20000; // TODO move to cfg
|
||||
void checkInput();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user