Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Hardware Button - Debounce delay now accessible in admin panel #294

Merged
merged 2 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
$config['remotebuzzer']['shutdowngpio'] = 16;
$config['remotebuzzer']['shutdownholdtime'] = '5';
$config['remotebuzzer']['port'] = 14711;
$config['remotebuzzer']['debounce'] = 30;


// S Y N C T O U S B S T I C K
Expand Down
11 changes: 11 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,17 @@
'name' => 'remotebuzzer[enable_standalonegallery]',
'value' => $config['remotebuzzer']['enable_standalonegallery'],
],
'remotebuzzer_debounce' => [
'view' => 'expert',
'type' => 'range',
'placeholder' => $defaultConfig['remotebuzzer']['debounce'],
'name' => 'remotebuzzer[debounce]',
'value' => $config['remotebuzzer']['debounce'],
'range_min' => 0,
'range_max' => 100,
'range_step' => 5,
'unit' => 'milliseconds',
],
'remotebuzzer_logfile' => [
'view' => 'expert',
'type' => 'hidden',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
"manual:print:textonprint_rotation": "Enter a value which is used as degrees the text gets rotated at print.",
"manual:remotebuzzer:remotebuzzer_collagebutton": "For COLLAGE connect the hardware button to GPIO20. Pull GPIO to ground for to trigger. If enabled, long-press on PICTURE button will not trigger collage.",
"manual:remotebuzzer:remotebuzzer_collagetime": "If PICTURE button pressed less than seconds here, a picture is triggered. If pressed more seconds than here, a collage is triggered. Only works if collage is enabled in the admin settings and the collage button is disbaled.",
"manual:remotebuzzer:remotebuzzer_debounce": "Debounce time for hardware buttons [ms]",
"manual:remotebuzzer:remotebuzzer_enable_standalonegallery": "Controls whether the rotary encoder is active on the standalone gallery view.",
"manual:remotebuzzer:remotebuzzer_logfile": "In Dev-Mode server debugging information will be written to the logfile, located in the <code>tmp</code> folder and defaults to <code>io_server.log</code>.",
"manual:remotebuzzer:remotebuzzer_picturebutton": "For PICTURE connect the hardware button to GPIO21. Pull GPIO to ground for to trigger. Long-press will trigger COLLAGE, if enabled and Collage hardware button is disabled.",
Expand Down Expand Up @@ -487,6 +488,7 @@
"remotebuzzer": "Hardware Button",
"remotebuzzer:remotebuzzer_collagebutton": "Collage Button",
"remotebuzzer:remotebuzzer_collagetime": "Seconds to trigger collage",
"remotebuzzer:remotebuzzer_debounce": "Debounce time",
"remotebuzzer:remotebuzzer_enable_standalonegallery": "Rotary for standalone gallery",
"remotebuzzer:remotebuzzer_logfile": "Logfile",
"remotebuzzer:remotebuzzer_picturebutton": "Picture Button",
Expand Down
20 changes: 15 additions & 5 deletions src/js/remotebuzzer_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ if (config.remotebuzzer.userotary) {
log('ROTARY support active');
const rotaryClk = new Gpio(config.remotebuzzer.rotaryclkgpio, 'in', 'both');
const rotaryDt = new Gpio(config.remotebuzzer.rotarydtgpio, 'in', 'both');
const rotaryBtn = new Gpio(config.remotebuzzer.rotarybtngpio, 'in', 'both', {debounceTimeout: 20});
const rotaryBtn = new Gpio(config.remotebuzzer.rotarybtngpio, 'in', 'both', {
debounceTimeout: config.remotebuzzer.debounce
});

rotaryClkPin = 0;
rotaryDtPin = 0;
Expand All @@ -535,7 +537,9 @@ if (config.remotebuzzer.userotary) {
if (config.remotebuzzer.usebuttons) {
log('BUTTON support active');
if (config.remotebuzzer.picturebutton) {
const pictureButton = new Gpio(config.remotebuzzer.picturegpio, 'in', 'both', {debounceTimeout: 20});
const pictureButton = new Gpio(config.remotebuzzer.picturegpio, 'in', 'both', {
debounceTimeout: config.remotebuzzer.debounce
});

if (!config.remotebuzzer.collagebutton && config.collage.enabled) {
pictureButton.watch(watchPictureGPIOwithCollage);
Expand All @@ -549,21 +553,27 @@ if (config.remotebuzzer.usebuttons) {

/* COLLAGE BUTTON */
if (config.remotebuzzer.collagebutton && config.collage.enabled) {
const collageButton = new Gpio(config.remotebuzzer.collagegpio, 'in', 'both', {debounceTimeout: 20});
const collageButton = new Gpio(config.remotebuzzer.collagegpio, 'in', 'both', {
debounceTimeout: config.remotebuzzer.debounce
});
collageButton.watch(watchCollageGPIO);
log('Looking for Collage Button on Raspberry GPIO', config.remotebuzzer.collagegpio);
}

/* SHUTDOWN BUTTON */
if (config.remotebuzzer.shutdownbutton) {
const shutdownButton = new Gpio(config.remotebuzzer.shutdowngpio, 'in', 'both', {debounceTimeout: 20});
const shutdownButton = new Gpio(config.remotebuzzer.shutdowngpio, 'in', 'both', {
debounceTimeout: config.remotebuzzer.debounce
});
shutdownButton.watch(watchShutdownGPIO);
log('Looking for Shutdown Button on Raspberry GPIO', config.remotebuzzer.shutdowngpio);
}

/* PRINT BUTTON */
if (config.remotebuzzer.printbutton) {
const printButton = new Gpio(config.remotebuzzer.printgpio, 'in', 'both', {debounceTimeout: 20});
const printButton = new Gpio(config.remotebuzzer.printgpio, 'in', 'both', {
debounceTimeout: config.remotebuzzer.debounce
});
printButton.watch(watchPrintGPIO);
log('Looking for Print Button on Raspberry GPIO', config.remotebuzzer.printgpio);
}
Expand Down