From 0d95fac94580fac00189a9185915230178a8c8e9 Mon Sep 17 00:00:00 2001 From: Mark Allyn Date: Sat, 13 Jun 2026 22:14:09 -0700 Subject: [PATCH] Update for radar testing and operation and added first component .md file --- CLAUDE.md | 36 +++++++++++++++++++------- global_data.cpp | 20 +++++++++----- include/data_structure_and_constants.h | 28 +++++++++++++++++--- include/settings.h | 22 ++++++++++++++++ setup_and_radar_selection.md | 16 ++++++++++++ 5 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 setup_and_radar_selection.md diff --git a/CLAUDE.md b/CLAUDE.md index cab2f42..851ad5d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -200,26 +200,32 @@ Overall control information These are knobs on the panel once that is built. Keyboard keys until then -1. Intensity - scope overall intensity - Keyboard 3 is lower; 4 is higher - uniform is float intensity; -2. Receiver Sensitivity - signal intensity - Keyboard 5 is lower; 6 is higher - uniform is float sensitivity; -3. STC Sensitivity - sensitivity for closer in targets which can overwhelm +1. Radar Selection - which radar to run. Selection is done with up or down; the radars are to be + in the selection order as follows 1, chain_home; 2, marine_ascope; 3, marine_traffic; 4, police boat. + When the application is started, chain_home is current selection. You go up, then marine_ascope is + selected. And so on. Then you hit enter to activate the selected radar. The Keyboard is 1 for going + forward; 2 for going backward. Note that when a radar is operating, you can go back to the selection + bt using the 1 key to go back to the selection. +2. Intensity - scope overall intensity - Keyboard 3 is lower; 4 is higher - uniform is float intensity; +3. Receiver Sensitivity - signal intensity - Keyboard 5 is lower; 6 is higher - uniform is float sensitivity; +4. STC Sensitivity - sensitivity for closer in targets which can overwhelm overall sensitivity - keyboard q for lower; w for higher - uniform is float stc_sensitivity; -4. STC Range - range to which sensitivity to closer targets is effective +5. STC Range - range to which sensitivity to closer targets is effective keyboard e for lower; r for higher - uniform is float stc_range; -5. Noise filter for rain noise. This is for the ppi scopes. keyboard t for decrease filtering and y +6. Noise filter for rain noise. This is for the ppi scopes. keyboard t for decrease filtering and y to increase filtering - uniform is float noise_filter; -6. Radiogoniometer knob for Chain Home; keyboard u for left turn; +7. Radiogoniometer knob for Chain Home; keyboard u for left turn; i for right turn. - uniform is float radiogoniometer; -7. Maximum Range for all scopes except for chain home, which is fixed. This control +8. Maximum Range for all scopes except for chain home, which is fixed. This control will not operate for Chain Home. These maximum range selections will be defined for each scope; If you try to go beyond the stated maximum ranges, the control will have no effect; note that the default maximum range would be the highest for that scope; keyboard o for lower; p for higher uniform is float max_range; -8. Range Cursor (for ppi scopes, not for a scopes) +9. Range Cursor (for ppi scopes, not for a scopes) keyboard a for lower; s for higher - uniform is float range_cursor; -9. Bearing Cursor (for all ppi scopes; not for a scopes) +10. Bearing Cursor (for all ppi scopes; not for a scopes) keyboard d for counterclockwise f for clockwise uniform is float bearing_cursor; -10. Bearing for Marine A Scope. This is not for a cursor, but this operates the motor +11. Bearing for Marine A Scope. This is not for a cursor, but this operates the motor that revolves the antenna unit keyboard g for counterclockwise and h for clockwise uniform is float marine_a_bearing; @@ -436,11 +442,21 @@ data structure. Here is a suggested global data for managing the radars: struct radar_management_structure { + int radar_type // 1 is chain_home; 2 is marine_ascope; 3 = marine_traffic 4 = police_boat int operatable; // 1 is yes, 0 is no int available; // 1 is yes, 0 is no - this is the one controled by the exhibit owner int selected; // 1 is currently operating, 0 is not operating + int testing; // What is being developed and tested; 1 = overall management + including startup and radar selectionr, + 2 = chain_home, 3 = marine_ascope, 4 = marine_traffic, 5 = police_boat, 6 = traffic_cop, + 7 = simulator, and 8 = raspberry pi receiver }; +Note that if a radar is in testing, no other radars can be available. Also testing code can be used +to work on the radar being tested and developed +In the global data, we need these items: + +struct radar_management_structure radar_management; int current_radar; // 0 is none; 1 is chain_home; 2 is marine_ascope; 3 is marine_traffic; 4 is police_boat diff --git a/global_data.cpp b/global_data.cpp index 79b0301..97dbb66 100644 --- a/global_data.cpp +++ b/global_data.cpp @@ -39,21 +39,27 @@ /* radar_management[] is indexed by RADAR_* constants (1-4). * Slot 0 is unused padding so current_radar works as a direct index. - * All fields start at 0. Set testing=1 when a radar component is under - * active development; set operatable=1 when it is built and tested. + * radar_type mirrors the array index for callers that receive a single + * struct by value. operatable is set to 1 once a radar is fully built. * available and selected are set during startup argument parsing. */ radar_management_structure radar_management[RADAR_COUNT] = { - { 0, 0, 0, 0 }, // [0] unused - { 0, 0, 0, 0 }, // [1] chain_home — not yet built - { 0, 0, 0, 0 }, // [2] marine_ascope — not yet built - { 0, 0, 0, 0 }, // [3] marine_traffic — not yet built - { 0, 0, 0, 0 }, // [4] police_boat — not yet built + { RADAR_NONE, 0, 0, 0 }, // [0] unused + { 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. // Components: Thread 1, Traffic Cop (Thread 2), all scope renderers int current_radar = RADAR_NONE; +// Component currently under development (TESTING_* constant). +// Initialized from TESTING_COMPONENT in settings.h; change that define and recompile. +// When non-zero, no other radars can be made available. +// Components: Thread 1 (startup gating), all components +int testing_component = TESTING_COMPONENT; + /* ============================================================ * THREAD MUTEXES * Components: all threads as noted per mutex diff --git a/include/data_structure_and_constants.h b/include/data_structure_and_constants.h index 2dcfd71..a419eb9 100644 --- a/include/data_structure_and_constants.h +++ b/include/data_structure_and_constants.h @@ -123,10 +123,10 @@ constexpr int RADAR_COUNT = 5; // valid indices: 1-4; 0 is unused * Components: Thread 1 (startup init, scope switching), * Traffic Cop (Thread 2, range filtering) */ struct radar_management_structure { - int testing; // 1 = radar component is under development/testing, 0 = not in testing - 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 radar_type; // RADAR_* constant identifying which radar this entry represents + 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 }; // Array of radar states, indexed by RADAR_* constants. @@ -139,6 +139,26 @@ 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 testing_component. + * When testing_component is non-zero, only that 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) + +// Active component under development; initialized from TESTING_COMPONENT in settings.h. +// Set to TESTING_NONE for normal exhibit operation. +// Components: Thread 1 (startup gating), all components +extern int testing_component; + /* ============================================================ * THREAD MUTEXES * Defined in global_data.cpp; extern declared here. diff --git a/include/settings.h b/include/settings.h index c73e84d..2b7212a 100644 --- a/include/settings.h +++ b/include/settings.h @@ -35,6 +35,28 @@ #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. 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 + * 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) + */ +#define TESTING_COMPONENT TESTING_NONE + /* ============================================================ * GENERAL / OPENGL DEBUG * Component: Thread 1 (initialization) diff --git a/setup_and_radar_selection.md b/setup_and_radar_selection.md new file mode 100644 index 0000000..a7afc56 --- /dev/null +++ b/setup_and_radar_selection.md @@ -0,0 +1,16 @@ +The setup_and_radar_selection module handles the housekeeping of starting the radar exhibit. + +It will use the radar_management_structure, which is in global data, will be used by this +module to manage what radars are available and which one is selected. + +The selection of which radars are to be available to the museum visitors is accomplished +my entering the radars that will be available as parameters of the command for example: + +radar_simulator chain_home marine_ascope marine_traffic police_boat - all radars +radar_simulator marine_ascope - only the marine ascope radar + +Note: if the operator invokes no parameters, then all the radars are to be made available. + +When the application is started, it will be in a state where no radar is in use. The visitor +will use the selector to select a radar to operate. +