Skip to content

Commit

Permalink
Add 1.4.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pcprince committed Sep 7, 2021
1 parent 0fca861 commit 3d4de20
Showing 6 changed files with 35 additions and 6 deletions.
8 changes: 8 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -36,6 +36,8 @@ const statusDiv = document.getElementById('status-div');
const versionSelect = document.getElementById('version-select');
const downloadButton = document.getElementById('download-button');

const overwriteBootloaderDiv = document.getElementById('overwrite-bootloader-div');

/* Status set getStatus which enables/disables flash buttons */
var inFlashableState = false;

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

});

electron.ipcRenderer.on('toggle-bootloader-overwrite', () => {

overwriteBootloaderDiv.style.display = (overwriteBootloaderDiv.style.display === '') ? 'none' : '';

});

/* Prepare UI */

firmwareInterface.updateFirmwareDirectoryDisplay('');
4 changes: 2 additions & 2 deletions communication.js
Original file line number Diff line number Diff line change
@@ -930,8 +930,8 @@ function crcCheck (expectedCRC, isDestructive, successCallback) {

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

let errorString = 'Flash failed, CRC did not match.\n';
errorString += 'Expected ' + expectedCRC + ' but received ' + receivedCRC + '.\n';
let errorString = 'Flash failed, CRC did not match. ';
errorString += 'Expected ' + expectedCRC + ' but received ' + receivedCRC + '. ';
errorString += 'Reconnect device and try again.';
displayError('Incorrect CRC', errorString);
electron.ipcRenderer.send('set-bar-aborted');
14 changes: 12 additions & 2 deletions firmwareInterface.js
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@

/* global XMLHttpRequest */

/* Firmware files open with a 32-bit address 0 which are valid if they fall between these two values */
const MIN_ADDRESS_0 = 536870912;
const MAX_ADDRESS_0 = 536903680;

const electron = require('electron');
const dialog = electron.remote.dialog;
const app = electron.remote.app;
@@ -125,7 +129,7 @@ function fillDescription (i) {
const month = (monthNum > 9) ? monthNum : '0' + monthNum;
const publishDateString = day + '/' + month + '/' + publishDate.getFullYear();

releaseDescriptionSpan.innerHTML = '</br><p><b>Version:</b> ' + releases[i].name + '</p>';
releaseDescriptionSpan.innerHTML = '</br><p><b>Firmware version:</b> AudioMoth-Firmware-Basic ' + releases[i].name + '</p>';
releaseDescriptionSpan.innerHTML += '<p><b>Date released:</b> ' + publishDateString + '</p>';
releaseDescriptionSpan.innerHTML += '<b>Changes:</b>';

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

}

const array8 = new Uint8Array([contents[0], contents[1], contents[2], contents[3]]);
const array32 = new Uint32Array(array8.buffer);
const address0 = array32[0];

console.log('Firmware address 0: ' + address0);

/* The first bytes of all AudioMoth firmware follow this sequence of values */
resolve((contents[0] === 0) && (contents[1] === 128) && (contents[2] === 0) && (contents[3] === 32));
resolve(address0 >= MIN_ADDRESS_0 && address0 <= MAX_ADDRESS_0);

});

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@
</div>
</div>

<div style="border: #cdcdcd thin solid; margin-top: 8px; width: 100%;">
<div style="border: #cdcdcd thin solid; margin-top: 8px; width: 100%; display: none;" id="overwrite-bootloader-div">
<div class="row" style="margin-top: 8px; margin-bottom: 8px;">
<div class="col-6" style="text-align: left;">
<span style="margin-left: 9%;">Overwrite bootloader:</span>
9 changes: 9 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -469,6 +469,15 @@ app.on('ready', () => {

}

}
}, {
type: 'checkbox',
checked: false,
label: 'Enable Bootloader Overwrite Option',
click: () => {

mainWindow.webContents.send('toggle-bootloader-overwrite');

}
}, {
type: 'separator'
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "AudioMoth-Flash",
"version": "1.3.0",
"version": "1.4.0",
"description": "The flashing app used to apply firmware to the AudioMoth acoustic monitoring device.",
"main": "main.js",
"author": "openacousticdevices.info",
@@ -48,6 +48,8 @@
},
"nsis": {
"createDesktopShortcut": true,
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"artifactName": "AudioMothFlashAppSetup${version}.exe",
"shortcutName": "AudioMoth Flash App",
"uninstallDisplayName": "AudioMoth Flash App ${version}"

0 comments on commit 3d4de20

Please sign in to comment.