Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #85 from matthias-bs/feature-m5stack-core2
Browse files Browse the repository at this point in the history
Add configuration for M5Stack Core2 with M5Stack Module LoRa868
  • Loading branch information
matthias-bs authored Mar 26, 2024
2 parents 50b0ed9 + bec1543 commit 3227a62
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 119 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- esp32:esp32:heltec_wireless_stick:PSRAM=disabled
- esp32:esp32:heltec_wifi_lora_32_V2
- esp32:esp32:featheresp32
- esp32:esp32:m5stack-core2
- esp32:esp32:adafruit_feather_esp32s2
- rp2040:rp2040:adafruit_feather:dbgport=Serial

Expand Down Expand Up @@ -75,7 +76,7 @@ jobs:
#declare -a required_libs=("https://github.com/matthias-bs/BresserWeatherSensorReceiver.git"
declare -a required_libs=(
"[email protected]"
"BresserWeatherSensorReceiver@0.23.1"
"BresserWeatherSensorReceiver@0.24.0"
"MCCI LoRaWAN LMIC [email protected]"
"MCCI Arduino LoRaWAN [email protected]"
"MCCI Arduino Development Kit [email protected]"
Expand All @@ -87,7 +88,9 @@ jobs:
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]")
"[email protected]"
"[email protected]"
"[email protected]")
for i in "${required_libs[@]}"
do
arduino-cli lib install "$i"
Expand Down Expand Up @@ -142,6 +145,7 @@ jobs:
# hardcoded fqbn, because 'esp32:[email protected]' did not work
arduino-cli compile --libraries /home/runner/work/BresserWeatherSensorReceiver --fqbn esp32:esp32:esp32${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}
else
#arduino-cli compile --show-properties --libraries /home/runner/work/BresserWeatherSensorReceiver --fqbn ${{ matrix.board }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}
arduino-cli compile --libraries /home/runner/work/BresserWeatherSensorReceiver --fqbn ${{ matrix.board }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}
fi

Expand Down
27 changes: 27 additions & 0 deletions BresserWeatherSensorTTN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
// (see https://github.com/matthias-bs/BresserWeatherSensorReceiver/releases/tag/v0.5.1)
// 20240222 Added weatherSensor.clearSlots() (part of fix for #82), added workaround for (#81)
// 20240303 Added evaluation of temp_ok/humidity_ok/rain_ok (#82)
// 20240325 Added configuration for M5Stack Core2 with M5Stack Module LoRa868
//
// ToDo:
// - Split this file
Expand Down Expand Up @@ -169,6 +170,9 @@
#include "src/pico_rtc/pico_rtc_utils.h"
#include <hardware/rtc.h>
#endif
#if defined(ARDUINO_M5STACK_CORE2)
#include <M5Unified.h>
#endif

#ifdef RAINDATA_EN
#include "RainGauge.h"
Expand Down Expand Up @@ -280,6 +284,19 @@
#pragma message("ARDUINO_ADAFRUIT_FEATHER_ESP32 defined; assuming RFM95W FeatherWing will be used")
#pragma message("Required wiring: A to RST, B to DIO1, D to DIO0, E to CS")

#elif defined(ARDUINO_M5STACK_Core2) || defined(ARDUINO_M5STACK_CORE2)
// Note:
// Depending on the environment, selecting M5Stack Core2 defines
// either ARDUINO_M5STACK_Core2 or ARDUINO_M5STACK_CORE2
// so both variants have to be checked!!!
#define PIN_LMIC_NSS 33
#define PIN_LMIC_RST 26
#define PIN_LMIC_DIO0 36
#define PIN_LMIC_DIO1 35
#define PIN_LMIC_DIO2 cMyLoRaWAN::lmic_pinmap::LMIC_UNUSED_PIN
#pragma message("ARDUINO_M5STACK_CORE2 defined; assuming M5Stack Module LoRa868 will be used")
#pragma message("Required wiring: DIO1 to GPIO35")

#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
// Use pinning for Adafruit Feather RP2040 with RFM95W "FeatherWing" ADA3232
// https://github.com/earlephilhower/arduino-pico/blob/master/variants/adafruit_feather/pins_arduino.h
Expand Down Expand Up @@ -791,6 +808,16 @@ void setup() {
longSleep = ((watchdog_hw->scratch[1] & 2) == 2);
rtcLastClockSync = watchdog_hw->scratch[2];
#endif
#if defined(ARDUINO_M5STACK_CORE2)
auto cfg = M5.config();
cfg.clear_display = true; // default=true. clear the screen when begin.
cfg.output_power = true; // default=true. use external port 5V output.
cfg.internal_imu = false; // default=true. use internal IMU.
cfg.internal_rtc = true; // default=true. use internal RTC.
cfg.internal_spk = false; // default=true. use internal speaker.
cfg.internal_mic = false; // default=true. use internal microphone.
M5.begin(cfg);
#endif

// set baud rate
Serial.begin(115200);
Expand Down
Loading

0 comments on commit 3227a62

Please sign in to comment.