tom-2015 / rpi-ws2812-server

Raspberry Pi WS2812 (web) server tool
172 stars 39 forks source link

New command store/laststate possible? #42

Open Bigdeath opened 4 years ago

Bigdeath commented 4 years ago

Is it possible to make a store and laststate command? example: I am making a fill with red and will send a blink at some point. And say a laststate command within the blink command that it automatically returns to the last state in the case just red. You could give the fill example a store that the laststate knows what it has to do.

With the store command you could generate a file or save it at the memory that stores the whole command and calls it with laststate. Each store then overwrites the last store.

I hope you understand what I mean.

Greetings

Bigdeath commented 4 years ago

No Answer about 1,5 months?

tom-2015 commented 4 years ago

Sorry, I've been busy with other project did not have time to implement yet.

Bigdeath commented 4 years ago

ok, no problem. Thanks for the Answer.

tom-2015 commented 4 years ago

Added these commands (load_state and save_state) and now updated the documentation. Can you check if it is working properly?

Bigdeath commented 4 years ago

I have now tried to test it with a few scripts. I just don't quite understand how it works. No CSV is created. I think I'm just doing it wrong. Where exactly should it be inserted? At the end? Is only the last status saved in itself or a whole effect?

In my case i would like to save the endles loop from this Script:

<?php
send_to_leds("
thread_start
brightness 2,255
blink 2,FFFFFF,000000,100,10
render 2
rainbow 2
render 2
do
       rotate 2
       render 2
       delay 1000
loop
brightness 2,255
fill 2, 000000
render 2
thread_stop
");
function send_to_leds ($data){
   $sock = fsockopen("192.168.178.29", 9997);
   fwrite($sock, $data);
   fclose($sock);
}
$timestamp = time();
$datum = date("d.m.Y - H:i:s", $timestamp);
echo $datum;
$datei = fopen("./triggers.txt", "a+");
$date=date("d.m.Y - H:i:s");
fwrite($datei, $daten."LEDPION: $date\r\n");
fclose($datei);
?>
tom-2015 commented 4 years ago

It saves the current led state (color and brightness). So normally you put the

save_state 1, "/dev/shm/test.csv"

At the end to save the current led state.