48
48
* *
49
49
************************************************************************
50
50
*
51
- * latest build
52
- * RAM : [==== ] 41.8 % (used 34220 bytes from 81920 bytes)
53
- * Flash : [======= ] 67.1 % (used 701191 bytes from 1044464 bytes)
54
- *
51
+ * latest build using lib 2.6.2
52
+ * DATA : [==== ] 41.7 % (used 34128 bytes from 81920 bytes)
53
+ * PROGRAM : [====== ] 67.2 % (used 701371 bytes from 1044464 bytes)
54
+ *
55
55
************************************************************************/
56
56
57
57
#include < WString.h>
@@ -661,6 +661,8 @@ IPAddress addr_static_subnet;
661
661
IPAddress addr_static_gateway;
662
662
IPAddress addr_static_dns;
663
663
664
+
665
+
664
666
#define msSince (timestamp_before ) (act_milli - (timestamp_before))
665
667
666
668
const char data_first_part[] PROGMEM = " {\" software_version\" : \" " SOFTWARE_VERSION_STR " \" , \" sensordatavalues\" :[" ;
@@ -1401,6 +1403,7 @@ static void end_html_page(String &page_content)
1401
1403
server.sendContent (page_content);
1402
1404
}
1403
1405
server.sendContent_P (WEB_PAGE_FOOTER);
1406
+
1404
1407
}
1405
1408
1406
1409
static void add_form_input (String &page_content, const ConfigShapeId cfgid, const __FlashStringHelper *info, const int length)
@@ -2709,6 +2712,8 @@ static void webserver_not_found()
2709
2712
*****************************************************************/
2710
2713
static void setup_webserver ()
2711
2714
{
2715
+ // server.addHandler( new AllRequestHandler());
2716
+
2712
2717
server.on (" /" , webserver_root);
2713
2718
server.on (F (" /config" ), webserver_config);
2714
2719
server.on (F (" /wifi" ), webserver_wifi);
@@ -2725,6 +2730,7 @@ static void setup_webserver()
2725
2730
server.on (F (" /favicon.ico" ), webserver_favicon);
2726
2731
server.on (F (STATIC_PREFIX), webserver_static);
2727
2732
server.onNotFound (webserver_not_found);
2733
+
2728
2734
2729
2735
debug_outln_info (F (" Starting Webserver... " ), WiFi.localIP ().toString ());
2730
2736
server.begin ();
@@ -5972,7 +5978,6 @@ else if (cfg::ips_read)
5972
5978
*****************************************************************/
5973
5979
void loop (void )
5974
5980
{
5975
- unsigned long sleep = SLEEPTIME_MS;
5976
5981
String result_PPD, result_SDS, result_PMS, result_HPM, result_NPM, result_IPS;
5977
5982
String result_GPS, result_DNMS, result_SCD30;
5978
5983
@@ -5982,10 +5987,11 @@ void loop(void)
5982
5987
act_milli = millis ();
5983
5988
send_now = msSince (starttime) > cfg::sending_intervall_ms;
5984
5989
5985
- if (send_now)
5986
- {
5987
- sleep = 0 ;
5988
- }
5990
+ unsigned int pastTime = act_milli - last_page_load;
5991
+ bool keepAlive = pastTime < KEEP_ALIVE_TIME_MS;
5992
+ unsigned long sleep = send_now || keepAlive
5993
+ ? 0
5994
+ : SLEEPTIME_MS;
5989
5995
5990
5996
// Wait at least 30s for each NTP server to sync
5991
5997
if (!sntp_time_set && send_now &&
@@ -6306,7 +6312,7 @@ void loop(void)
6306
6312
6307
6313
// Sleep if all of the tasks have an event in the future. The chip can then
6308
6314
// enter a lower power mode.
6309
- if (cfg::powersave) {
6315
+ if (cfg::powersave && sleep > 0 ) {
6310
6316
delay (sleep);
6311
6317
}
6312
6318
0 commit comments