1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-11 15:13:06 +01:00
Files
esp32-nmea2000-obp60/tools/getPgnType.py
2025-09-23 18:29:43 +02:00

29 lines
476 B
Python
Executable File

#! /usr/bin/env python3
import sys
import json
def err(txt):
print(txt,file=sys.stderr)
sys.exit(1)
HDR='''
PGNM_Fast=0
PGNM_Single=1
PGNM_ISO=2
PGN_MODES={
'''
FOOTER='''
}
'''
with open(sys.argv[1],"r") as ih:
data=json.load(ih)
pgns=data.get('PGNs')
if pgns is None:
err("no pgns")
print(HDR)
for p in pgns:
t=p['Type']
pgn=p['PGN']
if t and pgn:
print(f" {pgn}: PGNM_{t},")
print(FOOTER)