first refactor in to multiple files
This commit is contained in:
94
analog_system_monitor_arduino/Config.h
Normal file
94
analog_system_monitor_arduino/Config.h
Normal file
@@ -0,0 +1,94 @@
|
||||
#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
|
||||
// 23 (D8) remains as a spare
|
||||
};
|
||||
|
||||
static const uint32_t pwmFrequency = 25000; // 25 kHz
|
||||
static const uint8_t pwmResolution = 10; // 10-bit resolution (0–1023)
|
||||
|
||||
// -------------------------------
|
||||
// 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.999f; // 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
|
||||
|
||||
// -------------------------------
|
||||
// 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
|
||||
};
|
||||
Reference in New Issue
Block a user