Skip to content

Commit

Permalink
Add high sample rates
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenAcousticDevices committed Sep 11, 2017
1 parent c663a13 commit 0cdfd73
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 86 deletions.
19 changes: 19 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,23 @@ var configurations = [{
acquisitionCycles: 1,
oversampleRate: 4,
current: 18.1
}, {
sampleRate: 240000,
clockBand: AM_HFRCO_28MHZ,
clockDivider: 2,
acquisitionCycles: 1,
oversampleRate: 4,
current: 20.0
}, {
sampleRate: 320000,
clockBand: AM_HFXO,
clockDivider: 5,
acquisitionCycles: 2,
oversampleRate: 2,
current: 24.0
}];


function errorOccurred(err) {

console.error(err);
Expand Down Expand Up @@ -242,6 +257,10 @@ function configureDevice() {

}

/* Enable the high sample rates */

electron.ipcRenderer.on('enable', ui.enableHighSamplingRate);

/* Initiliase lifeDisplay configuration data */

lifeDisplay.setConfigurationData(configurations);
Expand Down
131 changes: 57 additions & 74 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,92 +85,75 @@

<div class="row" style="margin-top: 10px;">
<div style="border: #cdcdcd thin solid; margin-left: 2%; width: 96%;">
<div class="row" style="margin-top: 10px;">
<div class="col-xs-8" style="margin-left: 31%;">
<div class="row">
<div class="col-xs-12">
<div class="row" style="text-align: center; font-size: 8pt;">
<div class="col-xs-2">8</div>
<div class="col-xs-2">16</div>
<div class="col-xs-2">32</div>
<div class="col-xs-2">48</div>
<div class="col-xs-2">96</div>
<div class="col-xs-2">192</div>
</div>
</div>
</div>
</div>
</div>

<div class="row" style="margin-top: 2px;">
<div class="col-xs-3" style="text-align: left; margin-left: 3%; width: 150px;">Sample rate (kHz):</div>
<div class="col-xs-8" style="margin-left: 0%;">
<div class="row">
<div class="col-xs-12">
<div class="row" style="text-align: right;">
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio0" value=0 name="sample-rate-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio1" value=1 name="sample-rate-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio2" value=2 name="sample-rate-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio3" value=3 name="sample-rate-radio" checked></div>
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio4" value=4 name="sample-rate-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="sample-rate-radio5" value=5 name="sample-rate-radio"></div>
</div>
</div>
</div>
</div>
</div>

<div class="row" style="margin-top: 10px;">
<div class="col-xs-8" style="margin-left: 31.5%;">
<div class="row">
<div class="col-xs-12">
<div class="row" style="font-size: 8pt;">
<div class="col-xs-2"></div>
<div class="col-xs-2" style="text-align: center;">Low</div>
<div class="col-xs-2"></div>
<div class="col-xs-2" style="text-align: center;">Mid</div>
<div class="col-xs-2"></div>
<div class="col-xs-2" style="text-align: center;">High</div>
</div>
</div>
</div>
</div>
</div>

<div class="row" style="margin-top: 2px;">
<div class="col-xs-3" style="text-align: left; margin-left: 3%; width: 150px;">Gain:</div>
<div class="col-xs-8" style="margin-left: 0%;">
<div class="row">
<div class="col-xs-12">
<div class="row" style="text-align: right;">
<div class="col-xs-2" style=""></div>
<div class="col-xs-2" style=""><input type="radio" id="gain-radio0" value=0 name="gain-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="gain-radio1" value=1 name="gain-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="gain-radio2" value=2 name="gain-radio" checked></div>
<div class="col-xs-2" style=""><input type="radio" id="gain-radio3" value=3 name="gain-radio"></div>
<div class="col-xs-2" style=""><input type="radio" id="gain-radio4" value=4 name="gain-radio"></div>
</div>
</div>
</div>
<div class="row" style="margin-top: 10px; margin-left: 0px; margin-bottom: 0px">
<div class="col-xs-12">
<div class='container-fuid' style="margin-right: 4px">
<table class='table'>
<tr style='font-size: 11px;'>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'>8</td>
<td align="center" style='padding: 2px'>16</td>
<td align="center" style='padding: 2px'>32</td>
<td align="center" style='padding: 2px'>48</td>
<td align="center" style='padding: 2px'>96</td>
<td align="center" style='padding: 2px'>192</td>
<td id='sampling-240-label' align="center" style='padding: 2px; color: lightgray'>240</td>
<td id='sampling-320-label' align="center" style='padding: 2px; color: lightgray'>320</td>
</tr>
<tr>
<td align="left" style='padding-top: 0px'>Sample rate (kHz):</td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio0" value=0 name="sample-rate-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio1" value=1 name="sample-rate-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio2" value=2 name="sample-rate-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio3" value=3 name="sample-rate-radio" checked></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio4" value=4 name="sample-rate-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio5" value=5 name="sample-rate-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio6" value=6 name="sample-rate-radio" disabled></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="sample-rate-radio7" value=7 name="sample-rate-radio" disabled></td>
</tr>
<tr style='font-size: 11px;'>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'>Low</td>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'>Med</td>
<td align="center" style='padding: 2px'></td>
<td align="center" style='padding: 2px'>High</td>
</tr>
<tr>
<td align="left" style='padding-top: 0px'>Gain:</td>
<td align="center" style='padding-top: 0px'></td>
<td align="center" style='padding-top: 0px'></td>
<td align="center" style='padding-top: 0px'></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="gain-radio0" value=0 name="gain-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="gain-radio1" value=1 name="gain-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="gain-radio2" value=2 name="gain-radio" checked></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="gain-radio3" value=3 name="gain-radio"></td>
<td align="center" style='padding-top: 0px'><input type="radio" id="gain-radio4" value=4 name="gain-radio"></td>
</tr>
</table>
</div>
</div>
</div>

<div class="row" style="margin-top: 10px; margin-bottom: 10px;">
<div class="row">
<div class="col-xs-12">
<div class="row" style="margin-top: 10px; margin-bottom: 10px;">
<div class="row" style="margin-top: 0px; margin-bottom: 0px;">
<div class="col-xs-6" style="text-align: left;">
<span id="sleep-duration-label" style="margin-left: 7%;">Sleep duration (s):</span>
<span id="sleep-duration-label" style="margin-left: 9%;">Sleep duration (s):</span>
</div>
<div class="col-xs-6" style="text-align: right;">
<input id="sleep-duration-input" type="number" style="width: 40%; margin-right: 8%; text-align: right;" value="5">
<input id="sleep-duration-input" type="number" style="width: 40%; margin-right: 7%; text-align: right;" value="5">
</div>
</div>
<div class="row" style="margin-top: 10px; margin-bottom: 10px;">
<div class="col-xs-6" style="text-align: left;">
<span id="recording-duration-label" style="margin-left: 7%;">Recording duration (s):</span>
<span id="recording-duration-label" style="margin-left: 9%;">Recording duration (s):</span>
</div>
<div class="col-xs-6" style="text-align: right;">
<input id="recording-duration-input" type="number" style="width: 40%; margin-right: 8%; text-align: right;" value="10">
<input id="recording-duration-input" type="number" style="width: 40%; margin-right: 7%; text-align: right;" value="10">
</div>
</div>
</div>
Expand All @@ -179,7 +162,7 @@
</div>
</div>

<div class="row" style="margin-top: 10px; margin-bottom: 10px;">
<div class="row" style="margin-top: 10px; margin-bottom: 2px;">
<div style="border: #cdcdcd thin solid; margin-left: 2%; width: 96%;">
<div class="row" style="margin-top: 10px; margin-bottom: 10px;">
<div class="col-xs-12" style="height: 40px;">
Expand Down
27 changes: 17 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,27 @@ app.on('ready', function () {
menuTemplate = [{
label: "File",
submenu: [{
label: "Open configuration",
label: "Open Configuration",
accelerator: "CommandOrControl+O",
click: function () {
mainWindow.webContents.send("load");
}
}, {
label: "Save configuration",
label: "Save Configuration",
accelerator: "CommandOrControl+S",
click: function () {
mainWindow.webContents.send("save");
}
}, {
type: 'separator'
}, {
label: "Enable High Sampling Rates",
accelerator: "CommandOrControl+H",
click: function () {
mainWindow.webContents.send("enable");
}
}, {
type: 'separator'
}, {
label: "Quit",
accelerator: "CommandOrControl+Q",
Expand All @@ -77,19 +87,16 @@ app.on('ready', function () {
}, {
label: "Help",
submenu: [{
label: "Open Acoustic Devices website",
label: "About",
click: function () {
shell.openExternal("https://openacousticdevices.info");
openAboutWindow();
}
}, {
label: "Support forum",
click: function () {
shell.openExternal("https://www.openacousticdevices.info/support");
}
type: 'separator'
}, {
label: "About",
label: "Open Acoustic Devices Website",
click: function () {
openAboutWindow();
shell.openExternal("https://openacousticdevices.info");
}
}]
}];
Expand Down
5 changes: 5 additions & 0 deletions ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}

.table>tbody>tr>td,
.table>tbody>tr>th {
border-top: none;
}
23 changes: 21 additions & 2 deletions ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ var endTimeInput = document.getElementById('end-time-input');
var recordingDurationInput = document.getElementById('recording-duration-input');
var sleepDurationInput = document.getElementById('sleep-duration-input');

var sampling240Label = document.getElementById('sampling-240-label');
var sampling320Label = document.getElementById('sampling-320-label');

var sampling240RadioButton = document.getElementById('sample-rate-radio6');
var sampling320RadioButton = document.getElementById('sample-rate-radio7');

var configureButton = document.getElementById('configure-button');

/* Function to rescale */
Expand Down Expand Up @@ -85,7 +91,8 @@ function updateCanvas(timePeriods) {

}

// 6am, midday and 6pm markers.
// 6am, midday and 6pm markers\

timeContext.fillStyle = "#000000";
timeContext.fillRect(0.25 * timeCanvas.width, 0, 0.002 * timeCanvas.width, timeCanvas.height);
timeContext.fillRect(0.5 * timeCanvas.width, 0, 0.002 * timeCanvas.width, timeCanvas.height);
Expand Down Expand Up @@ -145,7 +152,7 @@ function initialiseDisplay() {

batteryDisplay.textContent = "0.0V";

};
}

exports.initialiseDisplay = initialiseDisplay;

Expand Down Expand Up @@ -189,6 +196,18 @@ exports.enableDisplayAndShowTime = function (date) {

};

/* Enable the high sample rates */

exports.enableHighSamplingRate = function () {

sampling240Label.style.color = 'black';
sampling320Label.style.color = 'black';

sampling240RadioButton.removeAttribute("disabled");
sampling320RadioButton.removeAttribute("disabled");

};

/* Insert retrieved values into device information display */

exports.updateIdDisplay = function (id) {
Expand Down

0 comments on commit 0cdfd73

Please sign in to comment.