Pair of scripts to update the progress variable in a pixel blaze script
Go to file
Morgan 'ARR\!' Allen 590e56dcdd README.md 2023-04-19 13:39:59 -07:00
README.md README.md 2023-04-19 13:39:59 -07:00
main.py linuxcnc > mqtt and mqtt > pixelblaze scripts 2023-04-19 13:24:37 -07:00
pb_proxy.py linuxcnc > mqtt and mqtt > pixelblaze scripts 2023-04-19 13:24:37 -07:00

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