Skip to content

Commit

Permalink
Add 1.6.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pcprince committed Jan 10, 2022
1 parent d9ae6fa commit fb84fef
Show file tree
Hide file tree
Showing 27 changed files with 797 additions and 354 deletions.
1 change: 1 addition & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<head>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link id="uiCSS" rel="stylesheet" href="./ui.css">
<title>About AudioMoth Configuration App</title>
</head>

Expand Down
16 changes: 16 additions & 0 deletions about.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
const electron = require('electron');
const audiomoth = require('audiomoth-hid');

const nightMode = require('./nightMode.js');

const versionDisplay = document.getElementById('version-display');
const electronVersionDisplay = document.getElementById('electron-version-display');
const audiomothHidVersionDisplay = document.getElementById('audiomoth-hid-version-display');
Expand All @@ -20,6 +22,20 @@ versionDisplay.textContent = 'Version ' + electron.remote.app.getVersion();
electronVersionDisplay.textContent = 'Running on Electron version ' + electron.remote.process.versions.electron;
audiomothHidVersionDisplay.textContent = 'AudioMoth-HID module ' + audiomoth.version;

electron.ipcRenderer.on('night-mode', (e, nm) => {

if (nm !== undefined) {

nightMode.setNightMode(nm);

} else {

nightMode.toggle();

}

});

