[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luaLinkMode - protect from change while connected #2813

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
enable Mvalink for internal modules
  • Loading branch information
JyeSmith committed Jun 27, 2024
commit 25b0cd9a2751dea3d5d0e514684228ca2a88c09b
30 changes: 13 additions & 17 deletions src/lib/LUA/tx_devLUA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,23 +696,19 @@ static void registerLuaParameters()
config.SetAntennaMode(arg);
});
}
// Only enable Mavlink option for external modules.
if (GPIO_PIN_RCSIGNAL_RX == GPIO_PIN_RCSIGNAL_TX)
{
registerLUAParameter(&luaLinkMode, [](struct luaPropertiesCommon *item, uint8_t arg) {
// Only allow changing when disconnected since we need to guarantee
// the switch pack and unpack functions are matched on the tx and rx.
bool isDisconnected = connectionState == disconnected;
if (isDisconnected)
{
config.SetLinkMode(arg);
}
else
{
setLuaWarningFlag(LUA_FLAG_ERROR_CONNECTED, true);
}
});
}
registerLUAParameter(&luaLinkMode, [](struct luaPropertiesCommon *item, uint8_t arg) {
// Only allow changing when disconnected since we need to guarantee
// the switch pack and unpack functions are matched on the tx and rx.
bool isDisconnected = connectionState == disconnected;
if (isDisconnected)
{
config.SetLinkMode(arg);
}
else
{
setLuaWarningFlag(LUA_FLAG_ERROR_CONNECTED, true);
}
});
if (!firmwareOptions.is_airport)
{
registerLUAParameter(&luaModelMatch, [](struct luaPropertiesCommon *item, uint8_t arg) {
Expand Down