diff --git a/src/main.cpp b/src/main.cpp index a197073..5f074c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,8 @@ const char *ssid = "LabWork_1"; ESP8266WebServer server(80); Sensor accelerometer = Sensor(); Graph graphAcc = Graph(256, 50); +Ticker sensorTicker, stepTicker; + double vReal[256]; double vImag[256]; @@ -30,12 +32,16 @@ int accCalRemains = 0; int accMax1 = 0; int accMax2 = 0; + +double peakFreq = 0; +int steps = 0; + WebSocketsServer webSocket = WebSocketsServer(81); void handleAccelerometer() { int16_t bias = 0; - const int arr_size = 5000; + const int arr_size = 7000; char *html_code = new char[arr_size]; memset(html_code, '\0', sizeof(char) * arr_size); @@ -189,17 +195,14 @@ void setup(void) webSocket.onEvent(webSocketEvent); pinMode(A0, INPUT); + sensorTicker.attach_ms(33, updateAccelerometer); + stepTicker.attach_ms(8500, stepUpdater); } void loop(void) { - updateCpuTime(0); - server.handleClient(); - webSocket.loop(); - updateAccelerometer(); + delay(10); sendAccelerometerData(); - - updateCpuTime(1); - printCpuLoad(); + delay(10); } \ No newline at end of file