tail pip timer

This commit is contained in:
Jim Colderwood 2024-04-17 20:30:32 +01:00
parent a1e2d5307f
commit 90a826c8b2
2 changed files with 5 additions and 4 deletions

View File

@ -74,16 +74,16 @@ void loop() {
myrpt->last = myrpt->state; myrpt->last = myrpt->state;
myrpt->state = HANG; myrpt->state = HANG;
ht = millis(); ht = millis();
myrpt->tail = ht;
if (ht - tot < PIP_KEYCHUNK || busy(myrpt)) if (ht - tot < PIP_KEYCHUNK || busy(myrpt))
continue; continue;
courtesyTone(myrpt); courtesyTone(myrpt);
} }
if (myrpt->state == HANG && TAILPIPS) { if (myrpt->state == HANG && TAILPIPS) {
static unsigned long bc = millis(); if (millis() - myrpt->tail >= TAIL_PIP_DELAY && !busy(myrpt)) {
if (millis() - bc >= 1000 && !busy(myrpt)) { myrpt->tail = millis();
bc = millis(); tone(PIP, TAILPIP_PITCH, myrpt->params.pip_length);
tone(3, TAILPIP_PITCH, myrpt->params.pip_length);
} }
} }

View File

@ -61,6 +61,7 @@ typedef struct {
serial serial; serial serial;
state state; state state;
transmitter transmitter; transmitter transmitter;
unsigned long tail;
}repeater; }repeater;
#endif #endif