Skip to content

Commit

Permalink
testing HeltecV3 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed May 14, 2024
1 parent 3a148fa commit 3de3aac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/bme_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "configuration.h"
#include "gps_utils.h"
#include "display.h"
#include <Wire.h>

#define SEALEVELPRESSURE_HPA (1013.25)
#define CORRECTION_FACTOR (8.2296) // for meters
Expand All @@ -17,12 +16,11 @@ float newHum, newTemp, newPress, newGas;


Adafruit_BME280 bme280;
//Adafruit_BME680 bme680;
#ifdef HELTEC_V3
Adafruit_BMP280 bmp280(&Wire1);
Adafruit_BME680 bme680(&Wire1);
#else
Adafruit_BMP280 bmp280;
Adafruit_BME680 bme680;
#endif


Expand Down Expand Up @@ -59,12 +57,25 @@ namespace BME_Utils {
wxModuleType = 1;
wxModuleFound = true;
}
/*if (!wxModuleFound) {
if (bme680.begin(wxModuleAddress, &Wire1)) {
Serial.println("BME680 sensor found");
wxModuleType = 3;
wxModuleFound = true;
}
}*/
#else
if (bme280.begin(wxModuleAddress)) {
Serial.println("BME280 sensor found");
wxModuleType = 1;
wxModuleFound = true;
}
/*if (!wxModuleFound) {
if (bme680.begin(wxModuleAddress)) {
Serial.println("BME680 sensor found");
wxModuleType = 3;
wxModuleFound = true;
}*/
#endif
if (!wxModuleFound) {
if (bmp280.begin(wxModuleAddress)) {
Expand All @@ -73,13 +84,6 @@ namespace BME_Utils {
wxModuleFound = true;
}
}
if (!wxModuleFound) {
if (bme680.begin(wxModuleAddress)) {
Serial.println("BME680 sensor found");
wxModuleType = 3;
wxModuleFound = true;
}
}
if (!wxModuleFound) {
show_display("ERROR", "", "BME/BMP sensor active", "but no sensor found...", 2000);
Serial.println("BME/BMP sensor Active in config but not found! Check Wiring");
Expand All @@ -102,13 +106,13 @@ namespace BME_Utils {
);
Serial.println("BMP280 Module init done!");
break;
case 3:
/*case 3:
bme680.setTemperatureOversampling(BME680_OS_1X);
bme680.setHumidityOversampling(BME680_OS_1X);
bme680.setPressureOversampling(BME680_OS_1X);
bme680.setIIRFilterSize(BME680_FILTER_SIZE_0);
Serial.println("BMP680 Module init done!");
break;
break;*/
}
}
}
Expand Down Expand Up @@ -194,7 +198,7 @@ namespace BME_Utils {
newPress = (bmp280.readPressure() / 100.0F);
newHum = 0;
break;
case 3: // BME680
/*case 3: // BME680
bme680.performReading();
delay(50);
if (bme680.endReading()) {
Expand All @@ -203,7 +207,7 @@ namespace BME_Utils {
newHum = bme680.humidity;
newGas = bme680.gas_resistance / 1000.0; // in Kilo ohms
}
break;
break;*/
}

if (isnan(newTemp) || isnan(newHum) || isnan(newPress)) {
Expand Down
2 changes: 2 additions & 0 deletions src/pins_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
#define BATTERY_PIN 1
#define VEXT_CTRL 36
#define ADC_CTRL 37
#define BOARD_I2C_SDA 41
#define BOARD_I2C_SCL 42
#endif

#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
Expand Down
4 changes: 4 additions & 0 deletions src/power_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ namespace POWER_Utils {
#ifdef HELTEC_WIRELESS_TRACKER
Wire.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);
#endif

#ifdef HELTEC_V3_GPS
Wire1.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);
#endif

delay(1000);
}
Expand Down

0 comments on commit 3de3aac

Please sign in to comment.