Files
modular-radar/include/settings.h

222 lines
8.4 KiB
C

/*
* MIT License
*
* Copyright (c) 2026 Mark Allyn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* settings.h
* Author: Mark Allyn
*
* System-wide configuration and debug toggles.
* Include this file in ALL components.
* Change a value and recompile — no AI rewrite needed.
*
* Each section is labeled with the component name it governs.
*/
#pragma once
/* ============================================================
* GENERAL / OPENGL DEBUG
* Component: Thread 1 (initialization)
* ============================================================ */
// 1 = enable GL_DEBUG_OUTPUT and glDebugMessageCallback at startup
#define ENABLE_GL_DEBUG_OUTPUT 1
/* ============================================================
* THREAD 1 - OpenGL / Shader Init / Keyboard / Main Loop
* ============================================================ */
// 1 = print shader compile and link status to stdout
#define DEBUG_SHADER_COMPILE 1
/* ============================================================
* THREAD 2 - Traffic Cop
* ============================================================ */
// 1 = print each target record received from simulator or Raspberry Pi
#define DEBUG_TRAFFIC_COP_INPUT 0
// 1 = print each target record handed off to Thread 1
#define DEBUG_TRAFFIC_COP_OUTPUT 0
/* ============================================================
* THREAD 3 - Simulator
* ============================================================ */
// 1 = print simulated target positions each update cycle
#define DEBUG_SIMULATOR_OUTPUT 0
/* ============================================================
* SCOPE RENDERING - ISOLATION TOGGLES
* Use these to isolate subsystems during development.
* ============================================================ */
// 1 = disable P7 phosphor persistence layer (see raw target hits only)
#define DISABLE_P7_PERSISTENCE 0
// 1 = disable land and terrain rendering (see targets without background)
#define DISABLE_LAND_TERRAIN 0
// 1 = disable target rendering (see terrain/land background alone)
#define DISABLE_TARGETS 0
/* ============================================================
* CHAIN HOME A-SCOPE
* Component: Chain Home scope (1940s, World War 2)
* ============================================================ */
// Fixed maximum range in km; the max_range control has no effect for this scope
#define CHAIN_HOME_MAX_RANGE_KM 200.0f
/* ============================================================
* MARINE A-SCOPE
* Component: 1940s marine A-scope (pre-PPI)
* ============================================================ */
// Selectable maximum range steps in nautical miles (o/p keys cycle through these)
#define MARINE_A_SCOPE_NUM_RANGES 4
#define MARINE_A_SCOPE_RANGE_STEP_1 3.0f
#define MARINE_A_SCOPE_RANGE_STEP_2 6.0f
#define MARINE_A_SCOPE_RANGE_STEP_3 12.0f
#define MARINE_A_SCOPE_RANGE_STEP_4 24.0f
/* ============================================================
* PPI SCOPE - MARINE TRAFFIC CONTROL
* Component: PPI scope, marine traffic control station
* ============================================================ */
// Selectable maximum range steps in nautical miles
#define PPI_MTC_NUM_RANGES 5
#define PPI_MTC_RANGE_STEP_1 3.0f
#define PPI_MTC_RANGE_STEP_2 6.0f
#define PPI_MTC_RANGE_STEP_3 12.0f
#define PPI_MTC_RANGE_STEP_4 24.0f
#define PPI_MTC_RANGE_STEP_5 48.0f
/* ============================================================
* PPI SCOPE - ON-BOARD BOAT
* Component: PPI scope, on-board boat view
* ============================================================ */
// Selectable maximum range steps in nautical miles
#define PPI_BOAT_NUM_RANGES 5
#define PPI_BOAT_RANGE_STEP_1 1.5f
#define PPI_BOAT_RANGE_STEP_2 3.0f
#define PPI_BOAT_RANGE_STEP_3 6.0f
#define PPI_BOAT_RANGE_STEP_4 12.0f
#define PPI_BOAT_RANGE_STEP_5 24.0f
/* ============================================================
* WINDOW AND PANEL LAYOUT
* Component: Thread 1 (main.cpp), 01_classes, 02_text_description
* ============================================================ */
#define WINDOW_WIDTH 1920
#define WINDOW_HEIGHT 1080
#define WINDOW_TITLE "RAF / Marine Radar Exhibit"
/* Left side is split vertically: text panel on top, status bar on bottom.
* Right side is the scope viewport — it takes the full window height. */
#define LEFT_PANEL_WIDTH 500
#define STATUS_BAR_HEIGHT 250
// Derived dimensions
#define SCOPE_WIDTH (WINDOW_WIDTH - LEFT_PANEL_WIDTH)
#define SCOPE_HEIGHT WINDOW_HEIGHT // scope takes full right-side height
#define LEFT_TEXT_HEIGHT (WINDOW_HEIGHT - STATUS_BAR_HEIGHT) // text portion of left panel
// Pixel margin on every side of the scope area (keeps edges visible on the monitor)
#define SCOPE_MARGIN 10
// Available scope area after removing the margin
#define SCOPE_VW (SCOPE_WIDTH - 2 * SCOPE_MARGIN)
#define SCOPE_VH (SCOPE_HEIGHT - 2 * SCOPE_MARGIN)
// Square scope: side length is the smaller of SCOPE_VW and SCOPE_VH (height wins here)
#define SCOPE_SQUARE SCOPE_VH
// Horizontal offset to centre the square inside the SCOPE_VW-wide available area
#define SCOPE_SQUARE_XOFF ((SCOPE_VW - SCOPE_SQUARE) / 2)
// 1 = draw a white debug border box around each screen panel (temporary layout aid)
#define DEBUG_DRAW_WINDOW_BORDERS 1
/* ============================================================
* TEXT RENDERING
* Component: 02_text_description
* ============================================================ */
#define FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
#define FONT_SIZE_NORMAL 18u
#define FONT_SIZE_TITLE 26u
// Pixels between text baselines at scale 1.0 with FONT_SIZE_NORMAL
#define LINE_HEIGHT 24.0f
// Pixels between text baselines at scale 1.0 with FONT_SIZE_TITLE
#define LINE_HEIGHT_LARGE 34.0f
// Pixel margin from panel edge for text placement
#define TEXT_MARGIN 10.0f
/* ============================================================
* SHADER DIRECTORY
* Component: all components that load shaders
* ============================================================ */
// Path is relative to the build/ directory where the executable lives
#define SHADER_DIR "../shaders/"
/* ============================================================
* KEYBOARD CONTROL STEP SIZES
* Component: Thread 1 keyboard handler (main.cpp)
* ============================================================ */
#define INTENSITY_STEP 0.05f
#define SENSITIVITY_STEP 0.05f
#define STC_SENSITIVITY_STEP 0.05f
#define STC_RANGE_STEP 0.05f
#define NOISE_FILTER_STEP 0.05f
#define RADIOGON_STEP 1.0f
#define BEARING_CURSOR_STEP 1.0f
#define RANGE_CURSOR_STEP 0.02f
#define MARINE_A_BEARING_STEP 1.0f
#define MAX_RANGE_STEP 0.1f
/* ============================================================
* KEYBOARD CONTROL LIMITS
* Component: Thread 1 keyboard handler (main.cpp)
* ============================================================ */
#define INTENSITY_MIN 0.0f
#define INTENSITY_MAX 2.0f
#define SENSITIVITY_MIN 0.0f
#define SENSITIVITY_MAX 2.0f
#define STC_SENSITIVITY_MIN 0.0f
#define STC_SENSITIVITY_MAX 1.0f
#define STC_RANGE_MIN 0.0f
#define STC_RANGE_MAX 1.0f
#define NOISE_FILTER_MIN 0.0f
#define NOISE_FILTER_MAX 1.0f
#define RANGE_CURSOR_MIN 0.0f
#define RANGE_CURSOR_MAX 1.0f
#define MAX_RANGE_MIN 0.1f
#define MAX_RANGE_MAX 1.0f