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

Commit c46116c

Browse files
committed
remotebuzzer: rework option to use remotebuzzer server without GPIO
On #400 we've added simple GET endpoints to trigger photos / collages (to support WiFi hardware buttons), this allows to use the remotebuzzer server without the need for GPIO. Change-Id: I4fa1dc088652bf5119f01d787c69094b0f8741d2
1 parent 2c9b381 commit c46116c

File tree

8 files changed

+14
-19
lines changed

8 files changed

+14
-19
lines changed

config/config.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
$config['remotebuzzer']['usebuttons'] = false;
258258
$config['remotebuzzer']['userotary'] = false;
259259
$config['remotebuzzer']['enable_standalonegallery'] = false;
260-
$config['remotebuzzer']['usegpio'] = true;
260+
$config['remotebuzzer']['usegnopio'] = false;
261261
$config['remotebuzzer']['rotaryclkgpio'] = 27;
262262
$config['remotebuzzer']['rotarydtgpio'] = 17;
263263
$config['remotebuzzer']['rotarybtngpio'] = 22;

lib/configsetup.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,11 +1545,11 @@
15451545
'name' => 'remotebuzzer[userotary]',
15461546
'value' => $config['remotebuzzer']['userotary'],
15471547
],
1548-
'remotebuzzer_usegpio' => [
1548+
'remotebuzzer_usenogpio' => [
15491549
'view' => 'advanced',
1550-
'type' => 'hidden',
1551-
'name' => 'remotebuzzer[usegpio]',
1552-
'value' => $config['remotebuzzer']['usegpio'],
1550+
'type' => 'checkbox',
1551+
'name' => 'remotebuzzer[usenogpio]',
1552+
'value' => $config['remotebuzzer']['usenogpio'],
15531553
],
15541554
'remotebuzzer_picturebutton' => [
15551555
'view' => 'advanced',

lib/services_start.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function processIsRunning($pName, $pidFile) {
1515
return count($output) - 1 ? true : false; // true if process is active
1616
}
1717

18-
if ($config['remotebuzzer']['usebuttons'] || $config['remotebuzzer']['userotary']) {
18+
if ($config['remotebuzzer']['usebuttons'] || $config['remotebuzzer']['userotary'] || $config['remotebuzzer']['usenogpio']) {
1919
$connection = @fsockopen('127.0.0.1', $config['remotebuzzer']['port']);
2020

2121
if (!is_resource($connection)) {

resources/lang/de.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@
564564
"remotebuzzer:remotebuzzer_shutdownbutton": "Abschalt-Taste",
565565
"remotebuzzer:remotebuzzer_shutdownholdtime": "Sekunden um das Herunterfahren einzuleiten",
566566
"remotebuzzer:remotebuzzer_usebuttons": "Hardware-Tasten aktivieren",
567-
"remotebuzzer:remotebuzzer_usegpio": "GPIO für Remotebuzzer verwenden",
568567
"reset": "Zurücksetzen",
569568
"reset:reset_button": "Konfiguration zurücksetzen",
570569
"reset:reset_remove_config": "Persönliche Konfiguration löschen (my.config.inc.php)",

resources/lang/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
"manual:remotebuzzer:remotebuzzer_shutdownbutton": "For SHUTDOWN connect the hardware button to GPIO16. Pull GPIO to ground for to trigger. Hold 5 sec (default) to trigger.",
444444
"manual:remotebuzzer:remotebuzzer_shutdownholdtime": "Seconds to hold button until system shutdown will be initiated. Setting to Zero (0) means immediate shutdown without waiting time.",
445445
"manual:remotebuzzer:remotebuzzer_usebuttons": "This feature enables hardware button support - see FAQ for details. Please activate GPIO support for remotebuzzer. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
446-
"manual:remotebuzzer:remotebuzzer_usegpio": "This feature enables hardware support through Raspberry GPIO pins - see FAQ for details. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
446+
"manual:remotebuzzer:remotebuzzer_usenogpio": "This feature enables the remotebuzzer server without GPIO support. This allows to use a simple GET endpoint to trigger photos / collage (e.g. to support WiFi hardware buttons. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
447447
"manual:remotebuzzer:remotebuzzer_userotary": "Enable Rotary Encoder support for to navigate the screen. Needs a rotary encoder switch connected to the GPIOs - see FAQ for details. Please activate GPIO support for remotebuzzer. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
448448
"manual:reset:reset_button": "Will execute config reset. If you like to also reset images and / or the mail address database make sure you first activate those settings and save (!) the config, then perform the config reset itself.",
449449
"manual:reset:reset_remove_config": "If enabled, personal config gets removed on reset.",
@@ -582,7 +582,7 @@
582582
"remotebuzzer:remotebuzzer_shutdownbutton": "Shutdown Button",
583583
"remotebuzzer:remotebuzzer_shutdownholdtime": "Seconds to initiate shutdown",
584584
"remotebuzzer:remotebuzzer_usebuttons": "Enable Hardware Buttons",
585-
"remotebuzzer:remotebuzzer_usegpio": "Use GPIO for remotebuzzer",
585+
"remotebuzzer:remotebuzzer_usenogpio": "Use remotebuzzer without GPIO support",
586586
"remotebuzzer:remotebuzzer_userotary": "Enable Rotary Encoder",
587587
"reset": "Reset",
588588
"reset:reset_button": "Execute config reset",

resources/lang/fr.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@
431431
"manual:remotebuzzer:remotebuzzer_shutdownbutton": "Pour ARRETER connectez le bouton matériel au GPIO16. Mettez le GPIO à la masse pour déclencher. Maintenez 5 secondes (par défaut) pour le déclencher.",
432432
"manual:remotebuzzer:remotebuzzer_shutdownholdtime": "Lee temps de maintien enfoncé du bouton, en secondes, jusqu'à ce que l'arrêt du système soit initié. La valeur de zéro (0) signifie l'arrêt immédiat sans temps d'attente.",
433433
"manual:remotebuzzer:remotebuzzer_usebuttons": "Cette fonction active le support des boutons matériels - voir FAQ pour plus de détails. Veuillez activer le support GPIO pour remotebuzzer. IMPORTANT: Pour les écrans connectés au Wi-Fi, vous devez vous assurer de configurer l'adresse IP du serveur web de Photobooth dans la section \"Général\", pour que cette fonctionnalité fonctionne correctement.",
434-
"manual:remotebuzzer:remotebuzzer_usegpio": "Cette fonctionnalité active le support matériel via les broches Raspberry GPIO - voir la FAQ pour plus de détails. IMPORTANT: Pour les écrans connectés au Wi-Fi, vous devez vous assurer de configurer l'adresse IP du serveur web Photobooth dans la section \"Général\", pour que cette fonction fonctionne correctement.",
435434
"manual:remotebuzzer:remotebuzzer_userotary": "Activez le support de l’encodeur rotatif pour naviguer sur l’écran. Nécessite un encodeur rotatif connecté aux GPIOs - voir FAQ pour plus de détails. Veuillez activer le support GPIO pour remotebuzzer. IMPORTANT: Pour les écrans connectés au Wi-Fi, vous devez vous assurer de configurer l'adresse IP du serveur web de Photobooth dans la section \"Général\", pour que cette fonctionnalité fonctionne correctement.",
436435
"manual:reset:reset_button": "Exécute la réinitialisation de la configuration. Si vous souhaitez également réinitialiser les photos et / ou la base de données d'adresse e-mail, assurez-vous d'abord d'activer ces paramètres et de sauvegarder la config (!), puis effectuez la réinitialisation de la configuration.",
437436
"manual:reset:reset_remove_config": "Si activé, la configuration personnelle sera supprimée lors de la réinitialisation.",
@@ -568,7 +567,6 @@
568567
"remotebuzzer:remotebuzzer_shutdownbutton": "Bouton d'arrêt",
569568
"remotebuzzer:remotebuzzer_shutdownholdtime": "Nombre de secondes pour lancer l'arrêt",
570569
"remotebuzzer:remotebuzzer_usebuttons": "Activer les boutons physiques",
571-
"remotebuzzer:remotebuzzer_usegpio": "Utilisez les GPIO pour le buzzer",
572570
"remotebuzzer:remotebuzzer_userotary": "Activer l'encodeur rotatif",
573571
"reset": "Réinitialiser",
574572
"reset:reset_button": "Exécuter la réinitialisation de la configuration",

src/js/remotebuzzer_client.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ let buttonController;
99
function initRemoteBuzzerFromDOM() {
1010
photoboothTools.console.logDev(
1111
'Remote Buzzer client:',
12-
config.remotebuzzer.usebuttons ||
13-
config.remotebuzzer.userotary
12+
config.remotebuzzer.usebuttons || config.remotebuzzer.userotary || config.remotebuzzer.usenogpio
1413
? 'enabled'
1514
: 'disabled'
1615
);
@@ -24,10 +23,7 @@ function initRemoteBuzzerFromDOM() {
2423
const api = {};
2524

2625
api.enabled = function () {
27-
return (
28-
config.remotebuzzer.usebuttons ||
29-
config.remotebuzzer.userotary
30-
);
26+
return config.remotebuzzer.usebuttons || config.remotebuzzer.userotary || config.remotebuzzer.usenogpio;
3127
};
3228

3329
api.init = function () {
@@ -181,6 +177,7 @@ function initRemoteBuzzerFromDOM() {
181177
api.enabled = function () {
182178
return (
183179
config.remotebuzzer.usebuttons &&
180+
!config.remotebuzzer.usenogpio &&
184181
typeof onStandaloneGalleryView === 'undefined' &&
185182
typeof onLiveChromaKeyingView === 'undefined'
186183
);
@@ -236,6 +233,7 @@ function initRemoteBuzzerFromDOM() {
236233
api.enabled = function () {
237234
return (
238235
config.remotebuzzer.userotary &&
236+
!config.remotebuzzer.usenogpio &&
239237
(typeof onStandaloneGalleryView === 'undefined' ? true : config.remotebuzzer.enable_standalonegallery)
240238
);
241239
};

src/js/remotebuzzer_server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ function gpioSanity(gpioconfig) {
235235
}
236236
}
237237

238-
if (config.remotebuzzer.usegpio) {
238+
if (!config.remotebuzzer.usenogpio) {
239239
gpioSanity(config.remotebuzzer.picturegpio);
240240
gpioSanity(config.remotebuzzer.collagegpio);
241241
gpioSanity(config.remotebuzzer.shutdowngpio);
@@ -588,7 +588,7 @@ const watchRotaryBtn = function watchRotaryBtn(err, gpioValue) {
588588

589589
/* INIT ONOFF LIBRARY AND LINK CALLBACK FUNCTIONS */
590590
const Gpio = require('onoff').Gpio;
591-
if (config.remotebuzzer.usegpio) {
591+
if (!config.remotebuzzer.usenogpio) {
592592
/* ROTARY ENCODER MODE */
593593
if (config.remotebuzzer.userotary) {
594594
/* ROTARY ENCODER MODE */

0 commit comments

Comments
 (0)