Skip to content

Commit 7b9180a

Browse files
authored
Merge pull request #337 from sensebox/development
Sound Level Meter
2 parents 5b7bbbd + 772cfe3 commit 7b9180a

File tree

8 files changed

+845
-665
lines changed

8 files changed

+845
-665
lines changed

app/components/leaflet.directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898
var baselayer = L.tileLayer('@@OPENSENSEMAP_MAPTILES_URL', {
9999
subdomains: 'abc',
100-
attribution: '&copy; <a href="http://osm.org/copyright" target="_blank">OpenStreetMap</a> contributors | Tiles &copy; <a href="http://www.mapbox.com/" target="_blank">Mapbox</a>',
100+
attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
101101
detectRetina: true,
102102
reuseTiles: true,
103103
maxZoom: 18

app/scripts/controllers/account.box.edit.script.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
vm.showSerialPort = false;
1818
vm.soilDigitalPort = 'A';
1919
vm.showSoilDigitalPort = false;
20+
vm.soundMeterPort = 'B';
21+
vm.showSoundMeterPort = false;
2022
vm.compiling = false;
2123
vm.wifi = {
2224
ssid: '',
@@ -45,6 +47,12 @@
4547
vm.showSoilDigitalPort = true;
4648
}
4749

50+
if (boxData.sensorsArray.filter(function (s) {
51+
return s.sensorType === 'SOUNDLEVELMETER';
52+
}).length !== 0) {
53+
vm.showSoundMeterPort = true;
54+
}
55+
4856
return getScript();
4957
}
5058

@@ -58,6 +66,7 @@
5866
return AccountService.getScript(boxData._id, {
5967
serialPort: vm.serialPort,
6068
soilDigitalPort: vm.soilDigitalPort,
69+
soundMeterPort: vm.soundMeterPort,
6170
ssid: vm.wifi.ssid,
6271
password: vm.wifi.password
6372
})

app/scripts/controllers/register.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
},
3939
serialPort: 'Serial1',
4040
soilDigitalPort: 'A',
41+
soundMeterPort: 'B',
4142
bmePhenomenon: 'tempHumiPress'
4243
};
4344

@@ -178,6 +179,7 @@
178179
return AccountService.getScript(vm.newSenseBox.id, {
179180
serialPort: vm.newSenseBox.serialPort,
180181
soilDigitalPort: vm.newSenseBox.soilDigitalPort,
182+
soundMeterPort: vm.newSenseBox.soundMeterPort,
181183
ssid: vm.wifi.ssid,
182184
password: vm.wifi.password
183185
})
@@ -323,6 +325,7 @@
323325
if (model.startsWith('homeV2')) {
324326
data.serialPort = vm.newModel.serialPort;
325327
data.soilDigitalPort = vm.newSenseBox.soilDigitalPort;
328+
data.soundMeterPort = vm.newSenseBox.soundMeterPort;
326329
}
327330
AccountService.getScript(boxId, data)
328331
.then(function (data) {
@@ -395,7 +398,7 @@
395398
}
396399
if (vm.extensions.soundLevelMeter.id !== '') {
397400
vm.newSenseBox.sensorTemplates.push('soundlevelmeter');
398-
vm.newSenseBox.soundLevelMeterPort = vm.extensions.soundLevelMeter.port;
401+
vm.newSenseBox.soundMeterPort = vm.extensions.soundLevelMeter.port;
399402
}
400403
}
401404

app/views/account.box.edit.script.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ <h3>{{'CONFIGURATION'|translate}}</h3>
3535
</div>
3636
</div>
3737
</div>
38+
<div class="form-group" ng-if="script.showSoundMeterPort">
39+
<label for="soundMeterPort">{{'SOUND_LEVEL'|translate}}<br/>{{'DIGITAL_PORT'|translate}}</label>
40+
<div class="input-group">
41+
<select type="text" class="form-control" id="soundMeterPort" ng-model="script.soundMeterPort"
42+
ng-change="script.generateScript()">
43+
<option value="A">A</option>
44+
<option value="B">B</option>
45+
<option value="C">C</option>
46+
</select>
47+
<div class="input-group-addon">
48+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
49+
</div>
50+
</div>
51+
</div>
3852
<div class="form-group">
3953
<label for="ssid">WiFi SSID</label>
4054
<div class="input-group" uib-tooltip="{{'DATA_NOT_STORED'|translate}}" tooltip-placement="top"

