Skip to content

Commit a33bcd6

Browse files
committed
Runtime: fix read() timing
read() must be done after all other components have been initialized
1 parent a05b262 commit a33bcd6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,17 @@ void setup()
146146
Datastore.init(scheduler);
147147
RestartHelper.init(scheduler);
148148

149-
// OpenDTU-OnBattery-specific initializations go below
150-
RuntimeData.init(scheduler);
151-
RuntimeData.read(); // make runtime data available as early as possible
149+
// OpenDTU-OnBattery-specific initializations go between here...
152150
SolarCharger.init(scheduler);
153151
PowerMeter.init(scheduler);
154152
PowerLimiter.init(scheduler);
155153
GridCharger.init(scheduler);
156154
Battery.init(scheduler);
155+
// ... and here (before RuntimeData)
156+
157+
// Must be done after all other components have been initialized
158+
RuntimeData.init(scheduler);
159+
RuntimeData.read();
157160

158161
ESP_LOGI(TAG, "Startup complete");
159162
}

0 commit comments

Comments
 (0)