Merge branch 'master' into raspi-portduino

This commit is contained in:
Thomas Göttgens 2023-02-10 00:21:47 +01:00 committed by GitHub
commit 97a0b164be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 19 deletions

View File

@ -1,7 +1,7 @@
; Common settings for ESP targes, mixin with extends = esp32_base ; Common settings for ESP targes, mixin with extends = esp32_base
[esp32_base] [esp32_base]
extends = arduino_base extends = arduino_base
platform = platformio/espressif32@^5.2.0 platform = platformio/espressif32@^6.0.0
build_src_filter = build_src_filter =
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> ${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
upload_speed = 921600 upload_speed = 921600
@ -26,7 +26,7 @@ build_flags =
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2 -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
-DDEBUG_HEAP ;-DDEBUG_HEAP
lib_deps = lib_deps =
${arduino_base.lib_deps} ${arduino_base.lib_deps}

View File

@ -1,6 +1,6 @@
[esp32s2_base] [esp32s2_base]
extends = arduino_base extends = arduino_base
platform = platformio/espressif32@^5.2.0 platform = platformio/espressif32@^6.0.0
build_src_filter = build_src_filter =
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<nimble/> ${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<nimble/>
upload_speed = 961200 upload_speed = 961200
@ -27,7 +27,7 @@ build_flags =
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
-DHAS_BLUETOOTH=0 -DHAS_BLUETOOTH=0
-DDEBUG_HEAP ;-DDEBUG_HEAP
lib_deps = lib_deps =
${arduino_base.lib_deps} ${arduino_base.lib_deps}

View File

@ -1,6 +1,6 @@
[esp32s3_base] [esp32s3_base]
extends = arduino_base extends = arduino_base
platform = platformio/espressif32@^5.2.0 platform = platformio/espressif32@^6.0.0
build_src_filter = build_src_filter =
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> ${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
upload_speed = 961200 upload_speed = 961200
@ -26,7 +26,7 @@ build_flags =
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2 -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20 -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
-DDEBUG_HEAP ;-DDEBUG_HEAP
lib_deps = lib_deps =
${arduino_base.lib_deps} ${arduino_base.lib_deps}

@ -1 +1 @@
Subproject commit 4bd60496c7372b9612c8eac2b4365ff23cb92ab1 Subproject commit 400dc2358942f1954b188cb5698a545850ca3d73

View File

@ -225,6 +225,9 @@ typedef struct _meshtastic_Config_DeviceConfig {
uint32_t buzzer_gpio; uint32_t buzzer_gpio;
/* Sets the role of node */ /* Sets the role of node */
meshtastic_Config_DeviceConfig_RebroadcastMode rebroadcast_mode; meshtastic_Config_DeviceConfig_RebroadcastMode rebroadcast_mode;
/* Send our nodeinfo this often
Defaults to 900 Seconds (15 minutes) */
uint32_t node_info_broadcast_secs;
} meshtastic_Config_DeviceConfig; } meshtastic_Config_DeviceConfig;
/* Position Config */ /* Position Config */
@ -515,7 +518,7 @@ extern "C" {
/* Initializer values for message structs */ /* Initializer values for message structs */
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}} #define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN} #define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0}
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""} #define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
@ -524,7 +527,7 @@ extern "C" {
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}} #define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0} #define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}} #define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN} #define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0}
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""} #define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
@ -540,6 +543,7 @@ extern "C" {
#define meshtastic_Config_DeviceConfig_button_gpio_tag 4 #define meshtastic_Config_DeviceConfig_button_gpio_tag 4
#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5 #define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6 #define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6
#define meshtastic_Config_DeviceConfig_node_info_broadcast_secs_tag 7
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1 #define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2 #define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
#define meshtastic_Config_PositionConfig_fixed_position_tag 3 #define meshtastic_Config_PositionConfig_fixed_position_tag 3
@ -629,7 +633,8 @@ X(a, STATIC, SINGULAR, BOOL, serial_enabled, 2) \
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \ X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \
X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \ X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \ X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \
X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6) X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6) \
X(a, STATIC, SINGULAR, UINT32, node_info_broadcast_secs, 7)
#define meshtastic_Config_DeviceConfig_CALLBACK NULL #define meshtastic_Config_DeviceConfig_CALLBACK NULL
#define meshtastic_Config_DeviceConfig_DEFAULT NULL #define meshtastic_Config_DeviceConfig_DEFAULT NULL
@ -741,7 +746,7 @@ extern const pb_msgdesc_t meshtastic_Config_BluetoothConfig_msg;
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
#define meshtastic_Config_BluetoothConfig_size 10 #define meshtastic_Config_BluetoothConfig_size 10
#define meshtastic_Config_DeviceConfig_size 20 #define meshtastic_Config_DeviceConfig_size 26
#define meshtastic_Config_DisplayConfig_size 26 #define meshtastic_Config_DisplayConfig_size 26
#define meshtastic_Config_LoRaConfig_size 77 #define meshtastic_Config_LoRaConfig_size 77
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20 #define meshtastic_Config_NetworkConfig_IpV4Config_size 20

