diff --git a/ampel-firmware/config.public.h b/ampel-firmware/config.public.h index b91b23618e8041842ddaf6414ea9741786324aec..45ec1ac5aa6e28993e91a245d62df9619cc06b7b 100644 --- a/ampel-firmware/config.public.h +++ b/ampel-firmware/config.public.h @@ -119,21 +119,23 @@ */ // 1) Requires "MCCI LoRaWAN LMIC library", which will be automatically used with PlatformIO but should be added in "Arduino IDE". -// 2) If you need to, region and transceiver type can be specified in lorawan.cpp. Default is "Europe 868" +// 2) Region and transceiver type should be specified in: +// * Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/lmic_project_config.h for Arduino IDE +// * platformio.ini for PlatformIO +// See https://github.com/mcci-catena/arduino-lmic#configuration for more information // 3) It has been tested with "TTGO ESP32 SX1276 LoRa 868" and will only work with an ESP32 + LoRa modem // 4) In order to use LoRaWAN, a gateway should be close to the co2ampel, and an account, an application and a device should be registered, -// e.g. on https://www.thethingsnetwork.org/docs/applications/ +// e.g. on https://www.thethingsindustries.com/docs/integrations/ // 5) The corresponding keys should be defined in LORAWAN_DEVICE_EUI, LORAWAN_APPLICATION_EUI and LORAWAN_APPLICATION_KEY // How often should measurements be sent over LoRaWAN? # define LORAWAN_SENDING_INTERVAL 300 // [s] This value should not be too low. See https://www.thethingsnetwork.org/docs/lorawan/duty-cycle.html#maximum-duty-cycle -// WARNING: If AMPEL_LORAWAN is enabled, you need to modify the 3 following constants! +// WARNING: If AMPEL_LORAWAN is true, you need to modify the 3 following constants! // This EUI must be in little-endian format, so least-significant-byte first. // When copying an EUI from ttnctl output, this means to reverse the bytes. # define LORAWAN_DEVICE_EUI {0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11} // This should also be in little endian format, see above. -// For TheThingsNetwork issued EUIs the last bytes should be 0xD5, 0xB3, 0x70. -# define LORAWAN_APPLICATION_EUI {0x00, 0x00, 0x00, 0x00, 0x00, 0xD5, 0xB3, 0x70} +# define LORAWAN_APPLICATION_EUI {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // This key should be in big endian format (or, since it is not really a // number but a block of memory, endianness does not really apply). In // practice, a key taken from ttnctl can be copied as-is. diff --git a/ampel-firmware/lorawan.cpp b/ampel-firmware/lorawan.cpp index aed932c0c7e5cf0ab32c743694c78cd2467b315c..19e9e085741427a77a67f5cb54106fb083c958b0 100644 --- a/ampel-firmware/lorawan.cpp +++ b/ampel-firmware/lorawan.cpp @@ -9,13 +9,6 @@ #include "util.h" #include "ntp.h" -/*** Define region and transceiver type, and ignore lmic_project_config.h from lmic library ***/ -// Those values are probably okay if you're in Europe. -#define ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS -#define CFG_eu868 1 -#define CFG_sx1276_radio 1 -/****************************************************************************************/ - // Requires "MCCI LoRaWAN LMIC library", which will be automatically used with PlatformIO but should be added in "Arduino IDE" // Tested successfully with v3.2.0 and connected to a thethingsnetwork.org app. #include <lmic.h> diff --git a/platformio.ini b/platformio.ini index a0443ae3711a6f5578fd64a6e592367181c653d3..16302db292f0b55c86b3774264b93e30757f93f0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,6 +20,8 @@ lib_deps = EEPROM DNSServer prampec/IotWebConf@^3.2.0 +;build_flags = +; -D IOTWEBCONF_DEBUG_DISABLED [env:esp32] platform = espressif32 @@ -31,3 +33,7 @@ lib_deps = EEPROM DNSServer prampec/IotWebConf@^3.2.0 +build_flags = + -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS + -D CFG_eu868=1 + -D CFG_sx1276_radio=1