Skip to content

Commit

Permalink
add altitude
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Aug 15, 2023
1 parent 69ad7f0 commit da6827a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Adafruit_Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion Adafruit_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -171,6 +172,7 @@ typedef struct {
the air (Ohms) */
float unitless_percent; /**<Percentage, unit-less (%) */
sensors_color_t color; /**< color in RGB component values */
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;

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```

Expand Down Expand Up @@ -163,6 +164,7 @@ typedef struct
float pm100_env,
float gas_resistance,
float unitless_percent,
float altitude,
sensors_color_t color;
};
} sensors_event_t;
Expand Down Expand Up @@ -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 ##

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit da6827a

Please sign in to comment.