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

Patch to add config for ttgo lora32v1 #39

Merged
merged 2 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions BresserWeatherSensorTTN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
// 20230101 Added remote configuration via LoRaWAN downlink
// 20230112 Fixed rain gauge update in case RTC was set by LoRaWAN downlink
// Added note regarding LMIC_ENABLE_DeviceTimeReq
// 20230121 Added configuration for TTGO LoRa32 V1
//
// ToDo:
// -
Expand Down Expand Up @@ -169,11 +170,25 @@
// Pin mapping for ESP32 (MCCI Arduino LoRaWAN Library)
// Note: Pin mapping for BresserWeatherSensorReceiver is done in WeatherSensorCfg.h!
// SPI2 is used on ESP32 per default! (e.g. see https://github.com/espressif/arduino-esp32/tree/master/variants/doitESP32devkitV1)
#define PIN_LMIC_NSS 14
#define PIN_LMIC_RST 12
#define PIN_LMIC_DIO0 4
#define PIN_LMIC_DIO1 16
#define PIN_LMIC_DIO2 17
#if defined(ARDUINO_TTGO_LoRa32_V1)
// https://github.com/espressif/arduino-esp32/blob/master/variants/ttgo-lora32-v1/pins_arduino.h
// http://www.lilygo.cn/prod_view.aspx?TypeId=50003&Id=1130&FId=t3:50003:3
// https://github.com/Xinyuan-LilyGo/TTGO-LoRa-Series
// https://github.com/LilyGO/TTGO-LORA32/blob/master/schematic1in6.pdf
#define PIN_LMIC_NSS LORA_CS
#define PIN_LMIC_RST LORA_RST
#define PIN_LMIC_DIO0 LORA_IRQ
#define PIN_LMIC_DIO1 33
#define PIN_LMIC_DIO2 cMyLoRaWAN::lmic_pinmap::LMIC_UNUSED_PIN
#else
// LoRaWAN_Node board
// https://github.com/matthias-bs/LoRaWAN_Node
#define PIN_LMIC_NSS 14
#define PIN_LMIC_RST 12
#define PIN_LMIC_DIO0 4
#define PIN_LMIC_DIO1 16
#define PIN_LMIC_DIO2 17
#endif


// Uplink message payload size
Expand Down
25 changes: 22 additions & 3 deletions BresserWeatherSensorTTNCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// ~/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/
// lmic_project_config.h
// in order to be recognized!!!
// 20230121 Added configuration for TTGO LoRa32 V1
//
// ToDo:
// -
Expand All @@ -63,6 +64,12 @@
//#define CORE_DEBUG_LEVEL ARDUHAL_LOG_LEVEL_DEBUG
//#define CORE_DEBUG_LEVEL ARDUHAL_LOG_LEVEL_VERBOSE

//--- Select Board ---
#ifndef ARDUINO_TTGO_LoRa32_V1
// Use pinning for LoRaWAN Node
#define LORAWAN_NODE
#endif

//--- Select LoRaWAN Network ---
// The Things Network
#define ARDUINO_LMIC_CFG_NETWORK_TTN 1
Expand Down Expand Up @@ -137,16 +144,24 @@

// ADC for supply/battery voltage measurement
// default: on-board connection to VB on FireBeetle ESP32 (with R10+R11 assembled)
// on-board connection to VBAT on TTGO LoRa32
#ifdef ADC_EN
#define PIN_ADC_IN A0
#if defined(ARDUINO_TTGO_LoRa32_V1)
#define PIN_ADC_IN 35
#else
#define PIN_ADC_IN A0
#endif
//#define PIN_ADC_IN 34
#endif


// Additional ADC pins (default: FireBeetle ESP32)
//#define PIN_ADC0_IN A0
//#define PIN_ADC1_IN A1
//#define PIN_ADC2_IN A2
#define PIN_ADC3_IN A3
#ifdef LORAWAN_NODE
#define PIN_ADC3_IN A3
#endif

#ifdef PIN_ADC0_IN
// Voltage divider R1 / (R1 + R2) -> V_meas = V(R1 + R2); V_adc = V(R1)
Expand All @@ -173,7 +188,11 @@
#endif

#ifdef ONEWIRE_EN
#define PIN_ONEWIRE_BUS 5
#if defined(ARDUINO_TTGO_LoRa32_V1)
#define PIN_ONEWIRE_BUS 21
#else
#define PIN_ONEWIRE_BUS 5
#endif
#endif

#ifdef ADC_EN
Expand Down