Merge branch 'master' into xmodem-proto

This commit is contained in:
Thomas Göttgens
2023-01-16 20:11:02 +01:00
committed by GitHub
26 changed files with 123 additions and 79 deletions

View File

@@ -84,7 +84,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
uint8_t defaultpskIndex = 1;
channelSettings.psk.bytes[0] = defaultpskIndex;
channelSettings.psk.size = 1;
strcpy(channelSettings.name, "");
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
ch.has_settings = true;
ch.role = Channel_Role_PRIMARY;

View File

@@ -265,10 +265,10 @@ void NodeDB::installDefaultDeviceState()
// Set default owner name
pickNewNodeNum(); // based on macaddr now
sprintf(owner.long_name, "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
sprintf(owner.short_name, "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
snprintf(owner.long_name, sizeof(owner.long_name), "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
}

View File

@@ -94,6 +94,18 @@ const RegionInfo regions[] = {
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, false),
/*
433,05-434,7 Mhz 10 mW
https://nkrzi.gov.ua/images/upload/256/5810/PDF_UUZ_19_01_2016.pdf
*/
RDEF(UA_433, 433.0f, 434.7f, 10, 0, 10, true, false, false),
/*
868,0-868,6 Mhz 25 mW
https://nkrzi.gov.ua/images/upload/256/5810/PDF_UUZ_19_01_2016.pdf
*/
RDEF(UA_868, 868.0f, 868.6f, 1, 0, 14, true, false, false),
/*
2.4 GHZ WLAN Band equivalent. Only for SX128x chips.

View File

@@ -147,7 +147,11 @@ typedef enum _Config_LoRaConfig_RegionCode {
/* Thailand */
Config_LoRaConfig_RegionCode_TH = 12,
/* WLAN Band */
Config_LoRaConfig_RegionCode_LORA_24 = 13
Config_LoRaConfig_RegionCode_LORA_24 = 13,
/* Ukraine 433mhz */
Config_LoRaConfig_RegionCode_UA_433 = 14,
/* Ukraine 868mhz */
Config_LoRaConfig_RegionCode_UA_868 = 15
} Config_LoRaConfig_RegionCode;
/* Standard predefined channel settings
@@ -437,8 +441,8 @@ extern "C" {
#define _Config_DisplayConfig_DisplayMode_ARRAYSIZE ((Config_DisplayConfig_DisplayMode)(Config_DisplayConfig_DisplayMode_COLOR+1))
#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET
#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_LORA_24
#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_LORA_24+1))
#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_UA_868
#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_UA_868+1))
#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST
#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST

View File

@@ -438,8 +438,9 @@ typedef struct _Waypoint {
int32_t longitude_i;
/* Time the waypoint is to expire (epoch) */
uint32_t expire;
/* If true, only allow the original sender to update the waypoint. */
bool locked;
/* If greater than zero, treat the value as a nodenum only allowing them to update the waypoint.
If zero, the waypoint is open to be edited by any member of the mesh. */
uint32_t locked_to;
/* Name of the waypoint - max 30 chars */
char name[30];
/* Description of the waypoint - max 100 chars */
@@ -855,7 +856,7 @@ extern "C" {
#define Waypoint_latitude_i_tag 2
#define Waypoint_longitude_i_tag 3
#define Waypoint_expire_tag 4
#define Waypoint_locked_tag 5
#define Waypoint_locked_to_tag 5
#define Waypoint_name_tag 6
#define Waypoint_description_tag 7
#define Waypoint_icon_tag 8
@@ -989,7 +990,7 @@ X(a, STATIC, SINGULAR, UINT32, id, 1) \
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
X(a, STATIC, SINGULAR, BOOL, locked, 5) \
X(a, STATIC, SINGULAR, UINT32, locked_to, 5) \
X(a, STATIC, SINGULAR, STRING, name, 6) \
X(a, STATIC, SINGULAR, STRING, description, 7) \
X(a, STATIC, SINGULAR, FIXED32, icon, 8)
@@ -1149,7 +1150,7 @@ extern const pb_msgdesc_t Compressed_msg;
#define Routing_size 42
#define ToRadio_size 324
#define User_size 77
#define Waypoint_size 161
#define Waypoint_size 165
#ifdef __cplusplus
} /* extern "C" */

View File

@@ -164,7 +164,7 @@ bool initWifi()
if (*wifiName) {
uint8_t dmac[6];
getMacAddr(dmac);
sprintf(ourHost, "Meshtastic-%02x%02x", dmac[4], dmac[5]);
snprintf(ourHost, sizeof(ourHost), "Meshtastic-%02x%02x", dmac[4], dmac[5]);
WiFi.mode(WIFI_MODE_STA);
WiFi.setHostname(ourHost);