#pragma once #include // --- Firmware Version --- #define FW_VERSION "2026-02-02" #define FW_HOSTNAME "attenuator" // --- WiFi Credentials --- // Override via build_flags or edit directly #ifndef WIFI_SSID #define WIFI_SSID "your-ssid" #endif #ifndef WIFI_PASS #define WIFI_PASS "your-password" #endif #define WIFI_TIMEOUT_MS 15000 // --- HMC472A Control Pins (active-low) --- // GPIOs 1-6: contiguous block in lower 32-bit register // Enables glitch-free simultaneous writes via GPIO.out_w1ts/w1tc static constexpr uint8_t PIN_V1 = 1; // 16 dB (MSB) static constexpr uint8_t PIN_V2 = 2; // 8 dB static constexpr uint8_t PIN_V3 = 3; // 4 dB static constexpr uint8_t PIN_V4 = 4; // 2 dB static constexpr uint8_t PIN_V5 = 5; // 1 dB static constexpr uint8_t PIN_V6 = 6; // 0.5 dB (LSB) static constexpr uint8_t ATTEN_PINS[6] = {PIN_V1, PIN_V2, PIN_V3, PIN_V4, PIN_V5, PIN_V6}; static constexpr float ATTEN_DB[6] = {16.0f, 8.0f, 4.0f, 2.0f, 1.0f, 0.5f}; // Bitmask covering all 6 control pins in the GPIO register static constexpr uint32_t ATTEN_PIN_MASK = (1 << PIN_V1) | (1 << PIN_V2) | (1 << PIN_V3) | (1 << PIN_V4) | (1 << PIN_V5) | (1 << PIN_V6); // --- Status LED --- static constexpr uint8_t PIN_LED = 15; // Built-in LED, active HIGH // --- Attenuator Limits --- static constexpr float DB_MIN = 0.0f; static constexpr float DB_MAX = 31.5f; static constexpr float DB_STEP = 0.5f; static constexpr uint8_t STEP_MIN = 0; static constexpr uint8_t STEP_MAX = 63; // --- Sweep Defaults --- static constexpr uint32_t SWEEP_DWELL_MS_DEFAULT = 500; static constexpr uint32_t SWEEP_DWELL_MS_MIN = 10; static constexpr uint32_t SWEEP_DWELL_MS_MAX = 10000; // --- NVS --- #define NVS_NAMESPACE "atten" #define NVS_KEY_STEP "step" // --- Watchdog --- #define WDT_TIMEOUT_S 120 // --- Web Server --- #define WEB_PORT 80