49 lines
1.8 KiB
C
49 lines
1.8 KiB
C
#pragma once
|
|
|
|
// ---------- Wi-Fi ----------
|
|
#define WIFI_SSID "your_ssid"
|
|
#define WIFI_PASSWORD "your_password"
|
|
#define WIFI_CONNECT_TIMEOUT_MS 15000
|
|
|
|
// If the station connection fails, the ESP32 starts its own access point
|
|
#define AP_SSID "VolumeControl"
|
|
#define AP_PASSWORD "12345678" // min 8 chars
|
|
|
|
#define MDNS_HOSTNAME "volume" // http://volume.local
|
|
|
|
// ---------- Pins (chosen to not clash with the TFT pins in platformio.ini) ----------
|
|
#define PIN_ENC_CLK 32
|
|
#define PIN_ENC_DT 33
|
|
#define PIN_ENC_SW 25
|
|
#define PIN_SERVO 13
|
|
#define PIN_RELAY 26
|
|
|
|
// ---------- Encoder ----------
|
|
#define ENCODER_REVERSE 0 // set to 1 if rotation direction is inverted
|
|
#define ENCODER_STEPS_PER_DETENT 4
|
|
#define VOLUME_STEP 2 // % per encoder detent
|
|
#define BUTTON_DEBOUNCE_MS 30
|
|
|
|
// ---------- Servo ----------
|
|
// Pulse widths for volume 0% and 100%. Tune to the real travel of the pot.
|
|
#define SERVO_MIN_US 500
|
|
#define SERVO_MAX_US 2400
|
|
#define SERVO_SPEED_US_PER_STEP 20 // smoothing: max pulse change per update
|
|
#define SERVO_UPDATE_MS 10
|
|
#define SERVO_DETACH_IDLE_MS 1000 // release servo when idle to avoid hum/jitter
|
|
|
|
// ---------- Relay ----------
|
|
#define RELAY_ACTIVE_LEVEL HIGH // many relay modules are active LOW
|
|
|
|
// ---------- Display ----------
|
|
#define DISPLAY_UPDATE_MS 20 // also the touch polling period
|
|
|
|
// ---------- Touch ----------
|
|
#define TOUCH_VOLUME_STEP 1 // % per tap on -/+
|
|
#define TOUCH_REPEAT_DELAY_MS 400 // hold -/+ this long to start auto-repeat
|
|
#define TOUCH_REPEAT_MS 80
|
|
#define TOUCH_RECAL_PRESSURE 400 // touch at power-up stronger than this -> recalibrate
|
|
|
|
// ---------- Persistence ----------
|
|
#define SAVE_DELAY_MS 2000 // write to NVS after values stop changing
|