@@ -22,15 +22,15 @@ const char *LED_BAR_MODE_NAMES[] = {
22
22
};
23
23
24
24
const char *PM_CORRECTION_ALGORITHM_NAMES[] = {
25
- [Unknown ] = " -" , // This is only to pass "non-trivial designated initializers" error
26
- [None ] = " none" ,
27
- [EPA_2021 ] = " epa_2021" ,
28
- [SLR_PMS5003_20220802 ] = " slr_PMS5003_20220802" ,
29
- [SLR_PMS5003_20220803 ] = " slr_PMS5003_20220803" ,
30
- [SLR_PMS5003_20220824 ] = " slr_PMS5003_20220824" ,
31
- [SLR_PMS5003_20231030 ] = " slr_PMS5003_20231030" ,
32
- [SLR_PMS5003_20231218 ] = " slr_PMS5003_20231218" ,
33
- [SLR_PMS5003_20240104 ] = " slr_PMS5003_20240104" ,
25
+ [COR_ALGO_PM_UNKNOWN ] = " -" , // This is only to pass "non-trivial designated initializers" error
26
+ [COR_ALGO_PM_NONE ] = " none" ,
27
+ [COR_ALGO_PM_EPA_2021 ] = " epa_2021" ,
28
+ [COR_ALGO_PM_PMS5003_20220802 ] = " slr_PMS5003_20220802" ,
29
+ [COR_ALGO_PM_PMS5003_20220803 ] = " slr_PMS5003_20220803" ,
30
+ [COR_ALGO_PM_PMS5003_20220824 ] = " slr_PMS5003_20220824" ,
31
+ [COR_ALGO_PM_PMS5003_20231030 ] = " slr_PMS5003_20231030" ,
32
+ [COR_ALGO_PM_PMS5003_20231218 ] = " slr_PMS5003_20231218" ,
33
+ [COR_ALGO_PM_PMS5003_20240104 ] = " slr_PMS5003_20240104" ,
34
34
};
35
35
36
36
const char *TEMP_HUM_CORRECTION_ALGORITHM_NAMES[] = {
@@ -115,8 +115,8 @@ PMCorrectionAlgorithm Configuration::matchPmAlgorithm(String algorithm) {
115
115
// If the input string matches an algorithm name, return the corresponding enum value
116
116
// Else return Unknown
117
117
118
- const size_t enumSize = SLR_PMS5003_20240104 + 1 ; // Get the actual size of the enum
119
- PMCorrectionAlgorithm result = PMCorrectionAlgorithm::Unknown ;
118
+ const size_t enumSize = COR_ALGO_PM_PMS5003_20240104 + 1 ; // Get the actual size of the enum
119
+ PMCorrectionAlgorithm result = COR_ALGO_PM_UNKNOWN; ;
120
120
121
121
// Loop through enum values
122
122
for (size_t enumVal = 0 ; enumVal < enumSize; enumVal++) {
@@ -166,15 +166,15 @@ bool Configuration::updatePmCorrection(JSONVar &json) {
166
166
// Check algorithm
167
167
String algorithm = pm02[" correctionAlgorithm" ];
168
168
PMCorrectionAlgorithm algo = matchPmAlgorithm (algorithm);
169
- if (algo == Unknown ) {
169
+ if (algo == COR_ALGO_PM_UNKNOWN ) {
170
170
logInfo (" Unknown algorithm" );
171
171
return false ;
172
172
}
173
173
logInfo (" Correction algorithm: " + algorithm);
174
174
175
175
// If algo is None or EPA_2021, no need to check slr
176
176
// But first check if pmCorrection different from algo
177
- if (algo == None || algo == EPA_2021 ) {
177
+ if (algo == COR_ALGO_PM_NONE || algo == COR_ALGO_PM_EPA_2021 ) {
178
178
if (pmCorrection.algorithm != algo) {
179
179
// Deep copy corrections from root to jconfig, so it will be saved later
180
180
jconfig[jprop_corrections][" pm02" ][" correctionAlgorithm" ] = algorithm;
@@ -397,8 +397,8 @@ void Configuration::defaultConfig(void) {
397
397
jconfig[jprop_offlineMode] = jprop_offlineMode_default;
398
398
jconfig[jprop_monitorDisplayCompensatedValues] = jprop_monitorDisplayCompensatedValues_default;
399
399
400
- // PM2.5 correction
401
- pmCorrection.algorithm = None ;
400
+ // PM2.5 default correction
401
+ pmCorrection.algorithm = COR_ALGO_PM_NONE ;
402
402
pmCorrection.changed = false ;
403
403
pmCorrection.intercept = 0 ;
404
404
pmCorrection.scalingFactor = 1 ;
@@ -1380,7 +1380,7 @@ void Configuration::toConfig(const char *buf) {
1380
1380
1381
1381
// PM2.5 correction
1382
1382
// / Set default first before parsing local config
1383
- pmCorrection.algorithm = PMCorrectionAlgorithm::None ;
1383
+ pmCorrection.algorithm = COR_ALGO_PM_NONE ;
1384
1384
pmCorrection.intercept = 0 ;
1385
1385
pmCorrection.scalingFactor = 0 ;
1386
1386
pmCorrection.useEPA = false ;
@@ -1526,8 +1526,8 @@ bool Configuration::isPMCorrectionChanged(void) {
1526
1526
*/
1527
1527
bool Configuration::isPMCorrectionEnabled (void ) {
1528
1528
PMCorrection pmCorrection = getPMCorrection ();
1529
- if (pmCorrection.algorithm == PMCorrectionAlgorithm::None ||
1530
- pmCorrection.algorithm == PMCorrectionAlgorithm::Unknown ) {
1529
+ if (pmCorrection.algorithm == COR_ALGO_PM_NONE ||
1530
+ pmCorrection.algorithm == COR_ALGO_PM_UNKNOWN ) {
1531
1531
return false ;
1532
1532
}
1533
1533
0 commit comments