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_BattMonitor/AP_BattMonitor_Generator.h
Views: 1798
1
#pragma once
2
3
#include <AP_Generator/AP_Generator.h>
4
5
#if HAL_GENERATOR_ENABLED
6
7
#include "AP_BattMonitor.h"
8
#include "AP_BattMonitor_Backend.h"
9
10
// Sub class for generator electrical
11
class AP_BattMonitor_Generator_Elec : public AP_BattMonitor_Backend
12
{
13
public:
14
15
// Inherit constructor
16
using AP_BattMonitor_Backend::AP_BattMonitor_Backend;
17
18
void init(void) override {};
19
20
// Read the battery voltage and current
21
void read(void) override;
22
23
bool has_current(void) const override;
24
25
bool has_consumed_energy(void) const override;
26
27
// Override backend update_failsafes. No point in failsafing twice so generator failsafes are only updated from the electrical instance of the generator drivers
28
AP_BattMonitor::Failsafe update_failsafes() override;
29
};
30
31
// Sub class for generator fuel
32
class AP_BattMonitor_Generator_FuelLevel : public AP_BattMonitor_Backend
33
{
34
public:
35
36
// Inherit constructor
37
using AP_BattMonitor_Backend::AP_BattMonitor_Backend;
38
39
void init(void) override;
40
41
// Read the fuel level
42
void read(void) override;
43
44
// This is where we tell the battery monitor 'we have current' if we want to report a fuel level remaining
45
bool has_current(void) const override;
46
47
// This is where we tell the battery monitor 'we have consumed energy' if we want to report a fuel level remaining
48
bool has_consumed_energy(void) const override;
49
};
50
#endif
51
52