From 94e50f146a3abf91caa5d01b8441231f7a930fff Mon Sep 17 00:00:00 2001 From: Hans Christian Olaussen <41271048+klutvott123@users.noreply.github.com> Date: Tue, 15 Dec 2020 22:43:37 +0100 Subject: [PATCH] Prevent running crossfire.lua if crossfire not available Checks if crossfire is available before running crossfire.lua. Exits the script and shows an error message if not. --- radio/sdcard/horus/SCRIPTS/TOOLS/crossfire.lua | 5 +++++ radio/sdcard/taranis-x7/SCRIPTS/TOOLS/crossfire.lua | 5 +++++ radio/sdcard/taranis-x9/SCRIPTS/TOOLS/crossfire.lua | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/radio/sdcard/horus/SCRIPTS/TOOLS/crossfire.lua b/radio/sdcard/horus/SCRIPTS/TOOLS/crossfire.lua index 0f9b1a20f..b19bb5ee2 100644 --- a/radio/sdcard/horus/SCRIPTS/TOOLS/crossfire.lua +++ b/radio/sdcard/horus/SCRIPTS/TOOLS/crossfire.lua @@ -30,6 +30,11 @@ local function run(event) return 2 end + if crossfireTelemetryPush() == nil then + error("Crossfire not available!") + return 2 + end + chdir("/SCRIPTS/TOOLS/CROSSFIRE") return "crossfire.lua" end diff --git a/radio/sdcard/taranis-x7/SCRIPTS/TOOLS/crossfire.lua b/radio/sdcard/taranis-x7/SCRIPTS/TOOLS/crossfire.lua index debf9056d..3e8a6930a 100644 --- a/radio/sdcard/taranis-x7/SCRIPTS/TOOLS/crossfire.lua +++ b/radio/sdcard/taranis-x7/SCRIPTS/TOOLS/crossfire.lua @@ -30,6 +30,11 @@ local function run(event) return 2 end + if crossfireTelemetryPush() == nil then + error("Crossfire not available!") + return 2 + end + chdir("/SCRIPTS/TOOLS/CROSSFIRE") return "crossfire.lua" end diff --git a/radio/sdcard/taranis-x9/SCRIPTS/TOOLS/crossfire.lua b/radio/sdcard/taranis-x9/SCRIPTS/TOOLS/crossfire.lua index 0f9b1a20f..b19bb5ee2 100644 --- a/radio/sdcard/taranis-x9/SCRIPTS/TOOLS/crossfire.lua +++ b/radio/sdcard/taranis-x9/SCRIPTS/TOOLS/crossfire.lua @@ -30,6 +30,11 @@ local function run(event) return 2 end + if crossfireTelemetryPush() == nil then + error("Crossfire not available!") + return 2 + end + chdir("/SCRIPTS/TOOLS/CROSSFIRE") return "crossfire.lua" end