pyfastnet 2.0.7__tar.gz → 2.0.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {pyfastnet-2.0.7/pyfastnet.egg-info → pyfastnet-2.0.9}/PKG-INFO +1 -1
  2. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/decode_fastnet.py +18 -13
  3. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/mappings.py +20 -16
  4. {pyfastnet-2.0.7 → pyfastnet-2.0.9/pyfastnet.egg-info}/PKG-INFO +1 -1
  5. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/setup.py +1 -1
  6. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/LICENSE +0 -0
  7. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/MANIFEST.in +0 -0
  8. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/README.md +0 -0
  9. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/__init__.py +0 -0
  10. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/frame_buffer.py +0 -0
  11. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/logger.py +0 -0
  12. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/fastnet_decoder/utils.py +0 -0
  13. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/pyfastnet.egg-info/SOURCES.txt +0 -0
  14. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/pyfastnet.egg-info/dependency_links.txt +0 -0
  15. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/pyfastnet.egg-info/top_level.txt +0 -0
  16. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/setup.cfg +0 -0
  17. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_apparent_frame.py +0 -0
  18. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_autopilot_frame.py +0 -0
  19. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_channels.py +0 -0
  20. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_depth_frame.py +0 -0
  21. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_format07_msb_regression.py +0 -0
  22. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_format08_layout.py +0 -0
  23. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_heel_frame.py +0 -0
  24. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_rudder_frame.py +0 -0
  25. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_tide_frame.py +0 -0
  26. {pyfastnet-2.0.7 → pyfastnet-2.0.9}/tests/test_true_frame.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyfastnet
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: A Python library for decoding FastNet protocol data streams.
5
5
  Home-page: https://github.com/ghotihook/pyfastnet
6
6
  Author: Alex Salmon
@@ -16,19 +16,24 @@ _DECIMAL_PLACES_MAP = {1: 0, 10: 1, 100: 2, 1000: 3}
16
16
  # "°M" → magnetic bearing, suffix added after value
17
17
 
18
18
  def _sign_from_layout(layout: str) -> int:
19
- return -1 if layout in ("-[data]", "=[data]", "°[data]") else 1
19
+ return -1 if layout in ("-[data]", "=[data]", "L[data]") else 1
20
20
 
21
21
 
22
22
  def _display_from_layout(layout: str, formatted: str) -> str:
23
- if layout == "°M": return f"{formatted}°M"
24
- if layout == "H[data]": return f"H{formatted}"
25
- if layout == "[data]H": return f"{formatted}H"
26
- if layout == "[data]=": return f"{formatted}="
27
- if layout == "[data]-": return f"{formatted}-"
28
- if layout == "[data]°C": return f"{formatted}°C"
29
- if layout == "[data]°F": return f"{formatted}°F"
30
- if layout == "[data]°": return f"{formatted}°"
31
- if layout == "°[data]": return f"°{formatted}"
23
+ if layout is None: return formatted
24
+ if layout == "°M": return f"{formatted}°M"
25
+ if layout == "H[data]": return f"H{formatted}"
26
+ if layout == "[data]H": return f"{formatted}H"
27
+ if layout == "[data]=": return f"{formatted}="
28
+ if layout == "[data]-": return f"{formatted}-"
29
+ if layout == "[data]°C": return f"{formatted}°C"
30
+ if layout == "[data]°F": return f"{formatted}°F"
31
+ if layout == "[data]L": return f"{formatted}L"
32
+ if layout == "L[data]": return f"L{formatted}"
33
+ if layout == "[data]z": return f"{formatted}z"
34
+ if layout == "z[data]": return f"z{formatted}"
35
+ if layout == "u[data]": return f"u{formatted}"
36
+ if layout == "d[data]": return f"d{formatted}"
32
37
  return formatted
33
38
 
34
39
 
@@ -181,7 +186,7 @@ def decode_format_and_data(channel_id, format_byte, data_bytes):
181
186
  elif format_bits == 0x03:
182
187
  if len(data_bytes) != 2:
183
188
  return None
184
- layout = SEGMENT_A.get(data_bytes[0], "?")
189
+ layout = SEGMENT_A.get(data_bytes[0], "TBC")
185
190
  unsigned = data_bytes[1]
186
191
  value = _sign_from_layout(layout) * unsigned / divisor
187
192
  display_text = _display_from_layout(layout, f"{value:.{decimal_places}f}")
@@ -212,7 +217,7 @@ def decode_format_and_data(channel_id, format_byte, data_bytes):
212
217
  if len(data_bytes) != 4:
213
218
  return None
214
219
  # data_bytes[0] is a status/flag byte; byte 1 is the segment/layout code
215
- layout = SEGMENT_A.get(data_bytes[1], "?")
220
+ layout = SEGMENT_A.get(data_bytes[1], "TBC")
216
221
  msb = data_bytes[2] & 0b01111111
217
222
  unsigned = (msb << 8) | data_bytes[3]
218
223
  value = _sign_from_layout(layout) * unsigned / divisor
@@ -222,7 +227,7 @@ def decode_format_and_data(channel_id, format_byte, data_bytes):
222
227
  if len(data_bytes) != 2:
223
228
  return None
224
229
  segment_code = (data_bytes[0] >> 1) & 0b01111111
225
- layout = SEGMENT_A.get(segment_code, "?")
230
+ layout = SEGMENT_A.get(segment_code, "TBC")
226
231
  unsigned = ((data_bytes[0] & 0b1) << 8) | data_bytes[1]
227
232
  value = unsigned / divisor
228
233
  display_text = _display_from_layout(layout, f"{value:.{decimal_places}f}")
@@ -258,7 +258,7 @@ CHANNEL_LOOKUP = {
258
258
  0xEB: "Speed Over Ground",
259
259
  0xEC: "VMG to Waypoint (VMC)",
260
260
  0xED: "Time to Waypoint",
261
- 0xEE: "Cross Track Error",
261
+ 0xEE: "Cross Track Error", # layout TBC — not present in captured log data
262
262
  0xEF: "Remote 0",
263
263
  0xF0: "Remote 1",
264
264
  0xF1: "Remote 2",
@@ -281,24 +281,28 @@ SEGMENT_A = {
281
281
  0x20: "[data]-", 0xa0: "-[data]",
282
282
  0x8c: "=[data]", 0x0c: "[data]=",
283
283
  0xf3: "H[data]", 0x73: "[data]H",
284
- 0x00: " ",
285
284
 
286
- # Plain-positive codes — no suffix, confirmed from 7-segment bit decoding
287
- 0x80: " ", # blank (no segments lit) depth channels
288
- 0x01: " ", # decimal-point onlylinear sensor null/zero state
289
- 0x99: " ", # top+bottom bars + dp — VMG positive direction indicator
290
- 0xbb: " ", # f,d,b,c + dp — VMG / tidal drift positive indicator
291
- 0x32: " ", # f,d,c — AP Off Course low indicator
292
- 0x61: " ", # g,f + dp — AP Off Course high indicator
285
+ # Blank — no segments lit, no indicator symbol
286
+ 0x00: None, # AFTER, all blankCOG, SOG
287
+ 0x80: None, # BEFORE, all blank Depth (m/ft/fm)
293
288
 
294
- # Degree / temperature suffix codes (symbol appears AFTER value)
295
- 0x5c: "[data]°C", # a,c,d,e,f (C-shape)sea temperature °C
296
- 0x74: "[data]°F", # a,b,d,e,f (F-shape)sea temperature °F
297
- 0x58: "[data]°", # a,d,g (three bars, ≡) bearing / compass target, positive
298
- 0x54: "[data]°", # a,d,e (partial)true wind angle, starboard/positive
289
+ # Confirmed symbols
290
+ 0xbb: "d[data]", # 'd' BEFORETidal Drift
291
+ 0x99: "u[data]", # 'u' BEFOREVMG (upwind indicator)
292
+ 0x58: "[data]L", # 'L' AFTER AP Compass Target
293
+ 0xd8: "L[data]", # 'L' BEFORELeeway port/negative
299
294
 
300
- # Negative counterpart: same three-bar symbol (a,d,g) BEFORE value
301
- 0xd8: "°[data]", # pair of 0x58leeway port (negative)
295
+ # AP Off Course — dog-leg symbol, direction shown by z position
296
+ 0x32: "[data]z", # z after valueAP Off Course one direction
297
+ 0x61: "z[data]", # z before value — AP Off Course other direction
298
+
299
+ # Temperature suffixes
300
+ 0x5c: "[data]°C", # 'C' shape AFTER — Sea Temperature °C
301
+ 0x74: "[data]°F", # 'F' shape AFTER — Sea Temperature °F
302
+
303
+ # TBC — symbol seen but not yet identified
304
+ 0x01: "TBC", # lower-right segment only — Linear sensors, Node Reset
305
+ 0x54: "TBC", # upper-left+lower-left+top — True Wind Angle starboard
302
306
  }
303
307
 
304
308
  SEGMENT_B = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyfastnet
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: A Python library for decoding FastNet protocol data streams.
5
5
  Home-page: https://github.com/ghotihook/pyfastnet
6
6
  Author: Alex Salmon
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyfastnet",
5
- version="2.0.7", # Ensure this matches your intended version
5
+ version="2.0.9", # Ensure this matches your intended version
6
6
  author="Alex Salmon",
7
7
  author_email="alex@ivila.net",
8
8
  description="A Python library for decoding FastNet protocol data streams.",
File without changes
File without changes
File without changes
File without changes