Closed mathieucarbou closed 11 months ago
At the time we create the Stat object, we might not be able to access the stats values yet. So we end up setting an empty string to the value:
Statistic _appFirmwareStat = Statistic(&_dashboard, "App Firmware", ""); Statistic _appIdStat = Statistic(&_dashboard, "App Id", ""); Statistic _appManufacturerStat = Statistic(&_dashboard, "App Manufacturer", ""); Statistic _appName = Statistic(&_dashboard, "App Name", ""); Statistic _appVersionStat = Statistic(&_dashboard, "App Version", ""); Statistic _cpuCoresStat = Statistic(&_dashboard, "CPU Cores", ""); Statistic _cpuModelStat = Statistic(&_dashboard, "CPU Model", "");
It would be better to support a default constructor with a customisable default, like this:
#ifndef DASH_DEFAULT_STATISTICS_VALUE #define DASH_DEFAULT_STATISTICS_VALUE "" #endif [...] Statistic(ESPDash *dashboard, const char *key, const char *value = DASH_DEFAULT_STATISTICS_VALUE);
At the time we create the Stat object, we might not be able to access the stats values yet. So we end up setting an empty string to the value:
It would be better to support a default constructor with a customisable default, like this: