-
Notifications
You must be signed in to change notification settings - Fork 239
/
Copy pathmodel.js
111 lines (108 loc) · 2.3 KB
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import BIN from "BinaryMessage";
const temperatureUnitRange = ["°F", "°C"];
const typeRange = ["Gel", "Flooded", "Sealed", "LiFePo"];
const model = {
VERSION: 0x1000,
home: {
View: "Home",
items: [
{
View: "Status",
title: 'Status',
},
{
View: "InputOutput",
title: 'Input/Output',
},
{
View: "StateOfCharge",
title: 'Charge',
},
{
View: "Settings",
title: 'Settings',
items: [
{
id: "type",
name: 'Battery Type',
unit: '',
View: "Type",
title: 'Battery Type',
range: typeRange,
},
{
id: "capacity",
name: 'Battery Capacity',
unit: 'Ah',
View: "IntPad",
title: 'Capacity (Ah)',
},
{
id: "alarm",
unit: 'Ah',
name: 'Alarm',
View: "IntPad",
title: 'Alarm (Ah)',
},
{
id: "currentLimit",
name: 'Current Limit',
unit: 'A',
View: "IntPad",
title: 'Current Limit (A)',
},
{
id: "fullChargeString",
name: 'Full Charge',
unit: 'V',
View: "FloatPad",
title: 'Full Charge (V)',
},
{
id: "zeroChargeString",
name: 'Zero Charge',
unit: 'V',
View: "FloatPad",
title: 'Zero Charge (V)',
},
{
id: "temperatureUnit",
name: 'Battery Temp',
unit: '',
View: "TemperatureUnit",
title: 'Battery Temp',
},
{
name: 'History',
unit: '',
},
{
name: 'Battery to 100%',
},
],
},
],
},
internal: {
type: { value:"LiFePo", retention:2 },
capacity: { value:230, retention:2 },
temperatureUnit: { value:"°F", retention:2 },
fullCharge: { value:13.3, retention:2 },
zeroCharge: { value:11.6, retention:2 },
alarm: { value:46, retention:2 },
currentLimit: { value:30, retention:2 },
},
internalFormat: [
{ type:BIN.Uint16, name:"VERSION" },
{ type:BIN.Uint8, name:"type", range:typeRange },
{ type:BIN.Uint16, name:"capacity" },
{ type:BIN.Uint8, name:"temperatureUnit", range:temperatureUnitRange },
{ type:BIN.Float32, name:"fullCharge" },
{ type:BIN.Float32, name:"zeroCharge" },
{ type:BIN.Uint16, name:"alarm" },
{ type:BIN.Uint16, name:"currentLimit" },
],
internalKey: "IN",
timeout: 30000,
};
export default Object.freeze(model, true);