Organizes 11 projects for Cerbo GX/Venus OS into a single repository: - axiom-nmea: Raymarine LightHouse protocol decoder - dbus-generator-ramp: Generator current ramp controller - dbus-lightning: Blitzortung lightning monitor - dbus-meteoblue-forecast: Meteoblue weather forecast - dbus-no-foreign-land: noforeignland.com tracking - dbus-tides: Tide prediction from depth + harmonics - dbus-vrm-history: VRM cloud history proxy - dbus-windy-station: Windy.com weather upload - mfd-custom-app: MFD app deployment package - venus-html5-app: Custom Victron HTML5 app fork - watermaker: Watermaker PLC control UI Adds root README, .gitignore, project template, and per-project .gitignore files. Sensitive config files excluded via .gitignore with .example templates provided. Made-with: Cursor
80 lines
1.9 KiB
Python
80 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Raymarine NMEA Library - Quick Start Example
|
|
|
|
This is a minimal example showing how to use the library.
|
|
"""
|
|
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
# Add repo root to path for development
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
|
|
|
|
from raymarine_nmea import (
|
|
RaymarineDecoder,
|
|
SensorData,
|
|
NMEAGenerator,
|
|
MulticastListener,
|
|
)
|
|
|
|
|
|
def main():
|
|
# Check for interface IP argument
|
|
if len(sys.argv) < 2:
|
|
print("Usage: python quickstart.py <interface_ip>")
|
|
print("Example: python quickstart.py 198.18.5.5")
|
|
sys.exit(1)
|
|
|
|
interface_ip = sys.argv[1]
|
|
|
|
# Create components
|
|
decoder = RaymarineDecoder()
|
|
data = SensorData()
|
|
generator = NMEAGenerator()
|
|
|
|
# Start listening
|
|
listener = MulticastListener(
|
|
decoder=decoder,
|
|
sensor_data=data,
|
|
interface_ip=interface_ip,
|
|
)
|
|
listener.start()
|
|
|
|
print(f"Listening on {interface_ip}...")
|
|
print("Press Ctrl+C to stop\n")
|
|
|
|
try:
|
|
while True:
|
|
# Generate all available NMEA sentences
|
|
sentences = generator.generate_all(data)
|
|
|
|
# Print each sentence
|
|
for sentence in sentences:
|
|
print(sentence, end='')
|
|
|
|
if sentences:
|
|
print() # Blank line between updates
|
|
|
|
time.sleep(1)
|
|
|
|
except KeyboardInterrupt:
|
|
print("\nStopping...")
|
|
finally:
|
|
listener.stop()
|
|
|
|
# Print final summary
|
|
print("\nFinal sensor data:")
|
|
print(f" GPS: {data.latitude}, {data.longitude}")
|
|
print(f" Heading: {data.heading_deg}")
|
|
print(f" Wind: {data.tws_kts} kts @ {data.twd_deg}°")
|
|
print(f" Depth: {data.depth_m} m")
|
|
print(f" Water temp: {data.water_temp_c}°C")
|
|
print(f" Tanks: {data.tanks}")
|
|
print(f" Batteries: {data.batteries}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|