neophob / PixelController

(LED) Matrix Control Software, supports various Hardware, Keywords: LED Matrix, OSC, Realtime, VJ, Arduino, Teensy, RPI
www.pixelinvaders.ch
GNU General Public License v3.0
286 stars 103 forks source link

2.1.0-RC1: OSC Random & Random Preset Mode #73

Closed belmendo closed 10 years ago

belmendo commented 10 years ago

I'm trying to take advantage of the randommode.lifetime.in.s config property - which is great for stand-alone operation.

In TouchOSC Editor, I'm trying to create Toggle buttons for /RANDOM and /RANDOM_PRESET_MODE but they take strings as parameters. Any chance you can do a translation on java side so '1' means "ON" and '0' means "OFF"? (Unless you know how to pass strings from Toggle buttons.)

When sending those OSC commands, the interface buttons on OSX 10.9.2 don't respond but I can see the commands being accepted in the log file.

Thanks again!

neophob commented 10 years ago

good catch, I implemented it. try to download the latest pixelcontroller release from the build server:

https://buildhive.cloudbees.com/job/neophob/job/PixelController/ws/pixelcontroller-distribution/target/assembly/pixelcontroller-distribution-2.1.0-RC2/*zip*/pixelcontroller-distribution-2.1.0-RC2.zip

let me know if that works

belmendo commented 10 years ago

Above link doesn't work - complains about No Workspace.

Thanks!

neophob commented 10 years ago

Try this temp download: https://dl.dropboxusercontent.com/u/3548330/pixelcontroller-distribution-2.1.0-RC2.zip

belmendo commented 10 years ago

Tried the download. It didn't quite work so I had a friend help me get it to build locally. Our Java skills are weak.

After some experimenting, TouchOSC is sending Ints and PixelController is using Floats. We just added some more logic and turn the mode off if it receives an unknown message.

                case RANDOM: // enable or disable random mode
                    try {
                        String onOrOff = msg[1];

                        if (ON.equalsIgnoreCase(onOrOff) || "1.0".equalsIgnoreCase(onOrOff) 
                            || "1".equalsIgnoreCase(onOrOff)) {
                            col.setRandomPresetMode(false);
                            col.setRandomMode(true);
                            LOG.log(Level.INFO, "Random Mode enabled");
                        } else {
                            col.setRandomPresetMode(false);
                            col.setRandomMode(false);
                            LOG.log(Level.INFO, "Random Mode disabled");
                        }
                    } catch (Exception e) {
                        LOG.log(Level.WARNING, IGNORE_COMMAND, e);
                    }
                    break;

                case RANDOM_PRESET_MODE:
                    try {
                        String onOrOff = msg[1];
                        if (ON.equalsIgnoreCase(onOrOff) || "1.0".equalsIgnoreCase(onOrOff) 
                            || "1".equalsIgnoreCase(onOrOff)) {
                            col.setRandomMode(false);
                            col.setRandomPresetMode(true);
                            LOG.log(Level.INFO, "Random Preset Mode enabled");
                        } else {
                            col.setRandomMode(false);
                            col.setRandomPresetMode(false);
                            LOG.log(Level.INFO, "Random Preset Mode disabled");
                        }
                    } catch (Exception e) {
                        LOG.log(Level.WARNING, IGNORE_COMMAND, e);
                    }
                    break;

Do you still get the pixelinvaders dot ch emails?

Really enjoying this project! Thank you!

neophob commented 10 years ago

yes, michu at pixelinvaders dot ch - can you send me the log files, so I see the errors, thanks

neophob commented 10 years ago

Ok I improved the handling, it should work with Strings (ON), ints (1) and floats (1.0). and if the parameter is something else a log message will be generated.

can you redownload it here: https://dl.dropboxusercontent.com/u/3548330/pixelcontroller-distribution-2.1.0-RC2.zip

and test? thanks

belmendo commented 10 years ago

Confirmed all of the above. Passed ON/OFF, 1/0, 1.0/0.0, and Z. Got correct responses including the new log message for unknown option Z.

Thank you!

neophob commented 10 years ago

Great, thanks for the test