DataFlash: log consumed energy (Wh)

This commit is contained in:
Holger Steinhaus 2017-12-05 10:54:11 +01:00 committed by WickedShell
parent 7383552ebc
commit d1a37a60b7
2 changed files with 8 additions and 4 deletions

View File

@ -1562,6 +1562,7 @@ void DataFlash_Class::Log_Write_Current_instance(const uint64_t time_us,
voltage_resting : battery.voltage_resting_estimate(battery_instance),
current_amps : battery.current_amps(battery_instance),
current_total : battery.current_total_mah(battery_instance),
consumed_wh : battery.consumed_wh(battery_instance),
temperature : (int16_t)(has_temp ? (temp * 100) : 0),
resistance : battery.get_resistance(battery_instance)
};

View File

@ -84,6 +84,7 @@ const struct UnitStructure log_Units[] = {
{ 'G', "Gauss" }, // Gauss is not an SI unit, but 1 tesla = 10000 gauss so a simple replacement is not possible here
{ 'h', "degheading" }, // 0.? to 359.?
{ 'i', "A.s" }, // Ampere second
{ 'J', "W.s" }, // Joule (Watt second)
// { 'l', "l" }, // litres
{ 'L', "rad/s/s" }, // radians per second per second
{ 'm', "m" }, // metres
@ -126,6 +127,7 @@ const struct MultiplierStructure log_Multipliers[] = {
{ 'G', 1e-7 },
// <leave a gap here, just in case....>
{ '!', 3.6 }, // (ampere*second => milliampere*hour) and (km/h => m/s)
{ '/', 3600 }, // (ampere*second => ampere*hour)
};
struct PACKED log_Parameter {
@ -666,6 +668,7 @@ struct PACKED log_Current {
float voltage_resting;
float current_amps;
float current_total;
float consumed_wh;
int16_t temperature; // degrees C * 100
float resistance;
};
@ -1110,10 +1113,10 @@ struct PACKED log_DSTL {
#define QUAT_UNITS "s????"
#define QUAT_MULTS "F????"
#define CURR_LABELS "TimeUS,Volt,VoltR,Curr,CurrTot,Temp,Res"
#define CURR_FMT "Qffffcf"
#define CURR_UNITS "sv?A?Ow"
#define CURR_MULTS "F??????"
#define CURR_LABELS "TimeUS,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res"
#define CURR_FMT "Qfffffcf"
#define CURR_UNITS "sv?A?JOw"
#define CURR_MULTS "F????/??"
#define CURR_CELL_LABELS "TimeUS,Volt,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10"
#define CURR_CELL_FMT "QfHHHHHHHHHH"