app/views/account.box.register.html

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ <h3>{{'SENSORS' | translate}}</h3>
419419
</div>
420420
</div>
421421
</div>
422-
<!-- <div class="row">
422+
<div class="row">
423423
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-6"
424424
style="border-right: 1px solid #e1e4e8;">
425425
<div style="text-align: left;">
@@ -430,7 +430,7 @@ <h3>{{'SENSORS' | translate}}</h3>
430430
<label for="soundLevelMeter"> </label>
431431
</div>
432432
<img
433-
src="https://sensebox.kaufen/api/public/uploads/1572259222502-SMT50_freigestellt_02.png"
433+
src="https://sensebox.kaufen/api/public/uploads/1579187023927-176092104_illustrator_02_gimp%20overlay_cropped.png"
434434
style="vertical-align: middle; height: 90px; width: 90px;" />
435435
<span style="vertical-align: middle;">Lautstärke</span>
436436
</div>
@@ -449,7 +449,7 @@ <h3>{{'SENSORS' | translate}}</h3>
449449
</div>
450450
</div>
451451
</div>
452-
</div> -->
452+
</div>
453453
</div>
454454
</div>
455455
</li>
@@ -739,6 +739,20 @@ <h4>Bodentemperatur</h4>
739739
</div>
740740
</div>
741741
</div>
742+
<div class="col-sm-3 col-md-3 col-lg-3">
743+
<div class="thumbnail">
744+
<img
745+
src="https://sensebox.kaufen/api/public/uploads/1579187023927-176092104_illustrator_02_gimp%20overlay_cropped.png"
746+
style="vertical-align: middle; height: 90px; width: 90px;" alt="">
747+
<div class="caption">
748+
<h4>{{'SOUND_LEVEL'|translate}}</h4>
749+
<p>
750+
<button type="button" class="btn btn-success"
751+
ng-click="register.addSensorTemplate('soundlevelmeter')">{{'ADD_SENSOR'|translate}}</button>
752+
</p>
753+
</div>
754+
</div>
755+
</div>
742756
</div>
743757
<br>
744758
<hr>
@@ -1348,6 +1362,20 @@ <h5 ng-bind-html="'COMPILE_SKETCH'|translate"></h5>
13481362
</div>
13491363
</div>
13501364
</div>
1365+
<div class="form-group">
1366+
<label for="soundMeterPort">{{'SOUND_LEVEL'|translate}} {{'DIGITAL_PORT'|translate}}</label>
1367+
<div class="input-group">
1368+
<select type="text" class="form-control" id="soundMeterPort" ng-model="register.newSenseBox.soundMeterPort"
1369+
ng-change="register.generateScript()">
1370+
<option value="A">A</option>
1371+
<option value="B">B</option>
1372+
<option value="C">C</option>
1373+
</select>
1374+
<div class="input-group-addon">
1375+
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
1376+
</div>
1377+
</div>
1378+
</div>
13511379
<div class="form-group">
13521380
<label for="ssid">WiFi SSID</label>
13531381
<div class="input-group" uib-tooltip="{{'DATA_NOT_STORED'|translate}}" tooltip-placement="top"

app/views/account.dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h3 translate="REGISTERED_BOXES" translate-values="{count: dashboard.boxes.lengt
88
<p>
99
<a ui-sref="account.register" class="btn btn-primary"
1010
role="button">{{'ACCOUNT_NEW_SENSEBOX' | translate}}</a>
11-
<a href="https://books.sensebox.de" target="_blank" class="btn btn-default" role="button">{{'DOCUMENTATION'
11+
<a href="https://sensebox.de/de/go-home" target="_blank" class="btn btn-default" role="button">{{'DOCUMENTATION'
1212
| translate}}</a>
1313
<a href="https://forum.sensebox.de" target="_blank" class="btn btn-default" role="button">Forum</a>
1414
</p>

0 commit comments

Comments
 (0)