|
8 | 8 |
|
9 | 9 | /* global XMLHttpRequest */ |
10 | 10 |
|
| 11 | +/* Firmware files open with a 32-bit address 0 which are valid if they fall between these two values */ |
| 12 | +const MIN_ADDRESS_0 = 536870912; |
| 13 | +const MAX_ADDRESS_0 = 536903680; |
| 14 | + |
11 | 15 | const electron = require('electron'); |
12 | 16 | const dialog = electron.remote.dialog; |
13 | 17 | const app = electron.remote.app; |
@@ -125,7 +129,7 @@ function fillDescription (i) { |
125 | 129 | const month = (monthNum > 9) ? monthNum : '0' + monthNum; |
126 | 130 | const publishDateString = day + '/' + month + '/' + publishDate.getFullYear(); |
127 | 131 |
|
128 | | - releaseDescriptionSpan.innerHTML = '</br><p><b>Version:</b> ' + releases[i].name + '</p>'; |
| 132 | + releaseDescriptionSpan.innerHTML = '</br><p><b>Firmware version:</b> AudioMoth-Firmware-Basic ' + releases[i].name + '</p>'; |
129 | 133 | releaseDescriptionSpan.innerHTML += '<p><b>Date released:</b> ' + publishDateString + '</p>'; |
130 | 134 | releaseDescriptionSpan.innerHTML += '<b>Changes:</b>'; |
131 | 135 |
|
@@ -212,8 +216,14 @@ function isFirmwareFile (directory) { |
212 | 216 |
|
213 | 217 | } |
214 | 218 |
|
| 219 | + const array8 = new Uint8Array([contents[0], contents[1], contents[2], contents[3]]); |
| 220 | + const array32 = new Uint32Array(array8.buffer); |
| 221 | + const address0 = array32[0]; |
| 222 | + |
| 223 | + console.log('Firmware address 0: ' + address0); |
| 224 | + |
215 | 225 | /* The first bytes of all AudioMoth firmware follow this sequence of values */ |
216 | | - resolve((contents[0] === 0) && (contents[1] === 128) && (contents[2] === 0) && (contents[3] === 32)); |
| 226 | + resolve(address0 >= MIN_ADDRESS_0 && address0 <= MAX_ADDRESS_0); |
217 | 227 |
|
218 | 228 | }); |
219 | 229 |
|
|
0 commit comments