Skip to content

Commit

Permalink
Update MissionRotation.lua
Browse files Browse the repository at this point in the history
Inhibited the ability to change mission if flight mode is AUTO, with associated warning message
  • Loading branch information
robustini authored Dec 2, 2024
1 parent 468c730 commit a5e5eef
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libraries/AP_Scripting/applets/MissionRotation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
local MAV_SEVERITY = {EMERGENCY=0, ALERT=1, CRITICAL=2, ERROR=3, WARNING=4, NOTICE=5, INFO=6, DEBUG=7}
local rc_switch = rc:find_channel_for_option(24)
if not rc_switch then
gcs:send_text(MAV_SEVERITY.ERROR, "Mission Reset switch not assigned.")
gcs:send_text(MAV_SEVERITY.ERROR, "Mission Reset switch not assigned")
return
end

Expand All @@ -14,6 +14,11 @@ local max_missions = 9
local high_timer = 0

local function read_mission(file_name)
if vehicle:get_mode() == 10 then -- 10 = AUTO mode
gcs:send_text(MAV_SEVERITY.ERROR, "Cannot load mission in AUTO mode")
return false
end

local file = io.open(file_name, "r")
if not file then
return false
Expand Down Expand Up @@ -62,7 +67,7 @@ local function read_mission(file_name)
end

if not read_mission("mission0.txt") then
gcs:send_text(MAV_SEVERITY.CRITICAL, "Critical error: mission0.txt not found, script stopped.")
gcs:send_text(MAV_SEVERITY.CRITICAL, "Critical error: mission0.txt not found, script stopped")
return
end

Expand Down Expand Up @@ -95,5 +100,5 @@ function update()
return update, 1000
end

gcs:send_text(MAV_SEVERITY.NOTICE, "MissionSelector loaded")
gcs:send_text(MAV_SEVERITY.NOTICE, "Mission Rotation loaded")
return update, 1000

0 comments on commit a5e5eef

Please sign in to comment.