jamct / DoorsignEPD

Doorsign with E-Paper-Display with ESP32. Loading images from webserver.
GNU General Public License v3.0
100 stars 36 forks source link

change sleeptime dynamicly #11

Closed JaquelineP closed 6 years ago

JaquelineP commented 6 years ago

Is there a possiblity to change the sleeptime dynamicly like it is done with the Production mode?

`//To stop productionMode (no deep sleep, web config), set http-header X-productionMode: false

header("X-productionMode: false");`

If Yes: Please provide the required Header or publish in which file/library the Header is processed.

jamct commented 6 years ago

Not implemented at the moment. Will add it to my todo!

d-gattermann commented 6 years ago

Similar request: reduced update interval during the night (when nobody is seeing changes) anyway. Bonus points for a different schedule on weekends.

jamct commented 6 years ago

I think we need a control surface for this ideas. I like it: Manage sleep times and contents for multiple displays. Will think about it.

JaquelineP commented 6 years ago

I think if there is a header available (like for production-mode) it is pretty straightforward.

The Header transmits the next sleeptime to the ESP-32 and everything else can be configuered in php.

what is unclear to me is weather the Header information needs to be in the index.php or can also be in the content files (conference-room.php etc.). I will test that shortly. If it is possible to write it in the content files as well, every display can have different sleeptimes configuered in the coresponding content.php file.

It is also easy in php to find out whether it is a workday or not so the request from d-gattermann is easily implemented as well without the need for a control surface.

JaquelineP commented 6 years ago

It works with aditional header lines in the index.php file and a small adition in the DoorsignEPD.ino file. I will create a pull-request tomorrow if I have time.

In Index.php:

if(intval(date("H"))>= 6 and intval(date("H"))<=8){
    header("X-sleepTime: 60");
}
else{   header("X-sleepTime: 300");
}

in DoorsignEPD.ino after line 186:

if (header.indexOf("X-sleepTime") > 0) { iot.configuration.set("ImageWait",header.substring(header.indexOf("X-sleepTime")+13,header.indexOf("X-sleepTime")+15)); }

jamct commented 6 years ago

Nice work!

JaquelineP commented 6 years ago

@d-gattermann for your weekend/night case you could use something like:

Still buggy as i am only reading 2 chars in the Arduino file! facepalm

if(intval(date("H"))> 23 or intval(date("H"))<6){

    header("X-sleepTime: 3600");

}

else{

    header("X-sleepTime: 300");

}

if(date("l")=="Saturday" or date("l")=="Sunday"){

    header("X-sleepTime: 120");

}
d-gattermann commented 6 years ago

@JaquelineP Thanks!

jamct commented 6 years ago

Feature is added by #22. Thanks to @jdede