1
0
mirror of https://github.com/Luzifer/lorabattery.git synced 2024-09-19 00:02:55 +00:00

Add configuration

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-05-31 01:55:44 +02:00
parent ed4ec49836
commit ea5518fd50
Signed by: luzifer
GPG Key ID: DC2729FDD34BE99E
4 changed files with 31 additions and 1 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.env
.pio

View File

@ -13,6 +13,11 @@ platform = espressif32
board = heltec_wifi_lora_32_V2
framework = arduino
build_flags =
-D DEVEUI=\"${sysenv.DEVEUI}\"
-D APPEUI=\"${sysenv.APPEUI}\"
-D APPKEY=\"${sysenv.APPKEY}\"
lib_deps =
Heltec ESP32 Dev-Boards@1.0.9
TTN_esp32@0.1.0

24
src/config.hh Normal file
View File

@ -0,0 +1,24 @@
// Logic: Below charging voltage deep-sleep is used, above delay as
// battery is provided power
#define BATTERY_LOAD_VOLTAGE 13.5 // 14V SHOULD be supplied during charge
#define BATTERY_SLEEP_US 240 * 1000000 // 240s of deep sleep = 360 wake-ups / day
#define CHARGE_SLEEP_MS 30 * 1000 // 30s delay between measurements during charging
// Debug: Allow to enable / disable LoRa sending / deep sleep
#define DISABLE_SLEEP false
#define ENABLE_SEND true
// PIN to which the voltage sensor is connected
#define PIN_VOLTAGE_READ 32
// Adjustments for the measurement to work around unstable measurements
#define CORRECT_DIFF 0.90 // Measurement isn't fully accurate, lets adjust
#define MEAS_COUNT 16 // How many readings to make for each measurement
// LoRaWAN configuration
#define BAND 868E6 // 868MHz = Europe transfer channel
// Defined through environment variable during build, see platformio.ini
const char* devEui = DEVEUI; // TTN Device EUI
const char* appEui = APPEUI; // TTN Application EUI
const char* appKey = APPKEY; // TTN Application Key

View File

@ -3,7 +3,7 @@
#include <TTN_esp32.h>
#include "heltec.h"
#include "config.h"
#include "config.hh"
#include "main.hh"
#include "math.hh"