2019-11-28 19:04:33 -04:00
# pragma once
2020-10-22 14:11:47 -03:00
# include <AP_Generator/AP_Generator.h>
2021-09-24 00:10:46 -03:00
# if HAL_GENERATOR_ENABLED
2020-10-22 14:11:47 -03:00
2019-11-28 19:04:33 -04:00
# include "AP_BattMonitor.h"
# include "AP_BattMonitor_Backend.h"
2020-10-22 14:11:47 -03:00
// Sub class for generator electrical
class AP_BattMonitor_Generator_Elec : public AP_BattMonitor_Backend
{
public :
// Inherit constructor
using AP_BattMonitor_Backend : : AP_BattMonitor_Backend ;
void init ( void ) override { } ;
// Read the battery voltage and current
void read ( void ) override ;
bool has_current ( void ) const override ;
bool has_consumed_energy ( void ) const override ;
// Override backend update_failsafes. No point in failsafing twice so generator failsafes are only updated from the electrical instance of the generator drivers
2020-10-22 22:33:03 -03:00
AP_BattMonitor : : Failsafe update_failsafes ( ) override ;
2020-10-22 14:11:47 -03:00
} ;
2019-11-28 19:04:33 -04:00
2020-10-22 14:11:47 -03:00
// Sub class for generator fuel
class AP_BattMonitor_Generator_FuelLevel : public AP_BattMonitor_Backend
2019-11-28 19:04:33 -04:00
{
public :
2020-10-22 14:11:47 -03:00
// Inherit constructor
2019-11-28 19:04:33 -04:00
using AP_BattMonitor_Backend : : AP_BattMonitor_Backend ;
2020-10-22 14:11:47 -03:00
void init ( void ) override ;
2019-11-28 19:04:33 -04:00
2020-10-22 14:11:47 -03:00
// Read the fuel level
void read ( void ) override ;
2019-11-28 19:04:33 -04:00
2020-10-22 14:11:47 -03:00
// This is where we tell the battery monitor 'we have current' if we want to report a fuel level remaining
bool has_current ( void ) const override ;
2019-11-28 19:04:33 -04:00
2023-10-11 04:41:51 -03:00
// This is where we tell the battery monitor 'we have consumed energy' if we want to report a fuel level remaining
2020-10-22 14:11:47 -03:00
bool has_consumed_energy ( void ) const override ;
2019-11-28 19:04:33 -04:00
} ;
2020-10-22 14:11:47 -03:00
# endif