Merge pull request #53 from brentru/add-altitude

Add altitude sensor type
This commit is contained in:
Brent Rubell
2023-08-15 14:28:56 -04:00
committed by GitHub
4 changed files with 13 additions and 4 deletions

View File

@ -100,6 +100,9 @@ void Adafruit_Sensor::printSensorDetails(void) {
case SENSOR_TYPE_UNITLESS_PERCENT:
Serial.print(F("Unitless Percent (%)"));
break;
case SENSOR_TYPE_ALTITUDE:
Serial.print(F("Altitude (m)"));
break;
}
Serial.println();

View File

@ -79,7 +79,8 @@ typedef enum {
SENSOR_TYPE_PM25_ENV = (27),
SENSOR_TYPE_PM100_ENV = (28),
SENSOR_TYPE_GAS_RESISTANCE = (29),
SENSOR_TYPE_UNITLESS_PERCENT = (30)
SENSOR_TYPE_UNITLESS_PERCENT = (30),
SENSOR_TYPE_ALTITUDE = (31)
} sensors_type_t;
/** struct sensors_vec_s is used to return a vector in a common format. */
@ -171,7 +172,9 @@ typedef struct {
the air (Ohms) */
float unitless_percent; /**<Percentage, unit-less (%) */
sensors_color_t color; /**< color in RGB component values */
}; ///< Union for the wide ranges of data we can carry
float altitude; /**< Distance between a reference datum and a point or
object, in meters. */
}; ///< Union for the wide ranges of data we can carry
} sensors_event_t;
/* Sensor details (40 bytes) */

View File

@ -87,7 +87,8 @@ typedef enum
SENSOR_TYPE_PM25_ENV = (27),
SENSOR_TYPE_PM100_ENV = (28),
SENSOR_TYPE_GAS_RESISTANCE = (29),
SENSOR_TYPE_UNITLESS_PERCENT = (30)
SENSOR_TYPE_UNITLESS_PERCENT = (30),
SENSOR_TYPE_ALTITUDE = (31),
} sensors_type_t;
```
@ -163,6 +164,7 @@ typedef struct
float pm100_env,
float gas_resistance,
float unitless_percent,
float altitude,
sensors_color_t color;
};
} sensors_event_t;
@ -218,6 +220,7 @@ A key part of the abstraction layer is the standardization of values on SI units
- **pm100_env**: values are in **parts per million** (ppm)
- **gas_resistance**: values are in **ohms**
- **unitless_percent**: values are in **%**
- **altitude**: values are in **meters** (m)
## The Unified Driver Abstraction Layer in Practice ##

View File

@ -1,5 +1,5 @@
name=Adafruit Unified Sensor
version=1.1.11
version=1.1.12
author=Adafruit <info@adafruit.com>
maintainer=Adafruit <info@adafruit.com>
sentence=Required for all Adafruit Unified Sensor based libraries.