Skip to content
Snippets Groups Projects
Verified Commit ea1a336b authored by Zoe Michaela Dietmar Pfister's avatar Zoe Michaela Dietmar Pfister :gay_pride_flag:
Browse files

minor changes to make the sht85 initialisation work

parent 0824b630
No related branches found
No related tags found
4 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!13Esp cam
...@@ -89,8 +89,8 @@ void camera_configESPCamera() ...@@ -89,8 +89,8 @@ void camera_configESPCamera()
camera_config.pin_pclk = PCLK_GPIO_NUM; camera_config.pin_pclk = PCLK_GPIO_NUM;
camera_config.pin_vsync = VSYNC_GPIO_NUM; camera_config.pin_vsync = VSYNC_GPIO_NUM;
camera_config.pin_href = HREF_GPIO_NUM; camera_config.pin_href = HREF_GPIO_NUM;
camera_config.pin_sscb_sda = SIOD_GPIO_NUM; camera_config.pin_sccb_sda = SIOD_GPIO_NUM;
camera_config.pin_sscb_scl = SIOC_GPIO_NUM; camera_config.pin_sccb_scl = SIOC_GPIO_NUM;
camera_config.pin_pwdn = PWDN_GPIO_NUM; camera_config.pin_pwdn = PWDN_GPIO_NUM;
camera_config.pin_reset = RESET_GPIO_NUM; camera_config.pin_reset = RESET_GPIO_NUM;
camera_config.xclk_freq_hz = 20000000; camera_config.xclk_freq_hz = 20000000;
...@@ -165,6 +165,8 @@ void camera_configESPCamera() ...@@ -165,6 +165,8 @@ void camera_configESPCamera()
// COLOR BAR PATTERN (0 = Disable , 1 = Enable) // COLOR BAR PATTERN (0 = Disable , 1 = Enable)
s->set_colorbar(s, 0); s->set_colorbar(s, 0);
} }
//SHTSensor sht(SHTSensor::SHT85); // I2C address: 0x44
void initMicroSDCard() void initMicroSDCard()
{ {
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
// //
#include "Sht85.hpp" #include "Sht85.hpp"
void Sht85::setup() {} void Sht85::setup()
{
this->sht = SHTSensor(SHTSensor::SHT85);
readData();
}
void Sht85::readSHT() void Sht85::readSHT()
{ {
...@@ -27,7 +32,7 @@ out_data_sht85 Sht85::readData() ...@@ -27,7 +32,7 @@ out_data_sht85 Sht85::readData()
// initiate the SHT85 sensor // initiate the SHT85 sensor
Serial.println(""); Serial.println("");
if (sht.init()) { if (sht.init(Wire)) {
Serial.println("SHT initialization successful"); Serial.println("SHT initialization successful");
} else { } else {
Serial.println("SHT initialization failed"); Serial.println("SHT initialization failed");
......
...@@ -6,18 +6,22 @@ ...@@ -6,18 +6,22 @@
#define ESPCAM_SHT85_HPP #define ESPCAM_SHT85_HPP
#include "ForteSensor.hpp" #include "ForteSensor.hpp"
#include "MeasurementData.hpp"
#include "Message.hpp" #include "Message.hpp"
#include "Pinout.hpp" #include "Pinout.hpp"
#include "MeasurementData.hpp"
#include "RTClib.h" // adafruit/RTClib @^2.1.1 #include "RTClib.h" // adafruit/RTClib @^2.1.1
#include "SHTSensor.h" // sensirion/arduino-sht@^1.2.2 #include "SHTSensor.h" // sensirion/arduino-sht@^1.2.2
#include "SPI.h" #include "SPI.h"
#include "Wire.h"
#include "esp_log.h"
#include "Time.hpp" #include "Time.hpp"
#include "esp_log.h"
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h> #include <Wire.h>
// Pin definitions for I2C (SHT85, RTC)
// This is different from the pins on the ESP32-C3-DevKit boards!
#define SDA 12
#define SCL 13
struct out_data_sht85 { struct out_data_sht85 {
float temperature = 0.0; float temperature = 0.0;
float humidity = 0.0; float humidity = 0.0;
...@@ -31,7 +35,7 @@ class Sht85 : public ForteSensor<out_data_sht85> { ...@@ -31,7 +35,7 @@ class Sht85 : public ForteSensor<out_data_sht85> {
[[nodiscard]] SensorInformation getSensorInformation() const override; [[nodiscard]] SensorInformation getSensorInformation() const override;
private: private:
SHTSensor sht{SHTSensor::SHT85}; // I2C address: 0x44 SHTSensor sht; // I2C address: 0x44
out_data_sht85 data; out_data_sht85 data;
const SensorInformation sensorInformation{"SHT85", Protocol::I2C}; const SensorInformation sensorInformation{"SHT85", Protocol::I2C};
void readSHT(); void readSHT();
...@@ -39,9 +43,8 @@ class Sht85 : public ForteSensor<out_data_sht85> { ...@@ -39,9 +43,8 @@ class Sht85 : public ForteSensor<out_data_sht85> {
enum class MeasurementType { TEMPERATURE, HUMIDITY }; enum class MeasurementType { TEMPERATURE, HUMIDITY };
// enum to string // enum to string
std::map<MeasurementType, const char *> measurementTypeToString = { std::map<MeasurementType, const char *> measurementTypeToString = {{MeasurementType::TEMPERATURE, "TEMPERATURE"},
{MeasurementType::TEMPERATURE, "TEMPERATURE"}, {MeasurementType::HUMIDITY, "HUMIDITY"}};
{MeasurementType::HUMIDITY, "HUMIDITY"}};
}; };
#endif // ESPCAM_SHT85_HPP #endif // ESPCAM_SHT85_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment