-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.h.example
More file actions
75 lines (58 loc) · 2.4 KB
/
config.h.example
File metadata and controls
75 lines (58 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
// ===== Wi-Fi =====
#define WIFI_SSID "YOUR_WIFI_NAME"
#define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"
// WiFi
#define WIFI_CONNECT_TIMEOUT_MS 15 * 1000 // 15 seconds
#define WIFI_RECHECK_INTERVAL_MS 5 * 60 * 1000 // Check WiFi connection every 5 minutes
#define WIFI_LOST_REBOOT_DELAY_MS 5 * 60 * 1000 // Reboot if WiFi is lost for more than 5 minutes
// Enable this to use a static IP
#define USE_STATIC_IP
#ifdef USE_STATIC_IP
#include <IPAddress.h>
// Set a static IP address
#define LOCAL_IP IPAddress(192, 168, 1, 63)
#define GATEWAY IPAddress(192, 168, 1, 1)
#define SUBNET IPAddress(255, 255, 255, 0)
#define DNS1 IPAddress(8, 8, 8, 8)
#define DNS2 IPAddress(8, 8, 4, 4)
#endif
// ===== HTTP =====
#define HTTP_PORT 80
// ===== Device =====
#define DEVICE_NAME "SoundNode"
// -----------------------------
// Battery / ADC configuration
// -----------------------------
#define BTR_ADC_PIN 3 // ADC pin for battery measurement
#define BATT_MAX_VOLTAGE 8.4f // Full charge voltage for 2S Li-ion (4.2V * 2)
#define BATT_MIN_VOLTAGE 5.6f // Minimum safe voltage for 2S Li-ion (~2.8V * 2)
#define BATT_CRITICAL_VOLTAGE 5.8f // go to deep sleep if below
// Voltage divider (Ohms)
#define BATT_DIV_R1 271660.0f // R1 from positive terminal to ADC
#define BATT_DIV_R2 94000.0f // R2 from ADC to GND
// ADC correction coefficients
#define BATT_CAL_FACTOR 1.165f // Coefficient to calibrate voltage readings (adjust based on measurements)
#define BATT_CORR_HIGH_TH 7.8f // Volts, 2S Li-ion
#define BATT_CORR_MID_TH 6.8f // Volts, 2S Li-ion
#define BATT_CORR_HIGH_K 1.02f
#define BATT_CORR_MID_K 1.03f
#define BATT_CORR_LOW_K 1.04f
#define BATTERY_CHECK_INTERVAL_MS 60*60*1000 // Check battery every hour (3600000 ms)
// ----------------------------
// Sleep config
// ----------------------------
#define NIGHT_CHECK_INTERVAL_MS 30*60*1000 // Check sleep condition every 30 minutes (1800000 ms)
#define BATTERY_WAKEUP_INTERVAL 600 // seconds
// ===== Time =====
#define SUNRISE_HOUR 04
#define SUNRISE_MINUTE 20
#define SUNSET_HOUR 18
#define SUNSET_MINUTE 00
#define TIMEZONE "CET-1CEST,M3.5.0/2,M10.5.0/3"
// ===== Audio =====
#define I2S_BCK 5
#define I2S_WS 4
#define I2S_DOUT 2
#define AMP_SD_PIN 0 // DC-DC (or MAX98357A) shutdown pin (HIGH=on, LOW=off)
#define AMP_SD_ON_STATE 1 // 1 - open when HIGH, 0 - open when LOW