Here is the final part to this module: wrapping it up and making it easy to use. SIMPL Windows is a powerful tool because it easily abstracts away a lot of details about how things happen. The way our phonebook works under the hood will be a detail we needn’t worry about, it will just plug into our larger programs.
Continue reading “Soup-to-Nuts: Phonebook Module (Part 4)”Tag: simpl plus
SIMPL+ Best Practice
I just finished watching the videos posted of Toine lecturing at Crestron Masters 2017. Sadly, this was a session I really wanted to sit in, but the space was reserved for veteran programmers (and this was my first time attending Masters).
He has many good points about how SIMPL+ has many bottlenecks to understand and work with, but one of his talks at the end covered GatherAsync. He prefaced this section by quickly covering what he considers the best practice for writing a CHANGE event in SIMPL+.
Here’s an example showing the design pattern:
THREADSAFE CHANGE From_Device { String Temp[MAX_LINE_LENGTH]; While (1) { Temp = Gather("\r", From_Device); MakeString(To_Device, "RX: %s", Temp); } }
This pattern works for 2-series and 3-series processors. Toine even says he can’t think of a better way to process incoming data from a device.
Normally, SIMPL+ operates at the lowest thread priority. The Gather function, however, runs at a higher priority so it can quickly service data coming in from devices. I wanted to pull this one idea out of his talk and put it into a blog post so I could easily remind myself that this is Crestron’s best practice.
SIMPL+ Tips and Tricks
I’ve spent the last week or so diving into Crestron SIMPL+ and have been reminded what a quirky language it is. Here are some of the concepts I’ve been bitten by.