Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
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
17 changes: 13 additions & 4 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ const photoBooth = (function () {

$('.loaderImage').show();

photoboothTools.console.logDev(
'Taken collage photo number: ' + (result.current + 1) + ' / ' + result.limit
);

if (config.collage.continuous) {
if (result.current + 1 < result.limit) {
setTimeout(() => {
Expand All @@ -490,33 +494,35 @@ const photoBooth = (function () {
}
} else {
// collage with interruption
remoteBuzzerClient.collageWaitForNext();

if (result.current + 1 < result.limit) {
$(
'<a class="btn rotaryfocus" href="#">' +
'<a class="btn rotaryfocus" href="#" id="btnCollageNext">' +
photoboothTools.getTranslation('nextPhoto') +
'</a>'
)
.appendTo('.loading')
.click((ev) => {
ev.stopPropagation();
ev.preventDefault();

$('.loaderImage').css('background-image', 'none');
imageUrl = '';
$('.loaderImage').css('display', 'none');
api.thrill('collage');
});

remoteBuzzerClient.collageWaitForNext();
} else {
$(
'<a class="btn rotaryfocus" href="#">' +
'<a class="btn rotaryfocus" href="#" id="btnCollageProcess">' +
photoboothTools.getTranslation('processPhoto') +
'</a>'
)
.appendTo('.loading')
.click((ev) => {
ev.stopPropagation();
ev.preventDefault();

$('.loaderImage').css('background-image', 'none');
imageUrl = '';
$('.loaderImage').css('display', 'none');
Expand All @@ -525,7 +531,10 @@ const photoBooth = (function () {

api.processPic(data.style, result);
});

remoteBuzzerClient.collageWaitForProcessing();
}

$(
'<a class="btn rotaryfocus" style="margin-left:2px" href="#">' +
photoboothTools.getTranslation('retakePhoto') +
Expand Down
28 changes: 28 additions & 0 deletions src/js/remotebuzzer_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ function initRemoteBuzzerFromDOM() {
buttonController.takeCollage();
break;

case 'collage-next':
// Need to handle collage process in button handler
if (buttonController.waitingToProcessCollage) {
buttonController.processCollage();
} else {
buttonController.takeCollageNext();
}
break;

case 'print':
buttonController.print();
break;
Expand Down Expand Up @@ -116,6 +125,14 @@ function initRemoteBuzzerFromDOM() {
}
};

api.collageWaitForProcessing = function () {
buttonController.waitingToProcessCollage = true;

if (this.enabled()) {
this.emitToServer('collage-wait-for-next');
}
};

api.startPicture = function () {
if (this.enabled()) {
this.emitToServer('start-picture');
Expand Down Expand Up @@ -159,6 +176,7 @@ function initRemoteBuzzerFromDOM() {
buttonController = (function () {
// vars
const api = {};
api.waitingToProcessCollage = false;

api.init = function () {
// nothing to init
Expand All @@ -182,10 +200,20 @@ function initRemoteBuzzerFromDOM() {
api.takeCollage = function () {
if (this.enabled() && config.collage.enabled) {
$('.resultInner').removeClass('show');
this.waitingToProcessCollage = false;
photoBooth.thrill('collage');
}
};

api.takeCollageNext = function () {
$('#btnCollageNext').trigger('click');
};

api.processCollage = function () {
this.waitingToProcessCollage = false;
$('#btnCollageProcess').trigger('click');
};

api.print = function () {
if ($('#result').is(':visible')) {
$('.printbtn').trigger('click');
Expand Down
26 changes: 22 additions & 4 deletions src/js/remotebuzzer_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ function photoboothAction(type) {
ioServer.emit('photobooth-socket', 'start-collage');
break;

case 'collage-next':
log('Photobooth COLLAGE : [ photobooth-socket ] => [ All Clients ]: command [ collage-next ]');
ioServer.emit('photobooth-socket', 'collage-next');
break;

case 'completed':
triggerArmed = true;
collageInProgress = false;
Expand Down Expand Up @@ -188,6 +193,11 @@ if (config.remotebuzzer.usegpio) {

/* BUTTON SEMAPHORE HELPER FUNCTION */
function buttonActiveCheck(gpio, value) {
/*
* value = 0 : button is pressed (connected to GND - pulled down)
* value = 1 : button is not pressed (pull-up)
*/

/* init */
if (typeof buttonActiveCheck.buttonIsPressed == 'undefined') {
buttonActiveCheck.buttonIsPressed = 0;
Expand Down Expand Up @@ -219,12 +229,13 @@ function buttonActiveCheck(gpio, value) {

/* error state - do nothing */
log(
'buttonActiveCheck error state - requested GPIO ',
'buttonActiveCheck WARNING - requested GPIO ',
gpio,
', for value ',
value,
'but buttonIsPressed:',
buttonActiveCheck.buttonIsPressed
buttonActiveCheck.buttonIsPressed,
' Please consider to add an external pull-up resistor to all your input GPIOs, this might help to eliminate this warning. Regardless of this warning, Photobooth should be fully functional.'
);

return true;
Expand Down Expand Up @@ -296,6 +307,10 @@ const watchPictureGPIOwithCollage = function watchPictureGPIOwithCollage(err, gp
/* Start Picture */
log('GPIO', config.remotebuzzer.picturegpio, '- Picture button released - normal -', timeElapsed, ' [ms] ');
photoboothAction('picture');
} else if (collageInProgress) {
/* Next Collage Picture*/
log('GPIO', config.remotebuzzer.picturegpio, '- Picture button released - long -', timeElapsed, ' [ms] ');
photoboothAction('collage-next');
} else {
/* Start Collage */
log('GPIO', config.remotebuzzer.picturegpio, '- Picture button released - long -', timeElapsed, ' [ms] ');
Expand Down Expand Up @@ -358,8 +373,11 @@ const watchCollageGPIO = function watchCollageGPIO(err, gpioValue) {
if (timeElapsed) {
log('GPIO', config.remotebuzzer.collagegpio, '- Collage button released ', timeElapsed, ' [ms] ');

/* Start Collage */
if (!collageInProgress) {
/* Collage Trigger Next */
if (collageInProgress) {
photoboothAction('collage-next');
} else {
/* Start Collage */
photoboothAction('collage');
}
} else {
Expand Down