I wasn’t thinking of doing anything quite so hacky as counting frames; I was just reflecting on a couple of points made in other threads:
- that 1D patterns which look good on a small strand often need to be slowed down when displayed in large scales like the outside of a house
- that many of the computationally complex 2D patterns need tuning to look good for a specific combination of device (v2/v3) and display (8x8,8x32,16x16,32x32, …)
- that there are language differences (such as the name of the analog input variable) between v2 and v3 hardware, regardless of software versions
- that the language features (including bugfixes like
atan2
) do not advance in parallel across all hardware platforms simultaneously - that there are times when you just need to know what you’re dealing with, like when dealing with the timing of external inputs
- that the increasing number of Pixelblazes, patterns, and permutations thereof in my life has already become a maintenance headache in only nine months. I built a little tool to fetch the patterns off my 'blazes so I can back them up and put them under version control, but even so it’s a tedious process to diff them and keep track of the little tweaks to code and variables for patterns that geniunely need to be different across devices.
I’ve seen recommendations to put anything that needs parameterization into a variable and then send the correct values to each device over websockets, but that requires yet another device and introduces yet another configuration element to keep track of…whereas if just a little bit of information about the system was made available to a pattern, it would be possible to handle all those sources of variation in a single code base.
Shims don’t need to be transparent; they just need to be optional. Making the use of new language features conditional (i.e. if (software_id() >= 3) { array.mutate((x) = > ... } else { for (i=0;i<10;i++) {array[i]=...} }
) could save a lot of cut-and-paste time as the platforms evolve.
Regarding device_id, I had in mind that the device would be referenced using the MAC as a hex literal: if (device_id() == 0xB10862) start_index = 201
; but I agree, a textual version like deviceNameIs("name")
would be even better.
skipRender()
is an interesting idea; I was tempted once to set a “dirty” flag within beforeRender()
when there was something new that needed to be output, but in the end I didn’t bother because I didn’t have had anything constructive to do with the time saved while the beforeRender()
was accumulating delta
during the “not dirty” cycles. Maybe it could save power in some applications like battery-powered costumes?