Skip to content

Commit 3d4de20

Browse files
committed
Add 1.4.0 changes
1 parent 0fca861 commit 3d4de20

6 files changed

Lines changed: 35 additions & 6 deletions

File tree

app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const statusDiv = document.getElementById('status-div');
3636
const versionSelect = document.getElementById('version-select');
3737
const downloadButton = document.getElementById('download-button');
3838

39+
const overwriteBootloaderDiv = document.getElementById('overwrite-bootloader-div');
40+
3941
/* Status set getStatus which enables/disables flash buttons */
4042
var inFlashableState = false;
4143

@@ -955,6 +957,12 @@ electron.ipcRenderer.on('update-check', () => {
955957

956958
});
957959

960+
electron.ipcRenderer.on('toggle-bootloader-overwrite', () => {
961+
962+
overwriteBootloaderDiv.style.display = (overwriteBootloaderDiv.style.display === '') ? 'none' : '';
963+
964+
});
965+
958966
/* Prepare UI */
959967

960968
firmwareInterface.updateFirmwareDirectoryDisplay('');

communication.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ function crcCheck (expectedCRC, isDestructive, successCallback) {
930930

931931
electronLog.error('Flash CRC was incorrect, ending communication');
932932

933-
let errorString = 'Flash failed, CRC did not match.\n';
934-
errorString += 'Expected ' + expectedCRC + ' but received ' + receivedCRC + '.\n';
933+
let errorString = 'Flash failed, CRC did not match. ';
934+
errorString += 'Expected ' + expectedCRC + ' but received ' + receivedCRC + '. ';
935935
errorString += 'Reconnect device and try again.';
936936
displayError('Incorrect CRC', errorString);
937937
electron.ipcRenderer.send('set-bar-aborted');

firmwareInterface.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
/* global XMLHttpRequest */
1010

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+
1115
const electron = require('electron');
1216
const dialog = electron.remote.dialog;
1317
const app = electron.remote.app;
@@ -125,7 +129,7 @@ function fillDescription (i) {
125129
const month = (monthNum > 9) ? monthNum : '0' + monthNum;
126130
const publishDateString = day + '/' + month + '/' + publishDate.getFullYear();
127131

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>';
129133
releaseDescriptionSpan.innerHTML += '<p><b>Date released:</b> ' + publishDateString + '</p>';
130134
releaseDescriptionSpan.innerHTML += '<b>Changes:</b>';
131135

@@ -212,8 +216,14 @@ function isFirmwareFile (directory) {
212216

213217
}
214218

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+
215225
/* 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);
217227

218228
});
219229

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</div>
5555
</div>
5656

57-
<div style="border: #cdcdcd thin solid; margin-top: 8px; width: 100%;">
57+
<div style="border: #cdcdcd thin solid; margin-top: 8px; width: 100%; display: none;" id="overwrite-bootloader-div">
5858
<div class="row" style="margin-top: 8px; margin-bottom: 8px;">
5959
<div class="col-6" style="text-align: left;">
6060
<span style="margin-left: 9%;">Overwrite bootloader:</span>

main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,15 @@ app.on('ready', () => {
469469

470470
}
471471

472+
}
473+
}, {
474+
type: 'checkbox',
475+
checked: false,
476+
label: 'Enable Bootloader Overwrite Option',
477+
click: () => {
478+
479+
mainWindow.webContents.send('toggle-bootloader-overwrite');
480+
472481
}
473482
}, {
474483
type: 'separator'

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AudioMoth-Flash",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "The flashing app used to apply firmware to the AudioMoth acoustic monitoring device.",
55
"main": "main.js",
66
"author": "openacousticdevices.info",
@@ -48,6 +48,8 @@
4848
},
4949
"nsis": {
5050
"createDesktopShortcut": true,
51+
"oneClick": false,
52+
"allowToChangeInstallationDirectory": true,
5153
"artifactName": "AudioMothFlashAppSetup${version}.exe",
5254
"shortcutName": "AudioMoth Flash App",
5355
"uninstallDisplayName": "AudioMoth Flash App ${version}"

0 commit comments

Comments
 (0)