Easy Training / Training

Dependents:   Easyfit

Revision:
4:4e871024310a
Parent:
2:0df0d0be0664
Child:
5:da9b6946a035
--- a/training.cpp	Sat May 02 13:01:37 2020 +0000
+++ b/training.cpp	Sun May 17 18:53:41 2020 +0000
@@ -50,14 +50,15 @@
 
 }
 
-void training::compire_point(float posx,float posy,float posz, int time)
+int training::compire_point(float posx,float posy,float posz, int time)
 {
     float temp_pos[3] = {};
     float dist = 0, timediv = 0;
+    int resetval = 0;
 
     if(data_vec[point_count].start) {                                           // counts the repetitions
         repet++;
-
+        resetval = 1;
     }
 
     temp_pos[0] = posx - data_vec[point_count].pos[0];                          // calculates distance curent to needed
@@ -71,6 +72,7 @@
     }
 
     if(data_vec[point_count].end) {                                             // counts time too short and time too long
+        resetval = 2;
         timediv = time - (data_vec[point_count].time);
         if(timediv>=TIMETOL) {
             time_long++;
@@ -85,6 +87,8 @@
     if(point_count>= data_vec.size()) {                                         // resets the piontecount after a complet cycle
         point_count = 0;
     }
+    
+    return resetval;
 
 }
 
@@ -101,4 +105,11 @@
 void training::end_training(string name)
 {
     // writhe status to memory / update memory
+    fail_pos = 0;
+    time_short = 0;
+    time_long = 0;
+    point_count = 0;
+    repet = 0;
+    data_vec.clear();
+    
 }
\ No newline at end of file