mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-13 16:42:07 +00:00
add veml7700
This commit is contained in:
parent
250cf16bf8
commit
f19aa49eb2
@ -80,7 +80,7 @@ lib_deps =
|
|||||||
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
||||||
https://github.com/meshtastic/TinyGPSPlus.git#964f75a72cccd6b53cd74e4add1f7a42c6f7344d
|
https://github.com/meshtastic/TinyGPSPlus.git#964f75a72cccd6b53cd74e4add1f7a42c6f7344d
|
||||||
https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0
|
https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0
|
||||||
nanopb/Nanopb@^0.4.7
|
nanopb/Nanopb@^0.4.8
|
||||||
erriez/ErriezCRC32@^1.0.1
|
erriez/ErriezCRC32@^1.0.1
|
||||||
|
|
||||||
; Used for the code analysis in PIO Home / Inspect
|
; Used for the code analysis in PIO Home / Inspect
|
||||||
@ -132,4 +132,5 @@ lib_deps =
|
|||||||
adafruit/Adafruit MPU6050@^2.2.4
|
adafruit/Adafruit MPU6050@^2.2.4
|
||||||
adafruit/Adafruit LIS3DH@^1.2.4
|
adafruit/Adafruit LIS3DH@^1.2.4
|
||||||
https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17
|
https://github.com/lewisxhe/SensorLib#27fd0f721e20cd09e1f81383f0ba58a54fe84a17
|
||||||
adafruit/Adafruit LSM6DS@^4.7.2
|
adafruit/Adafruit LSM6DS@^4.7.2
|
||||||
|
adafruit/Adafruit VEML7700 Library@^2.1.6
|
34
src/modules/Telemetry/Sensor/VEML7700Sensor.cpp
Normal file
34
src/modules/Telemetry/Sensor/VEML7700Sensor.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "VEML7700Sensor.h"
|
||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include <Adafruit_VEML7700.h>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
VEML7700Sensor::VEML7700Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_VEML7700, "VEML7700") {}
|
||||||
|
|
||||||
|
int32_t VEML7700Sensor::runOnce()
|
||||||
|
{
|
||||||
|
LOG_INFO("Init sensor: %s\n", sensorName);
|
||||||
|
if (!hasSensor()) {
|
||||||
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
|
}
|
||||||
|
status = veml7700.begin(nodeTelemetrySensorsMap[sensorType].second);
|
||||||
|
|
||||||
|
veml7700.setLowThreshold(10000);
|
||||||
|
veml7700.setHighThreshold(20000);
|
||||||
|
veml7700.interruptEnable(true);
|
||||||
|
|
||||||
|
return initI2CSensor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VEML7700Sensor::setup() {}
|
||||||
|
|
||||||
|
bool VEML7700Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||||
|
{
|
||||||
|
LOG_DEBUG("VEML7700Sensor::getMetrics\n");
|
||||||
|
|
||||||
|
measurement->variant.environment_metrics.lux = veml7700.readLux(VEML_LUX_AUTO);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
17
src/modules/Telemetry/Sensor/VEML7700Sensor.h
Normal file
17
src/modules/Telemetry/Sensor/VEML7700Sensor.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include <Adafruit_VEML7700.h>
|
||||||
|
|
||||||
|
class VEML7700Sensor : public TelemetrySensor
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Adafruit_VEML7700 veml7700;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setup() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
VEML7700Sensor();
|
||||||
|
virtual int32_t runOnce() override;
|
||||||
|
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user