Merge pull request #53 from DzikuVx/tx-indication-improvements

TX module LED indication
This commit is contained in:
Paweł Spychalski
2018-04-28 08:06:16 +02:00
committed by GitHub
3 changed files with 20 additions and 2 deletions

View File

@@ -16,7 +16,8 @@
"cppStandard": "c++17",
"compilerPath": "/usr/bin/clang",
"defines": [
"FEATURE_TX_INPUT_SBUS"
"FEATURE_TX_INPUT_SBUS",
"ARDUINO_AVR_FEATHER32U4"
]
},
{

View File

@@ -648,8 +648,24 @@ void loop(void)
}
#endif
#endif
/*
* Handle LED updates
*/
if (txDeviceState.nextLedUpdate < currentMillis) {
if (txDeviceState.isReceiving) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
txDeviceState.nextLedUpdate = currentMillis + 300;
} else if (txInput.isReceiving()) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
txDeviceState.nextLedUpdate = currentMillis + 100;
} else {
digitalWrite(LED_BUILTIN, HIGH);
txDeviceState.nextLedUpdate = currentMillis + 200;
}
}
#endif
}

View File

@@ -115,6 +115,7 @@ struct TxDeviceState_t {
uint8_t flags = 0;
uint32_t roundtrip = 0;
bool isReceiving = false; //Indicates that TX module is receiving frames from RX module
uint32_t nextLedUpdate = 0;
};
struct RxDeviceState_t {