mirror of
https://github.com/bitlair/bitlair_doorduino.git
synced 2025-05-13 20:20:08 +02:00
added: sound the horn 3 times when there is no mains power
This commit is contained in:
parent
f5a3d726b4
commit
c368af1eb4
1 changed files with 23 additions and 1 deletions
|
@ -45,6 +45,8 @@
|
||||||
OneWire ds(PIN_1WIRE);
|
OneWire ds(PIN_1WIRE);
|
||||||
DS1961 ibutton(&ds);
|
DS1961 ibutton(&ds);
|
||||||
|
|
||||||
|
bool HasMainsPower();
|
||||||
|
|
||||||
int Serialprintf (const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
int Serialprintf (const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
int Serialprintf (const char* fmt, ...)
|
int Serialprintf (const char* fmt, ...)
|
||||||
|
@ -147,6 +149,7 @@ void setup()
|
||||||
|
|
||||||
pinMode(PIN_LEDGREEN, OUTPUT);
|
pinMode(PIN_LEDGREEN, OUTPUT);
|
||||||
pinMode(PIN_LEDRED, OUTPUT);
|
pinMode(PIN_LEDRED, OUTPUT);
|
||||||
|
pinMode(PIN_MAINS_POWER, INPUT);
|
||||||
|
|
||||||
SetLEDState(LEDState_Off);
|
SetLEDState(LEDState_Off);
|
||||||
|
|
||||||
|
@ -494,11 +497,30 @@ void ToggleLock()
|
||||||
digitalWrite(PIN_OPEN, LOW);
|
digitalWrite(PIN_OPEN, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HasMainsPower())
|
||||||
|
{
|
||||||
DelayLEDs(10000);
|
DelayLEDs(10000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
digitalWrite(PIN_HORN, HIGH);
|
||||||
|
DelayLEDs(250);
|
||||||
|
digitalWrite(PIN_HORN, LOW);
|
||||||
|
DelayLEDs(250);
|
||||||
|
}
|
||||||
|
DelayLEDs(8500);
|
||||||
|
}
|
||||||
|
|
||||||
Serial.println("finished lock action");
|
Serial.println("finished lock action");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasMainsPower()
|
||||||
|
{
|
||||||
|
return digitalRead(PIN_MAINS_POWER) == HIGH;
|
||||||
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
uint8_t addr[ADDRSIZE];
|
uint8_t addr[ADDRSIZE];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue