Skip to content

Commit 60fbb5e

Browse files
authored
Merge pull request #4051 from EmVee381/master
feat: add system Quiet/Silent mode integration to prevent buzzing
2 parents 6f236ba + a379202 commit 60fbb5e

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

apps/grandfatherclock/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Defaults:
1616
- The time between count buzzes is 500ms.
1717
- The meridian buzzes are 50ms long.
1818
- The time between meridian buzzes is 300ms.
19+
- Follow system quiet mode is DISABLED
1920

2021
## Requests
2122

apps/grandfatherclock/settings.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals
1313
wait_ms: 500,
1414
meridian_buzz_ms: 50,
15-
meridian_buzz_wait_ms: 300
15+
meridian_buzz_wait_ms: 300,
16+
followQuietMode: true
1617
}, require('Storage').readJSON("grandfatherclock.json", true) || {});
1718

1819
let writeConfig = function() {
@@ -41,6 +42,12 @@
4142
config.swap_meridian = v;
4243
writeConfig();
4344
}
45+
},"Follow Quite Mode": {
46+
value: config.followQuietMode,
47+
onchange: v => {
48+
config.followQuietMode = v;
49+
writeConfig();
50+
}
4451
},"Hr attn. buzz length (ms)": {
4552
value: config.hour_attention_buzz_ms,
4653
onchange: v => {

apps/grandfatherclock/widget.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals
1212
wait_ms: 500,
1313
meridian_buzz_ms: 50,
14-
meridian_buzz_wait_ms: 300
14+
meridian_buzz_wait_ms: 300,
15+
followQuietMode: false
1516
}, require('Storage').readJSON("grandfatherclock.json", true) || {}); // or, load the app settings file.
1617

1718
WIDGETS["grandfatherclock"] = {
@@ -24,11 +25,13 @@
2425
}
2526
}
2627
};
28+
const quietMode= (require("Storage").readJSON("setting.json", 1) || {}).quiet && config.followQuietMode;
2729

2830
let date;
2931
let fractionMs = 3600000 / config.fractions_of_hour;
3032

3133
let chime = function () {
34+
if (quietMode) return;
3235
date = new Date();
3336
let hourFrac = Math.floor(date.getMinutes() / (60 / config.fractions_of_hour));
3437

0 commit comments

Comments
 (0)