Fix lint for TSL2591 (#3118)

This commit is contained in:
Otto Winter 2022-01-26 13:50:43 +01:00 committed by GitHub
parent 7590d5eacb
commit ad1f4429c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,24 +394,27 @@ void TSL2591Component::automatic_gain_update(uint16_t full_spectrum) {
switch (this->gain_) {
case TSL2591_GAIN_LOW:
if (full_spectrum < 54) // 1/3 FS / GAIN_HIGH
if (full_spectrum < 54) { // 1/3 FS / GAIN_HIGH
new_gain = TSL2591_GAIN_HIGH;
else if (full_spectrum < 875) // 1/3 FS / GAIN_MED
} else if (full_spectrum < 875) { // 1/3 FS / GAIN_MED
new_gain = TSL2591_GAIN_MED;
}
break;
case TSL2591_GAIN_MED:
if (full_spectrum < 57) // 1/3 FS / (GAIN_MAX/GAIN_MED)
if (full_spectrum < 57) { // 1/3 FS / (GAIN_MAX/GAIN_MED)
new_gain = TSL2591_GAIN_MAX;
else if (full_spectrum < 1365) // 1/3 FS / (GAIN_HIGH/GAIN_MED)
} else if (full_spectrum < 1365) { // 1/3 FS / (GAIN_HIGH/GAIN_MED)
new_gain = TSL2591_GAIN_HIGH;
else if (full_spectrum > 62000 / fs_divider) // 2/3 FS / (GAIN_LOW/GAIN_MED) clipped to 95% FS
} else if (full_spectrum > 62000 / fs_divider) { // 2/3 FS / (GAIN_LOW/GAIN_MED) clipped to 95% FS
new_gain = TSL2591_GAIN_LOW;
}
break;
case TSL2591_GAIN_HIGH:
if (full_spectrum < 920) // 1/3 FS / (GAIN_MAX/GAIN_HIGH)
if (full_spectrum < 920) { // 1/3 FS / (GAIN_MAX/GAIN_HIGH)
new_gain = TSL2591_GAIN_MAX;
else if (full_spectrum > 62000 / fs_divider) // 2/3 FS / (GAIN_MED/GAIN_HIGH) clipped to 95% FS
} else if (full_spectrum > 62000 / fs_divider) { // 2/3 FS / (GAIN_MED/GAIN_HIGH) clipped to 95% FS
new_gain = TSL2591_GAIN_LOW;
}
break;
case TSL2591_GAIN_MAX:
if (full_spectrum > 62000 / fs_divider) // 2/3 FS / (GAIN_MED/GAIN_HIGH) clipped to 95% FS