diff --git a/global_data.cpp b/global_data.cpp index 3cbade7..56a1b73 100644 --- a/global_data.cpp +++ b/global_data.cpp @@ -39,20 +39,15 @@ /* radar_management[] is indexed by RADAR_* constants (0-4). * Slot 0 (RADAR_NONE) is the management/system entry. - * Its testing field holds the system-wide TESTING_* mode, initialized - * from TESTING_COMPONENT in settings.h — change that define and recompile. - * When testing is non-zero, no other radars can be made available. * Slots 1-4 are per-radar entries. operatable is set to 1 once a radar is * fully built. available and selected are set during startup argument parsing. - * The testing field in slots 1-4 mirrors slot 0 for convenient access but - * slot 0 is authoritative. * Components: Thread 1, Traffic Cop (Thread 2) */ radar_management_structure radar_management[RADAR_COUNT] = { - { RADAR_NONE, 0, 0, 0, TESTING_COMPONENT }, // [0] management — testing mode lives here - { RADAR_CHAIN_HOME, 0, 0, 0, TESTING_NONE }, // [1] chain_home — not yet built - { RADAR_MARINE_ASCOPE, 0, 0, 0, TESTING_NONE }, // [2] marine_ascope — not yet built - { RADAR_MARINE_TRAFFIC, 0, 0, 0, TESTING_NONE }, // [3] marine_traffic — not yet built - { RADAR_POLICE_BOAT, 0, 0, 0, TESTING_NONE }, // [4] police_boat — not yet built + { RADAR_NONE, 0, 0, 0 }, // [0] management entry + { RADAR_CHAIN_HOME, 0, 0, 0 }, // [1] chain_home — not yet built + { RADAR_MARINE_ASCOPE, 0, 0, 0 }, // [2] marine_ascope — not yet built + { RADAR_MARINE_TRAFFIC, 0, 0, 0 }, // [3] marine_traffic — not yet built + { RADAR_POLICE_BOAT, 0, 0, 0 }, // [4] police_boat — not yet built }; // No radar selected on startup; intro screen is displayed. @@ -138,12 +133,3 @@ float uniform_bearing_cursor = 0.0f; // Components: Marine A-scope float uniform_marine_a_bearing = 0.0f; -/* ============================================================ - * TEMPORARY TEST FILE REGISTRY - * Each active test stub pushes its own filename here at startup. - * Thread 1 init prints these if non-empty so the presence of test - * infrastructure is always visible in the console output. - * Components: any temporary test stub; Thread 1 (startup logging) - * ============================================================ */ -std::vector test_functions; -std::vector test_functions_include; diff --git a/include/data_structure_and_constants.h b/include/data_structure_and_constants.h index 819d4ad..c167fce 100644 --- a/include/data_structure_and_constants.h +++ b/include/data_structure_and_constants.h @@ -36,7 +36,6 @@ #include #include #include -#include /* ============================================================ * TARGET DATA STRUCTURES @@ -109,8 +108,7 @@ struct target_data_to_thread_1_structure { * ============================================================ */ /* Index constants for radar_management[] and current_radar. - * Slot 0 (RADAR_NONE) is the management/system entry; its testing field - * holds the system-wide test mode. Radar entries are slots 1-4. */ + * Slot 0 (RADAR_NONE) is the management/system entry. Radar entries are slots 1-4. */ constexpr int RADAR_NONE = 0; // management/system entry constexpr int RADAR_CHAIN_HOME = 1; constexpr int RADAR_MARINE_ASCOPE = 2; @@ -120,8 +118,7 @@ constexpr int RADAR_COUNT = 5; // total slots: 0 (management) + 1-4 (ra /* Per-radar operational state. * Indexed by RADAR_* constants above. - * Slot 0 (RADAR_NONE) is the management/system entry — its testing field - * holds the active TESTING_* mode for the entire exhibit. + * Slot 0 (RADAR_NONE) is the management/system entry. * Components: Thread 1 (startup init, scope switching), * Traffic Cop (Thread 2, range filtering) */ struct radar_management_structure { @@ -129,14 +126,10 @@ struct radar_management_structure { int operatable; // 1 = radar is built and fully functional, 0 = not yet built int available; // 1 = enabled by exhibit operator at startup, 0 = disabled int selected; // 1 = currently active/displayed, 0 = not active - int testing; // TESTING_* constant: component under development (TESTING_NONE = normal operation) - // Only radar_management[0].testing is meaningful — it is the system-wide test mode. }; /* Array of radar states, indexed by RADAR_* constants. - * radar_management[0] is the management/system entry; its testing field - * holds the system-wide TESTING_* mode (see below). - * Access the active testing mode via: radar_management[RADAR_NONE].testing + * radar_management[0] is the management/system entry. * Components: Thread 1, Traffic Cop (Thread 2) */ extern radar_management_structure radar_management[RADAR_COUNT]; @@ -145,25 +138,6 @@ extern radar_management_structure radar_management[RADAR_COUNT]; // Components: Thread 1, Traffic Cop (Thread 2), all scope renderers extern int current_radar; -/* Component identifiers for radar_management[RADAR_NONE].testing. - * When that field is non-zero, only the named component is active and - * no other radars can be made available. - * Values 2-5 correspond to RADAR_* constants for the four radar types. - * Components: Thread 1 (startup), all components that gate on test mode */ -constexpr int TESTING_NONE = 0; // normal exhibit operation -constexpr int TESTING_MANAGEMENT = 1; // setup and radar selection (this module) -constexpr int TESTING_CHAIN_HOME = 2; // chain home A-scope -constexpr int TESTING_MARINE_ASCOPE = 3; // marine A-scope -constexpr int TESTING_MARINE_TRAFFIC = 4; // marine traffic control PPI -constexpr int TESTING_POLICE_BOAT = 5; // police boat PPI -constexpr int TESTING_TRAFFIC_COP = 6; // traffic cop (Thread 2) -constexpr int TESTING_SIMULATOR = 7; // simulator (Thread 3) -constexpr int TESTING_RASPBERRY_PI = 8; // raspberry pi receiver (Thread 5) - -/* radar_management[RADAR_NONE].testing is initialized from TESTING_COMPONENT in settings.h. - * Set TESTING_COMPONENT to TESTING_NONE for normal exhibit operation. - * Components: Thread 1 (startup gating), all components */ - /* ============================================================ * THREAD MUTEXES * Defined in global_data.cpp; extern declared here. @@ -239,13 +213,3 @@ extern float uniform_bearing_cursor; // Components: Marine A-scope extern float uniform_marine_a_bearing; -/* ============================================================ - * TEMPORARY TEST FILE REGISTRY - * Each active test .cpp stub pushes its filename into test_functions. - * Each active test .h stub pushes its filename into test_functions_include. - * Both are printed at startup when any entry is present so it is - * immediately visible that test infrastructure is compiled in. - * Components: any temporary test stub; Thread 1 (startup logging) - * ============================================================ */ -extern std::vector test_functions; -extern std::vector test_functions_include; diff --git a/include/settings.h b/include/settings.h index d64b2d4..c73e84d 100644 --- a/include/settings.h +++ b/include/settings.h @@ -35,31 +35,6 @@ #pragma once -/* ============================================================ - * TESTING MODE - * Component: all components (read at startup by Thread 1) - * ============================================================ */ - -/* - * Set to a TESTING_* constant to put the exhibit in single-component - * test mode. Stored in radar_management[RADAR_NONE].testing at startup. - * When non-zero, only the named component is active and no other radars - * can be made available. - * - * TESTING_NONE = 0 normal exhibit operation - * TESTING_MANAGEMENT = 1 setup and radar selection (03_setup_and_radar_selection) - * TESTING_CHAIN_HOME = 2 chain home A-scope - * TESTING_MARINE_ASCOPE = 3 marine A-scope - * TESTING_MARINE_TRAFFIC = 4 marine traffic control PPI - * TESTING_POLICE_BOAT = 5 police boat PPI - * TESTING_TRAFFIC_COP = 6 traffic cop (Thread 2) - * TESTING_SIMULATOR = 7 simulator (Thread 3) - * TESTING_RASPBERRY_PI = 8 raspberry pi receiver (Thread 5) - * - * Read the active mode at runtime via: radar_management[RADAR_NONE].testing - */ -#define TESTING_COMPONENT TESTING_NONE - /* ============================================================ * GENERAL / OPENGL DEBUG * Component: Thread 1 (initialization) diff --git a/todo b/todo new file mode 100644 index 0000000..938e862 --- /dev/null +++ b/todo @@ -0,0 +1,73 @@ +● Let me survey the project structure and key files before sharing concerns. + + Searched for 1 pattern, read 7 files, listed 1 directory (ctrl+o to expand) + +● Good. I have a thorough picture now. Here are the concerns, ordered by severity: + + --- + Compile Blocker + + global_data.cpp will not compile. It uses TESTING_COMPONENT (line 51) which is defined in settings.h, + but the file only includes data_structure_and_constants.h. Neither that header nor global_data.cpp + includes settings.h. This is a straightforward fix — add #include "include/settings.h" to + global_data.cpp. + + --- + Design Concerns + + 1. time_t in ssbo_target_information cannot go to GLSL without an extension. + time_t on Linux 64-bit is int64_t (8 bytes). Standard GLSL std430 has no 64-bit integer type — it would + require the GL_ARB_gpu_shader_int64 extension. The Radeon 780M does support it, but it's non-standard + and requires explicit enablement in the shader source. The simpler fix: since the Traffic Cop already + discards targets older than 1 hour on the CPU, the timestamp serves no GPU-side purpose. Remove time_t + timestamp from ssbo_target_information — it belongs only in target_data_to_thread_1_structure. + + 2. Dual state for "which radar is active" risks going out of sync. + Both current_radar (an int) and radar_management[i].selected (a per-entry flag) track the active radar. + Any code that changes one must change the other, and it's easy to miss one. I'd recommend a setter + function (e.g., set_active_radar(int)) that updates both atomically. Otherwise you'll eventually have + current_radar == RADAR_MARINE_TRAFFIC while radar_management[3].selected == 0. + + 3. uniform_max_range is a single float, but range selection is discrete steps. + The settings define 4–5 discrete range values per scope (MARINE_A_SCOPE_RANGE_STEP_1 through _4, etc.), + but there's no index variable to track which step is currently selected. The keyboard handler for o/p + keys will need a per-scope step index that it increments/decrements, then looks up the appropriate step + value to write into uniform_max_range. That index variable doesn't exist anywhere yet. + + 4. Thread safety gap on uniform globals. + The uniform_* globals are written by Thread 6 (future physical controls) protected by + mutex_control_data_to_shaders, but Thread 1 reads them during the render loop without acquiring that + mutex. When Thread 6 is eventually built, this will be a data race. Worth designing the read-side + locking now so you don't have to retrofit it across all scopes later. + + --- + Missing Infrastructure + + 5. No CMakeLists.txt. Nothing will compile without it. It needs to link against: OpenGL, GLFW3, + FreeType, GDAL, and link in glad/src/glad.c. This should be built before any component .cpp file. + + 6. No main.cpp / Thread 1 entry point. Expected at this stage since components are being built + piecemeal, but the CMakeLists.txt will need a placeholder main.cpp to have an executable. + + --- + Minor + + 7. Misleading comment in global_data.cpp (line 48). It says "The testing field in slots 1-4 mirrors slot + 0 for convenient access" — but the initialization hardcodes TESTING_NONE in slots 1-4; there's no + mirror. Either remove that sentence or actually initialize them to radar_management[0].testing (which + can't be done in a static initializer anyway). Simplest fix: just delete that sentence from the comment. + + 8. police_location in 01_classes.md is described as float police_location. A position in 2D local + Cartesian space needs two components (x, y). When you get to the police boat shader uniform, that will + need to be a vec2 (two floats), not a single float. + + 9. simulation_data/simulation_journey is a placeholder. It has no values for target_x/target_y and a + non-parseable timestamp. This is fine for now, but the format needs to be defined when the simulator + component (Thread 3) is built. + + --- + Summary: The one item to fix immediately before writing code is the settings.h missing include in + global_data.cpp. The SSBO time_t issue should be resolved before the first shader is written. The rest + can be addressed as the relevant components are built. Want me to fix the global_data.cpp include now? + +✻ Cooked for 1m 46s