Skip to content

Commit 8bf182f

Browse files
committed
AP_Scripting: changed LTE_BAND and LTE_MCCMNC to no-change by default
avoid setting band and network if not wanted
1 parent 2f2039b commit 8bf182f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libraries/AP_Scripting/drivers/LTE_modem.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ local LTE_IBAUD = bind_add_param('IBAUD', 13, 115200)
145145
// @Param: LTE_MCCMNC
146146
// @DisplayName: LTE operator selection
147147
// @Description: This allows selection of network operator
148-
// @Values: 0:Default,AU-Telstra:50501,AU-Optus:50502,AU-Vodaphone:50503
148+
// @Values: -1:NoChange,0:Default,AU-Telstra:50501,AU-Optus:50502,AU-Vodaphone:50503
149149
// @User: Standard
150150
--]]
151-
local LTE_MCCMNC = bind_add_param('MCCMNC', 14, 0)
151+
local LTE_MCCMNC = bind_add_param('MCCMNC', 14, -1)
152152

153153
local supports_routing = networking and networking.add_route -- luacheck: ignore 143
154154

@@ -211,11 +211,11 @@ local LTE_TX_RATE = bind_add_param('TX_RATE', 20, 0)
211211
--[[
212212
// @Param: LTE_BAND
213213
// @DisplayName: LTE band selection
214-
// @Description: This allows selection of LTE band, 0 for no preference
215-
// @Range: 0 50
214+
// @Description: This allows selection of LTE band. A value of -1 means no band setting change is made. A value of 0 sets all bands. Otherwise the specified band is set.
215+
// @Range: -1 50
216216
// @User: Standard
217217
--]]
218-
local LTE_BAND = bind_add_param('BAND', 21, 0)
218+
local LTE_BAND = bind_add_param('BAND', 21, -1)
219219

220220
LTE_OPTIONS_LOGALL = (1<<0)
221221
LTE_OPTIONS_SIGNALS = (1<<1)
@@ -746,7 +746,7 @@ local function set_MCCMNC()
746746
local mccmnc = math.floor(LTE_MCCMNC:get())
747747
if mccmnc > 0 then
748748
AT_send(string.format(modem.mccmnc, mccmnc))
749-
else
749+
elseif mccmnc == 0 then
750750
AT_send("AT+COPS=0\r\n")
751751
end
752752
last_mccmnc = mccmnc
@@ -766,7 +766,7 @@ local function set_BAND()
766766
else
767767
AT_send(string.format(modem.setband, band))
768768
end
769-
else
769+
elseif band == 0 then
770770
AT_send(modem.setband_all)
771771
end
772772
last_band = band

0 commit comments

Comments
 (0)