[tsl2561][tsl2591] Move set_gain into the headers (#19284)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-09-16 05:26:51 +00:00
committed by GitHub
co-authored by Jesse Hills
parent 4fba837d40
commit d61e0e4695
4 changed files with 2 additions and 5 deletions
-1
View File
@@ -145,7 +145,6 @@ float TSL2561Sensor::get_integration_time_ms_() {
void TSL2561Sensor::set_integration_time(TSL2561IntegrationTime integration_time) {
this->integration_time_ = integration_time;
}
void TSL2561Sensor::set_gain(TSL2561Gain gain) { this->gain_ = gain; }
bool TSL2561Sensor::tsl2561_write_byte(uint8_t a_register, uint8_t value) {
return this->write_byte(a_register | TSL2561_COMMAND_BIT, value);
+1 -1
View File
@@ -51,7 +51,7 @@ class TSL2561Sensor final : public sensor::Sensor, public PollingComponent, publ
*
* @param gain The new gain.
*/
void set_gain(TSL2561Gain gain);
void set_gain(TSL2561Gain gain) { this->gain_ = gain; }
/** The "CS" package of this sensor has a slightly different formula for
* converting the raw values. Use this setting to indicate that this is a CS
-2
View File
@@ -216,8 +216,6 @@ void TSL2591Component::set_integration_time(TSL2591IntegrationTime integration_t
this->integration_time_ = integration_time;
}
void TSL2591Component::set_gain(TSL2591ComponentGain gain) { this->component_gain_ = gain; }
void TSL2591Component::set_device_and_glass_attenuation_factors(float device_factor, float glass_attenuation_factor) {
this->device_factor_ = device_factor;
this->glass_attenuation_factor_ = glass_attenuation_factor;
+1 -1
View File
@@ -241,7 +241,7 @@ class TSL2591Component final : public PollingComponent, public i2c::I2CDevice {
/** Used by ESPHome framework. Does NOT actually set the value on the device. */
void set_integration_time(TSL2591IntegrationTime integration_time);
/** Used by ESPHome framework. Does NOT actually set the value on the device. */
void set_gain(TSL2591ComponentGain gain);
void set_gain(TSL2591ComponentGain gain) { this->component_gain_ = gain; }
/** Used by ESPHome framework. */
void setup() override;
/** Used by ESPHome framework. */