Merge pull request #53 from DzikuVx/tx-indication-improvements
TX module LED indication
This commit is contained in:
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@@ -16,7 +16,8 @@
|
||||
"cppStandard": "c++17",
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"defines": [
|
||||
"FEATURE_TX_INPUT_SBUS"
|
||||
"FEATURE_TX_INPUT_SBUS",
|
||||
"ARDUINO_AVR_FEATHER32U4"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user