mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 02:32:23 +00:00
Adds a userPrefs.h file, default blank, used for default settings for custom builds (#4325)
* add a userPrefs.h file, default blank, which can be used to easily set defaults on custom builds. * Add Splash Screen to userPrefs * Add channel 0 defaults to userPrefs.h * CONFIG_LORA_IGNORE_MQTT_DEFAULT * Unify naming for USERPREFS defines --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "Channels.h"
|
||||
#include "../userPrefs.h"
|
||||
#include "CryptoEngine.h"
|
||||
#include "DisplayFormatters.h"
|
||||
#include "NodeDB.h"
|
||||
@@ -90,6 +91,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
|
||||
loraConfig.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast
|
||||
loraConfig.use_preset = true;
|
||||
loraConfig.tx_power = 0; // default
|
||||
loraConfig.channel_num = 0;
|
||||
uint8_t defaultpskIndex = 1;
|
||||
channelSettings.psk.bytes[0] = defaultpskIndex;
|
||||
channelSettings.psk.size = 1;
|
||||
@@ -99,6 +101,29 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
|
||||
|
||||
ch.has_settings = true;
|
||||
ch.role = meshtastic_Channel_Role_PRIMARY;
|
||||
|
||||
#ifdef LORACONFIG_MODEM_PRESET_USERPREFS
|
||||
loraConfig.modem_preset = LORACONFIG_MODEM_PRESET_USERPREFS;
|
||||
#endif
|
||||
#ifdef LORACONFIG_CHANNEL_NUM_USERPREFS
|
||||
loraConfig.channel_num = LORACONFIG_CHANNEL_NUM_USERPREFS;
|
||||
#endif
|
||||
|
||||
// Install custom defaults. Will eventually support setting multiple default channels
|
||||
if (chIndex == 0) {
|
||||
#ifdef CHANNEL_0_PSK_USERPREFS
|
||||
static const uint8_t defaultpsk[] = CHANNEL_0_PSK_USERPREFS;
|
||||
memcpy(channelSettings.psk.bytes, defaultpsk, sizeof(defaultpsk));
|
||||
channelSettings.psk.size = sizeof(defaultpsk);
|
||||
|
||||
#endif
|
||||
#ifdef CHANNEL_0_NAME_USERPREFS
|
||||
strcpy(channelSettings.name, CHANNEL_0_NAME_USERPREFS);
|
||||
#endif
|
||||
#ifdef CHANNEL_0_PRECISION_USERPREFS
|
||||
channelSettings.module_settings.position_precision = CHANNEL_0_PRECISION_USERPREFS;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
CryptoKey Channels::getKey(ChannelIndex chIndex)
|
||||
@@ -330,4 +355,4 @@ bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
|
||||
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
|
||||
{
|
||||
return setCrypto(channelIndex);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user