# flyonspeed/tronview architecture

> Architecture diagram of the GitHub repository flyonspeed/tronview, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flyonspeed/tronview
- Repository: https://github.com/flyonspeed/tronview

## Overview

Key Components to Include:

##### Data Input Layer
- EFIS Systems (MGL iEFIS, Garmin G3x, Dynon Skyview, etc.)
- Sensor Inputs (BNO055/BNO085 IMUs, ADS1115 for analog)
- Network Inputs (Stratux WiFi, Levil BOM WiFi)
- Input Handlers (located in lib/inputs/)

##### Data Processing Core
- DataShip Module (lib/common/dataship/)
- Event Manager (lib/common/event_manager.py)
- Common Utilities (lib/common/)

##### Rendering Engine Layer
- Split into three main rendering modes:
- Graphic Mode (lib/common/graphic/)
- Text Mode (lib/common/text/)
- 3D Mode (lib/modules_kivy/horizon_3d/)

##### Module System
- EFIS Modules (artificial horizon, traffic scope, etc.)
- HUD Modules (AOA, CDI, heading, etc.)
- General Modules (gauges, text, 3D objects)
- GUI Modules (menus, controls)

##### Screen Management
- How screens are composed:
- Screen Templates (lib/screens/templates/)
- Screen Implementations (lib/screens/)
- Screen Configuration System

##### Connection Types
- Double lines: Configuration relationships

##### Important Details
- Data flow paths showing how information moves from inputs through processing to display
- Module loading system
- Event handling system
- Screen template system
- Configuration management

##### Architectural Patterns to Highlight
- Plugin architecture for inputs and modules
- Event-driven communication
- MVC-like pattern for screen management
- Template-based screen configuration

Keep the following aspects in mind:
- Separation between data acquisition, processing, and visualization
- Modular nature of the system
- Multiple display modes (HUD, EFIS, Text, 3D)
- How configuration affects different parts of the system
- Where external hardware interfaces exist

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef input fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef render fill:#FFE5B4,stroke:#333
    classDef module fill:#FFA07A,stroke:#333
    classDef screen fill:#DDA0DD,stroke:#333
    classDef legend fill:#f9f9f9,stroke:#333

    %% Input Layer
    subgraph InputLayer["Data Input Layer"]
        EFIS["EFIS Systems"]:::input
        Sensors["Sensor Inputs"]:::input
        Network["Network Inputs"]:::input
        InputHandlers["Input Handlers"]:::input
    end

    %% Core Processing
    subgraph CoreLayer["Data Processing Core"]
        DataShip["DataShip Module"]:::core
        EventMgr["Event Manager"]:::core
        CommonUtils["Common Utilities"]:::core
    end

    %% Rendering Layer
    subgraph RenderLayer["Rendering Engine Layer"]
        GraphicMode["Graphic Mode"]:::render
        TextMode["Text Mode"]:::render
        Mode3D["3D Mode"]:::render
    end

    %% Module System
    subgraph ModuleSystem["Module System"]
        EFISMods["EFIS Modules"]:::module
        HUDMods["HUD Modules"]:::module
        GenMods["General Modules"]:::module
        GUIMods["GUI Modules"]:::module
    end

    %% Screen Management
    subgraph ScreenMgmt["Screen Management"]
        Templates["Screen Templates"]:::screen
        Implementations["Screen Implementations"]:::screen
        BaseClass["Screen Base Class"]:::screen
    end

    %% Connections
    EFIS --> InputHandlers
    Sensors --> InputHandlers
    Network --> InputHandlers
    InputHandlers --> DataShip
    DataShip --> EventMgr
    EventMgr --> CommonUtils
    DataShip --> GraphicMode
    DataShip --> TextMode
    DataShip --> Mode3D
    EventMgr --> ModuleSystem
    ModuleSystem --> RenderLayer
    Templates --> Implementations
    BaseClass --> Implementations
    EventMgr --> ScreenMgmt

    %% Legend
    subgraph Legend["Legend"]
        L1["Input Systems"]:::input
        L2["Core Processing"]:::core
        L3["Rendering Systems"]:::render
        L4["Modules"]:::module
        L5["Screen Management"]:::screen
    end

    %% Click events
    click InputHandlers "https://github.com/flyonspeed/tronview/tree/master/lib/inputs/"
    click DataShip "https://github.com/flyonspeed/tronview/blob/master/lib/common/dataship/dataship.py"
    click EventMgr "https://github.com/flyonspeed/tronview/blob/master/lib/common/event_manager.py"
    click CommonUtils "https://github.com/flyonspeed/tronview/blob/master/lib/common/shared.py"
    click GraphicMode "https://github.com/flyonspeed/tronview/blob/master/lib/common/graphic/graphic_mode.py"
    click TextMode "https://github.com/flyonspeed/tronview/blob/master/lib/common/text/text_mode.py"
    click Mode3D "https://github.com/flyonspeed/tronview/blob/master/lib/modules_kivy/horizon_3d/horizon_3d.py"
    click EFISMods "https://github.com/flyonspeed/tronview/tree/master/lib/modules/efis/"
    click HUDMods "https://github.com/flyonspeed/tronview/tree/master/lib/modules/hud/"
    click GenMods "https://github.com/flyonspeed/tronview/tree/master/lib/modules/general/"
    click GUIMods "https://github.com/flyonspeed/tronview/tree/master/lib/modules/gui/"
    click Templates "https://github.com/flyonspeed/tronview/tree/master/lib/screens/templates/"
    click BaseClass "https://github.com/flyonspeed/tronview/blob/master/lib/screens/_screen.py"
    click Implementations "https://github.com/flyonspeed/tronview/blob/master/lib/screens/Default.py"
```
