CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_EFI/AP_EFI_Backend.cpp
Views: 1798
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
#include "AP_EFI.h"
17
18
#if HAL_EFI_ENABLED
19
20
#include "AP_EFI_Backend.h"
21
22
extern const AP_HAL::HAL &hal;
23
24
AP_EFI_Backend::AP_EFI_Backend(AP_EFI &_frontend) :
25
frontend(_frontend)
26
{
27
}
28
29
void AP_EFI_Backend::copy_to_frontend()
30
{
31
WITH_SEMAPHORE(frontend.sem);
32
frontend.state = internal_state;
33
}
34
35
float AP_EFI_Backend::get_coef1(void) const
36
{
37
return frontend.coef1;
38
}
39
40
float AP_EFI_Backend::get_coef2(void) const
41
{
42
return frontend.coef2;
43
}
44
45
void AP_EFI_Backend::set_default_coef1(float coef1)
46
{
47
frontend.coef1.set_default(coef1);
48
}
49
50
HAL_Semaphore &AP_EFI_Backend::get_sem(void)
51
{
52
return frontend.sem;
53
}
54
55
float AP_EFI_Backend::get_ecu_fuel_density(void) const
56
{
57
return frontend.ecu_fuel_density;
58
}
59
60
#if AP_EFI_THROTTLE_LINEARISATION_ENABLED
61
/*
62
linearise throttle if enabled
63
*/
64
float AP_EFI_Backend::linearise_throttle(float throttle_percent)
65
{
66
return frontend.throttle_linearisation.linearise_throttle(throttle_percent);
67
}
68
#endif // AP_EFI_THROTTLE_LINEARISATION_ENABLED
69
70
#endif // HAL_EFI_ENABLED
71
72