websiteLink.addEventListener('click', function () {

electron.shell.openExternal('https://openacousticdevices.info');
Expand Down
9 changes: 7 additions & 2 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ exports.oldConfigurations = [{
sampleRateDivider: 4
}];

/* GPS energy consumption */

exports.GPS_FIX_TIME = 1.0 / 60.0;
exports.GPS_FIX_CONSUMPTION = 30.0;

/* Packet lengths for each version */

exports.packetLengthVersions = [{
Expand Down Expand Up @@ -191,5 +196,5 @@ exports.getFirmwareClassification = (desc) => {

/* Version number for the latest firmware */

exports.latestFirmwareVersionArray = [1, 6, 0];
exports.latestFirmwareVersionString = '1.6.0';
exports.latestFirmwareVersionArray = [1, 7, 0];
exports.latestFirmwareVersionString = '1.7.0';
10 changes: 5 additions & 5 deletions expansion/expansion.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<td align="center" style="padding: 0px"><label class="duration-max-length-ui" for="duration-max-length-radio7">1 hr</label></td>
</tr>
<tr title="Select the max length of an expanded file.">
<td align="left" style="padding-top: 0px; padding-bottom: 0px;" id="max-length-type-label" class="duration-max-length-ui">Maximum file length:</td>
<td align="left" style="padding-top: 0px; padding-bottom: 0px;"><span id="max-length-type-label" class="duration-max-length-ui">Maximum file length:</span></td>
<td align="center" style="padding-top: 0px; padding-bottom: 0px"></td>
<td align="center" style="padding-top: 0px; padding-bottom: 0px">
<input class="duration-max-length-ui" type="radio" value="0" name="duration-max-length-radio" id="duration-max-length-radio0">
Expand Down Expand Up @@ -137,7 +137,7 @@
<td align="center" style="padding: 0px"><label class="event-max-length-ui" for="event-max-length-radio7">1 hr</label></td>
</tr>
<tr title="Select the max length of an expanded file.">
<td align="left" style="padding-top: 0px; padding-bottom: 0px;" id="max-length-type-label" class="event-max-length-ui">Maximum file length:</td>
<td align="left" style="padding-top: 0px; padding-bottom: 0px;"><span id="max-length-type-label" class="event-max-length-ui">Maximum file length:</span></td>
<td align="center" style="padding-top: 0px; padding-bottom: 0px"></td>
<td align="center" style="padding-top: 0px; padding-bottom: 0px">
<input class="event-max-length-ui" type="radio" value="0" name="event-max-length-radio" id="event-max-length-radio0">
Expand Down Expand Up @@ -207,12 +207,12 @@
</div>
<div class="col-5" style="padding-left: 0px;">
<div style="margin-top: 6px; margin-bottom: 0px; text-align: left;">
<label id="prefix-label" for="prefix-checkbox" title="'." style="color: lightgray; margin-left: 20px;">Add WAV file prefix:</label>
<label id="prefix-label" for="prefix-checkbox" title="Prefix which will be added to WAV file to differentiate it from the original file" style="margin-left: 20px;" class="grey">Add WAV file prefix:</label>
</div>
</div>
<div class="col-6">
<div style="text-align: right; margin-top: 2px; margin-bottom: 0px; margin-right: 16px;">
<input id="prefix-input" maxlength="20" disabled style="color: lightgray; text-align: right;">
<input id="prefix-input" maxlength="20" disabled style="text-align: right;" class="grey">
</div>
</div>
</div>
Expand All @@ -232,7 +232,7 @@
</div>
<div class="col-7">
<div style="margin-top: 11px; text-align: right; margin-right: 16px;">
<span id="output-label" title="'." style="color: lightgray;">Writing WAV files to source folder.</span>
<span id="output-label" title="'." class="grey">Writing WAV files to source folder.</span>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions expansion/split.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
</div>
<div class="col-5" style="padding-left: 0px;">
<div style="margin-top: 6px; margin-bottom: 0px; text-align: left;">
<label id="prefix-label" for="prefix-checkbox" title="'." style="color: lightgray; margin-left: 20px;">Add WAV file prefix:</label>
<label id="prefix-label" for="prefix-checkbox" title="Prefix which will be added to WAV file to differentiate it from the original file" style="margin-left: 20px;" class="grey">Add WAV file prefix:</label>
</div>
</div>
<div class="col-6">
<div style="text-align: right; margin-top: 2px; margin-bottom: 0px; margin-right: 16px;">
<input id="prefix-input" maxlength="20" disabled style="color: lightgray; text-align: right;">
<input id="prefix-input" maxlength="20" disabled style="text-align: right;" class="grey">
</div>
</div>
</div>
Expand All @@ -104,7 +104,7 @@
</div>
<div class="col-7">
<div style="margin-top: 11px; text-align: right; margin-right: 16px;">
<span id="output-label" title="'." style="color: lightgray;">Writing WAV files to source folder.</span>
<span id="output-label" title="'." class="grey">Writing WAV files to source folder.</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -156,7 +156,7 @@
</div>
<div class="col-8">
<div style="margin-top: 11px; text-align: right; margin-right: 16px;">
<span id="file-label" title="Amplitude thresholded recordings will have a file name ending in .WAV'.">No AudioMoth WAV files selected.</span>
<span id="file-label" title="Amplitude thresholded recordings will have a file name ending in WAV'.">No AudioMoth WAV files selected.</span>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions expansion/uiCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ prefixInput.addEventListener('keydown', (e) => {

}

var reg = /[^A-Za-z_0-9]{1}/g;
var reg = /[^A-Za-z-_0-9]{1}/g;

if (reg.test(e.key)) {

Expand Down Expand Up @@ -206,14 +206,14 @@ prefixCheckbox.addEventListener('change', () => {

if (prefixCheckbox.checked) {

prefixLabel.style.color = '';
prefixInput.style.color = '';
prefixLabel.classList.remove('grey');
prefixInput.classList.remove('grey');
prefixInput.disabled = false;

} else {

prefixLabel.style.color = 'lightgray';
prefixInput.style.color = 'lightgray';
prefixLabel.classList.add('grey');
prefixInput.classList.add('grey');
prefixInput.disabled = true;

}
Expand Down
15 changes: 12 additions & 3 deletions expansion/uiExpansion.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,16 @@ function updateFileMaxLengthUI (elementClass, checkbox) {
for (let i = 0; i < maxLengthElements.length; i++) {

maxLengthElements[i].disabled = !maxLengthEnabled;
maxLengthElements[i].style.color = maxLengthEnabled ? '' : 'lightgrey';

if (maxLengthEnabled) {

maxLengthElements[i].classList.remove('grey');

} else {

maxLengthElements[i].classList.add('grey');

}

}

Expand Down Expand Up @@ -473,12 +482,12 @@ outputCheckbox.addEventListener('change', () => {

if (outputCheckbox.checked) {

outputLabel.style.color = '';
outputLabel.classList.remove('grey');
outputButton.disabled = false;

} else {

outputLabel.style.color = 'lightgray';
outputLabel.classList.add('grey');
outputButton.disabled = true;
outputDir = '';
ui.updateOutputLabel(outputDir);
Expand Down
4 changes: 2 additions & 2 deletions expansion/uiSplit.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ outputCheckbox.addEventListener('change', () => {

if (outputCheckbox.checked) {

outputLabel.style.color = '';
outputLabel.classList.remove('grey');
outputButton.disabled = false;

} else {

outputLabel.style.color = 'lightgray';
outputLabel.classList.add('grey');
outputButton.disabled = true;
outputDir = '';
ui.updateOutputLabel(outputDir);
Expand Down
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<div class="row" style="margin-left: 0px;">
<div class="col-12" style="text-align: center; padding-top: 5px; padding-bottom: 5px">
<span style="font-size: 25px; font-family: &apos;Lucida Console&apos;, Monaco, monospace">
<div id="time-display" style="display: inline-block; color: lightgrey;"></div>
<div id="timezone-label" style="display: inline-block; color: lightgrey;"></div>
<div id="time-display" style="display: inline-block;" class="grey"></div>
<div id="timezone-label" style="display: inline-block;" class="grey"></div>
</span>
</div>
</div>
Expand All @@ -28,34 +28,34 @@
<div style="border: #cdcdcd thin solid; margin-left: 15px; width: 543px;">
<div class="row" style="margin-top: 5px;">
<div class="col-6" style="text-align: left;">
<span id="id-label" style="margin-left: 20px; color: lightgrey;">Device ID:</span>
<span id="id-label" style="margin-left: 20px;" class="grey">Device ID:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="id-display" style="margin-right: 20px; border: none; text-align: right; color: lightgrey;">-</span>
<span id="id-display" style="margin-right: 20px; border: none; text-align: right;" class="grey">-</span>
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-6" style="text-align: left;">
<span id="firmware-description-label" style="margin-left: 20px; color: lightgrey;">Firmware description:</span>
<span id="firmware-description-label" style="margin-left: 20px;" class="grey">Firmware description:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="firmware-description-display" style="margin-right: 20px; color: lightgrey;">-</span>
<span id="firmware-description-display" style="margin-right: 20px;" class="grey">-</span>
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-6" style="text-align: left;">
<span id="firmware-version-label" style="margin-left: 20px; color: lightgrey;">Firmware version:</span>
<span id="firmware-version-label" style="margin-left: 20px;" class="grey">Firmware version:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="firmware-version-display" style="margin-right: 20px; color: lightgrey;">-</span>
<span id="firmware-version-display" style="margin-right: 20px;" class="grey">-</span>
</div>
</div>
<div class="row" style="margin-top: 5px; margin-bottom: 5px;">
<div class="col-6" style="text-align: left;">
<span id="battery-label" style="margin-left: 20px; color: lightgrey;">Battery:</span>
<span id="battery-label" style="margin-left: 20px;" class="grey">Battery:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="battery-display" style="margin-right: 20px; color: lightgrey;">-</span>
<span id="battery-display" style="margin-right: 20px;" class="grey">-</span>
</div>
</div>
</div>
Expand Down
30 changes: 29 additions & 1 deletion lifeDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

'use strict';

const constants = require('./constants.js');

/* global document */

const MAX_WAV_SIZE = 4294966806;
Expand Down Expand Up @@ -143,7 +145,7 @@ function getFileSize (sampleRate, sampleRateDivider, secs) {

/* Update storage and energy usage values in life display box */

exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, amplitudeThresholdingEnabled, dutyEnabled, energySaverChecked) => {
exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, amplitudeThresholdingEnabled, dutyEnabled, energySaverChecked, gpsEnabled) => {

/* If no recording periods exist, do not perform energy calculations */

Expand Down Expand Up @@ -334,6 +336,14 @@ exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, am

const sleepEnergyUsage = totalSleepTime * sleepCurrent / 3600;

let gpsEnergyUsage = 0.0;

if (gpsEnabled) {

gpsEnergyUsage = schedule.length * constants.GPS_FIX_TIME * constants.GPS_FIX_CONSUMPTION;

}

if (amplitudeThresholdingEnabled) {

let minEnergyUsed = 0;
Expand All @@ -348,6 +358,12 @@ exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, am

minEnergyUsed = Math.round(minEnergyUsed / minEnergyPrecision) * minEnergyPrecision;

// Add GPS energy after rounding so it's clear what the effect of the GPS on energy consumption is

minEnergyUsed += gpsEnergyUsage;

minEnergyUsed = Math.round(minEnergyUsed);

let maxEnergyUsed = 0;

maxEnergyUsed += fileOpenEnergyUsage;
Expand All @@ -360,6 +376,12 @@ exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, am

maxEnergyUsed = Math.round(maxEnergyUsed / maxEnergyPrecision) * maxEnergyPrecision;

// Add GPS energy after rounding so it's clear what the effect of the GPS on energy consumption is

maxEnergyUsed += gpsEnergyUsage;

maxEnergyUsed = Math.round(maxEnergyUsed);

text += 'Daily energy consumption will be between ' + minEnergyUsed + ' and ' + maxEnergyUsed + ' mAh.';

} else {
Expand All @@ -376,6 +398,12 @@ exports.updateLifeDisplay = (schedule, configuration, recLength, sleepLength, am

energyUsed = Math.round(energyUsed / energyPrecision) * energyPrecision;

// Add GPS energy after rounding so it's clear what the effect of the GPS on energy consumption is

energyUsed += gpsEnergyUsage;

energyUsed = Math.round(energyUsed);

text += 'Daily energy consumption will be approximately ' + energyUsed + ' mAh.';

}
Expand Down
37 changes: 37 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ function openAboutWindow () {

});

aboutWindow.webContents.on('dom-ready', function () {

mainWindow.webContents.send('poll-night-mode');

});

ipcMain.on('night-mode-poll-reply', (e, nightMode) => {

if (aboutWindow) {

aboutWindow.webContents.send('night-mode', nightMode);

}

});

}

function toggleNightMode () {
Expand All @@ -205,6 +221,18 @@ function toggleNightMode () {

}

if (aboutWindow) {

aboutWindow.webContents.send('night-mode');

}

if (splitWindow) {

splitWindow.webContents.send('night-mode');

}

}

app.on('ready', function () {
Expand Down Expand Up @@ -383,6 +411,15 @@ app.on('ready', function () {

mainWindow.webContents.send('update-check');

}
}, {
type: 'separator'
}, {
label: 'AudioMoth Filter Playground',
click: function () {

shell.openExternal('https://playground.openacousticdevices.info/');

}
}, {
type: 'separator'
Expand Down
Loading

0 comments on commit fb84fef

Please sign in to comment.