From cae53f7dc0e90a62178df052cf98eb0a8ee51411 Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Fri, 19 Apr 2024 13:04:03 +0200 Subject: [PATCH] Fix I2C address to 0x77 for BMP280 --- lib/obp60task/OBP60Extensions.cpp | 15 --------------- lib/obp60task/OBP60Hardware.h | 4 ++-- lib/obp60task/obp60task.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index 94d4714..6e9480b 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -57,9 +57,6 @@ GxEPD2_BW & getdisplay(){r // Horter I2C moduls PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 from Horter -// RTC DS1388 -RTC_DS1388 ds1388; - // Define the array of leds CRGB fled[NUM_FLASH_LED]; // Flash LED CRGB backlight[NUM_BACKLIGHT_LED]; // Backlight @@ -76,10 +73,6 @@ void hardwareInit() // Init power rail 5.0V setPortPin(OBP_POWER_50, true); - // Init E-Ink display - //getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse - - // Init RGB LEDs FastLED.addLeds(fled, NUM_FLASH_LED); FastLED.addLeds(backlight, NUM_BACKLIGHT_LED); @@ -89,14 +82,6 @@ void hardwareInit() if(pcf8574_Out.begin()){ // Initialize PCF8574 pcf8574_Out.write8(255); // Clear all outputs } - - // Init DS1388 RTC - if(ds1388.begin()){ - uint year = ds1388.now().year(); - if(year < 2023){ - ds1388.adjust(DateTime(__DATE__, __TIME__)); // Set date and time from PC file time - } - } } void setPortPin(uint pin, bool value){ diff --git a/lib/obp60task/OBP60Hardware.h b/lib/obp60task/OBP60Hardware.h index c3ce5ec..66b8cd0 100644 --- a/lib/obp60task/OBP60Hardware.h +++ b/lib/obp60task/OBP60Hardware.h @@ -8,11 +8,11 @@ #define OBP_I2C_SDA 47 #define OBP_I2C_SCL 21 // DS1388 RTC - #define DS1388_I2C_ADDR 0xD0 // Addr. 0xD0 + #define DS1388_I2C_ADDR 0x00 // Addr. 0x00 (Range 0x00-0x0C) // BME280 #define BME280_I2C_ADDR 0x76 // Addr. 0x76 (0x77) // BMP280 - #define BMP280_I2C_ADDR 0x76 // Addr. 0x76 (0x77) + #define BMP280_I2C_ADDR 0x77 // Addr. 0x76 (0x77) // BMP085 / BMP180 #define BMP180_I2C_ADDR 0x77 // Addr. 0x77 (fix) // SHT21 / HUT21 diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index c7749f0..4a16d91 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -3,6 +3,7 @@ #include "Pagedata.h" #include "OBP60Hardware.h" // PIN definitions #include // I2C connections +#include // DS1388 RTC #include // MCP23017 extension Port #include // NMEA2000 #include @@ -23,6 +24,9 @@ #include "OBP60QRWiFi.h" // Functions lib for WiFi QR code #include "OBPSensorTask.h" // Functions lib for sensor data +// RTC DS1388 +RTC_DS1388 ds1388; + // Global vars bool initComplete = false; // Initialization complete int taskRunCounter = 0; // Task couter for loop section @@ -46,6 +50,13 @@ void OBP60Init(GwApi *api){ } else{ // Init code for DS1388 + api->getLogger()->logDebug(GwLog::LOG,"DS1388 found"); + if(ds1388.begin()){ + uint year = ds1388.now().year(); + if(year < 2023){ + ds1388.adjust(DateTime(__DATE__, __TIME__)); // Set date and time from PC file time + } + } } // Init hardware