Pixelblaze-client compilePattern can't be converted to PBP

Has anyone had any luck compiling a PBP from a javascript pattern file “offline”? I’m trying to setup a build system so I can deploy pixelblaze patterns more efficiently.

I am trying to use @zranger1 's awesome pixelblaze-client library. Currently I am able to upload my manually downloaded Main.pbp file, which was created afer I edited my Main.js file on the pixelblaze IDE.

Now I am trying to use the pixelblaze-client’s compilePattern method to convert my Main.js source code into bytecode, and then finally use PBP.fromBytes() on this compiled bytecode to produce a Main.pbp.

It seems that I am getting compiled bytecode, and I am converting it to a Main.pbp, but I have a feeling that the compiled bytecode is not the correct format for the PBP class to convert. When I try to use PBP.toPixelblaze() to send the Main.pbp, the compiled pattern does not upload like a normal pbp file would.

I read in the compilePattern() comments that the method is meant to be used to send a binary to the renderer, so I’m wondering if there is a better way to compile bytecode?

My next step is to try using selenium to spoof the IDE into thinking a user is uploading the Main.js via a script.

I’ve actually never tried using it that way - will look at it over the weekend and see if I can figure out a simple way to make it work. It may turn out to be, if not impractical, at least inconvenient.

What exactly are you passing to PBP.fromBytes()? Not just the output from compilePattern(), right? A PBP needs the compiled byte code, plus a UID string for the pattern, a jpeg-encoded preview image, the pattern’s source as a JSON object, and the name of the pattern as a string. They’re normally built by reading an .epe file, either directly the pixelblaze or from the file system.

1 Like

yes I was passing the output from compilePattern into PBP.fromBytes. So maybe I need to combine the UID string, a jpeg-encoded preview images, that pattern’s source, and the compiled bytecode before passing it into PBP.fromBytes().