Files
WaveShare_ESP32_BoomCast_FW/BoomCast_Waveshare_Arduino/boomcast_config.h
T
2026-10-09 15:37:57 +02:00

94 lines
3.8 KiB
C++

#pragma once
#include <Arduino.h>
// -----------------------------------------------------------------------------
// BoomCast firmware configuration
// Target: Waveshare ESP32-S3-ePaper-1.54 V2 (non-touch)
// -----------------------------------------------------------------------------
#define BOOMCAST_FIRMWARE_VERSION "0.1.0-concept"
// Set to 180 when the board is physically mounted upside-down.
// Supported by this sketch: 0 or 180.
constexpr uint16_t DISPLAY_ROTATION_DEG = 180;
// Passerby screen
constexpr bool SHOW_TODAY_COUNT_ON_PUBLIC_SCREEN = true;
constexpr const char* DEVICE_FRIENDLY_NAME = "BoomCast";
// Local management interface
constexpr const char* AP_SSID_PREFIX = "BoomCast-Setup";
constexpr const char* MDNS_HOSTNAME = "boomcast"; // http://boomcast.local/
// Each device generates unique AP and management passwords in NVS at first boot.
constexpr const char* MANAGEMENT_USER = "admin";
// Deployment values live in an ignored local header or in NVS; no secrets here.
#if __has_include("boomcast_config.local.h")
#include "boomcast_config.local.h"
#endif
#ifndef BOOMCAST_SERVER_BASE_URL
#define BOOMCAST_SERVER_BASE_URL "https://YOUR-BOOMCAST-SERVER"
#endif
#ifndef BOOMCAST_SENSOR_ID
#define BOOMCAST_SENSOR_ID 0
#endif
#ifndef BOOMCAST_SENSOR_TOKEN
#define BOOMCAST_SENSOR_TOKEN ""
#endif
#ifndef BOOMCAST_CA_CERT
#define BOOMCAST_CA_CERT ""
#endif
constexpr const char* SERVER_BASE_URL = BOOMCAST_SERVER_BASE_URL;
constexpr const char* SUBMIT_PATH = "/api/pending/";
constexpr uint32_t SENSOR_ID = BOOMCAST_SENSOR_ID;
constexpr const char* SENSOR_TOKEN = BOOMCAST_SENSOR_TOKEN;
constexpr const char* SERVER_CA_CERT = BOOMCAST_CA_CERT;
// Audio pipeline: matches the earlier Atom Echo / YAMNet 16 kHz mono design.
constexpr uint32_t AUDIO_SAMPLE_RATE = 16000;
constexpr uint8_t AUDIO_CODEC_CHANNELS = 2; // ES8311 example is opened stereo
constexpr uint8_t AUDIO_BITS_PER_SAMPLE = 16;
// Fixed codec slot. Verify this assignment with a real V2 recording before field use.
constexpr uint8_t AUDIO_MIC_SLOT = 0;
constexpr uint32_t AUDIO_RAW_BLOCK_BYTES = 1024;
constexpr uint32_t AUDIO_FRAMES_PER_BLOCK = AUDIO_RAW_BLOCK_BYTES / 4; // 16-bit stereo
constexpr uint32_t PRE_EVENT_MS = 2500;
constexpr uint32_t POST_EVENT_MS = 2500;
constexpr uint32_t CAPTURE_MS = PRE_EVENT_MS + POST_EVENT_MS;
constexpr size_t PRE_EVENT_SAMPLES = (AUDIO_SAMPLE_RATE * PRE_EVENT_MS) / 1000;
constexpr size_t CAPTURE_SAMPLES = (AUDIO_SAMPLE_RATE * CAPTURE_MS) / 1000;
// Starting point inherited from the Atom Echo concept. The web slider modifies
// software thresholds around these values rather than changing codec gain.
constexpr uint8_t DEFAULT_SENSITIVITY = 55; // 1..100
constexpr uint32_t TRIGGER_COOLDOWN_MS = 1500;
constexpr uint32_t AUDIO_WARMUP_MS = 3000;
constexpr float NOISE_EMA_ALPHA = 0.008f;
// Display behaviour. Dynamic text uses the panel's partial-refresh waveform.
// A periodic full refresh reduces accumulated ghosting.
constexpr uint16_t FULL_REFRESH_AFTER_PARTIALS = 40;
constexpr bool FULL_REFRESH_ON_PAGE_SWITCH = false;
constexpr uint32_t DISPLAY_STATUS_UPDATE_MS = 1500;
// Queue / SD
constexpr const char* SD_MOUNT_POINT = "/sdcard";
constexpr const char* QUEUE_DIR = "/sdcard/queue";
constexpr size_t MAX_QUEUE_ITEMS_SHOWN = 40;
constexpr size_t MAX_QUEUE_EVENTS = 1000;
constexpr uint64_t MIN_SD_FREE_BYTES = 4ULL * 1024 * 1024;
// Network timing
constexpr uint32_t WIFI_CONNECT_TIMEOUT_MS = 12000;
constexpr uint32_t WIFI_RETRY_INTERVAL_MS = 30000;
// Dutch / EU local time, including DST.
constexpr const char* TZ_INFO = "CET-1CEST,M3.5.0,M10.5.0/3";
constexpr const char* NTP_SERVER_1 = "pool.ntp.org";
constexpr const char* NTP_SERVER_2 = "time.cloudflare.com";
static_assert(DISPLAY_ROTATION_DEG == 0 || DISPLAY_ROTATION_DEG == 180,
"DISPLAY_ROTATION_DEG must be 0 or 180");