From 8b923174ebd88ad6ee50610ecad3d6ae5ee4d304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sun, 29 Apr 2018 11:13:13 +0300 Subject: [PATCH] increased cpu clock; added autorestart line at cpu lag --- platformio.ini | 1 + src/CpuLoad.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 8abd15a..c956083 100644 --- a/platformio.ini +++ b/platformio.ini @@ -6,4 +6,5 @@ platform = espressif8266 board = nodemcuv2 framework = arduino monitor_baud = 115200 +board_f_cpu = 160000000L lib_deps = ./lib/Json.zip, ./lib/WebSockets.zip diff --git a/src/CpuLoad.h b/src/CpuLoad.h index 883fa85..7cfda17 100644 --- a/src/CpuLoad.h +++ b/src/CpuLoad.h @@ -30,7 +30,9 @@ static void printCpuTime () { static void printCpuLoad () { if (millis() - cpuTimeLastUpdate > 2000) { - Serial.printf("CPU Load: %ld \n", cpuLoadAvgTime/10000); + int x = cpuLoadAvgTime/10000; + Serial.printf("CPU Load: %ld \n", x); + if (x > 400) ESP.restart(); cpuTimeLastUpdate = millis(); } }