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 #definethe new CAN ID (check Haltech ECU protocol)- Declare the new
can_typein theexternlist - Add the new entry to the
CAN_ValueTypeenum
Step 2 — can_types.cpp
- Define the new
can_typewith non-C++ initial values - Add a pointer to it in the
CAN_value_ptrsarray
Step 3 — main.c
- Add a case for the new CAN ID in the
switchstatement insideRxFifo0Callback
Step 4 — Screen1View.cpp
- Set C++ starting values (UI-related) in
setupScreen - Add any special visual logic to
updateDisplayValueif needed