Files
Analog_System_Monitor/analog_system_monitor_arduino/Config.h

106 lines
2.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <Arduino.h>
// -------------------------------
// Firmware version
// -------------------------------
static const char* FIRMWARE_VERSION = "V2.4_UDP_LEDC_WM_SLEW";
// -------------------------------
// UDP
// -------------------------------
static const int listenPort = 12345; // default / legacy constant
static const unsigned long watchdogTimeout = 5000; // 5 seconds
// -------------------------------
// PWM setup (LEDC, ESP32 Core 3.x)
// -------------------------------
static const uint8_t NUM_CHANNELS = 8;
static const uint8_t pwmPins[NUM_CHANNELS] = {
26, // D0
22, // D1
21, // D2
17, // D3
16, // D4
5, // D5
18, // D6
19 // D7
};
static const uint32_t pwmFrequency = 25000; // 25 kHz
static const uint8_t pwmResolution = 10; // 10-bit resolution (01023)
// -------------------------------
// Channel labels for debugging
// -------------------------------
static const char* const channelLabels[NUM_CHANNELS] = {
"CPU Load",
"CPU Temp",
"RAM Usage",
"GPU Load",
"GPU Temp",
"VRAM Usage",
"Reserved 6",
"Reserved 7"
};
static const char* const channelUnits[NUM_CHANNELS] = {
"%", // CPU Load
"°C", // CPU Temp
"%", // RAM Usage
"%", // GPU Load
"°C", // GPU Temp
"%", // VRAM Usage
"", // Reserved
"" // Reserved
};
// -------------------------------
// Channel labels ESPUI
// -------------------------------
static const char* const channelDropdownLabels[NUM_CHANNELS] = {
"CH0 (CPU Load)",
"CH1 (CPU Temp)",
"CH2 (RAM Usage)",
"CH3 (GPU Load)",
"CH4 (GPU Temp)",
"CH5 (VRAM Usage)",
"CH6 (Reserved 6)",
"CH7 (Reserved 7)"
};
// -------------------------------
// Calibration logical points
// -------------------------------
static const unsigned long slewDuration = 1000; // 1 second smooth transition
// -------------------------------
// Animation tuning
// -------------------------------
static const float FADE_IN_FACTOR = 0.998f; // boot-up 0 → 100%
static const float FADE_OUT_FACTOR = 0.999f; // watchdog 100% → 0
static const unsigned long FADE_INTERVAL = 1; // ms between fade steps
// Lighting fade durations (milliseconds)
#define LIGHTING_FADE_IN_DURATION 1250
#define LIGHTING_FADE_OUT_DURATION 4250
// Clamping brightness at the low end
const uint8_t BRIGHTNESS_MIN_VISIBLE = 33;
// -------------------------------
// Lighting (FastLED)
// -------------------------------
#define LED_PIN 23
#define NUM_LEDS 20
// -------------------------------
// Connection state machine
// -------------------------------
enum ConnectionState {
STATE_DISCONNECTED, // fade to zero
STATE_CONNECTING, // fade in 0 → 100%
STATE_WAIT_FOR_FIRST_PACKET, // hold at 100%, wait for first UDP
STATE_CONNECTED // normal UDP-driven slew
};