Skip to content

Commit

Permalink
Update WeatherSensorCfg.h
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Sep 26, 2023
1 parent cb8ed1f commit 3e0a8e4
Showing 1 changed file with 43 additions and 12 deletions.
55 changes: 43 additions & 12 deletions src/WeatherSensorCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// 20230607 Added pin definitions for Heltec WiFi LoRa 32(V2)
// 20230624 Added Bresser Lightning Sensor decoder
// 20230804 Added Bresser Water Leakage Sensor decoder
// 20230926 Added pin definitions for Adafruit Feather RP2040 with RFM95W "FeatherWing" ADA3232
//
// ToDo:
// -
Expand Down Expand Up @@ -139,7 +140,13 @@
#elif defined(ARDUINO_AVR_FEATHER32U4)
#pragma message("ARDUINO_AVR_FEATHER32U4 defined; assuming this is the Adafruit Feather 32u4 RFM95 LoRa Radio")
#define USE_SX1276


#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#pragma message("ARDUINO_ADAFRUIT_FEATHER_RP2040 defined; assuming assuming RFM95W FeatherWing will be used")
#define USE_SX1276
#pragma message("Required wiring: A to RST, B to DIO1, D to DIO0, E to CS")
#pragma message("NOT TESTED!")

#elif defined(ARDUINO_ESP32_DEV)
//#define LORAWAN_NODE
#define FIREBEETLE_ESP32_COVER_LORA
Expand Down Expand Up @@ -200,42 +207,52 @@
// DEBUG_ESP_PORT is set in Arduino IDE:
// Tools->Debug port: "<None>|<Serial>|<Serial1>"
//
// - RP2040:
// DEBUG_RP2040_PORT is set in Arduino IDE:
// Tools->Debug port: "<Disabled>|<Serial>|<Serial1>|<Serial2>"
//
// Replacement for
// https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-log.h
// on ESP8266:
#if defined(ESP8266)
#if defined(ESP8266) || defined(ARDUINO_ARCH_RP2040)
#define ARDUHAL_LOG_LEVEL_NONE 0
#define ARDUHAL_LOG_LEVEL_ERROR 1
#define ARDUHAL_LOG_LEVEL_WARN 2
#define ARDUHAL_LOG_LEVEL_INFO 3
#define ARDUHAL_LOG_LEVEL_DEBUG 4
#define ARDUHAL_LOG_LEVEL_VERBOSE 5

#if defined(ARDUINO_ARCH_RP2040)
#define DEBUG_ESP_PORT DEBUG_RP2040_PORT
#else
#define DEBUG_PORT DEBUG_ESP_PORT
#endif

// Set desired level here!
#define CORE_DEBUG_LEVEL ARDUHAL_LOG_LEVEL_VERBOSE

#if defined(DEBUG_ESP_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_NONE
#define log_e(...) { DEBUG_ESP_PORT.printf(__VA_ARGS__); DEBUG_ESP_PORT.println(); }
#if defined(DEBUG_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_NONE
#define log_e(...) { DEBUG_PORT.printf(__VA_ARGS__); DEBUG_PORT.println(); }
#else
#define log_e(...) {}
#endif
#if defined(DEBUG_ESP_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_ERROR
#define log_w(...) { DEBUG_ESP_PORT.printf(__VA_ARGS__); DEBUG_ESP_PORT.println(); }
#if defined(DEBUG_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_ERROR
#define log_w(...) { DEBUG_PORT.printf(__VA_ARGS__); DEBUG_PORT.println(); }
#else
#define log_w(...) {}
#endif
#if defined(DEBUG_ESP_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_WARN
#define log_i(...) { DEBUG_ESP_PORT.printf(__VA_ARGS__); DEBUG_ESP_PORT.println(); }
#if defined(DEBUG_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_WARN
#define log_i(...) { DEBUG_PORT.printf(__VA_ARGS__); DEBUG_PORT.println(); }
#else
#define log_i(...) {}
#endif
#if defined(DEBUG_ESP_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_INFO
#define log_d(...) { DEBUG_ESP_PORT.printf(__VA_ARGS__); DEBUG_ESP_PORT.println(); }
#if defined(DEBUG_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_INFO
#define log_d(...) { DEBUG_PORT.printf(__VA_ARGS__); DEBUG_PORT.println(); }
#else
#define log_d(...) {}
#endif
#if defined(DEBUG_ESP_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_DEBUG
#define log_v(...) { DEBUG_ESP_PORT.printf(__VA_ARGS__); DEBUG_ESP_PORT.println(); }
#if defined(DEBUG_PORT) && CORE_DEBUG_LEVEL > ARDUHAL_LOG_LEVEL_DEBUG
#define log_v(...) { DEBUG_PORT.printf(__VA_ARGS__); DEBUG_PORT.println(); }
#else
#define log_v(...) {}
#endif
Expand Down Expand Up @@ -459,6 +476,20 @@
// RFM95W/SX127x - GPIOxx / CC1101 - RADIOLIB_NC
#define PIN_RECEIVER_RST 4

#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
// Use pinning for Adafruit Feather RP2040 with RFM95W "FeatherWing" ADA3232
// NOTE: NOT TESTED!
#define PIN_RECEIVER_CS 7

// CC1101: GDO0 / RFM95W/SX127x: G0
#define PIN_RECEIVER_IRQ 8

// CC1101: GDO2 / RFM95W/SX127x: G1 (not used)
#define PIN_RECEIVER_GPIO 10

// RFM95W/SX127x - GPIOxx / CC1101 - RADIOLIB_NC
#define PIN_RECEIVER_RST 11

#endif

#define STR_HELPER(x) #x
Expand Down

0 comments on commit 3e0a8e4

Please sign in to comment.