// Compile-time configuration for the Butterfly EDFA Rack bridge. #pragma once #include "secrets.h" // ── MQTT topics ───────────────────────────────────────────────────── // One HA device, one topic base. Sub-units namespaced under it: // /availability online | offline (LWT) // /diag/ ESP/network diagnostics // /seed/ Koheron CTL200 (increment 3) // /amp/ Agiltron M511 EYDFA (increment 4) // /set/<...> command topics (increment 5) #define TOPIC_BASE "lab/laser/" DEVICE_NAME #define TOPIC_AVAIL TOPIC_BASE "/availability" #define DISCOVERY_PREFIX "homeassistant" #define AVAIL_ONLINE "online" #define AVAIL_OFFLINE "offline" #define TOPIC_CMD TOPIC_BASE "/set" // subscribe /set/# // ── Agiltron M511 identity & safety limits ────────────────────────── // SN Y4022708 / PN EDFA-1C51113331111 -> device ID 0x0000006F (edfa.py). // Startup reads SN/PN and logs them so the ID is confirmed before control. #define AGILTRON_DEV_ID 0x00, 0x00, 0x00, 0x6F // HA number sliders are capped here. The hardware allows 8000 mA pump, but // the lab notes report ~2500 mA pump-1 -> ~27 dBm (~515 mW). Keep a margin. #define SEED_CURRENT_MAX_MA 300 // CTL200 ilmax default is 1000; seed DFB is low-power #define PUMP_CURRENT_MAX_MA 3000 // firmware clamps amp pump-1 to this // ── Serial links to the instruments (wired in later increments) ───── // UART0 stays the USB console. The classic ESP32 has 3 hardware UARTs. // // Koheron CTL200 (ASCII, 115200 8N1, "\r\n", ">>" prompt) -> UART2 // ESP32 GPIO17 (TX2) -> CTL200 RX, GPIO16 (RX2) <- CTL200 TX, GND // // Agiltron M511 (binary 0x55AA packets, 115200 8N1) -> UART1 // ESP32 GPIO26 (TX1) -> M511 RX(pin3), GPIO25 (RX1) <- M511 TX(pin7), GND // (UART1 default pins clash with SPI flash on WROOM, so remap to 26/25.) #define KOHERON_UART_NUM 2 #define KOHERON_TX_PIN 17 #define KOHERON_RX_PIN 16 #define KOHERON_BAUD 115200 #define AGILTRON_UART_NUM 1 #define AGILTRON_TX_PIN 26 #define AGILTRON_RX_PIN 25 #define AGILTRON_BAUD 115200 // ── Static IP ─────────────────────────────────────────────────────── // Pinned to .150 (free as of 2026-06-17) to avoid the DHCP clash with the // BKtel EDFA Pi on .101. Comment out USE_STATIC_IP to fall back to DHCP. #define USE_STATIC_IP #define STATIC_IP_OCTETS 192, 168, 0, 150 #define GATEWAY_OCTETS 192, 168, 0, 1 #define SUBNET_OCTETS 255, 255, 255, 0 #define DNS_OCTETS 192, 168, 0, 1 // ── Timing ────────────────────────────────────────────────────────── #define PUBLISH_INTERVAL_MS 2000 // telemetry cadence #define MQTT_RECONNECT_MS 5000 // PubSubClient's default 256-byte buffer is too small for discovery // payloads that embed the device block; bump it. #define MQTT_BUFFER_SIZE 1024