mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 09:45:33 +03:00
Add support for getting and setting arbitrary settings via MSPv2
Add MSP2_COMMON_SETTING for retrieving arbitrary settings and MSP2_COMMON_SET_SETTING for setting them. This exposes any setting which was only available from the CLI via MSP now. Add support in settings.rb to generate a JSON file with all the settings, their types and their possible values for settings using a table. This file can be used by clients to properly format messages for settings over MSP.
This commit is contained in:
parent
cce3a25e35
commit
ff18b726d3
7 changed files with 232 additions and 11 deletions
|
@ -62,6 +62,19 @@ bool setting_name_exact_match(const setting_t *val, char *buf, const char *cmdli
|
|||
return sl_strncasecmp(cmdline, buf, strlen(buf)) == 0 && var_name_length == strlen(buf);
|
||||
}
|
||||
|
||||
const setting_t *setting_find(const char *name)
|
||||
{
|
||||
char buf[SETTING_MAX_NAME_LENGTH];
|
||||
for (int ii = 0; ii < SETTINGS_TABLE_COUNT; ii++) {
|
||||
const setting_t *setting = &settingsTable[ii];
|
||||
setting_get_name(setting, buf);
|
||||
if (strcmp(buf, name) == 0) {
|
||||
return setting;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pgn_t setting_get_pgn(const setting_t *val)
|
||||
{
|
||||
uint16_t pos = val - (const setting_t *)settingsTable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue