Skip to content

Commit

Permalink
This commit is for debugging purposes only. It tells you where to look
Browse files Browse the repository at this point in the history
in BTSDA to get the correct range multiplier when a missing range is
encountered. It finds the first instance of the missing range with
a non-zero current and prints an error message.
  • Loading branch information
d-cogswell committed Dec 17, 2024
1 parent 485671c commit f946959
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion NewareNDA/NewareNDA.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,13 @@ def _bytes_to_list(bytes):
if Index == 0 or Status == 0:
return []

multiplier = multiplier_dict[Range]
try:
multiplier = multiplier_dict[Range]
except KeyError:
multiplier = float('nan')
if Current != 0:
raise KeyError(f"Missing range multiplier {Range}. Using BTSDA, get the current at index {Index} and divide by {Current}.")
pass

# Create a dictionary for the record
list = [
Expand Down
8 changes: 7 additions & 1 deletion NewareNDA/NewareNDAx.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,13 @@ def _bytes_to_list_ndc(bytes):
[Y, M, D, h, m, s] = struct.unpack('<HBBBBB', bytes[75:82])
[Range] = struct.unpack('<i', bytes[82:86])

multiplier = multiplier_dict[Range]
try:
multiplier = multiplier_dict[Range]
except KeyError:
multiplier = float('nan')
if Current != 0:
raise KeyError(f"Missing range multiplier {Range}. Using BTSDA, get the current at index {Index} and divide by {Current}.")
pass

# Create a record
list = [
Expand Down

0 comments on commit f946959

Please sign in to comment.