8000 add altitude · adafruit/Adafruit_Sensor@da6827a · GitHub
[go: up one dir, main page]

Skip to content

Commit da6827a

Browse files
committed
add altitude
1 parent 69ad7f0 commit da6827a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Adafruit_Sensor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ void Adafruit_Sensor::printSensorDetails(void) {
100100
case SENSOR_TYPE_UNITLESS_PERCENT:
101101
Serial.print(F("Unitless Percent (%)"));
102102
break;
103+
case SENSOR_TYPE_ALTITUDE:
104+
Serial.print(F("Altitude (m)"));
105+
break;
103106
}
104107

105108
Serial.println();

Adafruit_Sensor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ typedef enum {
7979
SENSOR_TYPE_PM25_ENV = (27),
8080
SENSOR_TYPE_PM100_ENV = (28),
8181
SENSOR_TYPE_GAS_RESISTANCE = (29),
82-
SENSOR_TYPE_UNITLESS_PERCENT = (30)
82+
SENSOR_TYPE_UNITLESS_PERCENT = (30),
83+
SENSOR_TYPE_ALTITUDE = (31)
8384
} sensors_type_t;
8485

8586
/** struct sensors_vec_s is used to return a vector in a common format. */
@@ -171,6 +172,7 @@ typedef struct {
171172
the air (Ohms) */
172173
float unitless_percent; /**<Percentage, unit-less (%) */
173174
sensors_color_t color; /**< color in RGB component values */
175+
float altitude; /**< Distance between a reference datum and a point or object, in meters. */
174176
}; ///< Union for the wide ranges of data we can carry
175177
} sensors_event_t;
176178

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ typedef enum
8787
SENSOR_TYPE_PM25_ENV = (27),
8888
SENSOR_TYPE_PM100_ENV = (28),
8989
SENSOR_TYPE_GAS_RESISTANCE = (29),
90-
SENSOR_TYPE_UNITLESS_PERCENT = (30)
90+
SENSOR_TYPE_UNITLESS_PERCENT = (30),
91+
SENSOR_TYPE_ALTITUDE = (31),
9192
} sensors_type_t;
9293
```
9394

@@ -163,6 +164,7 @@ typedef struct
163164
float pm100_env,
164165
float gas_resistance,
165166
float unitless_percent,
167+
float altitude,
166168
sensors_color_t color;
167169
};
168170
} sensors_event_t;
@@ -218,6 +220,7 @@ A key part of the abstraction layer is the standardization of values on SI units
218220
- **pm100_env**: values are in **parts per million** (ppm)
219221
- **gas_resistance**: values are in **ohms**
220222
- **unitless_percent**: values are in **%**
223+
- **altitude**: values are in **meters** (m)
221224

222225
## The Unified Driver Abstraction Layer in Practice ##
223226

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit Unified Sensor
2-
version=1.1.11
2+
version=1.1.12
33
author=Adafruit <info@adafruit.com>
44
maintainer=Adafruit <info@adafruit.com>
55
sentence=Required for all Adafruit Unified Sensor based libraries.

0 commit comments

Comments
 (0)
0