changed main.h -> main.conf

This commit is contained in:
Klaus K Wilting 2018-03-30 20:51:49 +02:00
parent 875ad77967
commit f6f63b6a57
8 changed files with 127 additions and 132 deletions

View File

@ -34,9 +34,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/heltec.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -56,9 +56,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/ttgov1.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -78,9 +78,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/ttgov2.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -101,9 +101,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/lopy.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -124,9 +124,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/lopy4.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -148,9 +148,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/lolin32lite_lora.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE
@ -172,9 +172,9 @@ build_flags =
;needed for ESP32 BLE Ardunio v0.4.9
-fexceptions
-std=c++11
;override lora settings from LMiC library in lmic/config.h and use main.h instead
;override lora settings from LMiC library in lmic/config.h and use main.conf instead
-D_lmic_config_h_
-include "src/main.h"
-include "src/main.conf"
-include "src/hal/lolin32_lora.h"
;FreeRTOS single core operation, switches off core 1 (see arduino-esp32/cores/esp32/main.cpp)
; -DCONFIG_FREERTOS_UNICORE

View File

@ -1,6 +1,6 @@
/* configmanager persists runtime configuration using NVRAM of ESP32*/
#include "main.h"
#include "main.conf"
#include "globals.h"
#include <nvs.h>
#include <nvs_flash.h>
@ -19,7 +19,7 @@ esp_err_t err;
// populate cfg vars with factory settings
void defaultConfig() {
cfg.lorasf = LORASFDEFAULT; // 7-12, initial lora spreadfactor defined in main.h
cfg.lorasf = LORASFDEFAULT; // 7-12, initial lora spreadfactor defined in main.conf
cfg.txpower = 15; // 2-15, lora tx power
cfg.adrmode = 1; // 0=disabled, 1=enabled
cfg.screensaver = 0; // 0=disabled, 1=enabled

View File

@ -12,7 +12,6 @@
#include <hal/hal.h>
// Struct holding devices's runtime configuration
typedef struct {
int8_t lorasf; // 7-12, lora spreadfactor
int8_t txpower; // 2-15, lora tx power
@ -35,7 +34,6 @@ extern uint64_t uptimecounter;
extern osjob_t sendjob;
extern int macnum, blenum, countermode, screensaver, adrmode, lorasf, txpower, rlim;
extern bool joinstate;
//extern std::set<uint64_t, std::greater <uint64_t> > macs;
extern std::set<uint64_t> macs;
#ifdef HAS_DISPLAY

View File

@ -1,5 +1,5 @@
// Basic Config
#include "main.h"
#include "main.conf"
#include "globals.h"
// LMIC-Arduino LoRaWAN Stack

View File

@ -1,106 +1,106 @@
// program version
#define PROGVERSION "1.2.51" // use max 10 chars here!
#define PROGNAME "PAXCNT"
// Verbose enables serial output
#define VERBOSE 1 // comment out to silence the device, for mute use build option
// set this to include BLE counting and vendor filter functions
#define VENDORFILTER 1 // comment out if you want to count things, not people
#define BLECOUNTER 1 // comment out if you don't want BLE count
// BLE scan time
#define BLESCANTIME 30 // [seconds]
// WiFi Sniffer cycle interval
#define SEND_SECS 120 // [seconds/2] -> 240 sec.
// WiFi sniffer config
#define WIFI_CHANNEL_MAX 13
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
// Default LoRa Spreadfactor
#define LORASFDEFAULT 9 // 7 ... 12
#define MAXLORARETRY 500 // maximum count of TX retries if LoRa busy
#define RCMDPORT 2 // LoRaWAN Port on which device listenes for remote commands
// LMIC settings
// define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored
// define hardware specifics settings in platformio.ini as build_flag for hardware environment
// Select frequency band here according to national regulations
#define CFG_eu868 1
//#define CFG_us915 1
// This is the SX1272/SX1273 radio, which is also used on the HopeRF
// RFM92 boards.
//#define CFG_sx1272_radio 1
// This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on
// the HopeRF RFM95 boards.
//#define CFG_sx1276_radio 1
// 16 μs per tick
// LMIC requires ticks to be 15.5μs - 100 μs long
#define US_PER_OSTICK_EXPONENT 4
#define US_PER_OSTICK (1 << US_PER_OSTICK_EXPONENT)
#define OSTICKS_PER_SEC (1000000 / US_PER_OSTICK)
// Set this to 1 to enable some basic debug output (using printf) about
// RF settings used during transmission and reception. Set to 2 to
// enable more verbose output. Make sure that printf is actually
// configured (e.g. on AVR it is not by default), otherwise using it can
// cause crashing.
//#define LMIC_DEBUG_LEVEL 1
// Enable this to allow using printf() to print to the given serial port
// (or any other Print object). This can be easy for debugging. The
// current implementation only works on AVR, though.
//#define LMIC_PRINTF_TO Serial
// Any runtime assertion failures are printed to this serial port (or
// any other Print object). If this is unset, any failures just silently
// halt execution.
#define LMIC_FAILURE_TO Serial
// Uncomment this to disable all code related to joining
//#define DISABLE_JOIN
// Uncomment this to disable all code related to ping
#define DISABLE_PING
// Uncomment this to disable all code related to beacon tracking.
// Requires ping to be disabled too
#define DISABLE_BEACONS
// Uncomment these to disable the corresponding MAC commands.
// Class A
//#define DISABLE_MCMD_DCAP_REQ // duty cycle cap
//#define DISABLE_MCMD_DN2P_SET // 2nd DN window param
//#define DISABLE_MCMD_SNCH_REQ // set new channel
// Class B
//#define DISABLE_MCMD_PING_SET // set ping freq, automatically disabled by DISABLE_PING
//#define DISABLE_MCMD_BCNI_ANS // next beacon start, automatical disabled by DISABLE_BEACON
// In LoRaWAN, a gateway applies I/Q inversion on TX, and nodes do the
// same on RX. This ensures that gateways can talk to nodes and vice
// versa, but gateways will not hear other gateways and nodes will not
// hear other nodes. By uncommenting this macro, this inversion is
// disabled and this node can hear other nodes. If two nodes both have
// this macro set, they can talk to each other (but they can no longer
// hear gateways). This should probably only be used when debugging
// and/or when talking to the radio directly (e.g. like in the "raw"
// example).
//#define DISABLE_INVERT_IQ_ON_RX
// This allows choosing between multiple included AES implementations.
// Make sure exactly one of these is uncommented.
//
// This selects the original AES implementation included LMIC. This
// implementation is optimized for speed on 32-bit processors using
// fairly big lookup tables, but it takes up big amounts of flash on the
// AVR architecture.
// #define USE_ORIGINAL_AES
//
// This selects the AES implementation written by Ideetroon for their
// own LoRaWAN library. It also uses lookup tables, but smaller
// byte-oriented ones, making it use a lot less flash space (but it is
// also about twice as slow as the original).
#define USE_IDEETRON_AES
// program version
#define PROGVERSION "1.2.51" // use max 10 chars here!
#define PROGNAME "PAXCNT"
// Verbose enables serial output
#define VERBOSE 1 // comment out to silence the device, for mute use build option
// set this to include BLE counting and vendor filter functions
#define VENDORFILTER 1 // comment out if you want to count things, not people
#define BLECOUNTER 1 // comment out if you don't want BLE count
// BLE scan time
#define BLESCANTIME 30 // [seconds]
// WiFi Sniffer cycle interval
#define SEND_SECS 120 // [seconds/2] -> 240 sec.
// WiFi sniffer config
#define WIFI_CHANNEL_MAX 13
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
// Default LoRa Spreadfactor
#define LORASFDEFAULT 9 // 7 ... 12
#define MAXLORARETRY 500 // maximum count of TX retries if LoRa busy
#define RCMDPORT 2 // LoRaWAN Port on which device listenes for remote commands
// LMIC settings
// define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored
// define hardware specifics settings in platformio.ini as build_flag for hardware environment
// Select frequency band here according to national regulations
#define CFG_eu868 1
//#define CFG_us915 1
// This is the SX1272/SX1273 radio, which is also used on the HopeRF
// RFM92 boards.
//#define CFG_sx1272_radio 1
// This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on
// the HopeRF RFM95 boards.
//#define CFG_sx1276_radio 1
// 16 μs per tick
// LMIC requires ticks to be 15.5μs - 100 μs long
#define US_PER_OSTICK_EXPONENT 4
#define US_PER_OSTICK (1 << US_PER_OSTICK_EXPONENT)
#define OSTICKS_PER_SEC (1000000 / US_PER_OSTICK)
// Set this to 1 to enable some basic debug output (using printf) about
// RF settings used during transmission and reception. Set to 2 to
// enable more verbose output. Make sure that printf is actually
// configured (e.g. on AVR it is not by default), otherwise using it can
// cause crashing.
//#define LMIC_DEBUG_LEVEL 1
// Enable this to allow using printf() to print to the given serial port
// (or any other Print object). This can be easy for debugging. The
// current implementation only works on AVR, though.
//#define LMIC_PRINTF_TO Serial
// Any runtime assertion failures are printed to this serial port (or
// any other Print object). If this is unset, any failures just silently
// halt execution.
#define LMIC_FAILURE_TO Serial
// Uncomment this to disable all code related to joining
//#define DISABLE_JOIN
// Uncomment this to disable all code related to ping
#define DISABLE_PING
// Uncomment this to disable all code related to beacon tracking.
// Requires ping to be disabled too
#define DISABLE_BEACONS
// Uncomment these to disable the corresponding MAC commands.
// Class A
//#define DISABLE_MCMD_DCAP_REQ // duty cycle cap
//#define DISABLE_MCMD_DN2P_SET // 2nd DN window param
//#define DISABLE_MCMD_SNCH_REQ // set new channel
// Class B
//#define DISABLE_MCMD_PING_SET // set ping freq, automatically disabled by DISABLE_PING
//#define DISABLE_MCMD_BCNI_ANS // next beacon start, automatical disabled by DISABLE_BEACON
// In LoRaWAN, a gateway applies I/Q inversion on TX, and nodes do the
// same on RX. This ensures that gateways can talk to nodes and vice
// versa, but gateways will not hear other gateways and nodes will not
// hear other nodes. By uncommenting this macro, this inversion is
// disabled and this node can hear other nodes. If two nodes both have
// this macro set, they can talk to each other (but they can no longer
// hear gateways). This should probably only be used when debugging
// and/or when talking to the radio directly (e.g. like in the "raw"
// example).
//#define DISABLE_INVERT_IQ_ON_RX
// This allows choosing between multiple included AES implementations.
// Make sure exactly one of these is uncommented.
//
// This selects the original AES implementation included LMIC. This
// implementation is optimized for speed on 32-bit processors using
// fairly big lookup tables, but it takes up big amounts of flash on the
// AVR architecture.
// #define USE_ORIGINAL_AES
//
// This selects the AES implementation written by Ideetroon for their
// own LoRaWAN library. It also uses lookup tables, but smaller
// byte-oriented ones, making it use a lot less flash space (but it is
// also about twice as slow as the original).
#define USE_IDEETRON_AES

View File

@ -22,12 +22,9 @@ Refer to LICENSE.txt file in repository for more details.
*/
// Basic Config
#include "main.h"
#include "main.conf"
#include "globals.h"
// std::set for unified array functions
#include <set>
// OLED driver
#include <U8x8lib.h>

View File

@ -3,7 +3,7 @@
// checks commands and executes each command with 1 argument per command
// Basic Config
#include "main.h"
#include "main.conf"
#include "globals.h"
// LMIC-Arduino LoRaWAN Stack

View File

@ -1,5 +1,5 @@
// Basic Config
#include "main.h"
#include "main.conf"
#include "globals.h"
// ESP32 Functions
@ -37,7 +37,7 @@ extern void wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t
void wifi_sniffer_init(void) {
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
cfg.nvs_enable = 0; // we don't want wifi settings from NVRAM
cfg.nvs_enable = 0; // we don't need any wifi settings from NVRAM
wifi_promiscuous_filter_t filter = {.filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // we need only MGMT frames
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_country(&wifi_country));