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",
|
"cppStandard": "c++17",
|
||||||
"compilerPath": "/usr/bin/clang",
|
"compilerPath": "/usr/bin/clang",
|
||||||
"defines": [
|
"defines": [
|
||||||
"FEATURE_TX_INPUT_SBUS"
|
"FEATURE_TX_INPUT_SBUS",
|
||||||
|
"ARDUINO_AVR_FEATHER32U4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -648,8 +648,24 @@ void loop(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
uint8_t flags = 0;
|
||||||
uint32_t roundtrip = 0;
|
uint32_t roundtrip = 0;
|
||||||
bool isReceiving = false; //Indicates that TX module is receiving frames from RX module
|
bool isReceiving = false; //Indicates that TX module is receiving frames from RX module
|
||||||
|
uint32_t nextLedUpdate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RxDeviceState_t {
|
struct RxDeviceState_t {
|
||||||
|
|||||||
Reference in New Issue
Block a user