mirror of
https://github.com/Luzifer/lorabattery.git
synced 2024-12-20 18:01:16 +00:00
Add configuration
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
ed4ec49836
commit
ea5518fd50
4 changed files with 31 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
|
.env
|
||||||
.pio
|
.pio
|
||||||
|
|
|
@ -13,6 +13,11 @@ platform = espressif32
|
||||||
board = heltec_wifi_lora_32_V2
|
board = heltec_wifi_lora_32_V2
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-D DEVEUI=\"${sysenv.DEVEUI}\"
|
||||||
|
-D APPEUI=\"${sysenv.APPEUI}\"
|
||||||
|
-D APPKEY=\"${sysenv.APPKEY}\"
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
Heltec ESP32 Dev-Boards@1.0.9
|
Heltec ESP32 Dev-Boards@1.0.9
|
||||||
TTN_esp32@0.1.0
|
TTN_esp32@0.1.0
|
||||||
|
|
24
src/config.hh
Normal file
24
src/config.hh
Normal 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
|
|
@ -3,7 +3,7 @@
|
||||||
#include <TTN_esp32.h>
|
#include <TTN_esp32.h>
|
||||||
#include "heltec.h"
|
#include "heltec.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.hh"
|
||||||
#include "main.hh"
|
#include "main.hh"
|
||||||
#include "math.hh"
|
#include "math.hh"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue