2929#include " defs.h"
3030
3131#include < ui/Dashboard.h>
32- #include < ui/drivers/RoundDisplay.h>
33- #include < ui/drivers/StandardDisplay.h>
32+ #include < ui/drivers/GC9A01.h>
33+ #include < ui/drivers/ST7789.h>
34+ #include < ui/drivers/ST7796.h>
35+ #include < ui/drivers/AutodetectDisplay.h>
3436#include < ui/activities/utilities/SystemInfoActivity.h>
3537
3638#ifdef BOARD_HAS_PSRAM
@@ -64,7 +66,7 @@ namespace DisplayConfig = DisplayApi::Configuration;
6466namespace DisplayOption = DisplayApi::Options;
6567
6668
67- Dashboard* dashboard;
69+ Dashboard* dashboard = nullptr ;
6870
6971
7072// UI options update listener
@@ -148,7 +150,7 @@ void addDashboardActivities(String &list) {
148150 static int systemInfoCount = 0 ;
149151 if (elementName == " SystemInfo" ) {
150152 // single instance activity
151- if (systemInfoCount++ == 0 ) {
153+ if (++systemInfoCount == 1 ) {
152154 auto systemInfo = new SystemInfoActivity ();
153155 dashboard->addActivity (systemInfo);
154156 }
@@ -159,7 +161,7 @@ void addDashboardActivities(String &list) {
159161 static int sensorValuesCount = 0 ;
160162 if (elementName == " SensorValues" ) {
161163 // single instance activity
162- if (sensorValuesCount++ == 0 ) {
164+ if (++sensorValuesCount == 1 ) {
163165 auto miniModule = HomeGenie::getInstance ()->getDefaultModule ();
164166 auto sensorValues = new SensorValuesActivity (miniModule);
165167 dashboard->addActivity (sensorValues);
@@ -171,7 +173,7 @@ void addDashboardActivities(String &list) {
171173 static int digitalClockCount = 0 ;
172174 if (elementName == " DigitalClock" ) {
173175 // single instance activity
174- if (digitalClockCount++ == 0 ) {
176+ if (++digitalClockCount == 1 ) {
175177 auto digitalClock = new DigitalClockActivity ();
176178 dashboard->addActivity (digitalClock);
177179 }
@@ -181,8 +183,9 @@ void addDashboardActivities(String &list) {
181183 // user-definable devices. Each button emits events
182184 // that can be automated using the device Scheduler.
183185 // It can be configured using HomeGenie Panel app.
186+ static int switchControlCount = 0 ;
184187 if (elementName == " SwitchControl" ) {
185- String address = " D1 " ;
188+ String address = " D " + String (++switchControlCount) ;
186189 if (elementOptions.length () > 0 ) {
187190 address = elementOptions;
188191 }
@@ -196,8 +199,9 @@ void addDashboardActivities(String &list) {
196199
197200#ifndef DISABLE_LVGL
198201 // Similar to the SwitchControl but using LVGL
202+ static int levelControlCount = 0 ;
199203 if (elementName == " LevelControl" ) {
200- String address = " M1 " ;
204+ String address = " M " + String (++levelControlCount) ;
201205 if (elementOptions.length () > 0 ) {
202206 address = elementOptions;
203207 }
@@ -209,8 +213,9 @@ void addDashboardActivities(String &list) {
209213#endif
210214 }
211215 // Color control
216+ static int colorControlCount = 0 ;
212217 if (elementName == " ColorControl" ) {
213- String address = " H1 " ;
218+ String address = " H " + String (++colorControlCount) ;
214219 if (elementOptions.length () > 0 ) {
215220 address = elementOptions;
216221 }
@@ -226,12 +231,12 @@ void addDashboardActivities(String &list) {
226231 // or local camera directly connected to the ESP32.
227232 static int cameraDisplayCount = 0 ;
228233 if (elementName == " CameraDisplay" ) {
229- String address = " V1 " ;
234+ String address = " V " + String (++cameraDisplayCount) ;
230235 if (elementOptions.length () > 0 ) {
231236 address = elementOptions;
232237 }
233238 auto cameraDisplay = new CameraDisplayActivity (address.c_str ());
234- if (cameraDisplayCount++ == 0 ) {
239+ if (cameraDisplayCount == 1 ) {
235240 // The first instance is reserved for
236241 // onboard ESP32 camera module if enabled
237242 if (Config::getSetting (Camera_Sensor::SensorType).equals (" esp32-cam" )) {
@@ -245,15 +250,15 @@ void addDashboardActivities(String &list) {
245250 static int analogClockCount = 0 ;
246251 if (elementName == " AnalogClock" ) {
247252 // single instance activity
248- if (analogClockCount++ == 0 ) {
253+ if (++analogClockCount == 1 ) {
249254 auto analogClock = new AnalogClockActivity ();
250255 dashboard->addActivity (analogClock);
251256 }
252257 }
253258 static int gaugeExampleCount = 0 ;
254259 if (elementName == " GaugeExample" ) {
255260 // single instance activity
256- if (gaugeExampleCount++ == 0 ) {
261+ if (++gaugeExampleCount == 1 ) {
257262 auto gaugeExample = new GaugeExampleActivity ();
258263 dashboard->addActivity (gaugeExample);
259264 }
0 commit comments