From 59f60a4e4f0e6c56cd63102027f91bbc3fd42267 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 12:57:28 +0100 Subject: [PATCH 1/6] add esp32 for build examples workflow --- .github/workflows/compile_examples.yml | 31 +++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile_examples.yml b/.github/workflows/compile_examples.yml index b1f21a2..7b72cb6 100644 --- a/.github/workflows/compile_examples.yml +++ b/.github/workflows/compile_examples.yml @@ -44,4 +44,33 @@ jobs: libraries: | - source-path: ./ sketch-paths: - ./examples/ESP8266_example/ESP8266_example.ino \ No newline at end of file + ./examples/ESP8266_example/ESP8266_example.ino + + build-esp32: + runs-on: ubuntu-latest + if: contains(github.event.head_commit.message, 'esp32') + + strategy: + fail-fast: false + + matrix: + idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "latest"] + idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3"] + + container: espressif/idf:${{ matrix.idf_ver }} + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + - name: esp-idf build + env: + IDF_TARGET: ${{ matrix.idf_target }} + shell: bash + working-directory: examples/ESP8266_example + run: | + . ${IDF_PATH}/export.sh + export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" + export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" + export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" + idf.py build \ No newline at end of file From ec0984de5be9941f6c596c92f8d1cc11d38d7a1a Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 13:13:15 +0100 Subject: [PATCH 2/6] adapt compile examples for esp32 --- .github/workflows/compile_examples.yml | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/compile_examples.yml b/.github/workflows/compile_examples.yml index 7b72cb6..8fc69e3 100644 --- a/.github/workflows/compile_examples.yml +++ b/.github/workflows/compile_examples.yml @@ -54,23 +54,25 @@ jobs: fail-fast: false matrix: - idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "latest"] - idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3"] - - container: espressif/idf:${{ matrix.idf_ver }} - + board: + - fqbn: esp32:esp32:nodemcu + core: + - version: 3.0.6 + - version: 3.0.7 + steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Compile ESP32 examples + uses: arduino/compile-sketches@v1 with: - submodules: 'true' - - name: esp-idf build - env: - IDF_TARGET: ${{ matrix.idf_target }} - shell: bash - working-directory: examples/ESP8266_example - run: | - . ${IDF_PATH}/export.sh - export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" - export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" - export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" - idf.py build \ No newline at end of file + platforms: | + - name: esp32:esp32 + source-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json + version: ${{ matrix.core.version }} + fqbn: ${{ matrix.board.fqbn }} + libraries: | + - source-path: ./ + sketch-paths: + ./examples/ESP8266_example/ESP8266_example.ino \ No newline at end of file From 3da142603cf5173275f9b158a69b00e01a82527a Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 13:23:26 +0100 Subject: [PATCH 3/6] adapt board for esp32 --- .github/workflows/compile_examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile_examples.yml b/.github/workflows/compile_examples.yml index 8fc69e3..e74036f 100644 --- a/.github/workflows/compile_examples.yml +++ b/.github/workflows/compile_examples.yml @@ -55,7 +55,7 @@ jobs: matrix: board: - - fqbn: esp32:esp32:nodemcu + - fqbn: esp32:esp32:esp32 core: - version: 3.0.6 - version: 3.0.7 From 895c93c3e53e6815adc55b0edde4d4f456860b10 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 13:29:12 +0100 Subject: [PATCH 4/6] adapt examples for esp32 and esp8266 --- .github/workflows/compile_examples.yml | 2 +- examples/ESP32_example/ESP32_example.ino | 63 ++++++++++++++++++++ examples/ESP8266_example/ESP8266_example.ino | 2 +- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 examples/ESP32_example/ESP32_example.ino diff --git a/.github/workflows/compile_examples.yml b/.github/workflows/compile_examples.yml index e74036f..20dfc3f 100644 --- a/.github/workflows/compile_examples.yml +++ b/.github/workflows/compile_examples.yml @@ -75,4 +75,4 @@ jobs: libraries: | - source-path: ./ sketch-paths: - ./examples/ESP8266_example/ESP8266_example.ino \ No newline at end of file + ./examples/ESP32_example/ESP32_example.ino \ No newline at end of file diff --git a/examples/ESP32_example/ESP32_example.ino b/examples/ESP32_example/ESP32_example.ino new file mode 100644 index 0000000..3f7983f --- /dev/null +++ b/examples/ESP32_example/ESP32_example.ino @@ -0,0 +1,63 @@ +#include +#include +#include +#include + + +// ============================================ +// ### --- START: Klassen Instanzen --- ### +// ============================================ + +BME::Bosch_BME280 sensor_bme280{BME280_I2C_ADDR_PRIM, 249.76F, true}; + +// ============================================ +// ### --- END: Klassen --- ### +// ============================================ + + +// ============================================ +// ### --- START: Setup --- ### +// ============================================ +void setup() { + WiFi.mode(WIFI_OFF); + // Serielle Schnittstelle initialisieren + Serial.begin(115200); + while (!Serial) { + yield(); + } + Serial.println(F("\n ### >>> ESP32 test - read Bosch BME280 Sensor Data <<< ###")); + + // SDA, SCL needed for ESPs + Wire.setPins(SDA, SCL); + Wire.begin(); + + Serial.println(F("\t>>> init Sensor")); + + sensor_bme280.begin(); +} + +// ============================================ +// ### --- END: Setup --- ### +// ============================================ + +// ============================================ +// ### --- START: Main Loop --- ### +// ============================================ + +void loop() { + static unsigned long last_ms {10000}; + unsigned long ms {millis()}; + + if(ms - last_ms >= 10000) { + last_ms = ms; + sensor_bme280.measure(); + + Serial.printf("\n\n\tTemperature:\t%.2f\n", sensor_bme280.getTemperature()); + Serial.printf("\tHumidity:\t%.2f\n", sensor_bme280.getHumidity()); + Serial.printf("\tPressure:\t%.2f\n", sensor_bme280.getPressure()); + Serial.printf("\tPressure at NN:\t%.2f\n", sensor_bme280.getSealevelForAltitude()); + } +} +// ============================================ +// ### --- END: Main Loop --- ### +// ============================================ \ No newline at end of file diff --git a/examples/ESP8266_example/ESP8266_example.ino b/examples/ESP8266_example/ESP8266_example.ino index 474b997..35b013d 100644 --- a/examples/ESP8266_example/ESP8266_example.ino +++ b/examples/ESP8266_example/ESP8266_example.ino @@ -25,7 +25,7 @@ void setup() { while (!Serial) { yield(); } - Serial.println(F("\n ### >>> ESP01 Test - read Bosch BME280 Sensor Data <<< ###")); + Serial.println(F("\n ### >>> ESP8266 Test - read Bosch BME280 Sensor Data <<< ###")); // SDA, SCL needed for ESPs #if defined (ESP8266) From 2a0909402f0d9d5d0a4dfadd1f1e4415bf81d689 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 13:40:16 +0100 Subject: [PATCH 5/6] adapt boards for esp32 and esp8266 --- .github/workflows/compile_examples.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/compile_examples.yml b/.github/workflows/compile_examples.yml index 20dfc3f..345dc38 100644 --- a/.github/workflows/compile_examples.yml +++ b/.github/workflows/compile_examples.yml @@ -23,7 +23,9 @@ jobs: matrix: board: + - fqbn: esp8266:esp8266:esp8285 - fqbn: esp8266:esp8266:nodemcu + - fqbn: esp8266:esp8266:nodemcuv2 - fqbn: esp8266:esp8266:d1_mini core: - version: 3.1.2 From ee745272f9cf15ba9b210c8ac0b12fb6358868d4 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Sun, 10 Nov 2024 13:45:41 +0100 Subject: [PATCH 6/6] update readme.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index efaf1b3..438cb84 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,9 @@ setSensorStatus(status); ### Example See also in: -[Arduino_example.ino](https://github.com/hasenradball/Bosch_BME280_Arduino/blob/master/examples/Arduino_example/Arduino_example.ino) +* [Arduino_example.ino](https://github.com/hasenradball/Bosch_BME280_Arduino/blob/master/examples/Arduino_example/Arduino_example.ino) +* [ESP32_example.ino](https://github.com/hasenradball/Bosch_BME280_Arduino/blob/master/examples/ESP32_example/ESP32_example.ino) +* [ESP8266_example.ino](https://github.com/hasenradball/Bosch_BME280_Arduino/blob/master/examples/ESP8266_example/ESP8266_example.ino) ``` #include