mirror of
https://github.com/alexhopeoconnor/DFTE.git
synced 2026-10-04 04:28:10 +10:00
Fix iterator cleanup and configuration guidance
This commit is contained in:
@@ -24,7 +24,7 @@ build_flags =
|
||||
-I$PROJECT_LIBDEPS_DIR/$PIOENV/ESPAsyncTCP/src
|
||||
|
||||
[env:dashboard_esp32]
|
||||
platform = espressif32
|
||||
platform = espressif32@6.13.0
|
||||
board = esp32dev
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
|
||||
@@ -125,8 +125,13 @@ struct DeviceIteratorState {
|
||||
|
||||
DeviceIteratorState gIteratorState;
|
||||
static PlaceholderEntry gDeviceOverrides[kDeviceCount][4];
|
||||
static DynamicDataDescriptor gDeviceOverrideData[kDeviceCount][4];
|
||||
static bool gOverridesInitialized = false;
|
||||
|
||||
const char* getStaticRamValue(void* userData) {
|
||||
return static_cast<const char*>(userData);
|
||||
}
|
||||
|
||||
void initializeDeviceOverrides() {
|
||||
if (gOverridesInitialized) {
|
||||
return;
|
||||
@@ -148,9 +153,10 @@ void initializeDeviceOverrides() {
|
||||
PlaceholderEntry& entry = gDeviceOverrides[i][field];
|
||||
memset(entry.name, 0, sizeof(entry.name));
|
||||
strncpy(entry.name, names[field], sizeof(entry.name) - 1);
|
||||
entry.type = PlaceholderType::PROGMEM_DATA;
|
||||
entry.data = values[field];
|
||||
entry.getLength = DeviceFrameworkPlaceholderRegistry::getProgmemLength;
|
||||
gDeviceOverrideData[i][field] = {getStaticRamValue, nullptr, const_cast<char*>(values[field])};
|
||||
entry.type = PlaceholderType::DYNAMIC_DATA;
|
||||
entry.data = &gDeviceOverrideData[i][field];
|
||||
entry.getLength = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ platform_packages =
|
||||
platformio/framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#521ae60a89e64bb0d1eb7a0b7addf620ced5cad3
|
||||
|
||||
[env:example_esp32]
|
||||
platform = espressif32
|
||||
platform = espressif32@6.13.0
|
||||
board = esp32dev
|
||||
|
||||
|
||||
@@ -103,6 +103,11 @@ struct SubsystemIteratorState {
|
||||
|
||||
SubsystemIteratorState iteratorState;
|
||||
PlaceholderEntry subsystemOverrides[SUBSYSTEM_COUNT][3];
|
||||
DynamicDataDescriptor subsystemOverrideData[SUBSYSTEM_COUNT][3];
|
||||
|
||||
const char* getStaticRamValue(void* userData) {
|
||||
return static_cast<const char*>(userData);
|
||||
}
|
||||
|
||||
void initialiseOverrides() {
|
||||
for (size_t i = 0; i < SUBSYSTEM_COUNT; ++i) {
|
||||
@@ -110,21 +115,24 @@ void initialiseOverrides() {
|
||||
|
||||
PlaceholderEntry& name = subsystemOverrides[i][0];
|
||||
strncpy(name.name, "%NAME%", sizeof(name.name) - 1);
|
||||
name.type = PlaceholderType::RAM_DATA;
|
||||
name.data = status.name;
|
||||
name.getLength = DeviceFrameworkPlaceholderRegistry::getRamLength;
|
||||
subsystemOverrideData[i][0] = {getStaticRamValue, nullptr, const_cast<char*>(status.name)};
|
||||
name.type = PlaceholderType::DYNAMIC_DATA;
|
||||
name.data = &subsystemOverrideData[i][0];
|
||||
name.getLength = nullptr;
|
||||
|
||||
PlaceholderEntry& detail = subsystemOverrides[i][1];
|
||||
strncpy(detail.name, "%DETAIL%", sizeof(detail.name) - 1);
|
||||
detail.type = PlaceholderType::RAM_DATA;
|
||||
detail.data = status.detail;
|
||||
detail.getLength = DeviceFrameworkPlaceholderRegistry::getRamLength;
|
||||
subsystemOverrideData[i][1] = {getStaticRamValue, nullptr, const_cast<char*>(status.detail)};
|
||||
detail.type = PlaceholderType::DYNAMIC_DATA;
|
||||
detail.data = &subsystemOverrideData[i][1];
|
||||
detail.getLength = nullptr;
|
||||
|
||||
PlaceholderEntry& severity = subsystemOverrides[i][2];
|
||||
strncpy(severity.name, "%SEVERITY%", sizeof(severity.name) - 1);
|
||||
severity.type = PlaceholderType::RAM_DATA;
|
||||
severity.data = status.severityClass;
|
||||
severity.getLength = DeviceFrameworkPlaceholderRegistry::getRamLength;
|
||||
subsystemOverrideData[i][2] = {getStaticRamValue, nullptr, const_cast<char*>(status.severityClass)};
|
||||
severity.type = PlaceholderType::DYNAMIC_DATA;
|
||||
severity.data = &subsystemOverrideData[i][2];
|
||||
severity.getLength = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user