Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
training.h
- Committer:
- MarcelPortmann
- Date:
- 2020-04-29
- Revision:
- 2:0df0d0be0664
- Parent:
- 1:aa8497b98ef4
- Child:
- 3:1ce1b3915621
File content as of revision 2:0df0d0be0664:
/*
Training Class for EasyFitnes
This class loads Position data from the memory and compairs it with the data wich
is transmitet from the IMU via the main programm
it counts all misstaiks over a certain value and reports them back.
when questions ask someone else
the autor is not responsible for any spelling mistakes
*/
/*
Typical Programm use example
1. call constructor and creat object; training test();
2. load selectet training into function test.load_training(string name);
3. set all parameters to begin training test.start_training(void);
4. during training compair all points with the recordet ones test.compire_point(float posx,float posy,float posz, int time);
5. repeat point 4 until the end of the trainings sesion
6. finish training and saves status to memory at block name test.end_training(string name);
to get a intermediat reading from the status use test.get_status(void);
*/
#include <vector>
#include <string>
#include "mbed.h"
#include "memory.h"
#ifndef training_H // no idea what this does
#define training_H // seems important
#define POSTOL 20 // max pos toleranz point to point in mm
#define TIMETOL 3 // max time toleranz
#define SHORTMAX 5 // max time to short
#define LONGMAX 5 // max time to long
#define FAILPOSMAX 100 // max position fails
struct posdata{
int time;
int hi, low;
bool end, start;
float pos[3];
};
class training
{
public:
training(void);
void load_training(string name); // loads a training from the sd card into the flash
void start_training(void); // sets all parameters to begin training
void compire_point(float posx,float posy,float posz, int time); // compairs curent point to memory point and counts repetitions
void end_training(string name); // creates a feedback and stores it into the SD card
int* get_status(void); // returns a pointer to an int array with fail pot, time short, time long, pointcount
private:
std::vector<posdata> data_vec; // dynamic array for trainings data
int fail_pos;
int time_short;
int time_long;
int repet;
int point_count;
memory loading;
string tr_name;
struct posdata temp;
int status_array[4];
};
#endif