mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-02 17:53:46 +00:00
Migrate NRF52 devices max nodes down to 80 for now to prevent brownouts (#5346)
This commit is contained in:
parent
f4908fadd6
commit
ec6949fdc0
@ -794,7 +794,7 @@ void NodeDB::loadFromDisk()
|
|||||||
// disk we will still factoryReset to restore things.
|
// disk we will still factoryReset to restore things.
|
||||||
|
|
||||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||||
auto state = loadProto(prefFileName, sizeof(meshtastic_DeviceState) + MAX_NUM_NODES * sizeof(meshtastic_NodeInfo),
|
auto state = loadProto(prefFileName, sizeof(meshtastic_DeviceState) + MAX_NUM_NODES_FS * sizeof(meshtastic_NodeInfo),
|
||||||
sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg, &devicestate);
|
sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg, &devicestate);
|
||||||
|
|
||||||
// See https://github.com/meshtastic/firmware/issues/4184#issuecomment-2269390786
|
// See https://github.com/meshtastic/firmware/issues/4184#issuecomment-2269390786
|
||||||
@ -813,6 +813,10 @@ void NodeDB::loadFromDisk()
|
|||||||
meshNodes = &devicestate.node_db_lite;
|
meshNodes = &devicestate.node_db_lite;
|
||||||
numMeshNodes = devicestate.node_db_lite.size();
|
numMeshNodes = devicestate.node_db_lite.size();
|
||||||
}
|
}
|
||||||
|
if (numMeshNodes > MAX_NUM_NODES) {
|
||||||
|
LOG_WARN("Node count %d exceeds MAX_NUM_NODES %d, truncating", numMeshNodes, MAX_NUM_NODES);
|
||||||
|
numMeshNodes = MAX_NUM_NODES;
|
||||||
|
}
|
||||||
meshNodes->resize(MAX_NUM_NODES);
|
meshNodes->resize(MAX_NUM_NODES);
|
||||||
|
|
||||||
state = loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg,
|
state = loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "architecture.h"
|
||||||
#include "mesh/generated/meshtastic/admin.pb.h"
|
#include "mesh/generated/meshtastic/admin.pb.h"
|
||||||
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
||||||
#include "mesh/generated/meshtastic/localonly.pb.h"
|
#include "mesh/generated/meshtastic/localonly.pb.h"
|
||||||
@ -20,8 +21,14 @@
|
|||||||
|
|
||||||
/// max number of nodes allowed in the mesh
|
/// max number of nodes allowed in the mesh
|
||||||
#ifndef MAX_NUM_NODES
|
#ifndef MAX_NUM_NODES
|
||||||
|
#ifdef ARCH_NRF52
|
||||||
|
#define MAX_NUM_NODES 80
|
||||||
|
#else
|
||||||
#define MAX_NUM_NODES 100
|
#define MAX_NUM_NODES 100
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_NUM_NODES_FS 100
|
||||||
|
|
||||||
/// Max number of channels allowed
|
/// Max number of channels allowed
|
||||||
#define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0]))
|
#define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0]))
|
||||||
|
Loading…
Reference in New Issue
Block a user