Skip to content

Commit

Permalink
rip, need motorola
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Sep 20, 2024
1 parent 76751c1 commit c9a6b5f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PCAN_project/hytech.sym
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,10 @@ Sig=drivebrain_set_rpm_fl unsigned 16
Sig=drivebrain_set_rpm_fr unsigned 16
Sig=drivebrain_set_rpm_rl unsigned 16
Sig=drivebrain_set_rpm_rr unsigned 16
Sig=izze_brake_IR_temp_1 unsigned 16
Sig=izze_brake_IR_temp_2 unsigned 16
Sig=izze_brake_IR_temp_3 unsigned 16
Sig=izze_brake_IR_temp_4 unsigned 16
Sig=izze_brake_IR_temp_1 unsigned 16 -m
Sig=izze_brake_IR_temp_2 unsigned 16 -m
Sig=izze_brake_IR_temp_3 unsigned 16 -m
Sig=izze_brake_IR_temp_4 unsigned 16 -m

{SENDRECEIVE}

Expand Down
44 changes: 44 additions & 0 deletions id_finder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import matplotlib.pyplot as plt
import re
import sys

def parse_sym_file(sym_file_path):
used_ids = set()

# Regular expression for matching ID lines
id_pattern = re.compile(r'ID=(\w+)h', re.IGNORECASE)

with open(sym_file_path, 'r') as file:
for line in file:
id_match = id_pattern.search(line)
if id_match:
can_id = int(id_match.group(1), 16) # Convert hex to int
# Only add IDs within the 11-bit CAN ID range (0x000 to 0x7FF)
if 0x000 <= can_id <= 0x7FF:
used_ids.add(can_id)

return used_ids

def plot_can_id_space(used_ids):
# Define the full 11-bit CAN ID range (0x000 to 0x7FF)
all_ids = set(range(0x000, 0x800))
available_ids = all_ids - used_ids

plt.figure(figsize=(15, 6))

# Plotting available and used CAN IDs
plt.scatter(sorted(available_ids), [1] * len(available_ids), color='green', label='Available', s=10)
plt.scatter(sorted(used_ids), [1] * len(used_ids), color='red', label='Used', s=10)

plt.xlabel('CAN ID')
plt.ylabel('Availability')
plt.yticks([]) # No need for y-axis ticks
plt.title('CAN ID Space (0x000 to 0x7FF) Availability')
plt.grid(axis='x', linestyle='--', linewidth=0.5)
plt.legend()
plt.tight_layout()
plt.show()
if __name__ == "__main__":
sym_file_path = sys.argv[1] # Replace with your actual .sym file path
used_ids = parse_sym_file(sym_file_path)
plot_can_id_space(used_ids)

0 comments on commit c9a6b5f

Please sign in to comment.