-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHMIArq.h
108 lines (88 loc) · 2.91 KB
/
HMIArq.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* HMIArq.h
*
* Created on: 16 abr. 2017
* Author: Sergio
*/
#ifndef HMIArq_H_
#define HMIArq_H_
#include "Autopilot.h"
// All configurations are managed in Fenix_config.h
#include "Fenix_config.h"
////rudder inc/dec rate
//#define RATE_1 10
//#define RATE_10 30
//
//// Maximum time (in millisecs) to answer to user request
//#define MAX_USER_ANSWER_TIME 5000
enum e_operation {OP_ADD, OP_DEC, OP_MULT, OP_DIV};
enum e_requestStatus {NO_USER_REQUEST, WAITING_USER_ANSWER, USER_ACCEPTED, USER_REJECTED, REQUEST_TIME_OUT};
static e_requestStatus _requestStatus = NO_USER_REQUEST; // There is a request to user for confirmation to change Waypoint
//static char _requestDestID[5] ={'-','-','-','-','\0'}; // current request is associated to this WPID TODO: Avoid confirmation of wrong WPID
static double _requestTime =0; // time when request was launched
class HMIArq {
public:
HMIArq(Autopilot*);
virtual ~HMIArq();
//Library I/F
virtual void setup() = 0;
virtual void refresh() = 0;
protected:
Autopilot* MyPilot;
void Start_Stop(e_start_stop type=CURRENT_HEADING);
void Start_Stop_wind(void);
void Set_TrackMode(s_APB APB);
void Inc_Rudder_1();
void Inc_Rudder_10();
void Dec_Rudder_1();
void Dec_Rudder_10();
void Stop_Rudder();
void Inc_Course_1();
void Inc_Course_10();
void Dec_Course_1();
void Dec_Course_10();
void Inc_Mix_1();
void Inc_Mix_10();
void Dec_Mix_1();
void Dec_Mix_10();
void Set_NewCourse(float newCourse);
void Set_NextCourse(float nextCourse);
void Set_NextCourse_delta(int delta);
void Set_Tacking(int delta);
void Accept_Next(void);
void Set_NewDeltaCourse(float newDCourse);
void Set_Headalign();
void Enter_Exit_FBK_Calib();
void Start_Cancel_AutotunePID();
void ResetPID();
void Request_PIDgain(s_PIDgain & PIDgain);
void Request_instParam(s_instParam & instParam);
void Request_APinfo(s_APinfo & APinfo);
void Request_IMUcal(s_IMUcal & IMUcal);
void Request_FBKcal(s_FBKcal & FBKcal);
void Change_PID(s_PIDgain_flag, s_gain);
void Change_PID_rel (s_PIDgain_flag change, e_operation op, float value );
void Apply_PIDrecom();
bool Change_instParam (s_instParam instParam);
void setDBConf (type_DBConfig status);
void nextDBConf (void);
void received_APB( s_APB APB);
void received_HDM( s_HDM HDM);
void received_VWR( s_VWR VWR);
void Start_Cal(char sensor = '-');
void Cal_NextSensor (void);
void Cancel_Cal();
void Save_Cal();
void Save_instParam();
void Save_PIDgain();
void Save_HCParam(); // Saves GAIN and Inst.Param HARDCODED values
void Load_calibrate_py(s_calibrate_py calibrate_py); // Load ICM20948 calibration parameters from calibrate.py programme
bool check_userRequest(void);
static e_requestStatus userRequest (void);
static e_requestStatus userRequestAnswer (bool answer);
static e_requestStatus getRequestStatus ();
private:
void operation (e_operation op, float &K, float value);
static bool updateRequestTimeout ();
};
#endif /* HMIArq_H_ */