Fix capacity matrix build regressions
This commit is contained in:
1 parent
e4db57dbef
commit
5f7d03373c
11 files changed
+75
-13
No files matched your search
@@ -1757,6 +1757,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(MESH_COMPANION_SCREEN_STARTUP_BYTES)
|
||||
// The target may replace the generic UI allowance with a tighter measured
|
||||
// bound. Keep the check next to the actual allocations so a future screen
|
||||
// growth cannot silently invalidate its runtime-RAM budget. ESP32's checked
|
||||
// heap allocator can consume up to 16 bytes per allocation.
|
||||
static_assert(sizeof(SplashScreen) + sizeof(HomeScreen)
|
||||
+ sizeof(MsgPreviewScreen) + 3 * 16
|
||||
<= MESH_COMPANION_SCREEN_STARTUP_BYTES,
|
||||
"Increase MESH_COMPANION_SCREEN_STARTUP_BYTES and its RAM budget");
|
||||
#endif
|
||||
|
||||
void UITask::begin(DisplayDriver* display, SensorManager* sensors, CompanionNodePrefs* node_prefs) {
|
||||
_display = display;
|
||||
_sensors = sensors;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#if MESH_ENABLE_ROOM_FLOOD_RULE_ENGINE
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <helpers/FloodFilterPolicy.h>
|
||||
@@ -394,8 +395,13 @@ static bool verifyWrittenFile(FILESYSTEM* fs, const char* path,
|
||||
|
||||
} // namespace
|
||||
|
||||
FloodRuleEngine::FloodRuleEngine() : _fs(NULL), _regions(NULL) {
|
||||
memset(_entries, 0, sizeof(_entries));
|
||||
FloodRuleEngine::FloodRuleEngine()
|
||||
: _fs(NULL), _regions(NULL),
|
||||
_entries(new (std::nothrow) Entry[RULE_SLOTS]) {
|
||||
// MyMesh is constructed before setup(), while the internal heap is
|
||||
// unfragmented. The runtime RAM gate budgets this exact allocation.
|
||||
if (_entries == NULL) abort();
|
||||
memset(_entries, 0, sizeof(Entry) * RULE_SLOTS);
|
||||
}
|
||||
|
||||
void FloodRuleEngine::begin(FILESYSTEM* fs, RegionMap* regions) {
|
||||
@@ -405,7 +411,7 @@ void FloodRuleEngine::begin(FILESYSTEM* fs, RegionMap* regions) {
|
||||
}
|
||||
|
||||
void FloodRuleEngine::seedDefaults() {
|
||||
memset(_entries, 0, sizeof(_entries));
|
||||
memset(_entries, 0, sizeof(Entry) * RULE_SLOTS);
|
||||
Entry& entry = _entries[0];
|
||||
entry.active = true;
|
||||
entry.payload_type = PAYLOAD_TYPE_OTA;
|
||||
@@ -423,7 +429,7 @@ void FloodRuleEngine::load() {
|
||||
|
||||
enum class FileState : uint8_t { Missing, Valid, Invalid, Unreadable };
|
||||
auto loadFile = [this](const char* path) -> FileState {
|
||||
memset(_entries, 0, sizeof(_entries));
|
||||
memset(_entries, 0, sizeof(Entry) * RULE_SLOTS);
|
||||
if (!_fs->exists(path)) return FileState::Missing;
|
||||
File file = openRead(_fs, path);
|
||||
if (!file) return FileState::Unreadable;
|
||||
@@ -655,7 +661,7 @@ void FloodRuleEngine::load() {
|
||||
&& file.available() == 0;
|
||||
}
|
||||
file.close();
|
||||
if (!success) memset(_entries, 0, sizeof(_entries));
|
||||
if (!success) memset(_entries, 0, sizeof(Entry) * RULE_SLOTS);
|
||||
return success ? FileState::Valid : FileState::Invalid;
|
||||
};
|
||||
|
||||
@@ -1746,7 +1752,7 @@ void FloodRuleEngine::remove(const char* args, char* reply) {
|
||||
if (asciiEqual(selector, "all")) {
|
||||
Entry previous[RULE_SLOTS];
|
||||
memcpy(previous, _entries, sizeof(previous));
|
||||
memset(_entries, 0, sizeof(_entries));
|
||||
memset(_entries, 0, sizeof(Entry) * RULE_SLOTS);
|
||||
if (!save()) {
|
||||
memcpy(_entries, previous, sizeof(_entries));
|
||||
copyString(reply, "Err - unable to save flood filter", 160);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Mesh.h>
|
||||
#include <new>
|
||||
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/RegionMap.h>
|
||||
@@ -71,9 +72,16 @@ private:
|
||||
bool rate_window_active;
|
||||
};
|
||||
|
||||
// This table is 6,200 bytes. Keep it in the constructor-time heap rather
|
||||
// than inside the global MyMesh object: classic ESP32 has a small static
|
||||
// DRAM window but substantially more internal heap at this point in boot.
|
||||
// Allocation is deliberately all-or-nothing. A node must never fall back
|
||||
// to silently running without its configured flood rules.
|
||||
static_assert(sizeof(Entry) == 200,
|
||||
"Update the flood-rule runtime RAM budget in check_firmware_ram.py");
|
||||
FILESYSTEM* _fs;
|
||||
RegionMap* _regions;
|
||||
Entry _entries[RULE_SLOTS];
|
||||
Entry* _entries;
|
||||
|
||||
void seedDefaults();
|
||||
void load();
|
||||
|
||||
Reference in new issue
Block a user