Pair of scripts to update the progress variable in a pixel blaze script
main.py | ||
pb_proxy.py | ||
README.md |
LinuxCNC to Pixelblaze Progress Bar
Will work with any Pixelblaze script that declares and uses...
export var progress = 0;
Example of the adapted Block Reflection script.
export var progress = 0.6;
export function beforeRender(delta) {
t2 = time(0.1) * PI2
t1 = time(.1)
t3 = time(.5)
t4 = time(0.2) * PI2
}
export function render(index) {
if(index > (progress * pixelCount)) return hsv(0,0,0);
h = sin(t2)
m = (.3 + triangle(t1) * .2)
h = h + (((index - pixelCount / 2) / pixelCount * ( triangle(t3) * 10 + 4 * sin(t4)) % m))
s = 1;
v = ((abs(h) + abs(m) + t1) % 1);
v = v * v
hsv(h, s, v)
}
This requires running both Python 2 and Python 3 (sooooorrry), because current LinuxCNC 2.8 only supports Python 2 and the pixelblaze-client only supports Python 3. These will be merged to a single script when LinuxCNC 2.9 because current.
Prerequisites
pip install paho-mqtt pixelblaze-client