Skip to content

Commit ee75b98

Browse files
committed
Allow Status LED to blink during pairing hold
1 parent 0e36522 commit ee75b98

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

Firmware/BlueSMiRF-v2/LED.ino

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ void ledUpdate(void *e)
138138
// Turn on TX (aka Connect) LED
139139
void ledTxOn()
140140
{
141-
if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
141+
if (ledState == LED_BUTTON_3S_HOLD || ledState == LED_BUTTON_8S_HOLD)
142+
{
143+
// Don't allow serial tasks to control the LEDs during these states
144+
}
145+
else if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
142146
{
143147
ledStatusBlinkSerial();
144148
}
@@ -154,7 +158,11 @@ void ledTxOn()
154158
}
155159
void ledTxOff()
156160
{
157-
if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
161+
if (ledState == LED_BUTTON_3S_HOLD || ledState == LED_BUTTON_8S_HOLD)
162+
{
163+
// Don't allow serial tasks to control the LEDs during these states
164+
}
165+
else if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
158166
{
159167
ledStatusOff();
160168
}
@@ -172,7 +180,11 @@ void ledTxOff()
172180
// Turn on RX (aka Status) LED
173181
void ledRxOn()
174182
{
175-
if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
183+
if (ledState == LED_BUTTON_3S_HOLD || ledState == LED_BUTTON_8S_HOLD)
184+
{
185+
// Don't allow serial tasks to control the LEDs during these states
186+
}
187+
else if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
176188
{
177189
ledStatusBlinkSerial();
178190
}
@@ -188,7 +200,11 @@ void ledRxOn()
188200
}
189201
void ledRxOff()
190202
{
191-
if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
203+
if (ledState == LED_BUTTON_3S_HOLD || ledState == LED_BUTTON_8S_HOLD)
204+
{
205+
// Don't allow serial tasks to control the LEDs during these states
206+
}
207+
else if (settings.ledStyle == LEDS_CLASSIC) // Blink the status LED during serial traffic
192208
{
193209
ledStatusOff();
194210
}
@@ -229,15 +245,8 @@ void ledConnectBlink()
229245
{
230246
if (pin_connectLED != PIN_UNDEFINED)
231247
{
232-
if (ledState == LED_BUTTON_3S_HOLD || ledState == LED_BUTTON_8S_HOLD)
233-
{
234-
// Don't allow serial tasks to control the LEDs during these states
235-
}
236-
else
237-
{
238-
pinMode(pin_connectLED, OUTPUT); // Reconfig pin, post analog write
239-
digitalWrite(pin_connectLED, !digitalRead(pin_connectLED));
240-
}
248+
pinMode(pin_connectLED, OUTPUT); // Reconfig pin, post analog write
249+
digitalWrite(pin_connectLED, !digitalRead(pin_connectLED));
241250
}
242251
}
243252
void ledConnectBlinkSerial()

0 commit comments

Comments
 (0)