mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
Enable battery code again
This commit is contained in:
parent
5a67b8cc29
commit
0a7f5fd5d3
@ -75,12 +75,10 @@ static void onTimer(UAVObjEvent* ev);
|
|||||||
* Initialise the module, called on startup
|
* Initialise the module, called on startup
|
||||||
* \returns 0 on success or -1 if initialisation failed
|
* \returns 0 on success or -1 if initialisation failed
|
||||||
*/
|
*/
|
||||||
MODULE_INITCALL(BatteryInitialize, 0)
|
|
||||||
|
|
||||||
int32_t BatteryInitialize(void)
|
int32_t BatteryInitialize(void)
|
||||||
{
|
{
|
||||||
BatteryStateInitialze();
|
FlightBatteryStateInitialize();
|
||||||
BatterySettingsInitialize();
|
FlightBatterySettingsInitialize();
|
||||||
|
|
||||||
static UAVObjEvent ev;
|
static UAVObjEvent ev;
|
||||||
|
|
||||||
@ -90,6 +88,8 @@ int32_t BatteryInitialize(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_INITCALL(BatteryInitialize, 0)
|
||||||
|
|
||||||
static void onTimer(UAVObjEvent* ev)
|
static void onTimer(UAVObjEvent* ev)
|
||||||
{
|
{
|
||||||
static portTickType lastSysTime;
|
static portTickType lastSysTime;
|
||||||
@ -114,7 +114,6 @@ static void onTimer(UAVObjEvent* ev)
|
|||||||
portTickType thisSysTime;
|
portTickType thisSysTime;
|
||||||
FlightBatterySettingsData batterySettings;
|
FlightBatterySettingsData batterySettings;
|
||||||
static float dT = SAMPLE_PERIOD_MS / 1000;
|
static float dT = SAMPLE_PERIOD_MS / 1000;
|
||||||
float Bob;
|
|
||||||
float energyRemaining;
|
float energyRemaining;
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +128,7 @@ static void onTimer(UAVObjEvent* ev)
|
|||||||
//calculate the battery parameters
|
//calculate the battery parameters
|
||||||
flightBatteryData.Voltage = ((float)PIOS_ADC_PinGet(2)) * batterySettings.SensorCalibrations[FLIGHTBATTERYSETTINGS_SENSORCALIBRATIONS_VOLTAGEFACTOR]; //in Volts
|
flightBatteryData.Voltage = ((float)PIOS_ADC_PinGet(2)) * batterySettings.SensorCalibrations[FLIGHTBATTERYSETTINGS_SENSORCALIBRATIONS_VOLTAGEFACTOR]; //in Volts
|
||||||
flightBatteryData.Current = ((float)PIOS_ADC_PinGet(1)) * batterySettings.SensorCalibrations[FLIGHTBATTERYSETTINGS_SENSORCALIBRATIONS_CURRENTFACTOR]; //in Amps
|
flightBatteryData.Current = ((float)PIOS_ADC_PinGet(1)) * batterySettings.SensorCalibrations[FLIGHTBATTERYSETTINGS_SENSORCALIBRATIONS_CURRENTFACTOR]; //in Amps
|
||||||
Bob =dT; // FIXME: something funky happens if I don't do this... Andrew
|
|
||||||
flightBatteryData.ConsumedEnergy += (flightBatteryData.Current * 1000.0 * dT / 3600.0) ;//in mAh
|
flightBatteryData.ConsumedEnergy += (flightBatteryData.Current * 1000.0 * dT / 3600.0) ;//in mAh
|
||||||
|
|
||||||
if (flightBatteryData.Current > flightBatteryData.PeakCurrent)flightBatteryData.PeakCurrent = flightBatteryData.Current; //in Amps
|
if (flightBatteryData.Current > flightBatteryData.PeakCurrent)flightBatteryData.PeakCurrent = flightBatteryData.Current; //in Amps
|
||||||
|
@ -50,6 +50,7 @@ FLASH_TOOL = OPENOCD
|
|||||||
|
|
||||||
# List of modules to include
|
# List of modules to include
|
||||||
MODULES = Sensors Attitude/revolution ManualControl Stabilization Actuator
|
MODULES = Sensors Attitude/revolution ManualControl Stabilization Actuator
|
||||||
|
MODULES += Battery
|
||||||
MODULES += Altitude/revolution GPS FirmwareIAP
|
MODULES += Altitude/revolution GPS FirmwareIAP
|
||||||
MODULES += AltitudeHold VtolPathFollower PathPlanner
|
MODULES += AltitudeHold VtolPathFollower PathPlanner
|
||||||
MODULES += CameraStab
|
MODULES += CameraStab
|
||||||
|
Loading…
Reference in New Issue
Block a user