Adding command to skip to the next image, and removing mqtt test code
This commit is contained in:
8
index.js
8
index.js
@@ -66,13 +66,18 @@ function displayImage(filename) {
|
||||
}
|
||||
|
||||
function displayWifi() {
|
||||
console.log('Displaying wifi connection information for 10 minutes')
|
||||
console.log('Displaying wifi connection information for 10 minutes...')
|
||||
clearTimeout(ticker)
|
||||
frame.display_png('img/wifi.png')
|
||||
frame.show()
|
||||
ticker = setTimeout(displayAlbum, 600000)
|
||||
}
|
||||
|
||||
function skipToNext() {
|
||||
clearTimeout(ticker)
|
||||
displayAlbum()
|
||||
}
|
||||
|
||||
// Subscribe to our MQTT topic...
|
||||
mqttclient.on('connect', () => {
|
||||
mqttclient.subscribe('pictureframe/command')
|
||||
@@ -83,6 +88,7 @@ mqttclient.on('message', (topic, message) => {
|
||||
message = message.toString()
|
||||
console.log('MQTT command received: ' + message)
|
||||
|
||||
if (message == 'skip') skipToNext()
|
||||
if (message == 'wifi') displayWifi()
|
||||
if (message == 'reset') {
|
||||
clearTimeout(ticker)
|
||||
|
||||
Reference in New Issue
Block a user