Skip to content

Commit

Permalink
Update WeatherSensorCfg.h.template
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Sep 27, 2023
1 parent 03b4f53 commit c50a599
Showing 1 changed file with 49 additions and 26 deletions.
75 changes: 49 additions & 26 deletions src/WeatherSensorCfg.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
// 20230420 Added pin definitions for DFRobot FireBeetle ESP32 with FireBeetle Cover LoRa
// 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
// 20230927 Removed _DEBUG_MODE_ (log_d() is used instead)
//
// ToDo:
// -
Expand Down Expand Up @@ -138,7 +141,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 @@ -175,8 +184,8 @@
#define NUM_SENSORS 1 // Number of sensors to be received

// List of sensor IDs to be excluded - can be empty
#define SENSOR_IDS_EXC {}
//#define SENSOR_IDS_EXC { 0x39582376 }
#define SENSOR_IDS_EXC { 0x792882A2 }
//#define SENSOR_IDS_EXC { 0x792882A2 }

// List of sensor IDs to be included - if empty, handle all available sensors
#define SENSOR_IDS_INC {}
Expand All @@ -199,42 +208,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)
// on ESP8266 and RP2040:
#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) && defined(DEBUG_RP2040_PORT)
#define DEBUG_ESP_PORT DEBUG_RP2040_PORT
#elif defined(DEBUG_ESP_PORT)
#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 @@ -283,17 +302,6 @@
#endif
#endif


//#define _DEBUG_MODE_ // Enable debug output (serial console)
#define DEBUG_PORT Serial
#if defined(_DEBUG_MODE_)
#define DEBUG_PRINT(...) { DEBUG_PORT.print(__VA_ARGS__); }
#define DEBUG_PRINTLN(...) { DEBUG_PORT.println(__VA_ARGS__); }
#else
#define DEBUG_PRINT(...) {}
#define DEBUG_PRINTLN(...) {}
#endif

// Disable data type which will not be used to save RAM
#define WIND_DATA_FLOATINGPOINT
#define WIND_DATA_FIXEDPOINT
Expand All @@ -303,6 +311,7 @@
#define BRESSER_6_IN_1
#define BRESSER_7_IN_1
#define BRESSER_LIGHTNING
#define BRESSER_LEAKAGE

#if ( !defined(BRESSER_5_IN_1) && !defined(BRESSER_6_IN_1) && !defined(BRESSER_7_IN_1) )
#error "Either BRESSER_5_IN_1 and/or BRESSER_6_IN_1 and/or BRESSER_7_IN_1 must be defined!"
Expand Down Expand Up @@ -457,6 +466,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 c50a599

Please sign in to comment.