LCOV - code coverage report
Current view: top level - AP_EFI - AP_EFI_Backend.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 18 22 81.8 %
Date: 2026-09-09 11:02:08 Functions: 7 9 77.8 %

          Line data    Source code
       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          12 : AP_EFI_Backend::AP_EFI_Backend(AP_EFI &_frontend) :
      25          12 :     frontend(_frontend)
      26             : {
      27          12 : }
      28             : 
      29        4503 : void AP_EFI_Backend::copy_to_frontend() 
      30             : {
      31        4503 :     WITH_SEMAPHORE(frontend.sem);
      32        4503 :     frontend.state = internal_state;
      33        4503 : }
      34             : 
      35       44724 : bool AP_EFI_Backend::healthy() const
      36             : {
      37       44724 :     return (AP_HAL::millis() - frontend.state.last_updated_ms) < HEALTHY_LAST_RECEIVED_MS;
      38             : }
      39             : 
      40         192 : float AP_EFI_Backend::get_coef1(void) const
      41             : {
      42         192 :     return frontend.coef1;
      43             : }
      44             : 
      45          15 : float AP_EFI_Backend::get_coef2(void) const
      46             : {
      47          15 :     return frontend.coef2;
      48             : }
      49             : 
      50           1 : void AP_EFI_Backend::set_default_coef1(float coef1)
      51             : {
      52           1 :     frontend.coef1.set_default(coef1);
      53           1 : }
      54             : 
      55           0 : HAL_Semaphore &AP_EFI_Backend::get_sem(void)
      56             : {
      57           0 :     return frontend.sem;
      58             : }
      59             : 
      60           0 : float AP_EFI_Backend::get_ecu_fuel_density(void) const
      61             : {
      62           0 :     return frontend.ecu_fuel_density;
      63             : }
      64             : 
      65             : #if AP_EFI_THROTTLE_LINEARISATION_ENABLED
      66             : /*
      67             :   linearise throttle if enabled
      68             : */
      69          48 : float AP_EFI_Backend::linearise_throttle(float throttle_percent)
      70             : {
      71          48 :     return frontend.throttle_linearisation.linearise_throttle(throttle_percent);
      72             : }
      73             : #endif // AP_EFI_THROTTLE_LINEARISATION_ENABLED
      74             : 
      75             : #endif // HAL_EFI_ENABLED

Generated by: LCOV version 1.14