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 Nov 18, 2020
1 parent ffcf7e2 commit c37f036
Show file tree
Hide file tree
Showing 12 changed files with 539 additions and 170 deletions.
5 changes: 5 additions & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,9 @@ exports.packetLengthVersions = [{
}, {
firmwareVersion: '1.4.0',
packetLength: 58
}, {
firmwareVersion: '1.5.0',
packetLength: 59
}];

exports.supportedFirmwareDescs = ['AudioMoth-Firmware-Basic', 'AudioMoth-Firmware-Basic-RC1', 'AudioMoth-Firmware-Basic-RC2', 'AudioMoth-Firmware-Basic-RC3'];
27 changes: 17 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,46 @@
<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;"></div>
<div id="timezone-label" style="display: inline-block;"></div>
<div id="time-display" style="display: inline-block; color: lightgrey;"></div>
<div id="timezone-label" style="display: inline-block; color: lightgrey;"></div>
</span>
</div>
</div>
</div>
</div>

<!-- Device information -->
<div class="row" style="margin-top: 8px;">
<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;">Device ID:</span>
<span id="id-label" style="margin-left: 20px; color: lightgrey;">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;">0000000000000000</span>
<span id="id-display" style="margin-right: 20px; border: none; text-align: right; color: lightgrey;">-</span>
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-6" style="text-align: left;">
<span id="firmware-label" style="margin-left: 20px;">Firmware version:</span>
<span id="firmware-description-label" style="margin-left: 20px; color: lightgrey;">Firmware description:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="firmware-display" class="firmware-display" style="margin-right: 20px;">0.0.0</span>
<span id="firmware-description-display" style="margin-right: 20px; color: lightgrey;">-</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>
</div>
<div class="col-6" style="text-align: right;">
<span id="firmware-version-display" style="margin-right: 20px; color: lightgrey;">-</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;">Battery:</span>
<span id="battery-label" style="margin-left: 20px; color: lightgrey;">Battery:</span>
</div>
<div class="col-6" style="text-align: right;">
<span id="battery-display" style="margin-right: 20px;">0.0V</span>
<span id="battery-display" style="margin-right: 20px; color: lightgrey;">-</span>
</div>
</div>
</div>
Expand All @@ -72,7 +79,7 @@
</div>

<!-- Tab content -->
<div class="tab-content" style="margin-top: 8px;">
<div class="tab-content" style="margin-top: 4px;">

