Skip to content

Commit 9f5fd78

Browse files
committed
Fix: limit battery profiles to vTerm max
1 parent 98367fb commit 9f5fd78

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/components/Profiling/Dialog/ConfigurationDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export default ({
6565
return null;
6666
}
6767

68+
const vTerm = Math.max(...npmDevice.chargerModule.ranges.voltage);
69+
6870
const [iTerm, setITerm] = useState<ITerm>(
6971
charger?.iTerm ?? npmDevice.chargerModule.values.iTerm[0].value
7072
);
@@ -89,7 +91,8 @@ export default ({
8991
npmDevice.batteryProfiler?.loadProfile(
9092
capacity,
9193
vUpperCutOff,
92-
vLowerCutOff
94+
vLowerCutOff,
95+
vTerm
9396
) ?? [];
9497

9598
const profile: Profile = {

src/features/pmicControl/npm/npm1300/batteryProfiler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ export class BatteryProfiler implements BatteryProfilerBase {
301301
loadProfile(
302302
capacity: number,
303303
vUpperCutOff: number,
304-
vLowerCutOff: number
304+
vLowerCutOff: number,
305+
vTerm: number
305306
): CCProfile[] {
306307
return [
307308
{
@@ -323,7 +324,7 @@ export class BatteryProfiler implements BatteryProfilerBase {
323324
tRest: 1800000, // 30Min // 1304 45min
324325
iLoad: capacity / 5 / 1000, // A // 1304 apacity / 6 / 1000
325326
iRest: 0,
326-
vCutoff: vLowerCutOff + 0.5,
327+
vCutoff: Math.min(vLowerCutOff + 0.5, vTerm),
327328
},
328329
{
329330
tLoad: 300000, // 5Min

src/features/pmicControl/npm/npm1304/batteryProfiler.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ export class BatteryProfiler extends nPM1300BatteryProfiler {
8686
// eslint-disable-next-line class-methods-use-this
8787
loadProfile(
8888
capacity: number,
89-
vUpperCutOff: number,
90-
vLowerCutOff: number
89+
_vUpperCutOff: number,
90+
vLowerCutOff: number,
91+
vTerm: number
9192
): CCProfile[] {
9293
return [
9394
{
@@ -102,14 +103,14 @@ export class BatteryProfiler extends nPM1300BatteryProfiler {
102103
tRest: 2400000, // 40Min
103104
iLoad: capacity / 6 / 1000, // A
104105
iRest: 0,
105-
vCutoff: vLowerCutOff + 0.8,
106+
vCutoff: Math.min(vLowerCutOff + 0.8, vTerm),
106107
},
107108
{
108109
tLoad: 300000, // 5Min
109110
tRest: 2400000, // 40Min
110111
iLoad: capacity / 6 / 1000, // A
111112
iRest: 0,
112-
vCutoff: vLowerCutOff + 0.5,
113+
vCutoff: Math.min(vLowerCutOff + 0.5, vTerm),
113114
},
114115
{
115116
tLoad: 300000, // 5Min

src/features/pmicControl/npm/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,8 @@ export type BatteryProfiler = {
10291029
loadProfile(
10301030
capacity: number,
10311031
vUpperCutOff: number,
1032-
vLowerCutOff: number
1032+
vLowerCutOff: number,
1033+
vTerm: number
10331034
): CCProfile[];
10341035
};
10351036

0 commit comments

Comments
 (0)