100 lines
4.2 KiB
C++
100 lines
4.2 KiB
C++
#pragma once
|
|
#include <Arduino.h>
|
|
#include "boomcast_audio_calibration.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// BoomCast firmware configuration
|
|
// Target: Waveshare ESP32-S3-ePaper-1.54 V2 (non-touch)
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define BOOMCAST_FIRMWARE_VERSION "0.3.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
|
|
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;
|
|
|
|
// 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
|
|
|
|
// Browser worklet reference: 10 s rolling clip, 2 s tail, 30 level windows/s.
|
|
constexpr uint32_t DETECTION_WINDOWS_PER_SECOND = 30;
|
|
constexpr float DETECTION_INITIAL_BASELINE = 0.01f;
|
|
constexpr float DETECTION_BASELINE_ALPHA = 0.02f;
|
|
constexpr float DETECTION_BASELINE_CLAMP = 2.0f;
|
|
constexpr float DETECTION_RMS_FLOOR = 0.075f;
|
|
constexpr float DETECTION_RMS_MULTIPLIER = 5.0f;
|
|
constexpr float DETECTION_PEAK_FLOOR = 0.16f;
|
|
constexpr uint32_t DETECTION_WARMUP_SAMPLES = AUDIO_SAMPLE_RATE;
|
|
constexpr uint32_t DETECTION_COOLDOWN_SAMPLES = AUDIO_SAMPLE_RATE * 3;
|
|
constexpr uint32_t PRE_EVENT_MS = 8000;
|
|
constexpr uint32_t POST_EVENT_MS = 2000;
|
|
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;
|
|
|
|
// Hardware calibration, separate from the browser algorithm. The default
|
|
// assumes codec PCM maps linearly to browser Float32 [-1,1]. Calibrate on V2.
|
|
constexpr float AUDIO_MIC_NORMALISED_GAIN = BOOMCAST_DETECTION_INPUT_GAIN;
|
|
constexpr float AUDIO_SENSITIVITY_REFERENCE = 55.0f;
|
|
constexpr uint8_t DEFAULT_SENSITIVITY = 55; // 1..100
|
|
|
|
// 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");
|