mirror of
https://github.com/manuelbl/ttn-esp32.git
synced 2025-06-15 12:24:27 +02:00
Ensure library compiles even if no frequency plan was selected
This commit is contained in:
parent
585c4b80bb
commit
9f0d912758
8
Kconfig
8
Kconfig
@ -2,13 +2,13 @@ menu "The Things Network"
|
|||||||
|
|
||||||
choice TTN_LORA_FREQ
|
choice TTN_LORA_FREQ
|
||||||
prompt "TTN LoRa frequency"
|
prompt "TTN LoRa frequency"
|
||||||
default TTN_LORA_FREQ_NONE
|
default TTN_LORA_FREQ_DISABLED
|
||||||
help
|
help
|
||||||
LoRa frequency must match the geographic region the device is operated in.
|
LoRa frequency must match the geographic region the device is operated in.
|
||||||
Running it with the incorrect frequency most like violates the law.
|
Running it with the incorrect frequency most likely violates the law.
|
||||||
|
|
||||||
config TTN_LORA_FREQ_NONE
|
config TTN_LORA_FREQ_DISABLED
|
||||||
bool "None"
|
bool "LoRa Disabled"
|
||||||
|
|
||||||
config TTN_LORA_FREQ_EU_868
|
config TTN_LORA_FREQ_EU_868
|
||||||
bool "868 MHz (Europe)"
|
bool "868 MHz (Europe)"
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "TheThingsNetwork.h"
|
#include "TheThingsNetwork.h"
|
||||||
|
#include "config.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
#include "hal_esp32.h"
|
#include "hal_esp32.h"
|
||||||
#include "lmic.h"
|
#include "lmic.h"
|
||||||
@ -37,10 +38,15 @@ static ClientAction clientAction = eActionUnrelated;
|
|||||||
TheThingsNetwork::TheThingsNetwork()
|
TheThingsNetwork::TheThingsNetwork()
|
||||||
: messageCallback(NULL)
|
: messageCallback(NULL)
|
||||||
{
|
{
|
||||||
|
#if defined(TTN_IS_DISABLED)
|
||||||
|
ESP_LOGE(TAG, "TTN is disabled. Configure a frequency plan using 'make menuconfig'");
|
||||||
|
ASSERT(0);
|
||||||
|
esp_restart();
|
||||||
|
#endif
|
||||||
|
|
||||||
ASSERT(ttnInstance == NULL);
|
ASSERT(ttnInstance == NULL);
|
||||||
ttnInstance = this;
|
ttnInstance = this;
|
||||||
hal_initCriticalSection();
|
hal_initCriticalSection();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TheThingsNetwork::~TheThingsNetwork()
|
TheThingsNetwork::~TheThingsNetwork()
|
||||||
|
@ -24,7 +24,8 @@ extern "C" {
|
|||||||
#elif defined(CONFIG_TTN_LORA_FREQ_US_915)
|
#elif defined(CONFIG_TTN_LORA_FREQ_US_915)
|
||||||
#define CFG_us915 1
|
#define CFG_us915 1
|
||||||
#else
|
#else
|
||||||
#error TTN LoRa frequency must be configured using 'make menuconfig'
|
#define TTN_IS_DISABLED 1
|
||||||
|
#define CFG_eu868 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_TTN_RADIO_SX1272_73)
|
#if defined(CONFIG_TTN_RADIO_SX1272_73)
|
||||||
|
Loading…
Reference in New Issue
Block a user