diff --git a/PCAN_project/hytech.sym b/PCAN_project/hytech.sym index 22d2c72..44bb089 100644 --- a/PCAN_project/hytech.sym +++ b/PCAN_project/hytech.sym @@ -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} diff --git a/id_finder.py b/id_finder.py new file mode 100644 index 0000000..cb3ebfc --- /dev/null +++ b/id_finder.py @@ -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)