Path: blob/master/libraries/AP_EFI/AP_EFI_Backend.cpp
9575 views
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/1415#include "AP_EFI.h"1617#if HAL_EFI_ENABLED1819#include "AP_EFI_Backend.h"2021extern const AP_HAL::HAL &hal;2223AP_EFI_Backend::AP_EFI_Backend(AP_EFI &_frontend) :24frontend(_frontend)25{26}2728void AP_EFI_Backend::copy_to_frontend()29{30WITH_SEMAPHORE(frontend.sem);31frontend.state = internal_state;32}3334bool AP_EFI_Backend::healthy() const35{36return (AP_HAL::millis() - frontend.state.last_updated_ms) < HEALTHY_LAST_RECEIVED_MS;37}3839float AP_EFI_Backend::get_coef1(void) const40{41return frontend.coef1;42}4344float AP_EFI_Backend::get_coef2(void) const45{46return frontend.coef2;47}4849void AP_EFI_Backend::set_default_coef1(float coef1)50{51frontend.coef1.set_default(coef1);52}5354HAL_Semaphore &AP_EFI_Backend::get_sem(void)55{56return frontend.sem;57}5859float AP_EFI_Backend::get_ecu_fuel_density(void) const60{61return frontend.ecu_fuel_density;62}6364#if AP_EFI_THROTTLE_LINEARISATION_ENABLED65/*66linearise throttle if enabled67*/68float AP_EFI_Backend::linearise_throttle(float throttle_percent)69{70return frontend.throttle_linearisation.linearise_throttle(throttle_percent);71}72#endif // AP_EFI_THROTTLE_LINEARISATION_ENABLED7374#endif // HAL_EFI_ENABLED757677