testing HeltecV3 0.1

This commit is contained in:
richonguzman 2024-05-14 08:59:47 -04:00
parent 3a148fa55d
commit 3de3aac026
3 changed files with 24 additions and 14 deletions

View File

@ -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
@ -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
@ -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)) {
@ -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");
@ -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;*/
}
}
}
@ -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()) {
@ -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)) {

View File

@ -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)

View File

@ -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);
}