Fixes LED issues as discussed in #562

Removing MY_LED_BLINKING_FEATURE, as we now are
using MY_DEFAULT_LED_xx_PIN defines to enable
LED blinking feature.

updated Gateway sketches to not refer to
MY_LED_BLINKING_FEATURE any more

fixes #562
This commit is contained in:
Thomas Mørch
2016-08-20 09:35:49 +02:00
parent c925dd6f5e
commit 15b46f8023
15 changed files with 216 additions and 276 deletions
+12 -2
View File
@@ -37,10 +37,15 @@ inline void ledsInit()
countErr = 0;
// Setup led pins
#if defined(MY_DEFAULT_RX_LED_PIN)
pinMode(MY_DEFAULT_RX_LED_PIN, OUTPUT);
#endif
#if defined(MY_DEFAULT_TX_LED_PIN)
pinMode(MY_DEFAULT_TX_LED_PIN, OUTPUT);
#endif
#if defined(MY_DEFAULT_ERR_LED_PIN)
pinMode(MY_DEFAULT_ERR_LED_PIN, OUTPUT);
#endif
ledsProcess();
}
@@ -55,17 +60,23 @@ void ledsProcess() {
// For an On/Off ratio of 4, the pattern repeated will be [on, on, on, off]
// until the counter becomes 0.
#if defined(MY_DEFAULT_RX_LED_PIN)
state = (countRx & (LED_ON_OFF_RATIO-1)) ? LED_ON : LED_OFF;
hwDigitalWrite(MY_DEFAULT_RX_LED_PIN, state);
if (countRx) --countRx;
#endif
#if defined(MY_DEFAULT_TX_LED_PIN)
state = (countTx & (LED_ON_OFF_RATIO-1)) ? LED_ON : LED_OFF;
hwDigitalWrite(MY_DEFAULT_TX_LED_PIN, state);
if (countTx) --countTx;
#endif
#if defined(MY_DEFAULT_ERR_LED_PIN)
state = (countErr & (LED_ON_OFF_RATIO-1)) ? LED_ON : LED_OFF;
hwDigitalWrite(MY_DEFAULT_ERR_LED_PIN, state);
if (countErr) --countErr;
#endif
}
void ledsBlinkRx(uint8_t cnt) {
@@ -79,4 +90,3 @@ void ledsBlinkTx(uint8_t cnt) {
void ledsBlinkErr(uint8_t cnt) {
if(!countErr) { countErr = cnt*LED_ON_OFF_RATIO; }
}