added beacon stuff similiar architecture then wifi \n added activity percentage stuff \n added testcases

This commit is contained in:
toni
2016-11-04 17:25:49 +01:00
parent 7f53f83da0
commit a35a22e676
26 changed files with 1207 additions and 144 deletions

View File

@@ -38,12 +38,20 @@ public:
Activity currentActivity;
MovingAVG<float> mvAvg = MovingAVG<float>(20);
/** change this values for much success */
/** change this values for much success
*
* Nexus 6:
* butter = Filter::ButterworthLP<float>(10,0.1f,2);
* threshold = 0.025;
* diffSize = 20;
* FixedFrequencyInterpolator<float> ffi = FixedFrequencyInterpolator<float>(Timestamp::fromMS(100));
*/
const bool additionalLowpassFilter = false;
const int diffSize = 20; //the number values used for finding the activity.
const int diffSize = 20; //the number values used for finding the activity.
const float threshold = 0.025; // if diffSize is getting smaller, treshold needs to be adjusted in the same direction!
Filter::ButterworthLP<float> butter = Filter::ButterworthLP<float>(10,0.1f,2);
Filter::ButterworthLP<float> butter2 = Filter::ButterworthLP<float>(10,0.1f,2);
Filter::ButterworthLP<float> butter = Filter::ButterworthLP<float>(10,0.05f,2);
Filter::ButterworthLP<float> butter2 = Filter::ButterworthLP<float>(10,0.05f,2);
FixedFrequencyInterpolator<float> ffi = FixedFrequencyInterpolator<float>(Timestamp::fromMS(100));
public:
@@ -68,14 +76,14 @@ public:
return STAY;
}
input.push_back(History(ts, baro));
//input.push_back(History(ts, baro));
bool newInterpolatedValues = false;
//interpolate & butter
auto callback = [&] (const Timestamp ts, const float val) {
float interpValue = val;
inputInterp.push_back(History(ts, BarometerData(interpValue)));
//inputInterp.push_back(History(ts, BarometerData(interpValue)));
//butter
float butterValue = butter.process(interpValue);
@@ -113,7 +121,7 @@ public:
}else{
actValue = sum;
}
sumHist.push_back(actValue);
//sumHist.push_back(actValue);
if(actValue > threshold){
currentActivity = DOWN;
@@ -127,7 +135,7 @@ public:
}
}
actHist.push_back(History(ts, BarometerData(currentActivity)));
//actHist.push_back(History(ts, BarometerData(currentActivity)));
return currentActivity;