View File

@ -188,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg;
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
#define meshtastic_ChannelFile_size 638 #define meshtastic_ChannelFile_size 638
#define meshtastic_DeviceState_size 21800 #define meshtastic_DeviceState_size 21800
#define meshtastic_OEMStore_size 2992 #define meshtastic_OEMStore_size 2998
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -156,7 +156,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg #define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
#define meshtastic_LocalConfig_size 434 #define meshtastic_LocalConfig_size 440
#define meshtastic_LocalModuleConfig_size 412 #define meshtastic_LocalModuleConfig_size 412
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -212,7 +212,6 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
void AdminModule::handleSetOwner(const meshtastic_User &o) void AdminModule::handleSetOwner(const meshtastic_User &o)
{ {
int changed = 0; int changed = 0;
bool licensed_changed = false;
if (*o.long_name) { if (*o.long_name) {
changed |= strcmp(owner.long_name, o.long_name); changed |= strcmp(owner.long_name, o.long_name);
@ -228,14 +227,12 @@ void AdminModule::handleSetOwner(const meshtastic_User &o)
} }
if (owner.is_licensed != o.is_licensed) { if (owner.is_licensed != o.is_licensed) {
changed = 1; changed = 1;
licensed_changed = true;
owner.is_licensed = o.is_licensed; owner.is_licensed = o.is_licensed;
config.lora.override_duty_cycle = owner.is_licensed; // override duty cycle for licensed operators
} }
if (changed) { // If nothing really changed, don't broadcast on the network or write to flash if (changed) { // If nothing really changed, don't broadcast on the network or write to flash
service.reloadOwner(!hasOpenEditTransaction); service.reloadOwner(!hasOpenEditTransaction);
licensed_changed ? saveChanges(SEGMENT_CONFIG | SEGMENT_DEVICESTATE) : saveChanges(SEGMENT_DEVICESTATE); saveChanges(SEGMENT_DEVICESTATE);
} }
} }
@ -604,14 +601,27 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p) void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p)
{ {
// Set call sign and override lora limitations for licensed use
strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name)); strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name));
owner.is_licensed = true; owner.is_licensed = true;
config.lora.override_duty_cycle = true; config.lora.override_duty_cycle = true;
config.lora.tx_power = p.tx_power; config.lora.tx_power = p.tx_power;
config.lora.override_frequency = p.frequency; config.lora.override_frequency = p.frequency;
// Set node info broadcast interval to 10 minutes
// For FCC minimum call-sign announcement
config.device.node_info_broadcast_secs = 600;
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY;
// Remove PSK of primary channel for plaintext amateur usage
auto primaryChannel = channels.getByIndex(channels.getPrimaryIndex());
auto &channelSettings = primaryChannel.settings;
channelSettings.psk.bytes[0] = 0;
channelSettings.psk.size = 0;
channels.setChannel(primaryChannel);
channels.onConfigChanged();
service.reloadOwner(false); service.reloadOwner(false);
service.reloadConfig(SEGMENT_CONFIG | SEGMENT_DEVICESTATE); service.reloadConfig(SEGMENT_CONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
} }
AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg) AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg)

View File

@ -71,5 +71,5 @@ int32_t NodeInfoModule::runOnce()
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
} }
return default_broadcast_interval_secs * 1000; return getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_broadcast_interval_secs);
} }