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

Commit

Permalink
Updated, added RAINGAUGE_USE_PREFS and LIGHTNING_USE_PREFS
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jan 26, 2024
1 parent 583b9fe commit c56f92c
Showing 1 changed file with 60 additions and 16 deletions.
76 changes: 60 additions & 16 deletions WeatherSensorCfg.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
// 20230926 Added pin definitions for Adafruit Feather RP2040 with RFM95W "FeatherWing" ADA3232
// 20230927 Removed _DEBUG_MODE_ (log_d() is used instead)
// 20231004 Added function names and line numbers to ESP8266/RP2040 debug logging
// 20231101 Added USE_SX1262 for Heltec Wireless Stick V3
// 20231121 Added Heltec WiFi LoRa32 V3
// 20231130 Bresser 3-in-1 Professional Wind Gauge / Anemometer, PN 7002531: Replaced workaround
// for negative temperatures by fix (6-in-1 decoder)
// 20240124 Added RAINGAUGE_USE_PREFS and LIGHTNING_USE_PREFS
//
// ToDo:
// -
Expand All @@ -72,11 +77,6 @@
#define SENSOR_IDS_INC {}
//#define SENSOR_IDS_INC { 0x83750871 }

// List of sensor IDs of the model "BRESSER 3-in-1 Professional Wind Gauge / Anemometer"
// P/N 7002531 - requiring special heandling in decodeBresser5In1Payload()
//#define SENSOR_IDS_DECODE3IN1 {}
#define SENSOR_IDS_DECODE3IN1 { 0x2C100512 }

// Disable data type which will not be used to save RAM
#define WIND_DATA_FLOATINGPOINT
#define WIND_DATA_FIXEDPOINT
Expand All @@ -90,6 +90,25 @@
#define BRESSER_LEAKAGE


// ------------------------------------------------------------------------------------------------
// --- Rain Gauge / Lightning sensor data retention during deep sleep ---
// ------------------------------------------------------------------------------------------------

#if !defined(INSIDE_UNITTEST)
#if defined(ESP32)
// Option: Comment out to save data in RTC RAM
// N.B.:
// ESP8266 has RTC RAM, too, but access is different from ESP32
// and currently not implemented here
#define RAINGAUGE_USE_PREFS
#define LIGHTNING_USE_PREFS
#else
// Using Preferences is mandatory on other architectures (e.g. RP2040)
#define RAINGAUGE_USE_PREFS
#define LIGHTNING_USE_PREFS
#endif
#endif

// ------------------------------------------------------------------------------------------------
// --- Board ---
// ------------------------------------------------------------------------------------------------
Expand All @@ -114,6 +133,11 @@
// in the Arduino IDE:
//#define ARDUINO_TTGO_LoRa32_V21new

// Heltec Wireless Stick
// V2 -> SX1276
// V3 -> SX1262
// THERE IS NO WAY TO DISTINGUISH THE VERSION AUTOMATICALLY!
//
// This define is set by selecting "Board: Heltec Wireless Stick"
// in the Arduino IDE:
//#define ARDUINO_heltec_wireless_stick
Expand Down Expand Up @@ -161,12 +185,18 @@

#elif defined(ARDUINO_heltec_wireless_stick)
#pragma message("ARDUINO_heltec_wireless_stick defined; using on-board transceiver")
#define USE_SX1276
#pragma message("Radio transceiver chip has to be configured manually: V2 -> USE_SX1276 / V3 -> USE_SX1262")
//#define USE_SX1276 // Heltec Wireless Stick V2
#define USE_SX1262 // Heltec Wireless Stick V3

#elif defined(ARDUINO_heltec_wifi_lora_32_V2)
#pragma message("ARDUINO_heltec_wifi_lora_32_V2 defined; using on-board transceiver")
#define USE_SX1276

#elif defined(ARDUINO_heltec_wifi_32_lora_V3)
#pragma message("ARDUINO_heltec_wifi_32_lora_V3 defined; using on-board transceiver")
#define USE_SX1262

#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
#pragma message("ARDUINO_ADAFRUIT_FEATHER_ESP32S2 defined; assuming RFM95W FeatherWing will be used")
#define USE_SX1276
Expand Down Expand Up @@ -199,8 +229,8 @@
#define USE_SX1276

#else
#pragma message("ARDUINO_ESP32_DEV defined; select either LORAWAN_NODE or FIREBEETLE_ESP32_COVER_LORA manually!")
#pragma message("ARDUINO_ESP32_DEV defined; if you use one of those boards, select either LORAWAN_NODE or FIREBEETLE_ESP32_COVER_LORA manually!")

#endif
#endif

Expand All @@ -209,9 +239,10 @@
// --- Radio Transceiver ---
// ------------------------------------------------------------------------------------------------
// Select type of receiver module (if not yet defined based on the assumptions above)
#if ( !defined(USE_CC1101) && !defined(USE_SX1276) )
#if ( !defined(USE_CC1101) && !defined(USE_SX1276) && !defined(USE_SX1262) )
//#define USE_CC1101
#define USE_SX1276
//#define USE_SX1262
#endif


Expand Down Expand Up @@ -321,20 +352,20 @@
#endif
#endif

#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!"
#endif

#if ( defined(USE_CC1101) && defined(USE_SX1276) )
#error "Either USE_CC1101 OR USE_SX1276 must be defined!"
#if ( (defined(USE_CC1101) && defined(USE_SX1276)) || \
(defined(USE_SX1276) && defined(USE_SX1262)) || \
(defined(USE_SX1262) && defined(USE_CC1101)) )
#error "Either USE_CC1101 OR USE_SX1276 OR USE_SX1262 must be defined!"
#endif

#if defined(USE_CC1101)
#define RECEIVER_CHIP "[CC1101]"
#elif defined(USE_SX1276)
#define RECEIVER_CHIP "[SX1276]"
#elif defined(USE_SX1262)
#define RECEIVER_CHIP "[SX1262]"
#else
#error "Either USE_CC1101 or USE_SX1276 must be defined!"
#error "Either USE_CC1101, USE_SX1276 or USE_SX1262 must be defined!"
#endif


Expand Down Expand Up @@ -409,6 +440,19 @@
// RFM95W/SX127x - GPIOxx / CC1101 - RADIOLIB_NC
#define PIN_RECEIVER_RST RST_LoRa

#elif defined(ARDUINO_heltec_wifi_32_lora_V3)
// Use pinning for Heltec WiFi LoRa32 V3
#define PIN_RECEIVER_CS SS

// CC1101: GDO0 / RFM95W/SX127x: G0 / SX1262: DIO0
#define PIN_RECEIVER_IRQ DIO0

// CC1101: GDO2 / RFM95W/SX127x: G1 / SX1262: BUSY
#define PIN_RECEIVER_GPIO BUSY_LoRa

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

#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
// Use pinning for Adafruit Feather ESP32S2 with RFM95W "FeatherWing" ADA3232
#define PIN_RECEIVER_CS 6
Expand Down

0 comments on commit c56f92c

Please sign in to comment.