Expandable-6-Channel-ESP32-Energy-Meter icon indicating copy to clipboard operation
Expandable-6-Channel-ESP32-Energy-Meter copied to clipboard

Feature request: EmonESP change sampling rate

Open Projects0987 opened this issue 2 years ago • 1 comments

Would it be possible to add the option to adjust the sampling rate on the EmonESP via the web access? Currently it is doing every second which is crating 1000's of data points. If not do I just add a delay in the emoncms.cpp?

Thanks, Matt

Projects0987 avatar Jan 21 '22 16:01 Projects0987

I'm not a programmer, but this solution is working for me. I added a delay line at the bottom of the loop in SRC. See below.

// ------------------------------------------------------------------- // LOOP // ------------------------------------------------------------------- void loop() { #ifdef ENABLE_WDT feedLoopWDT(); #endif

web_server_loop(); wifi_loop();

#ifdef ESP8266 ota_loop(); #endif

#ifdef ENABLE_ENERGY_METER energy_meter_loop(); #endif

boolean gotInput = input_get(input); if (gotInput) { DBUGS.println("."); }

if (wifi_client_connected()) { if (emoncms_apikey != 0 && gotInput) { DBUGS.println(input); emoncms_publish(input); } if (mqtt_server != 0) { mqtt_loop(); if (gotInput && mqtt_connected()) { mqtt_publish(input); } } } // ------------------------------------------------------------------- delay(60000); //60-Second delay // ------------------------------------------------------------------- } // end loop

github768484 avatar Jan 31 '22 14:01 github768484