Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add altitude sensor type #53

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 5 additions & 2 deletions 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,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) */
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