<div role="tabpanel" class="tab-pane fade in active show" id="settings-tab" role="tabpanel">
<div id="settings-content"></div>
Expand Down
9 changes: 8 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ app.on('ready', function () {
var menu, menuTemplate, iconLocation, windowHeight;

iconLocation = '/build/icon.ico';
windowHeight = shrinkWindowHeight(641);
windowHeight = shrinkWindowHeight(665);

if (process.platform === 'linux') {

Expand Down Expand Up @@ -301,6 +301,13 @@ app.on('ready', function () {

openAboutWindow();

}
}, {
label: 'Check For Updates',
click: function () {

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

}
}, {
type: 'separator'
Expand Down
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "AudioMoth-Config",
"version": "1.3.6",
"version": "1.4.0",
"description": "The configuration app for the AudioMoth acoustic monitoring device.",
"main": "main.js",
"author": "openacousticdevices.info",
"license": "ISC",
"repository": {
"type" : "git",
"url" : "https://github.com/OpenAcousticDevices/AudioMoth-Configuration-App.git"
},
"scripts": {
"postinstall": "install-app-deps",
"start": "electron .",
Expand Down Expand Up @@ -51,23 +55,23 @@
}
},
"devDependencies": {
"electron": "8.2.4",
"electron-builder": "^22.8.1",
"electron": "8.5.2",
"electron-builder": "^22.9.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"
"eslint-plugin-standard": "^4.0.2"
},
"dependencies": {
"audiomoth-hid": "^2.0.4",
"audiomoth-hid": "^2.1.0",
"bootstrap": "4.3.1",
"bootstrap-slider": "^10.6.2",
"electron-debug": "3.0.1",
"electron-localshortcut": "^3.2.1",
"electron-progressbar": "^1.2.0",
"jquery": "^3.4.1",
"jquery": "^3.5.1",
"jsonschema": "1.2.4",
"popper.js": "^1.15.0",
"showdown": "^1.9.1",
Expand Down
14 changes: 13 additions & 1 deletion packetReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ typedef struct {
uint16_t lowerFilterFreq;
uint16_t higherFilterFreq;
uint16_t amplitudeThreshold;
uint8_t requireAcousticConfiguration;
AM_batteryLevelDisplayType_t batteryLevelDisplayType;
} configSettings_t;
*/

exports.read = function (packet) {

var i, j, time, gain, clockDivider, acquisitionCycles, oversampleRate, sampleRate, sampleRateDivider, sleepDuration, recordDuration, enableLED, activeStartStopPeriods, startStopPeriods, timezoneHours, enableLowVoltageCutoff, disableBatteryLevelDisplay, timezoneMinutes, disableSleepRecordCycle, earliestRecordingTime, latestRecordingTime, lowerFilterFreq, higherFilterFreq, amplitudeThreshold, startMinutes, stopMinutes;
var i, j, time, gain, clockDivider, acquisitionCycles, oversampleRate, sampleRate, sampleRateDivider, sleepDuration, recordDuration, enableLED, activeStartStopPeriods, startStopPeriods, timezoneHours, enableLowVoltageCutoff, disableBatteryLevelDisplay, timezoneMinutes, disableSleepRecordCycle, earliestRecordingTime, latestRecordingTime, lowerFilterFreq, higherFilterFreq, amplitudeThreshold, startMinutes, stopMinutes, requireAcousticConfig, displayVoltageRange;

/* Read and decode configuration packet */

Expand Down Expand Up @@ -126,6 +128,12 @@ exports.read = function (packet) {

amplitudeThreshold = twoBytesToNumber(packet, 56);

var packedByte = packet[58];

displayVoltageRange = (packedByte >> 1) & 1;

requireAcousticConfig = packedByte & 1;

/* Display configuration */

console.log('Current time: ', formatDate(time));
Expand Down Expand Up @@ -164,4 +172,8 @@ exports.read = function (packet) {

console.log('Amplitude threshold:', amplitudeThreshold);

console.log('Acoustic configuration required:', requireAcousticConfig === 1);

console.log('Use NiMH/LiPo voltage range for battery level indication:', displayVoltageRange === 1);

};
39 changes: 32 additions & 7 deletions saveLoad.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

const electron = require('electron');
const dialog = electron.remote.dialog;
const BrowserWindow = electron.remote.BrowserWindow;

const fs = require('fs');
const Validator = require('jsonschema').Validator;
Expand All @@ -25,13 +26,15 @@ const defaultSettings = {
lowerFilter: 0,
higherFilter: 24000,
amplitudeThresholdingEnabled: false,
amplitudeThreshold: 0
amplitudeThreshold: 0,
requireAcousticConfig: false,
displayVoltageRange: false
};
exports.defaultSettings = defaultSettings;

/* Save configuration settings in UI to .config file */

function saveConfiguration (timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, dutyEnabled, passFiltersEnabled, filterTypeIndex, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold, callback) {
function saveConfiguration (timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, dutyEnabled, passFiltersEnabled, filterTypeIndex, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold, requireAcousticConfig, displayVoltageRange, callback) {

var configuration, fileName, sampleRate, filterType;

Expand Down Expand Up @@ -71,7 +74,9 @@ function saveConfiguration (timePeriods, ledEnabled, lowVoltageCutoffEnabled, ba
configuration += '"lowerFilter": ' + lowerFilter + ',\n';
configuration += '"higherFilter": ' + higherFilter + ',\n';
configuration += '"amplitudeThresholdingEnabled": ' + amplitudeThresholdingEnabled + ',\n';
configuration += '"amplitudeThreshold": ' + amplitudeThreshold + '\n';
configuration += '"amplitudeThreshold": ' + amplitudeThreshold + ',\n';
configuration += '"requireAcousticConfig": ' + requireAcousticConfig + ',\n';
configuration += '"displayVoltageRange": ' + displayVoltageRange + '\n';
configuration += '}';

fileName = dialog.showSaveDialogSync({
Expand Down Expand Up @@ -134,11 +139,16 @@ function getSampleRateIndex (jsonSampleRateIndex, jsonSampleRate) {

function useLoadedConfiguration (err, data, callback) {

var jsonObj, validator, schema, timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, dutyEnabled, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, passFiltersEnabled, filterType, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold;
var jsonObj, validator, schema, timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, dutyEnabled, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, passFiltersEnabled, filterType, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold, requireAcousticConfig, displayVoltageRange;

if (err) {

dialog.showErrorBox('Load failed', 'Configuration file could not be loaded.');
dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
type: 'error',
title: 'Load failed',
message: 'Configuration file could not be loaded.'
});

console.error(err);

} else {
Expand Down Expand Up @@ -229,6 +239,12 @@ function useLoadedConfiguration (err, data, callback) {
},
amplitudeThreshold: {
type: 'integer'
},
requireAcousticConfig: {
type: 'boolean'
},
displayVoltageRange: {
type: 'boolean'
}
},
required: ['timePeriods', 'ledEnabled', 'sleepDuration']
Expand Down Expand Up @@ -307,13 +323,22 @@ function useLoadedConfiguration (err, data, callback) {
amplitudeThresholdingEnabled = (typeof jsonObj.amplitudeThresholdingEnabled === 'undefined') ? false : jsonObj.amplitudeThresholdingEnabled;
amplitudeThreshold = amplitudeThresholdingEnabled ? jsonObj.amplitudeThreshold : 0;

callback(timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, dutyEnabled, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, passFiltersEnabled, filterType, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold);
requireAcousticConfig = (typeof jsonObj.requireAcousticConfig === 'undefined') ? false : jsonObj.requireAcousticConfig;

displayVoltageRange = (typeof jsonObj.displayVoltageRange === 'undefined') ? false : jsonObj.displayVoltageRange;

callback(timePeriods, ledEnabled, lowVoltageCutoffEnabled, batteryLevelCheckEnabled, sampleRateIndex, gain, dutyEnabled, recordDuration, sleepDuration, localTime, firstRecordingDate, lastRecordingDate, passFiltersEnabled, filterType, lowerFilter, higherFilter, amplitudeThresholdingEnabled, amplitudeThreshold, requireAcousticConfig, displayVoltageRange);

console.log('Config loaded');

} catch (usageErr) {

dialog.showErrorBox('Incorrect format', 'Configuration file was not readable.');
dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
type: 'error',
title: 'Incorrect format',
message: 'Configuration file was not readable.'
});

console.error(usageErr);

}
Expand Down
2 changes: 1 addition & 1 deletion schedule/uiSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ exports.prepareUI = function (changeFunction) {

/* Set up time display */

ui.disableTimeDisplay();
ui.disableTimeDisplay(true);
ui.showTime();

};
24 changes: 22 additions & 2 deletions settings/advanced.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style="border: #cdcdcd thin solid; width: 100%; margin-top: 8px;">
<div style="border: #cdcdcd thin solid; width: 100%;">
<div class="row" style="margin-top: 8px;">
<div class="col-8" style="text-align: left;">
<span class="settings-text" style="margin-left: 17px;">Enable filtering:</span>
Expand All @@ -8,7 +8,7 @@
</div>
</div>

<div class="row" style="margin-top: 8px;">
<div class="row" style="margin-top: 1px;">
<div class="col-12">
<div style="margin-left: 5px; margin-right: 4px">
<table class="table" style="margin-bottom: 4px;" title="Type of filter.">
Expand Down Expand Up @@ -120,3 +120,23 @@
</div>
</div>
</div>

<div style="border: #cdcdcd thin solid; width: 100%; margin-top: 8px;">
<div class="row" style="margin-top: 8px; margin-bottom: 8px;">
<div class="col-9" style="text-align: left;">
<span style="margin-left: 17px;">Always require acoustic chime on switching to CUSTOM:</span>
</div>
<div class="col-3" style="text-align: right;" title="Whether the time or deployment ID must be set by an acoustic chime before CUSTOM recording starts.">
<input id="acoustic-config-checkbox" type="checkbox" style="margin-right: 16px;">
</div>
</div>

<div class="row" style="margin-top: 8px; margin-bottom: 8px;">
<div class="col-9" style="text-align: left;">
<span style="margin-left: 17px;">Use NiMH/LiPo voltage range for battery level indication:</span>
</div>
<div class="col-3" style="text-align: right;" title="Whether voltage range of a NiMH/LiPo battery should be displayed instead of battery level.">
<input id="voltage-range-checkbox" type="checkbox" style="margin-right: 16px;">
</div>
</div>
</div>
11 changes: 10 additions & 1 deletion settings/uiSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ var sleepDurationInput = document.getElementById('sleep-duration-input');
var recordingDurationLabel = document.getElementById('recording-duration-label');
var sleepDurationLabel = document.getElementById('sleep-duration-label');

var acousticConfigCheckBox = document.getElementById('acoustic-config-checkbox');

var voltageRangeCheckBox = document.getElementById('voltage-range-checkbox');

/* Whether or not the warning on sleep duration being set less than 5 has been displayed this app load */
var sleepWarningDisplayed = false;

Expand Down Expand Up @@ -139,7 +143,9 @@ exports.getSettings = function () {
lowerFilter: uiFiltering.getLowerSliderValue(),
higherFilter: uiFiltering.getHigherSliderValue(),
amplitudeThresholdingEnabled: uiFiltering.amplitudeThresholdingIsEnabled(),
amplitudeThreshold: parseInt(uiFiltering.getAmplitudeThreshold())
amplitudeThreshold: parseInt(uiFiltering.getAmplitudeThreshold()),
requireAcousticConfig: acousticConfigCheckBox.checked,
displayVoltageRange: voltageRangeCheckBox.checked
};

return settings;
Expand Down Expand Up @@ -176,4 +182,7 @@ exports.fillUI = function (settings) {
durationInput.setValue(sleepDurationInput, settings.sleepDuration);
durationInput.setValue(recordingDurationInput, settings.recordDuration);

acousticConfigCheckBox.checked = settings.requireAcousticConfig;
voltageRangeCheckBox.checked = settings.displayVoltageRange;

};
8 changes: 6 additions & 2 deletions ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,19 @@ exports.updateDate = function (date) {

};

exports.disableTimeDisplay = function () {
exports.disableTimeDisplay = function (blankValue) {

if (timeDisplay) {

timeDisplay.style.color = 'lightgrey';

timezoneLabel.style.color = 'lightgrey';

deviceDate = new Date(0);
if (blankValue) {

deviceDate = new Date(0);

}

}

Expand Down
Loading

0 comments on commit c37f036

Please sign in to comment.