-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.js
111 lines (92 loc) · 2.57 KB
/
constants.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
/****************************************************************************
* recordingConfigurations.js
* openacousticdevices.info
* August 2021
*****************************************************************************/
/* Setting parameters */
exports.configurations = [{
trueSampleRate: 8,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 48
}, {
trueSampleRate: 16,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 24
}, {
trueSampleRate: 32,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 12
}, {
trueSampleRate: 48,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 8
}, {
trueSampleRate: 96,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 4
}, {
trueSampleRate: 192,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 2
}, {
trueSampleRate: 250,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 250000,
sampleRateDivider: 1
}, {
trueSampleRate: 384,
clockDivider: 4,
acquisitionCycles: 16,
oversampleRate: 1,
sampleRate: 384000,
sampleRateDivider: 1
}];
/* Packet lengths for each version */
exports.packetLengthVersions = [{
firmwareVersion: '1.0.0',
packetLength: 18
},
{
firmwareVersion: '1.2.0',
packetLength: 19
}];
const FIRMWARE_OFFICIAL_RELEASE = 0;
const FIRMWARE_OFFICIAL_RELEASE_CANDIDATE = 1;
const FIRMWARE_UNSUPPORTED = 2;
exports.FIRMWARE_OFFICIAL_RELEASE = FIRMWARE_OFFICIAL_RELEASE;
exports.FIRMWARE_OFFICIAL_RELEASE_CANDIDATE = FIRMWARE_OFFICIAL_RELEASE_CANDIDATE;
exports.FIRMWARE_UNSUPPORTED = FIRMWARE_UNSUPPORTED;
/* Remove trailing digit and check if description is in list of supported firmware descriptions */
exports.getFirmwareClassification = (desc) => {
/* If official firmware or a release candidate of the official firmware */
if (desc === 'AudioMoth-USB-Microphone') {
return FIRMWARE_OFFICIAL_RELEASE;
}
if (desc.replace(/-RC\d+$/, '-RC') === 'AudioMoth-USB-Microphone-RC') {
return FIRMWARE_OFFICIAL_RELEASE_CANDIDATE;
}
return FIRMWARE_UNSUPPORTED;
};
/* Version number for the latest firmware */
exports.latestFirmwareVersionArray = ['1', '2', '0'];
exports.latestFirmwareVersionString = '1.2.0';