Skip to content

Commit 9c8f087

Browse files
committed
Improved standalone output
1 parent fbadbef commit 9c8f087

File tree

3 files changed

+188
-134
lines changed

3 files changed

+188
-134
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Sample outputs can be found in folder extras.
6262
```
6363
START ../src/SBMInfo.cpp
6464
Version 2.1 from Oct 27 2018
65-
I2C initalized sucessfully
65+
I2C initalized successfully
6666
Found attached I2C device at 0xB
6767
6868
*** STATIC INFO ***

SBMInfo/SBMInfo.h

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@
99
#define SRC_SBMINFO_H_
1010

1111
// standard I2C address for Smart Battery packs
12-
#define SBM_DEVICE_ADDRESS 0x0B
13-
#define SBM_INVALID_ADDRESS 0xFF
12+
#define SBM_DEVICE_ADDRESS 0x0B
13+
#define SBM_INVALID_ADDRESS 0xFF
1414

1515
// Standard and common non-standard Smart Battery commands
1616
#define MANUFACTURER_ACCESS 0x00 // r/w Manufacturer specific values
17-
#define REMAINING_CAPACITY_ALARM 0x01 // r/w
18-
#define REMAINING_TIME_ALARM 0x02 // r/w
17+
#define REMAINING_CAPACITY_ALARM 0x01 // r/w
18+
#define REMAINING_TIME_ALARM 0x02 // r/w
1919

2020
#define BATTERY_MODE 0x03 // r/w
2121

22-
#define AtRate 0x04 // r/w
23-
#define AtRateTimeToFull 0x05 // r
24-
#define AtRateTimeToEmpty 0x06 // r
25-
#define AtRateOK 0x07 // r
22+
#define AtRate 0x04 // r/w
23+
#define AtRateTimeToFull 0x05 // r
24+
#define AtRateTimeToEmpty 0x06 // r
25+
#define AtRateOK 0x07 // r
2626

2727
#define TEMPERATURE 0x08
2828
#define VOLTAGE 0x09
2929
#define CURRENT 0x0A
30-
#define AverageCurrent 0x0B // of last minute
31-
#define MAX_ERROR 0x0C // Byte - of state of charge calculation
30+
#define AverageCurrent 0x0B // of last minute
31+
#define MAX_ERROR 0x0C // Byte - of state of charge calculation
3232

3333
#define RELATIVE_SOC 0x0D // Byte - StateOfCharge
3434
#define ABSOLUTE_SOC 0x0E // Byte
3535
#define REMAINING_CAPACITY 0x0F
3636
#define FULL_CHARGE_CAPACITY 0x10
37-
#define RUN_TIME_TO_EMPTY 0x11
38-
#define AVERAGE_TIME_TO_EMPTY 0x12
37+
#define RUN_TIME_TO_EMPTY 0x11
38+
#define AVERAGE_TIME_TO_EMPTY 0x12
3939
#define TIME_TO_FULL 0x13
4040
#define CHARGING_CURRENT 0x14 // r/w ?
4141
#define CHARGING_VOLTAGE 0x15 // r/w ?
@@ -62,36 +62,36 @@
6262
#define CELL2_VOLTAGE 0x3E // r/w Word - OptionalMfgFunction2
6363
#define CELL1_VOLTAGE 0x3F // r/w Word - OptionalMfgFunction1
6464

65-
#define STATE_OF_HEALTH 0x4F // in % Byte - = CELL1_VOLTAGE for bq2085
65+
#define STATE_OF_HEALTH 0x4F // in % Byte - = CELL1_VOLTAGE for bq2085
6666

6767
/*
6868
* Bits of BatteryMode
6969
*/
70-
#define INTERNAL_CHARGE_CONTROLLER 0x0001
71-
#define CONDITION_FLAG 0x0008
72-
#define CHARGE_CONTROLLER 0x0100
73-
#define ALARM_MODE 0x2000
74-
#define CHARGER_MODE 0x4000
75-
#define CAPACITY_MODE 0x8000
70+
#define INTERNAL_CHARGE_CONTROLLER 0x0001
71+
#define CONDITION_FLAG 0x0008
72+
#define CHARGE_CONTROLLER 0x0100
73+
#define ALARM_MODE 0x2000
74+
#define CHARGER_MODE 0x4000
75+
#define CAPACITY_MODE 0x8000
7676
const char StringCapacityModeCurrent[] = " mA";
77-
const char StringCapacityModePower[] = "0 mW"; // 10mWh
77+
const char StringCapacityModePower[] = "0mW"; // 10mWh
7878

7979
/*
8080
* Bits of BatteryStatus
8181
*/
8282
// Alarm Bits
83-
#define OVER_CHARGED_ALARM__FLAG 0x8000
84-
#define TERMINATE_CHARGE_ALARM_FLAG 0x4000
85-
#define OVER_TEMP_ALARM_FLAG 0x1000
86-
#define TERMINATE_DISCHARGE_ALARM_FLAG 0x0800
87-
#define REMAINING_CAPACITY_ALARM_FLAG 0x0200
88-
#define REMAINING_TIME_ALARM_FLAG 0x0100
83+
#define OVER_CHARGED_ALARM__FLAG 0x8000
84+
#define TERMINATE_CHARGE_ALARM_FLAG 0x4000
85+
#define OVER_TEMP_ALARM_FLAG 0x1000
86+
#define TERMINATE_DISCHARGE_ALARM_FLAG 0x0800
87+
#define REMAINING_CAPACITY_ALARM_FLAG 0x0200
88+
#define REMAINING_TIME_ALARM_FLAG 0x0100
8989

9090
// Bits of Status
91-
#define INITIALIZED 0x0080
92-
#define DISCHARGING 0x0040
93-
#define FULLY_CHARGED 0x0020
94-
#define FULLY_DISCHARGED 0x0010
91+
#define INITIALIZED 0x0080
92+
#define DISCHARGING 0x0040
93+
#define FULLY_CHARGED 0x0020
94+
#define FULLY_DISCHARGED 0x0010
9595

9696
struct SBMFunctionDescriptionStruct {
9797
uint8_t FunctionCode;
@@ -110,34 +110,34 @@ struct SBMFunctionDescriptionStruct {
110110
#define BQ20Z70_Hardware_Version 0x0003
111111
#define BQ40Z50_Hardware_Version 0x0003
112112

113-
#define BQ2084_EDV_level 0x0003
113+
#define BQ2084_EDV_level 0x0003
114114

115-
#define BQ20Z70_Manufacturer_Status 0x0006
115+
#define BQ20Z70_Manufacturer_Status 0x0006
116116

117117
/*
118118
* BQ20Z70 extended commands - Not used yet
119119
*/
120-
#define BQ20Z70_AFEData 0x45 // -11+1 Byte
121-
#define BQ20Z70_FETControl 0x46 // -Byte
122-
#define BQ20Z70_SafetyStatus 0x51
123-
#define BQ20Z70_PFStatus 0x53 // permanent failure
124-
#define BQ20Z70_OperationStatus 0x54
125-
#define BQ20Z70_ChargingStatus 0x55
126-
#define BQ20Z70_WDResetData 0x58
127-
#define BQ20Z70_PackVoltage 0x5a
128-
#define BQ20Z70_AverageVoltage 0x5d // of last minute
129-
#define BQ20Z70_UnSealKey 0x60 // -4 Byte
130-
#define BQ20Z70_FullAccessKey 0x61 // -4 Byte
131-
#define BQ20Z70_PFKey 0x62 // -4 Byte
132-
#define BQ20Z70_AuthenKey3 0x63 // -4 Byte
133-
#define BQ20Z70_AuthenKey2 0x64 // -4 Byte
134-
#define BQ20Z70_AuthenKey1 0x65 // -4 Byte
135-
#define BQ20Z70_AuthenKey0 0x66 // -4 Byte
136-
#define BQ20Z70_ManufacturerInfo 0x70 // -8+1 Byte
137-
#define BQ20Z70_SenseResistor 0x71
138-
#define BQ20Z70_DataFlashSubClassID 0x77
139-
#define BQ20Z70_DataFlashSubClassPage1 0x78 // -32 Byte
120+
#define BQ20Z70_AFEData 0x45 // -11+1 Byte
121+
#define BQ20Z70_FETControl 0x46 // -Byte
122+
#define BQ20Z70_SafetyStatus 0x51
123+
#define BQ20Z70_PFStatus 0x53 // permanent failure
124+
#define BQ20Z70_OperationStatus 0x54
125+
#define BQ20Z70_ChargingStatus 0x55
126+
#define BQ20Z70_WDResetData 0x58
127+
#define BQ20Z70_PackVoltage 0x5a
128+
#define BQ20Z70_AverageVoltage 0x5d // of last minute
129+
#define BQ20Z70_UnSealKey 0x60 // -4 Byte
130+
#define BQ20Z70_FullAccessKey 0x61 // -4 Byte
131+
#define BQ20Z70_PFKey 0x62 // -4 Byte
132+
#define BQ20Z70_AuthenKey3 0x63 // -4 Byte
133+
#define BQ20Z70_AuthenKey2 0x64 // -4 Byte
134+
#define BQ20Z70_AuthenKey1 0x65 // -4 Byte
135+
#define BQ20Z70_AuthenKey0 0x66 // -4 Byte
136+
#define BQ20Z70_ManufacturerInfo 0x70 // -8+1 Byte
137+
#define BQ20Z70_SenseResistor 0x71
138+
#define BQ20Z70_DataFlashSubClassID 0x77
139+
#define BQ20Z70_DataFlashSubClassPage1 0x78 // -32 Byte
140140
// ...
141-
#define BQ20Z70_DataFlashSubClassPage8 0x7f // -32 Byte
141+
#define BQ20Z70_DataFlashSubClassPage8 0x7f // -32 Byte
142142

143143
#endif /* SRC_SBMINFO_H_ */

0 commit comments

Comments
 (0)