Made corrections to radar managment to add testing

This commit is contained in:
2026-06-10 09:14:19 -07:00
parent 1898a2e17a
commit e923dc2c42
2 changed files with 58 additions and 0 deletions

View File

@@ -32,6 +32,28 @@
#include "include/data_structure_and_constants.h" #include "include/data_structure_and_constants.h"
/* ============================================================
* RADAR MANAGEMENT
* Components: Thread 1 (startup, scope switching), Traffic Cop (Thread 2)
* ============================================================ */
/* 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.
* 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
};
// No radar selected on startup; intro screen is displayed.
// Components: Thread 1, Traffic Cop (Thread 2), all scope renderers
int current_radar = RADAR_NONE;
/* ============================================================ /* ============================================================
* THREAD MUTEXES * THREAD MUTEXES
* Components: all threads as noted per mutex * Components: all threads as noted per mutex

View File

@@ -102,6 +102,42 @@ struct target_data_to_thread_1_structure {
uint32_t mmsi; uint32_t mmsi;
}; };
/* ============================================================
* RADAR MANAGEMENT
* Components: Thread 1 (startup, scope switching), Traffic Cop (Thread 2)
* ============================================================ */
/* Index constants for radar_management[] and current_radar.
* Array slot 0 (RADAR_NONE) is unused padding so current_radar
* can be used as a direct index into radar_management[]. */
constexpr int RADAR_NONE = 0;
constexpr int RADAR_CHAIN_HOME = 1;
constexpr int RADAR_MARINE_ASCOPE = 2;
constexpr int RADAR_MARINE_TRAFFIC = 3;
constexpr int RADAR_POLICE_BOAT = 4;
constexpr int RADAR_COUNT = 5; // valid indices: 1-4; 0 is unused
/* Per-radar operational state.
* Indexed by RADAR_* constants above; slot 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
};
// Array of radar states, indexed by RADAR_* constants.
// radar_management[0] is unused padding.
// Components: Thread 1, Traffic Cop (Thread 2)
extern radar_management_structure radar_management[RADAR_COUNT];
// Index of the currently active radar (RADAR_NONE through RADAR_POLICE_BOAT).
// 0 means no radar selected (e.g. intro screen).
// Components: Thread 1, Traffic Cop (Thread 2), all scope renderers
extern int current_radar;
/* ============================================================ /* ============================================================
* THREAD MUTEXES * THREAD MUTEXES
* Defined in global_data.cpp; extern declared here. * Defined in global_data.cpp; extern declared here.