mirror of
https://github.com/adafruit/Adafruit_TSL2561.git
synced 2025-08-03 10:54:28 +02:00
Set min value to 1.0
This commit is contained in:
@@ -173,7 +173,7 @@ void Adafruit_TSL2561_Unified::getData (uint16_t *broadband, uint16_t *ir)
|
||||
Constructor
|
||||
*/
|
||||
/**************************************************************************/
|
||||
Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorID)
|
||||
Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorID)
|
||||
{
|
||||
_addr = addr;
|
||||
_tsl2561Initialised = false;
|
||||
@@ -193,14 +193,14 @@ Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorI
|
||||
doing anything else)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
boolean Adafruit_TSL2561_Unified::begin()
|
||||
boolean Adafruit_TSL2561_Unified::begin()
|
||||
{
|
||||
wire = &Wire;
|
||||
wire -> begin();
|
||||
return init();
|
||||
}
|
||||
|
||||
boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire)
|
||||
boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire)
|
||||
{
|
||||
wire = theWire;
|
||||
wire -> begin();
|
||||
@@ -226,7 +226,7 @@ boolean Adafruit_TSL2561_Unified::init()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Enables or disables the auto-gain settings when reading
|
||||
@@ -380,8 +380,8 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
|
||||
{
|
||||
unsigned long chScale;
|
||||
unsigned long channel1;
|
||||
unsigned long channel0;
|
||||
|
||||
unsigned long channel0;
|
||||
|
||||
/* Make sure the sensor isn't saturated! */
|
||||
uint16_t clipThreshold;
|
||||
switch (_tsl2561IntegrationTime)
|
||||
@@ -495,10 +495,10 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
|
||||
bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event)
|
||||
{
|
||||
uint16_t broadband, ir;
|
||||
|
||||
|
||||
/* Clear the event */
|
||||
memset(event, 0, sizeof(sensors_event_t));
|
||||
|
||||
|
||||
event->version = sizeof(sensors_event_t);
|
||||
event->sensor_id = _tsl2561SensorID;
|
||||
event->type = SENSOR_TYPE_LIGHT;
|
||||
@@ -507,9 +507,9 @@ bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event)
|
||||
/* Calculate the actual lux value */
|
||||
getLuminosity(&broadband, &ir);
|
||||
event->light = calculateLux(broadband, ir);
|
||||
|
||||
|
||||
if (event->light == 65536) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -532,6 +532,6 @@ void Adafruit_TSL2561_Unified::getSensor(sensor_t *sensor)
|
||||
sensor->type = SENSOR_TYPE_LIGHT;
|
||||
sensor->min_delay = 0;
|
||||
sensor->max_value = 17000.0; /* Based on trial and error ... confirm! */
|
||||
sensor->min_value = 0.0;
|
||||
sensor->min_value = 1.0;
|
||||
sensor->resolution = 1.0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user