Thanks, both. That was a big help, and I appreciate the details and example. I managed to get it working as described by both Marek and Maciej, although it took me some time to really understand Maciej’s (clever) method. Does saving operations (e.g., 4 operations is reduced to 2 operations) result in a performance improvement or is it simply more elegant? It seems like it would improve performance because the choose and lookup functions are more like a “lookup table,” if I follow the logic of the operators correctly.
Now for another question: the blue gray in byte 4 is a counter. It counts 0,1,2,3 and repeats. The message is 100Hz/10ms, so it seems like I could implement a similar style counter as described here: Can I make reactive CANBUS Export cycling timers? but unsure if that is the best method because any misalignment or out of tolerance in timing could result in a skipped number, which could result in a failure by the receiving motor controller. The OP of the reference article simply needed an incremental number, so slightly different than my situation.
It looks like the new CRC field supports such counters, but there can only be one CRC field per message, if my experimentation is correct.