diff --git a/.gitignore b/.gitignore index 790b585..65a8df0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .vscode/launch.json .vscode .vscode/.browse.c_cpp.db* +.lib/readme.txt diff --git a/src/main.cpp b/src/main.cpp index fec68b8..45840d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,8 @@ Sensor accelerometer = Sensor(); Graph graphAcc = Graph(200, 200); long int lastDataSend = 0; +long int lastTest = 0; +bool testState = false; int timeOfCal = 0; bool accCalibrated = false; @@ -54,6 +56,10 @@ void cookDataToJson(String &in, int *in_array, int array_size) { root.printTo(*output); } +void eatDataFromJson() { + +} + int lowFreqFilter(int inputValue, int lastFilteredValue, int alpha) { return (lastFilteredValue + alpha * (inputValue - lastFilteredValue)+100); } @@ -74,7 +80,6 @@ void updateSensors() if (graphAcc.counter < graphAcc.size - 1) { graphAcc.array[graphAcc.counter] = filteredSignal; - graphAcc.source[graphAcc.counter] = sourceSignal; graphAcc.counter++; } else @@ -82,10 +87,8 @@ void updateSensors() for (int i = 0; i != graphAcc.counter; i++) { graphAcc.array[i] = graphAcc.array[i + 1]; - graphAcc.source[i] = graphAcc.source[i + 1]; } graphAcc.array[graphAcc.counter] = filteredSignal; - graphAcc.source[graphAcc.counter] = sourceSignal; } accelerometer.lastUpdate = millis(); @@ -181,7 +184,7 @@ void loop(void) webSocket.loop(); updateSensors(); sendDataToSocket(); - + selfTest(); updateCpuTime(1);