Add security and reliability and add stubs for non essential controls

This commit is contained in:
2026-04-19 08:39:43 -07:00
parent ec8495cc54
commit 7f019cec4e
3 changed files with 258 additions and 2 deletions

View File

@@ -179,3 +179,138 @@
* GRATICULE_LABEL_COLOR_G Green component
* GRATICULE_LABEL_COLOR_B Blue component
*/
/*
* ================================================================
* INPUT RATE LIMITING
* ================================================================
* Minimum milliseconds between accepted inputs for any single
* control. Inputs arriving faster than this are silently discarded.
* Protects against key-mashing and encoder bounce.
*
* MIN_INPUT_INTERVAL_MS General controls (bearing, range, cursor)
* MIN_INPUT_INTERVAL_GONIO_MS Goniometer — kept slower for precise null hunting
*/
/*
* ================================================================
* GENERAL OPERATOR CONTROLS — Default, Minimum, and Maximum Values
* ================================================================
* These controls will eventually be driven by physical encoders
* wired through KnobPanel (Thread 3). Until hardware is installed,
* KnobPanel idles without ever acquiring Mutex A, and
* SharedRenderState holds these defaults unchanged. Thread 1 reads
* and applies them every frame regardless of source.
*
* Clamping is applied at the point of write using std::clamp().
* All values normalized 0.01.0 unless noted otherwise.
*
* DEFAULT_INTENSITY CRT beam intensity
* MIN_INTENSITY / MAX_INTENSITY
*
* DEFAULT_FOCUS CRT focus sharpness
* MIN_FOCUS / MAX_FOCUS
*
* DEFAULT_ASTIGMATISM CRT astigmatism correction offset
* MIN_ASTIGMATISM / MAX_ASTIGMATISM
*
* DEFAULT_GAIN Receiver gain — scales target return amplitude
* MIN_GAIN / MAX_GAIN
*
* DEFAULT_RAIN_CLUTTER Rain clutter suppression (0 = full clutter shown)
* MIN_RAIN_CLUTTER / MAX_RAIN_CLUTTER
*
* DEFAULT_WAVE_CLUTTER Sea/wave clutter suppression level
* MIN_WAVE_CLUTTER / MAX_WAVE_CLUTTER
*
* DEFAULT_GRATICULE_INTENSITY Incandescent backlight brightness of graticule glass
* MIN_GRATICULE_INTENSITY / MAX_GRATICULE_INTENSITY
*/
/*
* ================================================================
* SCOPE DEFAULT STATE — Initial control values at startup
* ================================================================
* Each scope initializes its runtime state from these constants.
* Change a value here and recompile to adjust the startup condition
* without touching scope implementation code.
*
* MIN_*/MAX_* companions are the hard clamp limits applied at every
* write keyboard, KnobPanel, or any other source.
*
* --- Marine A-Scope ---
* MARINE_A_DEFAULT_BEARING_DEG Initial antenna bearing, degrees True
* MARINE_A_MIN_BEARING_DEG (0.0)
* MARINE_A_MAX_BEARING_DEG (359.9)
* MARINE_A_DEFAULT_MAX_RANGE_MI Initial max range index (0=2mi, 1=4mi, 2=6mi)
*
* --- Chain Home A-Scope ---
* CHAIN_HOME_DEFAULT_GONIO_AZ_DEG Initial goniometer azimuth, degrees
* CHAIN_HOME_MIN_GONIO_AZ_DEG (0.0)
* CHAIN_HOME_MAX_GONIO_AZ_DEG (359.9)
* CHAIN_HOME_DEFAULT_GONIO_EL_DEG Initial goniometer elevation, degrees
* CHAIN_HOME_MIN_GONIO_EL_DEG (0.0)
* CHAIN_HOME_MAX_GONIO_EL_DEG (90.0)
* CHAIN_HOME_DEFAULT_PRF_HIGH true = 25 Hz, false = 12.5 Hz
* CHAIN_HOME_DEFAULT_CALIBRATOR Initial trace scale factor (1.0 = nominal)
* CHAIN_HOME_MIN_CALIBRATOR Minimum scale (prevents trace from collapsing)
* CHAIN_HOME_MAX_CALIBRATOR Maximum scale (prevents trace from stretching off screen)
*
* --- Marine PPI Scope ---
* MARINE_PPI_DEFAULT_MAX_RANGE_MI Initial max range index (0=2mi, 1=4mi, 2=6mi)
* MARINE_PPI_DEFAULT_CURSOR_BRG Initial cursor bearing, degrees True
* MARINE_PPI_DEFAULT_CURSOR_RNG Initial cursor range in miles
* MARINE_PPI_DEFAULT_BEARING_OFFSET Initial antenna bearing offset (0 = True North)
* MARINE_PPI_MIN_BEARING_OFFSET (-180.0)
* MARINE_PPI_MAX_BEARING_OFFSET (180.0)
*
* --- ATC PPI Scope ---
* ATC_PPI_DEFAULT_MAX_RANGE_MI Initial max range index (0=5mi, 1=10mi, 2=15mi, 3=20mi)
* ATC_PPI_DEFAULT_CURSOR_BRG Initial cursor bearing, degrees True
* ATC_PPI_DEFAULT_CURSOR_RNG Initial cursor range in miles
* ATC_PPI_DEFAULT_BEARING_OFFSET Initial antenna bearing offset (0 = True North)
* ATC_PPI_MIN_BEARING_OFFSET (-180.0)
* ATC_PPI_MAX_BEARING_OFFSET (180.0)
*/
/*
* ================================================================
* INCOMING DATA VALIDATION LIMITS
* ================================================================
* Applied in RPiReceiver::parseFrame() and Simulator::poll().
* Any target whose fields fall outside these bounds is discarded
* (returns std::nullopt). The exhibit continues; no crash, no assert.
*
* TARGET_MAX_BEARING_DEG Upper bound for target bearing (360.0)
* TARGET_MIN_BEARING_DEG Lower bound for target bearing (0.0)
* TARGET_MAX_RANGE_MI Hard ceiling; per-scope max is enforced separately
* TARGET_MIN_RANGE_MI Must be non-negative (0.0)
* TARGET_MAX_AMPLITUDE Maximum normalized signal amplitude (1.0)
* TARGET_MIN_AMPLITUDE Minimum (0.0)
* TARGET_MAX_ALTITUDE_FT Sanity ceiling for ATC/PAR targets (60000.0)
* TARGET_MIN_ALTITUDE_FT (0.0)
* TARGET_MAX_STALE_SEC Discard targets older than this many seconds
*
* MAX_SIMULTANEOUS_TARGETS Hard array size cap; frames claiming more
* targets than this are truncated, not rejected
* MAX_RPI_FRAME_BYTES Maximum accepted frame size from any RPi;
* larger frames are discarded as malformed
*/
/*
* ================================================================
* PAR GEOMETRY
* ================================================================
* Constants for the Precision Approach Radar non-linear display
* scale and runway geometry at BLI Runway 16/34.
*
* PAR_NONLINEAR_BREAKPOINT_MI Range at which non-linear scale transitions (5.0)
* Inner 05 miles occupies PAR_NONLINEAR_INNER_FRAC
* of horizontal width; outer 510 miles fills the rest
* PAR_NONLINEAR_INNER_FRAC Fraction of display width used by inner 5 miles (0.70)
*
* PAR_RUNWAY_HEADING_DEG True heading of active runway 34 approach (340.0)
* PAR_GLIDE_PATH_ANGLE_DEG Standard glide path angle in degrees (3.0)
* PAR_AZIMUTH_SCAN_WIDTH_DEG Total lateral scan width, degrees either side (10.0)
* PAR_ELEVATION_SCAN_MAX_DEG Upper elevation limit of elevation scan (7.0)
*/