Skip to content

Adding New Display Item

Follow these steps to add a new value from the CAN bus to the display.

Step 0 — Design in TouchGFX Designer (Windows only)

Use TouchGFX Designer to design and generate UI files (the project is in TouchGFX_Designer folder), then copy the generated TouchGFX/generated folder into the project. If someone could find a way to integrate the TouchGFX Designer project with the actual code that would be pretty cool, but it was weird and had buggy build issues in my experience.

Step 1 — can_types.hpp

  • Increment NUM_OF_CAN_VALUES
  • #define the new CAN ID (check Haltech ECU protocol)
  • Declare the new can_type in the extern list
  • Add the new entry to the CAN_ValueType enum

Step 2 — can_types.cpp

  • Define the new can_type with non-C++ initial values
  • Add a pointer to it in the CAN_value_ptrs array

Step 3 — main.c

  • Add a case for the new CAN ID in the switch statement inside RxFifo0Callback

Step 4 — Screen1View.cpp

  • Set C++ starting values (UI-related) in setupScreen
  • Add any special visual logic to updateDisplayValue if needed