Move LoRa config out of primary channel

pull/1444/head
Sacha Weatherstone 2022-05-07 13:34:06 +10:00
rodzic 211273cc08
commit ea86f76393
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7AB2D7E206124B31
14 zmienionych plików z 130 dodań i 135 usunięć

2
proto

@ -1 +1 @@
Subproject commit 521620ba14862d541f85e1eee7445eccb6a6b92a
Subproject commit cb8c31bdd9ff17e3cbc904c86a6caf927b2021c5

1
sdk-nrfxlib 160000

@ -0,0 +1 @@
Subproject commit e6e02cb83d238fae2f54f084858bd5e49a31afa1

Wyświetl plik

@ -31,8 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graphics/images.h"
#include "main.h"
#include "mesh-pb-constants.h"
#include "mesh/generated/deviceonly.pb.h"
#include "mesh/Channels.h"
#include "mesh/generated/deviceonly.pb.h"
#include "modules/TextMessageModule.h"
#include "sleep.h"
#include "target_specific.h"
@ -162,21 +162,22 @@ static void drawOEMIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDi
// needs to be drawn relative to x and y
// draw centered icon left to right and centered above the one line of app text
display->drawXbm(x + (SCREEN_WIDTH - oemStore.oem_icon_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - oemStore.oem_icon_height) / 2 + 2,
oemStore.oem_icon_width, oemStore.oem_icon_height, (const uint8_t *)oemStore.oem_icon_bits.bytes);
display->drawXbm(x + (SCREEN_WIDTH - oemStore.oem_icon_width) / 2,
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - oemStore.oem_icon_height) / 2 + 2, oemStore.oem_icon_width,
oemStore.oem_icon_height, (const uint8_t *)oemStore.oem_icon_bits.bytes);
switch(oemStore.oem_font){
case 0:
display->setFont(FONT_SMALL);
switch (oemStore.oem_font) {
case 0:
display->setFont(FONT_SMALL);
break;
case 2:
display->setFont(FONT_LARGE);
case 2:
display->setFont(FONT_LARGE);
break;
default:
display->setFont(FONT_MEDIUM);
default:
display->setFont(FONT_MEDIUM);
break;
}
display->setTextAlignment(TEXT_ALIGN_LEFT);
const char *title = oemStore.oem_text;
display->drawString(x + getStringCenteredX(title), y + SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM, title);
@ -816,7 +817,8 @@ void _screen_header()
#endif
// #ifdef RAK4630
// Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl), dispdev_oled(address, sda, scl), ui(&dispdev)
// Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl),
// dispdev_oled(address, sda, scl), ui(&dispdev)
// {
// address_found = address;
// cmdQueue.setReader(this);
@ -976,7 +978,7 @@ int32_t Screen::runOnce()
}
// If we have an OEM Boot screen, toggle after 2,5 seconds
if(strlen(oemStore.oem_text) > 0){
if (strlen(oemStore.oem_text) > 0) {
static bool showingOEMBootScreen = true;
if (showingOEMBootScreen && (millis() > (2500 + serialSinceMsec))) {
DEBUG_MSG("Switch to OEM screen...\n");
@ -1515,22 +1517,33 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
auto mode = "";
if (channels.getPrimary().modem_config == 0) {
mode = "VLongSlow";
} else if (channels.getPrimary().modem_config == 1) {
mode = "LongSlow";
} else if (channels.getPrimary().modem_config == 2) {
mode = "LongFast";
} else if (channels.getPrimary().modem_config == 3) {
mode = "MidSlow";
} else if (channels.getPrimary().modem_config == 4) {
mode = "MidFast";
} else if (channels.getPrimary().modem_config == 5) {
Config_LoRaConfig &loraConfig = config.payloadVariant.lora_config;
switch (loraConfig.modem_config) {
case Config_LoRaConfig_ModemConfig_ShortSlow:
mode = "ShortSlow";
} else if (channels.getPrimary().modem_config == 6) {
break;
case Config_LoRaConfig_ModemConfig_ShortFast:
mode = "ShortFast";
} else {
break;
case Config_LoRaConfig_ModemConfig_MidSlow:
mode = "MediumSlow";
break;
case Config_LoRaConfig_ModemConfig_MidFast:
mode = "MediumFast";
break;
case Config_LoRaConfig_ModemConfig_LongFast:
mode = "LongFast";
break;
case Config_LoRaConfig_ModemConfig_LongSlow:
mode = "LongSlow";
break;
case Config_LoRaConfig_ModemConfig_VLongSlow:
mode = "VLongSlow";
break;
default:
mode = "Custom";
break;
}
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode), y, mode);

Wyświetl plik

@ -1,7 +1,7 @@
#include "configuration.h"
#include "Channels.h"
#include "CryptoEngine.h"
#include "NodeDB.h"
#include "configuration.h"
#include <assert.h>
@ -83,10 +83,11 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
{
Channel &ch = getByIndex(chIndex);
ChannelSettings &channelSettings = ch.settings;
Config_LoRaConfig &loraConfig = config.payloadVariant.lora_config;
channelSettings.modem_config = ChannelSettings_ModemConfig_LongFast; // Default to Long Range & Fast
loraConfig.modem_config = Config_LoRaConfig_ModemConfig_LongFast; // Default to Long Range & Fast
channelSettings.tx_power = 0; // default
loraConfig.tx_power = 0; // default
uint8_t defaultpskIndex = 1;
channelSettings.psk.bytes[0] = defaultpskIndex;
channelSettings.psk.size = 1;
@ -202,6 +203,7 @@ void Channels::setChannel(const Channel &c)
const char *Channels::getName(size_t chIndex)
{
Config_LoRaConfig &loraConfig = config.payloadVariant.lora_config;
// Convert the short "" representation for Default into a usable string
const ChannelSettings &channelSettings = getByIndex(chIndex).settings;
const char *channelName = channelSettings.name;
@ -209,29 +211,29 @@ const char *Channels::getName(size_t chIndex)
// Per mesh.proto spec, if bandwidth is specified we must ignore modemConfig enum, we assume that in that case
// the app fucked up and forgot to set channelSettings.name
if (channelSettings.bandwidth != 0)
if (loraConfig.bandwidth != 0)
channelName = "Unset";
else
switch (channelSettings.modem_config) {
case ChannelSettings_ModemConfig_ShortSlow:
switch (loraConfig.modem_config) {
case Config_LoRaConfig_ModemConfig_ShortSlow:
channelName = "ShortSlow";
break;
case ChannelSettings_ModemConfig_ShortFast:
case Config_LoRaConfig_ModemConfig_ShortFast:
channelName = "ShortFast";
break;
case ChannelSettings_ModemConfig_MidSlow:
case Config_LoRaConfig_ModemConfig_MidSlow:
channelName = "MediumSlow";
break;
case ChannelSettings_ModemConfig_MidFast:
case Config_LoRaConfig_ModemConfig_MidFast:
channelName = "MediumFast";
break;
case ChannelSettings_ModemConfig_LongFast:
case Config_LoRaConfig_ModemConfig_LongFast:
channelName = "LongFast";
break;
case ChannelSettings_ModemConfig_LongSlow:
case Config_LoRaConfig_ModemConfig_LongSlow:
channelName = "LongSlow";
break;
case ChannelSettings_ModemConfig_VLongSlow:
case Config_LoRaConfig_ModemConfig_VLongSlow:
channelName = "VLongSlow";
break;
default:

Wyświetl plik

@ -210,6 +210,7 @@ void NodeDB::installDefaultDeviceState()
installDefaultChannels();
installDefaultRadioConfig();
installDefaultConfig();
}
void NodeDB::init()

Wyświetl plik

@ -76,15 +76,15 @@ const RegionInfo regions[] = {
*/
RDEF(IN, 865.0f, 867.0f, 100, 0, 30, true, false),
/*
https://rrf.rsm.govt.nz/smart-web/smart/page/-smart/domain/licence/LicenceSummary.wdk?id=219752
https://iotalliance.org.nz/wp-content/uploads/sites/4/2019/05/IoT-Spectrum-in-NZ-Briefing-Paper.pdf
*/
/*
https://rrf.rsm.govt.nz/smart-web/smart/page/-smart/domain/licence/LicenceSummary.wdk?id=219752
https://iotalliance.org.nz/wp-content/uploads/sites/4/2019/05/IoT-Spectrum-in-NZ-Briefing-Paper.pdf
*/
RDEF(NZ865, 864.0f, 868.0f, 100, 0, 0, true, false),
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
*/
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
*/
RDEF(TH, 920.0f, 925.0f, 100, 0, 16, true, false),
/*
@ -183,7 +183,6 @@ uint32_t RadioInterface::getTxDelayMsec()
return random((MIN_TX_WAIT_MSEC), (MIN_TX_WAIT_MSEC + shortPacketMsec));
}
/** The delay to use when we want to send something but the ether is busy */
uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
{
@ -210,7 +209,6 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
DEBUG_MSG("rx_snr found in packet. Setting tx delay:%d\n", delay);
}
return delay;
}
@ -351,41 +349,41 @@ void RadioInterface::applyModemConfig()
{
// Set up default configuration
// No Sync Words in LORA mode
Config_LoRaConfig &loraConfig = config.payloadVariant.lora_config;
auto channelSettings = channels.getPrimary();
if (channelSettings.spread_factor == 0) {
switch (channelSettings.modem_config) {
case ChannelSettings_ModemConfig_ShortFast:
if (loraConfig.spread_factor == 0) {
switch (loraConfig.modem_config) {
case Config_LoRaConfig_ModemConfig_ShortFast:
bw = 250;
cr = 8;
sf = 7;
break;
case ChannelSettings_ModemConfig_ShortSlow:
case Config_LoRaConfig_ModemConfig_ShortSlow:
bw = 250;
cr = 8;
sf = 8;
break;
case ChannelSettings_ModemConfig_MidFast:
case Config_LoRaConfig_ModemConfig_MidFast:
bw = 250;
cr = 8;
sf = 9;
break;
case ChannelSettings_ModemConfig_MidSlow:
case Config_LoRaConfig_ModemConfig_MidSlow:
bw = 250;
cr = 8;
sf = 10;
break;
case ChannelSettings_ModemConfig_LongFast:
case Config_LoRaConfig_ModemConfig_LongFast:
bw = 250;
cr = 8;
sf = 11;
break;
case ChannelSettings_ModemConfig_LongSlow:
case Config_LoRaConfig_ModemConfig_LongSlow:
bw = 125;
cr = 8;
sf = 12;
break;
case ChannelSettings_ModemConfig_VLongSlow:
case Config_LoRaConfig_ModemConfig_VLongSlow:
bw = 31.25;
cr = 8;
sf = 12;
@ -394,9 +392,9 @@ void RadioInterface::applyModemConfig()
assert(0); // Unknown enum
}
} else {
sf = channelSettings.spread_factor;
cr = channelSettings.coding_rate;
bw = channelSettings.bandwidth;
sf = loraConfig.spread_factor;
cr = loraConfig.coding_rate;
bw = loraConfig.bandwidth;
if (bw == 31) // This parameter is not an integer
bw = 31.25;
@ -404,7 +402,7 @@ void RadioInterface::applyModemConfig()
bw = 62.5;
}
power = channelSettings.tx_power;
power = loraConfig.tx_power;
shortPacketMsec = getPacketTime(sizeof(PacketHeader));
assert(myRegion); // Should have been found in init
@ -419,7 +417,7 @@ void RadioInterface::applyModemConfig()
saveChannelNum(channel_num);
saveFreq(freq);
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelName, channelSettings.modem_config, channel_num, power);
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelName, loraConfig.modem_config, channel_num, power);
DEBUG_MSG("Radio myRegion->freqStart / myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
myRegion->freqEnd - myRegion->freqStart);
DEBUG_MSG("Radio myRegion->numChannels: %d\n", numChannels);

Wyświetl plik

@ -11,3 +11,4 @@ PB_BIND(AdminMessage, AdminMessage, 2)

Wyświetl plik

@ -14,4 +14,3 @@ PB_BIND(Channel, Channel, AUTO)

Wyświetl plik

@ -10,16 +10,6 @@
#endif
/* Enum definitions */
typedef enum _ChannelSettings_ModemConfig {
ChannelSettings_ModemConfig_VLongSlow = 0,
ChannelSettings_ModemConfig_LongSlow = 1,
ChannelSettings_ModemConfig_LongFast = 2,
ChannelSettings_ModemConfig_MidSlow = 3,
ChannelSettings_ModemConfig_MidFast = 4,
ChannelSettings_ModemConfig_ShortSlow = 5,
ChannelSettings_ModemConfig_ShortFast = 6
} ChannelSettings_ModemConfig;
typedef enum _Channel_Role {
Channel_Role_DISABLED = 0,
Channel_Role_PRIMARY = 1,
@ -48,28 +38,6 @@ typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
FIXME: explain how apps use channels for security.
explain how remote settings and remote gpio are managed as an example */
typedef struct _ChannelSettings {
/* If zero then, use default max legal continuous power (ie. something that won't
burn out the radio hardware)
In most cases you should use zero here.
Units are in dBm. */
int8_t tx_power;
/* Note: This is the 'old' mechanism for specifying channel parameters.
Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH.
As a heuristic: If bandwidth is specified, do not use modem_config.
Because protobufs take ZERO space when the value is zero this works out nicely.
This value is replaced by bandwidth/spread_factor/coding_rate.
If you'd like to experiment with other options add them to MeshRadio.cpp in the device code. */
ChannelSettings_ModemConfig modem_config;
/* Bandwidth in MHz
Certain bandwidth numbers are 'special' and will be converted to the
appropriate floating point value: 31 -> 31.25MHz */
ChannelSettings_psk_t psk;
/* A number from 7 to 12.
Indicates number of chirps per symbol as 1<<spread_factor. */
char name[12];
/* The denominator of the coding rate.
ie for 4/8, the value is 8. 5/8 the value is 5. */
uint16_t bandwidth;
/* NOTE: this field is _independent_ and unrelated to the concepts in channel.proto.
this is controlling the actual hardware frequency the radio is transmitting on.
In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming.
@ -88,7 +56,7 @@ typedef struct _ChannelSettings {
hash = ((hash << 5) + hash) + (unsigned char) c;
return hash;
} */
uint32_t spread_factor;
ChannelSettings_psk_t psk;
/* A simple pre-shared key for now for crypto.
Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
A special shorthand is used for 1 byte long psks.
@ -99,7 +67,7 @@ typedef struct _ChannelSettings {
`1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf}
`2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
Shown to user as simple1 through 10 */
uint8_t coding_rate;
char name[12];
/* A SHORT name that will be packed into the URL.
Less than 12 bytes.
Something for end users to call the channel
@ -142,10 +110,6 @@ typedef struct _Channel {
/* Helper constants for enums */
#define _ChannelSettings_ModemConfig_MIN ChannelSettings_ModemConfig_VLongSlow
#define _ChannelSettings_ModemConfig_MAX ChannelSettings_ModemConfig_ShortFast
#define _ChannelSettings_ModemConfig_ARRAYSIZE ((ChannelSettings_ModemConfig)(ChannelSettings_ModemConfig_ShortFast+1))
#define _Channel_Role_MIN Channel_Role_DISABLED
#define _Channel_Role_MAX Channel_Role_SECONDARY
#define _Channel_Role_ARRAYSIZE ((Channel_Role)(Channel_Role_SECONDARY+1))
@ -156,19 +120,14 @@ extern "C" {
#endif
/* Initializer values for message structs */
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
#define ChannelSettings_init_default {{0, {0}}, "", 0, 0, 0, 0}
#define Channel_init_default {0, false, ChannelSettings_init_default, _Channel_Role_MIN}
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
#define ChannelSettings_init_zero {{0, {0}}, "", 0, 0, 0, 0}
#define Channel_init_zero {0, false, ChannelSettings_init_zero, _Channel_Role_MIN}
/* Field tags (for use in manual encoding/decoding) */
#define ChannelSettings_tx_power_tag 1
#define ChannelSettings_modem_config_tag 3
#define ChannelSettings_psk_tag 4
#define ChannelSettings_name_tag 5
#define ChannelSettings_bandwidth_tag 6
#define ChannelSettings_spread_factor_tag 7
#define ChannelSettings_coding_rate_tag 8
#define ChannelSettings_channel_num_tag 9
#define ChannelSettings_id_tag 10
#define ChannelSettings_uplink_enabled_tag 16
@ -179,13 +138,8 @@ extern "C" {
/* Struct field encoding specification for nanopb */
#define ChannelSettings_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, INT32, tx_power, 1) \
X(a, STATIC, SINGULAR, UENUM, modem_config, 3) \
X(a, STATIC, SINGULAR, BYTES, psk, 4) \
X(a, STATIC, SINGULAR, STRING, name, 5) \
X(a, STATIC, SINGULAR, UINT32, bandwidth, 6) \
X(a, STATIC, SINGULAR, UINT32, spread_factor, 7) \
X(a, STATIC, SINGULAR, UINT32, coding_rate, 8) \
X(a, STATIC, SINGULAR, UINT32, channel_num, 9) \
X(a, STATIC, SINGULAR, FIXED32, id, 10) \
X(a, STATIC, SINGULAR, BOOL, uplink_enabled, 16) \
@ -209,8 +163,8 @@ extern const pb_msgdesc_t Channel_msg;
#define Channel_fields &Channel_msg
/* Maximum encoded size of messages (where known) */
#define ChannelSettings_size 87
#define Channel_size 102
#define ChannelSettings_size 61
#define Channel_size 76
#ifdef __cplusplus
} /* extern "C" */

Wyświetl plik

@ -52,3 +52,4 @@ PB_BIND(Config_ModuleConfig_CannedMessageConfig, Config_ModuleConfig_CannedMessa

Wyświetl plik

@ -10,6 +10,17 @@
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _Config_LoRaConfig_ModemConfig {
Config_LoRaConfig_ModemConfig_VLongSlow = 0,
Config_LoRaConfig_ModemConfig_LongSlow = 1,
Config_LoRaConfig_ModemConfig_LongFast = 2,
Config_LoRaConfig_ModemConfig_MidSlow = 3,
Config_LoRaConfig_ModemConfig_MidFast = 4,
Config_LoRaConfig_ModemConfig_ShortSlow = 5,
Config_LoRaConfig_ModemConfig_ShortFast = 6
} Config_LoRaConfig_ModemConfig;
/* Struct definitions */
typedef struct _Config_DeviceConfig {
char dummy_field;
@ -23,10 +34,6 @@ typedef struct _Config_GpsConfig {
char dummy_field;
} Config_GpsConfig;
typedef struct _Config_LoRaConfig {
char dummy_field;
} Config_LoRaConfig;
typedef struct _Config_ModuleConfig_CannedMessageConfig {
char dummy_field;
} Config_ModuleConfig_CannedMessageConfig;
@ -55,6 +62,14 @@ typedef struct _Config_PowerConfig {
char dummy_field;
} Config_PowerConfig;
typedef struct _Config_LoRaConfig {
int32_t tx_power;
Config_LoRaConfig_ModemConfig modem_config;
uint32_t bandwidth;
uint32_t spread_factor;
uint32_t coding_rate;
} Config_LoRaConfig;
typedef struct _Config_ModuleConfig_TelemetryConfig {
uint32_t device_update_interval;
uint32_t environment_update_interval;
@ -101,6 +116,12 @@ typedef struct _Config {
} Config;
/* Helper constants for enums */
#define _Config_LoRaConfig_ModemConfig_MIN Config_LoRaConfig_ModemConfig_VLongSlow
#define _Config_LoRaConfig_ModemConfig_MAX Config_LoRaConfig_ModemConfig_ShortFast
#define _Config_LoRaConfig_ModemConfig_ARRAYSIZE ((Config_LoRaConfig_ModemConfig)(Config_LoRaConfig_ModemConfig_ShortFast+1))
#ifdef __cplusplus
extern "C" {
#endif
@ -112,7 +133,7 @@ extern "C" {
#define Config_PowerConfig_init_default {0}
#define Config_WiFiConfig_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0}
#define Config_DisplayConfig_init_default {0}
#define Config_LoRaConfig_init_default {0}
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemConfig_MIN, 0, 0, 0}
#define Config_ModuleConfig_init_default {0, {Config_ModuleConfig_MQTTConfig_init_default}}
#define Config_ModuleConfig_MQTTConfig_init_default {0}
#define Config_ModuleConfig_SerialConfig_init_default {0}
@ -127,7 +148,7 @@ extern "C" {
#define Config_PowerConfig_init_zero {0}
#define Config_WiFiConfig_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0}
#define Config_DisplayConfig_init_zero {0}
#define Config_LoRaConfig_init_zero {0}
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemConfig_MIN, 0, 0, 0}
#define Config_ModuleConfig_init_zero {0, {Config_ModuleConfig_MQTTConfig_init_zero}}
#define Config_ModuleConfig_MQTTConfig_init_zero {0}
#define Config_ModuleConfig_SerialConfig_init_zero {0}
@ -138,6 +159,11 @@ extern "C" {
#define Config_ModuleConfig_CannedMessageConfig_init_zero {0}
/* Field tags (for use in manual encoding/decoding) */
#define Config_LoRaConfig_tx_power_tag 1
#define Config_LoRaConfig_modem_config_tag 3
#define Config_LoRaConfig_bandwidth_tag 6
#define Config_LoRaConfig_spread_factor_tag 7
#define Config_LoRaConfig_coding_rate_tag 8
#define Config_ModuleConfig_TelemetryConfig_device_update_interval_tag 1
#define Config_ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
#define Config_ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
@ -212,7 +238,11 @@ X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 3)
#define Config_DisplayConfig_DEFAULT NULL
#define Config_LoRaConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, INT32, tx_power, 1) \
X(a, STATIC, SINGULAR, UENUM, modem_config, 3) \
X(a, STATIC, SINGULAR, UINT32, bandwidth, 6) \
X(a, STATIC, SINGULAR, UINT32, spread_factor, 7) \
X(a, STATIC, SINGULAR, UINT32, coding_rate, 8)
#define Config_LoRaConfig_CALLBACK NULL
#define Config_LoRaConfig_DEFAULT NULL
@ -316,7 +346,7 @@ extern const pb_msgdesc_t Config_ModuleConfig_CannedMessageConfig_msg;
#define Config_DeviceConfig_size 0
#define Config_DisplayConfig_size 0
#define Config_GpsConfig_size 0
#define Config_LoRaConfig_size 0
#define Config_LoRaConfig_size 31
#define Config_ModuleConfig_CannedMessageConfig_size 0
#define Config_ModuleConfig_ExternalNotificationConfig_size 0
#define Config_ModuleConfig_MQTTConfig_size 0

Wyświetl plik

@ -158,7 +158,7 @@ extern const pb_msgdesc_t OEMStore_msg;
#define OEMStore_fields &OEMStore_msg
/* Maximum encoded size of messages (where known) */
#define ChannelFile_size 832
#define ChannelFile_size 624
#define DeviceState_size 19197
#define OEMStore_size 2106

Wyświetl plik

@ -55,4 +55,3 @@ PB_BIND(ToRadio_PeerInfo, ToRadio_PeerInfo, AUTO)

Wyświetl plik

@ -209,6 +209,8 @@ void AdminModule::handleSetConfig(const Config &c)
break;
case Config_lora_config_tag:
DEBUG_MSG("Setting config: LoRa\n");
config.payloadVariant.lora_config = c.payloadVariant.lora_config;
service.reloadConfig();
break;
}
@ -248,15 +250,8 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
void AdminModule::handleSetChannel(const Channel &cc)
{
channels.setChannel(cc);
// Just update and save the channels - no need to update the radio for ! primary channel changes
if (cc.index == 0) {
// FIXME, this updates the user preferences also, which isn't needed - we really just want to notify on configChanged
service.reloadConfig();
} else {
channels.onConfigChanged(); // tell the radios about this change
nodeDB.saveChannelsToDisk();
}
channels.onConfigChanged(); // tell the radios about this change
nodeDB.saveChannelsToDisk();
}
/**
@ -325,6 +320,7 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
case AdminMessage_ConfigType_LORA_CONFIG:
DEBUG_MSG("Getting config: LoRa\n");
res.get_config_response.which_payloadVariant = Config_lora_config_tag;
res.get_config_response.payloadVariant.lora_config = config.payloadVariant.lora_config;
break;
}