Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program takes a long time to respond #29

Open
davidpuetter opened this issue Jun 19, 2019 · 3 comments
Open

Program takes a long time to respond #29

davidpuetter opened this issue Jun 19, 2019 · 3 comments

Comments

@davidpuetter
Copy link

davidpuetter commented Jun 19, 2019

Hi, I'm currently using this program on a RPI 3B+ using : sudo ./ws2812svr -i "setup 1,60,3;init;" -tcp 9999 and I'm running the php script here: https://github.com/tom-2015/rpi-ws2812-server/blob/master/php/index.php on a remote machine on the local network (I changed the IP in fsockopen)

So far, only the rainbow/brightness commands work - however they take a long time to respond (a minute or two) and react. The rotating rainbow never responded even after 10 minutes.
The program outputs 'Client Connected' as soon as I press an option on the website, and then after the colour changed after a few minutes, it says 'Waiting for client to connect'. I checked CPU usage with top and it remains at around 25% while executing, and 1.3% when done.

I've tried the following #28 and that did not succeed.

@tom-2015
Copy link
Owner

Can you post the PHP code you are using?

@davidpuetter
Copy link
Author

<?php
$cmd = @$_REQUEST['cmd'];
$brightness = intval(@$_REQUEST['brightness']);
$color = @$_REQUEST['color'];
if ($color=='') $color='FF0000';
if ($brightness==0) $brightness=32;
$data  = "";
if ($cmd!=''){
    switch ($cmd){
        case 'fill':
            $data .= "brightness 1,$brightness;fill 1,$color;render;";
            break;
        case 'rainbow':
            $data .= "brightness 1,$brightness;rainbow;render;";
            break;
        case 'rotating_rainbow':
            $data .= "brightness 1,$brightness;
                      thread_start;
                     do;
                        rotate 1,1,2;
                        render;
                        delay 200;
                     loop;
                    thread_stop;";
            break;
    }
    send_to_leds($data);
}
function send_to_leds ($data){
    $sock = fsockopen("192.168.XXX.XXX", 9999);
    fwrite($sock, $data);
    fclose($sock);
}
?>

@tom-2015
Copy link
Owner

tom-2015 commented Jun 24, 2019

Can't see problem, what happens if you run the same commands from a text file or direct enter on CLI?
Try connecting to the server with putty (raw mode) and paste the code to see if it's PHP related or not.

Enable debug mode on the ./ws2812svr command (add -d). See what the program prints when PHP is connecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants