9 changed files with 965 additions and 29 deletions
-
1.vscode/settings.json
-
23html/websiteBasic_EN.html
-
358html/website_EN.html
-
23processHtml.py
-
23src/logmessages.h
-
139src/logmessages_EN.h
-
38src/main.cpp
-
24src/websiteBasic_EN.h
-
359src/websiteMgmt_EN.h
@ -1,3 +1,2 @@ |
|||||
{ |
{ |
||||
"python.pythonPath": "/Users/torsten/.platformio/penv/bin/python" |
|
||||
} |
} |
@ -0,0 +1,23 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<head> |
||||
|
<title>Wifi-configuration</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<form action="/init" method="POST"> |
||||
|
<fieldset> |
||||
|
<legend>Basic wifi-setup</legend> |
||||
|
<label for="ssid">SSID:</label><br> |
||||
|
<input type="text" id="ssid" name="ssid" placeholder="SSID" required><br> |
||||
|
<label for="pwd">Password:</label><br> |
||||
|
<input type="password" id="pwd" name="pwd" autocomplete="off" required><br> |
||||
|
<label for="hostname">Tonuino-name (hostname):</label><br> |
||||
|
<input type="text" id="hostname" name="hostname" required><br><br> |
||||
|
<input type="submit" value="Submit"> |
||||
|
</fieldset> |
||||
|
</form> |
||||
|
<form action="/restart"> |
||||
|
<button type="submit">Reboot</button> |
||||
|
</form> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,358 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="de"> |
||||
|
<head> |
||||
|
<title>ESPuino-configuration</title> |
||||
|
<meta charset="utf-8"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
|
<link rel="stylesheet" href="https://ts-cs.de/tonuino/css/bootstrap.min.css"> |
||||
|
<script src="https://ts-cs.de/tonuino/js/jquery.min.js"></script> |
||||
|
<script src="https://ts-cs.de/tonuino/js/popper.min.js"></script> |
||||
|
<script src="https://ts-cs.de/tonuino/js/bootstrap.min.js"></script> |
||||
|
</head> |
||||
|
<body> |
||||
|
<nav class="navbar navbar-expand-sm bg-primary navbar-dark"> |
||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> |
||||
|
<span class="navbar-toggler-icon"></span> |
||||
|
</button> |
||||
|
<a class="navbar-brand"> |
||||
|
<img src="https://raw.githubusercontent.com/biologist79/Tonuino-ESP32-I2S/master/html/tonuino_logo.png" width="30" height="30" class="d-inline-block align-top" alt="" /> |
||||
|
Tonuino |
||||
|
</a> |
||||
|
<div class="collapse navbar-collapse" id="collapsibleNavbar"> |
||||
|
<ul class="navbar-nav mr-auto"> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#wifiConfig">Wifi</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#rfidMusicTags">RFID-assignments</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#rfidModTags">RFID-modifications</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#mqttConfig">MQTT</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#ftpConfig">FTP</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#generalConfig">General</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="#importNvs">NVS-importer</a> |
||||
|
</li> |
||||
|
<li class="nav-item"> |
||||
|
<a class="nav-link" href="/restart" style="color: orange">Reboot Tonuino</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</nav> |
||||
|
<br /> |
||||
|
<div class="container" id="wifiConfig"> |
||||
|
<h2>Wifi-configuration</h2> |
||||
|
<form action="#wifiConfig" method="POST" onsubmit="wifiConfig('wifiConfig'); return false"> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="ssid">Wifi-name (SSID):</label> |
||||
|
<input type="text" class="form-control" id="ssid" placeholder="SSID" name="ssid" required> |
||||
|
<div class="invalid-feedback"> |
||||
|
Please enter name of wifi (SSID). |
||||
|
</div> |
||||
|
<label for="pwd">Password:</label> |
||||
|
<input type="password" class="form-control" id="pwd" placeholder="Passwort" name="pwd" required> |
||||
|
<label for="hostname">Tonuino-name (hostname):</label> |
||||
|
<input type="text" class="form-control" id="hostname" placeholder="tonuino" name="hostname" value="%HOSTNAME%" pattern="^[^-\.]{2,32}" required> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container my-5" id="rfidMusicTags"> |
||||
|
<h2>RFID-assignments</h2> |
||||
|
<form action="#rfidMusicTags" method="POST" onsubmit="rfidAssign('rfidMusicTags'); return false"> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="rfidIdMusic">RFID-chip-ID (12 digits)</label> |
||||
|
<input type="text" class="form-control" id="rfidIdMusic" maxlength="12" pattern="[0-9]{12}" placeholder="%RFID_TAG_ID%" name="rfidIdMusic" required> |
||||
|
<label for="fileOrUrl">File, directory or URL (^ und # are not allowed)</label> |
||||
|
<input type="text" class="form-control" id="fileOrUrl" maxlength="255" placeholder="z.B. /mp3/Hoerspiele/Yakari/Yakari_und_seine_Freunde.mp3" pattern="^[^\^#]+$" name="fileOrUrl" required> |
||||
|
<label for="playMode">Playmode</label> |
||||
|
<select class="form-control" id="playMode" name="playMode"> |
||||
|
<option value="1">Single track</option> |
||||
|
<option value="2">Single track (infinite loop)</option> |
||||
|
<option value="3">Audiobook</option> |
||||
|
<option value="4">Audiobook (infinite loop)</option> |
||||
|
<option value="5">All tracks of directory (sorted)</option> |
||||
|
<option value="6">All tracks of directory (random)</option> |
||||
|
<option value="7">All tracks of directory (sorted, inf. loop)</option> |
||||
|
<option value="9">All tracks of directory (random, inf. loop)</option> |
||||
|
<option value="8">Webradio</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container my-5" id="rfidModTags"> |
||||
|
<h2>RFID-modifications</h2> |
||||
|
<form class="needs-validation" action="#rfidModTags" method="POST" onsubmit="rfidMods('rfidModTags'); return false"> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="rfidIdMod">RFID-chip-ID (12-digits)</label> |
||||
|
<input type="text" class="form-control" id="rfidIdMod" maxlength="12" pattern="[0-9]{12}" placeholder="%RFID_TAG_ID%" name="rfidIdMod" required> |
||||
|
<div class="invalid-feedback"> |
||||
|
Please enter a 12-digits-number. |
||||
|
</div> |
||||
|
<label for="modId">Abspielmodus</label> |
||||
|
<select class="form-control" id="modId" name="modId"> |
||||
|
<option value="100">Lock keys</option> |
||||
|
<option value="101">Sleep after 15 minutes</option> |
||||
|
<option value="102">Sleep after 30 minutes</option> |
||||
|
<option value="103">Sleep after 1 hour</option> |
||||
|
<option value="104">Sleep after 1 hours</option> |
||||
|
<option value="105">Sleep after end of track</option> |
||||
|
<option value="106">Sleep after end of playlist</option> |
||||
|
<option value="107">Sleep after five tracks</option> |
||||
|
<option value="110">Repeat playlist (inf. loop)</option> |
||||
|
<option value="111">Repeat track (inf. loop)</option> |
||||
|
<option value="112">Dimm LEDs (nightmode)</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container my-5" id="mqttConfig"> |
||||
|
<h2>MQTT-configuration</h2> |
||||
|
<form class="needs-validation" action="#mqttConfig" method="POST" onsubmit="mqttSettings('mqttConfig'); return false"> |
||||
|
<div class="form-check col-md-6"> |
||||
|
<input class="form-check-input" type="checkbox" value="1" id="mqttEnable" name="mqttEnable" %MQTT_ENABLE%> |
||||
|
<label class="form-check-label" for="mqttEnable"> |
||||
|
Enable MQTT |
||||
|
</label> |
||||
|
</div> |
||||
|
<div class="form-group my-2 col-md-6"> |
||||
|
<label for="mqttServer">MQTT-server (IP-address)</label> |
||||
|
<input type="text" class="form-control" id="mqttServer" pattern="^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$" minlength="7" maxlength="15" placeholder="z.B. 192.168.2.89" name="mqttServer" value="%MQTT_SERVER%"> |
||||
|
<div class="invalid-feedback"> |
||||
|
Please enter a valid IPv4-address, e.g. 192.168.2.89. |
||||
|
</div> |
||||
|
<label for="mqttUser">MQTT-username (optional):</label> |
||||
|
<input type="text" class="form-control" id="mqttUser" maxlength="15" placeholder="Benutzername" name="mqttUser" value="%MQTT_USER%"> |
||||
|
<label for="mqttPwd">Password (optional):</label> |
||||
|
<input type="password" class="form-control" id="mqttPwd" maxlength="15" placeholder="Passwort" name="mqttPwd" value="%MQTT_PWD%"> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container" id="ftpConfig"> |
||||
|
<h2>FTP-configuration</h2> |
||||
|
<form action="#ftpConfig" method="POST" onsubmit="ftpSettings('ftpConfig'); return false"> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="ftpUser">FTP-username:</label> |
||||
|
<input type="text" class="form-control" id="ftpUser" maxlength="32" placeholder="Benutzername" name="ftpUser" value="%FTP_USER%" required> |
||||
|
<label for="pwd">password:</label> |
||||
|
<input type="password" class="form-control" id="ftpPwd" maxlength="32" placeholder="Passwort" name="ftpPwd" value="%FTP_PWD%" required> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container my-5" id="generalConfig"> |
||||
|
<h2>General configuration</h2> |
||||
|
<form action="#generalConfig" method="POST" onsubmit="genSettings('generalConfig'); return false"> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="initialVolume">Volume after start</label> |
||||
|
<input type="number" min="1" max="21" class="form-control" id="initialVolume" name="initialVolume" value="%INIT_VOLUME%" required> |
||||
|
<label for="maxVolume">Maximum volume</label> |
||||
|
<input type="number" min="1" max="21" class="form-control" id="maxVolume" name="maxVolume" value="%MAX_VOLUME%" required> |
||||
|
</div> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="initBrightness">Neopixel-brightness after start</label> |
||||
|
<input type="number" min="0" max="255" class="form-control" id="initBrightness" name="initBrightness" value="%INIT_LED_BRIGHTBESS%" required> |
||||
|
<label for="nightBrightness">Neopixel-brightness in nightmode</label> |
||||
|
<input type="number" min="0" max="255" class="form-control" id="nightBrightness" name="nightBrightness" value="%NIGHT_LED_BRIGHTBESS%" required> |
||||
|
</div> |
||||
|
<div class="form-group col-md-6"> |
||||
|
<label for="inactivityTime">Deepsleep after inactivity (minutes)</label> |
||||
|
<input type="number" min="1" max="1440" class="form-control" id="inactivityTime" name="inactivityTime" value="%MAX_INACTIVITY%" required> |
||||
|
</div> |
||||
|
<button type="reset" class="btn btn-secondary">Reset</button> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<div class="container my-5" id="importNvs"> |
||||
|
<h2>NVS-importer</h2> |
||||
|
<form action="/upload" enctype="multipart/form-data" method="POST"> |
||||
|
<div class="form-group"> |
||||
|
<label for="nvsUpload">Backup-files can be imported here.</label> |
||||
|
<input type="file" class="form-control-file" id="nvsUpload" name="nvsUpload" accept=".txt"> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Submit</button> |
||||
|
</form> |
||||
|
<div class="messages col-md-6 my-2"></div> |
||||
|
</div> |
||||
|
<script> |
||||
|
var lastIdclicked = ''; |
||||
|
var errorBox = '<div class="alert alert-danger alert-dismissible fade show" role="alert">Error occured!<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>'; |
||||
|
var okBox = '<div class="alert alert-success alert-dismissible fade show" role="alert">Action successful.<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>'; |
||||
|
|
||||
|
var socket = new WebSocket("ws://%IPv4%/ws"); |
||||
|
|
||||
|
function connect() { |
||||
|
socket = new WebSocket("ws://%IPv4%/ws"); |
||||
|
} |
||||
|
|
||||
|
function ping() { |
||||
|
var myObj = { |
||||
|
"ping": { |
||||
|
ping: 'ping' |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
tm = setTimeout(function () { |
||||
|
alert("Connection to tonuino is broken!\\nPlease refresh this website."); |
||||
|
}, 5000); |
||||
|
} |
||||
|
|
||||
|
function pong() { |
||||
|
clearTimeout(tm); |
||||
|
} |
||||
|
|
||||
|
socket.onopen = function () { |
||||
|
setInterval(ping, 15000); |
||||
|
}; |
||||
|
|
||||
|
socket.onclose = function(e) { |
||||
|
console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason); |
||||
|
setTimeout(function() { |
||||
|
connect(); |
||||
|
}, 5000); |
||||
|
}; |
||||
|
|
||||
|
socket.onerror = function(err) { |
||||
|
console.error('Socket encountered error: ', err.message, 'Closing socket'); |
||||
|
socket.close(); |
||||
|
}; |
||||
|
|
||||
|
socket.onmessage = function(event) { |
||||
|
console.log(event.data); |
||||
|
var socketMsg = JSON.parse(event.data); |
||||
|
if (socketMsg.rfidId != null) { |
||||
|
document.getElementById('rfidIdMod').value = socketMsg.rfidId; |
||||
|
document.getElementById('rfidIdMusic').value = socketMsg.rfidId; |
||||
|
$("#rfidIdMusic").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500); |
||||
|
$("#rfidIdMod").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500); |
||||
|
|
||||
|
} if (socketMsg.status != null) { |
||||
|
if (socketMsg.status == 'ok') { |
||||
|
$("#" + lastIdclicked).find('.messages').html(okBox); |
||||
|
} else { |
||||
|
$("#" + lastIdclicked).find('.messages').html(errorBox); |
||||
|
} |
||||
|
} if (socketMsg.pong != null) { |
||||
|
if (socketMsg.pong == 'pong') { |
||||
|
pong(); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
function genSettings(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var myObj = { |
||||
|
"general": { |
||||
|
iVol: document.getElementById('initialVolume').value, |
||||
|
mVol: document.getElementById('maxVolume').value, |
||||
|
iBright: document.getElementById('initBrightness').value, |
||||
|
nBright: document.getElementById('nightBrightness').value, |
||||
|
iTime: document.getElementById('inactivityTime').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
|
||||
|
function ftpSettings(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var myObj = { |
||||
|
"ftp": { |
||||
|
ftpUser: document.getElementById('ftpUser').value, |
||||
|
ftpPwd: document.getElementById('ftpPwd').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
|
||||
|
function mqttSettings(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var val; |
||||
|
if (document.getElementById('mqttEnable').checked) { |
||||
|
val = document.getElementById('mqttEnable').value; |
||||
|
} else { |
||||
|
val = 0; |
||||
|
} |
||||
|
var myObj = { |
||||
|
"mqtt": { |
||||
|
mqttEnable: val, |
||||
|
mqttServer: document.getElementById('mqttServer').value, |
||||
|
mqttUser: document.getElementById('mqttUser').value, |
||||
|
mqttPwd: document.getElementById('mqttPwd').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
|
||||
|
function rfidMods(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var myObj = { |
||||
|
"rfidMod": { |
||||
|
rfidIdMod: document.getElementById('rfidIdMod').value, |
||||
|
modId: document.getElementById('modId').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
|
||||
|
function removeTrSlash(str) { |
||||
|
if(str.substr(-1) === '/') { |
||||
|
return str.substr(0, str.length - 1); |
||||
|
} |
||||
|
return str; |
||||
|
} |
||||
|
|
||||
|
function rfidAssign(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var myObj = { |
||||
|
"rfidAssign": { |
||||
|
rfidIdMusic: document.getElementById('rfidIdMusic').value, |
||||
|
fileOrUrl: removeTrSlash(document.getElementById('fileOrUrl').value), |
||||
|
playMode: document.getElementById('playMode').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
|
||||
|
function wifiConfig(clickedId) { |
||||
|
lastIdclicked = clickedId; |
||||
|
var myObj = { |
||||
|
"wifiConfig": { |
||||
|
ssid: document.getElementById('ssid').value, |
||||
|
pwd: document.getElementById('pwd').value, |
||||
|
hostname: document.getElementById('hostname').value |
||||
|
} |
||||
|
}; |
||||
|
var myJSON = JSON.stringify(myObj); |
||||
|
socket.send(myJSON); |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,139 @@ |
|||||
|
static const char stillOnlineMqtt[] PROGMEM = "MQTT: still online."; |
||||
|
static const char tryConnectMqttS[] PROGMEM = "Trying to connect to MQTT-broker"; |
||||
|
static const char mqttOk[] PROGMEM = "MQTT-connection established."; |
||||
|
static const char sleepTimerEOP[] PROGMEM = "Sleep-timer: after last track of playlist."; |
||||
|
static const char sleepTimerEOT[] PROGMEM = "Sleep-timer: after end of current track."; |
||||
|
static const char sleepTimerStop[] PROGMEM = "Sleep-timer has been disabled."; |
||||
|
static const char sleepTimerEO5[] PROGMEM = "Sleep-timer: after five track or end of playlist - whatever is reached first"; |
||||
|
static const char sleepTimerAlreadyStopped[] PROGMEM = "sleep-timer is already disabled."; |
||||
|
static const char sleepTimerSetTo[] PROGMEM = "sleep-timer adjusted to"; |
||||
|
static const char allowButtons[] PROGMEM = "Unlocking all keys."; |
||||
|
static const char lockButtons[] PROGMEM = "Locking all keys."; |
||||
|
static const char noPlaylistNotAllowedMqtt[] PROGMEM = "Playmode cannot be adjusted to 'no playlist' via MQTT."; |
||||
|
static const char playmodeChangedMQtt[] PROGMEM = "Playlist adjusted via MQTT."; |
||||
|
static const char noPlaymodeChangeIfIdle[] PROGMEM = "Playlist cannot be adjusted while no playlist is active."; |
||||
|
static const char noValidTopic[] PROGMEM = "No valid MQTT-topic"; |
||||
|
static const char freePtr[] PROGMEM = "Releasing Pointer"; |
||||
|
static const char freeMemory[] PROGMEM = "Free memory"; |
||||
|
static const char writeEntryToNvs[] PROGMEM = "Storing data to NVS"; |
||||
|
static const char freeMemoryAfterFree[] PROGMEM = "Free memory after cleaning"; |
||||
|
static const char releaseMemoryOfOldPlaylist[] PROGMEM = "Releasing memory of old playlist."; |
||||
|
static const char dirOrFileDoesNotExist[] PROGMEM = "File of directory does not exist!"; |
||||
|
static const char unableToAllocateMemForPlaylist[] PROGMEM = "Unable to allocate memory for playlist!"; |
||||
|
static const char unableToAllocateMem[] PROGMEM = "Unable to allocate memory!"; |
||||
|
static const char fileModeDetected[] PROGMEM = "File-mode detected."; |
||||
|
static const char nameOfFileFound[] PROGMEM = "File found"; |
||||
|
static const char reallocCalled[] PROGMEM = "Reallocated memory."; |
||||
|
static const char unableToAllocateMemForLinearPlaylist[] PROGMEM = "Unable to allocate memory for linear playlist!"; |
||||
|
static const char numberOfValidFiles[] PROGMEM = "Number of valid files"; |
||||
|
static const char newLoudnessReceivedQueue[] PROGMEM = "New volume received via queue"; |
||||
|
static const char newCntrlReceivedQueue[] PROGMEM = "Control-command received via queue"; |
||||
|
static const char newPlaylistReceived[] PROGMEM = "New playlist received"; |
||||
|
static const char repeatTrackDueToPlaymode[] PROGMEM = "Repeating track due to playmode configured."; |
||||
|
static const char repeatPlaylistDueToPlaymode[] PROGMEM = "Repeating playlist due to playmode configured."; |
||||
|
static const char cmndStop[] PROGMEM = "Command: stop"; |
||||
|
static const char cmndPause[] PROGMEM = "Command: pause"; |
||||
|
static const char cmndNextTrack[] PROGMEM = "Command: next track"; |
||||
|
static const char cmndPrevTrack[] PROGMEM = "Command: previous track"; |
||||
|
static const char cmndFirstTrack[] PROGMEM = "Command: first track of playlist"; |
||||
|
static const char cmndLastTrack[] PROGMEM = "Command: last track of playlist"; |
||||
|
static const char cmndDoesNotExist[] PROGMEM = "Command requested does not exist."; |
||||
|
static const char lastTrackAlreadyActive[] PROGMEM = "Already playing last track."; |
||||
|
static const char firstTrackAlreadyActive[] PROGMEM = "Already playing first track."; |
||||
|
static const char trackStartAudiobook[] PROGMEM = "Starting track in playmode from the very beginning."; |
||||
|
static const char trackStart[] PROGMEM = "Starting track from the very beginning."; |
||||
|
static const char trackChangeWebstream[] PROGMEM = "Playing from the very beginning is not possible while webradio-mode is active."; |
||||
|
static const char endOfPlaylistReached[] PROGMEM = "Reached end of playlist."; |
||||
|
static const char trackStartatPos[] PROGMEM = "Starting track at position"; |
||||
|
static const char rfidScannerReady[] PROGMEM = "RFID-tags can now be applied..."; |
||||
|
static const char rfidTagDetected[] PROGMEM = "RFID-tag detected: "; |
||||
|
static const char rfidTagReceived[] PROGMEM = "RFID-tag received"; |
||||
|
static const char rfidTagUnknownInNvs[] PROGMEM = "RFID-tag is unkown to NVS."; |
||||
|
static const char goToSleepDueToIdle[] PROGMEM = "Going to deepsleep due to inactivity-timer..."; |
||||
|
static const char goToSleepDueToTimer[] PROGMEM = "Going to deepsleep due to sleep timer..."; |
||||
|
static const char goToSleepNow[] PROGMEM = "Going to deepsleep now!"; |
||||
|
static const char maxLoudnessReached[] PROGMEM = "Already reached max volume!"; |
||||
|
static const char minLoudnessReached[] PROGMEM = "Already reached min volume!"; |
||||
|
static const char errorOccured[] PROGMEM = "Error occured!"; |
||||
|
static const char noMp3FilesInDir[] PROGMEM = "Directory does not contain mp3-files."; |
||||
|
static const char modeSingleTrack[] PROGMEM = "Mode: Single track"; |
||||
|
static const char modeSingleTrackLoop[] PROGMEM = "Mode: single track as infinite loop"; |
||||
|
static const char modeSingleAudiobook[] PROGMEM = "Mode: audiobook"; |
||||
|
static const char modeSingleAudiobookLoop[] PROGMEM = "Mode: audiobook as infinite loop"; |
||||
|
static const char modeAllTrackAlphSorted[] PROGMEM = "Mode: all tracks (in alph. order) of directory"; |
||||
|
static const char modeAllTrackRandom[] PROGMEM = "Mode: all tracks (in random. order) of directory"; |
||||
|
static const char modeAllTrackAlphSortedLoop[] PROGMEM = "Mode: all tracks (in alph. order) of directory as infinite loop"; |
||||
|
static const char modeAllTrackRandomLoop[] PROGMEM = "Mode: all tracks (in random order) of directory as infinite loop"; |
||||
|
static const char modeWebstream[] PROGMEM = "Mode: webstream"; |
||||
|
static const char webstreamNotAvailable[] PROGMEM = "Unable to access webstream as no wifi-connection is available!"; |
||||
|
static const char modeDoesNotExist[] PROGMEM = "Playmode does not exist!"; |
||||
|
static const char modeRepeatNone[] PROGMEM = "Repeatmode: no repeat"; |
||||
|
static const char modeRepeatTrack[] PROGMEM = "Repeatmode: current track"; |
||||
|
static const char modeRepeatPlaylist[] PROGMEM = "Repeatmode: whole playlist"; |
||||
|
static const char modeRepeatTracknPlaylist[] PROGMEM = "Repeatmode: track and playlist"; |
||||
|
static const char modificatorAllButtonsLocked[] PROGMEM = "Modificator: locking all keys via RFID-tag."; |
||||
|
static const char modificatorAllButtonsUnlocked[] PROGMEM = "Modificator: unlocking all keys via RFID-tag."; |
||||
|
static const char modificatorSleepd[] PROGMEM = "Modificator: sleep-Timer deactivated."; |
||||
|
static const char modificatorSleepTimer15[] PROGMEM = "Modificator: sleep-Timer enabled via RFID (15 minutes)."; |
||||
|
static const char modificatorSleepTimer30[] PROGMEM = "Modificator: sleep-Timer enabled via RFID (30 minutes)."; |
||||
|
static const char modificatorSleepTimer60[] PROGMEM = "Modificator: sleep-Timer enabled via RFID (60 minutes)."; |
||||
|
static const char modificatorSleepTimer120[] PROGMEM = "Modificator: sleep-Timer enabled via RFID (2 hours)."; |
||||
|
static const char ledsDimmedToNightmode[] PROGMEM = "Dimmed LEDs to nightmode."; |
||||
|
static const char modificatorNotallowedWhenIdle[] PROGMEM = "Modificator cannot be applied while playlist is inactive."; |
||||
|
static const char modificatorSleepAtEOT[] PROGMEM = "Modificator: adjusted sleep-timer to after end of current track."; |
||||
|
static const char modificatorSleepAtEOTd[] PROGMEM = "Modificator: disabled sleep-timer after end of current track."; |
||||
|
static const char modificatorSleepAtEOP[] PROGMEM = "Modificator: adjusted sleep-timer to after end of playlist."; |
||||
|
static const char modificatorSleepAtEOPd[] PROGMEM = "Modificator: disabled sleep-timer after end of playlist."; |
||||
|
static const char modificatorAllTrackAlphSortedLoop[] PROGMEM = "Modificator: adjusted to all tracks (in alph. order) as infinite loop."; |
||||
|
static const char modificatorAllTrackRandomLoop[] PROGMEM = "Modificator: adjusted to all tracks (in random order) as infinite loop."; |
||||
|
static const char modificatorCurTrackLoop[] PROGMEM = "Modificator: adjusted to current track as infinite loop."; |
||||
|
static const char modificatorCurAudiobookLoop[] PROGMEM = "Modificator: adjusted to current audiobook as infinite loop."; |
||||
|
static const char modificatorPlaylistLoopActive[] PROGMEM = "Modificator: adjusted to all tracks as infinite loop."; |
||||
|
static const char modificatorPlaylistLoopDeactive[] PROGMEM = "Modificator: disabled all tracks as infinite loop."; |
||||
|
static const char modificatorTrackActive[] PROGMEM = "Modificator: adjusted to current track as infinite loop."; |
||||
|
static const char modificatorTrackDeactive[] PROGMEM = "Modificator: disabled current track as infinite loop."; |
||||
|
static const char modificatorNotAllowed[] PROGMEM = "Unable to apply modificator."; |
||||
|
static const char modificatorLoopRev[] PROGMEM = "Modificator: infinite loop ended."; |
||||
|
static const char modificatorDoesNotExist[] PROGMEM = "This type of card-modificator does not exist"; |
||||
|
static const char errorOccuredNvs[] PROGMEM = "Error occured while reading from NVS!"; |
||||
|
static const char statementsReceivedByServer[] PROGMEM = "Data received from server"; |
||||
|
static const char savedSsidInNvs[] PROGMEM = "Storing SSID to NVS"; |
||||
|
static const char savedWifiPwdInNvs[] PROGMEM = "Storing wifi-password to NVS"; |
||||
|
static const char apReady[] PROGMEM = "Started wifi-access-point"; |
||||
|
static const char httpReady[] PROGMEM = "Started HTTP-server."; |
||||
|
static const char unableToMountSd[] PROGMEM = "Unable to mount sd-card."; |
||||
|
static const char unableToCreateVolQ[] PROGMEM = "Unable to create volume-queue."; |
||||
|
static const char unableToCreateRfidQ[] PROGMEM = "Unable to create RFID-queue."; |
||||
|
static const char unableToCreateMgmtQ[] PROGMEM = "Unable to play-management-queue."; |
||||
|
static const char unableToCreatePlayQ[] PROGMEM = "Unable to create track-queue.."; |
||||
|
static const char initialBrightnessfromNvs[] PROGMEM = "Restoring initial LED-brightness from NVS"; |
||||
|
static const char wroteInitialBrightnessToNvs[] PROGMEM = "Storing initial LED-brightness to NVS."; |
||||
|
static const char restoredInitialBrightnessForNmFromNvs[] PROGMEM = "Restored LED-brightness for nightmode from NVS"; |
||||
|
static const char wroteNmBrightnessToNvs[] PROGMEM = "Stored LED-brightness for nightmode to NVS."; |
||||
|
static const char wroteFtpUserToNvs[] PROGMEM = "Stored FTP-user to NVS."; |
||||
|
static const char restoredFtpUserFromNvs[] PROGMEM = "Restored FTP-user from NVS"; |
||||
|
static const char wroteFtpPwdToNvs[] PROGMEM = "Stored FTP-password to NVS."; |
||||
|
static const char restoredFtpPwdFromNvs[] PROGMEM = "Restored FTP-password from NVS"; |
||||
|
static const char restoredMaxInactivityFromNvs[] PROGMEM = "Restored maximum inactivity-time from NVS."; |
||||
|
static const char wroteMaxInactivityToNvs[] PROGMEM = "Stored maximum inactivity-time to NVS."; |
||||
|
static const char restoredInitialLoudnessFromNvs[] PROGMEM = "Restored initial volume from NVS"; |
||||
|
static const char wroteInitialLoudnessToNvs[] PROGMEM = "Stored initial volume to NVS."; |
||||
|
static const char restoredMaxLoudnessFromNvs[] PROGMEM = "Restored maximum volume from NVS"; |
||||
|
static const char wroteMaxLoudnessToNvs[] PROGMEM = "Stored maximum volume to NVS."; |
||||
|
static const char wroteMqttFlagToNvs[] PROGMEM = "Stored MQTT-flag to NVS."; |
||||
|
static const char restoredMqttActiveFromNvs[] PROGMEM = "Restored MQTT-flag (enabled) from NVS"; |
||||
|
static const char restoredMqttDeactiveFromNvs[] PROGMEM = "Restored MQTT-flag (disabled) from NVS"; |
||||
|
static const char wroteMqttServerToNvs[] PROGMEM = "Stored MQTT-server to NVS."; |
||||
|
static const char restoredMqttServerFromNvs[] PROGMEM = "Restored MQTT-Server from NVS"; |
||||
|
static const char wroteMqttUserToNvs[] PROGMEM = "Stored MQTT-user to NVS."; |
||||
|
static const char restoredMqttUserFromNvs[] PROGMEM = "Restored MQTT-user from NVS"; |
||||
|
static const char wroteMqttPwdToNvs[] PROGMEM = "Stored MQTT-password to NVS."; |
||||
|
static const char restoredMqttPwdFromNvs[] PROGMEM = "Restored MQTT-password from NVS"; |
||||
|
static const char mqttWithPwd[] PROGMEM = "Try to connect to MQTT-server with user und password"; |
||||
|
static const char mqttWithoutPwd[] PROGMEM = "Try to connect to MQTT-server without user und password"; |
||||
|
static const char ssidNotFoundInNvs[] PROGMEM = "Unable to find SSID to NVS."; |
||||
|
static const char wifiPwdNotFoundInNvs[] PROGMEM = "Unable to find wifi-password to NVS."; |
||||
|
static const char wifiStaticIpConfigNotFoundInNvs[] PROGMEM = "Unable to find static wifi-ip-configuration to NVS."; |
||||
|
static const char wifiHostnameNotSet[] PROGMEM = "Unable to find hostname-configuration to NVS."; |
||||
|
static const char mqttConnFailed[] PROGMEM = "Unable to establish mqtt-connection, trying again..."; |
||||
|
static const char restoredHostnameFromNvs[] PROGMEM = "Restored hostname from NVS"; |
@ -0,0 +1,24 @@ |
|||||
|
static const char basicWebsite[] PROGMEM = "<!DOCTYPE html>\ |
||||
|
<html>\ |
||||
|
<head>\ |
||||
|
<title>Wifi-configuration</title>\ |
||||
|
</head>\ |
||||
|
<body>\ |
||||
|
<form action=\"/init\" method=\"POST\">\ |
||||
|
<fieldset>\ |
||||
|
<legend>Basic wifi-setup</legend>\ |
||||
|
<label for=\"ssid\">SSID:</label><br>\ |
||||
|
<input type=\"text\" id=\"ssid\" name=\"ssid\" placeholder=\"SSID\" required><br>\ |
||||
|
<label for=\"pwd\">Password:</label><br>\ |
||||
|
<input type=\"password\" id=\"pwd\" name=\"pwd\" autocomplete=\"off\" required><br>\ |
||||
|
<label for=\"hostname\">Tonuino-name (hostname):</label><br>\ |
||||
|
<input type=\"text\" id=\"hostname\" name=\"hostname\" required><br><br>\ |
||||
|
<input type=\"submit\" value=\"Submit\">\ |
||||
|
</fieldset>\ |
||||
|
</form>\ |
||||
|
<form action=\"/restart\">\ |
||||
|
<button type=\"submit\">Reboot</button>\ |
||||
|
</form>\ |
||||
|
</body>\ |
||||
|
</html>\ |
||||
|
"; |
@ -0,0 +1,359 @@ |
|||||
|
static const char mgtWebsite[] PROGMEM = "<!DOCTYPE html>\ |
||||
|
<html lang=\"de\">\ |
||||
|
<head>\ |
||||
|
<title>ESPuino-configuration</title>\ |
||||
|
<meta charset=\"utf-8\">\ |
||||
|
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\ |
||||
|
<link rel=\"stylesheet\" href=\"https://ts-cs.de/tonuino/css/bootstrap.min.css\">\ |
||||
|
<script src=\"https://ts-cs.de/tonuino/js/jquery.min.js\"></script>\ |
||||
|
<script src=\"https://ts-cs.de/tonuino/js/popper.min.js\"></script>\ |
||||
|
<script src=\"https://ts-cs.de/tonuino/js/bootstrap.min.js\"></script>\ |
||||
|
</head>\ |
||||
|
<body>\ |
||||
|
<nav class=\"navbar navbar-expand-sm bg-primary navbar-dark\">\ |
||||
|
<button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbarSupportedContent\" aria-controls=\"navbarSupportedContent\" aria-expanded=\"false\" aria-label=\"Toggle navigation\">\ |
||||
|
<span class=\"navbar-toggler-icon\"></span>\ |
||||
|
</button>\ |
||||
|
<a class=\"navbar-brand\">\ |
||||
|
<img src=\"https://raw.githubusercontent.com/biologist79/Tonuino-ESP32-I2S/master/html/tonuino_logo.png\" width=\"30\" height=\"30\" class=\"d-inline-block align-top\" alt=\"\" />\ |
||||
|
Tonuino\ |
||||
|
</a>\ |
||||
|
<div class=\"collapse navbar-collapse\" id=\"collapsibleNavbar\">\ |
||||
|
<ul class=\"navbar-nav mr-auto\">\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#wifiConfig\">Wifi</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#rfidMusicTags\">RFID-assignments</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#rfidModTags\">RFID-modifications</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#mqttConfig\">MQTT</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#ftpConfig\">FTP</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#generalConfig\">General</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"#importNvs\">NVS-importer</a>\ |
||||
|
</li>\ |
||||
|
<li class=\"nav-item\">\ |
||||
|
<a class=\"nav-link\" href=\"/restart\" style=\"color: orange\">Reboot Tonuino</a>\ |
||||
|
</li>\ |
||||
|
</ul>\ |
||||
|
</div>\ |
||||
|
</nav>\ |
||||
|
<br />\ |
||||
|
<div class=\"container\" id=\"wifiConfig\">\ |
||||
|
<h2>Wifi-configuration</h2>\ |
||||
|
<form action=\"#wifiConfig\" method=\"POST\" onsubmit=\"wifiConfig('wifiConfig'); return false\">\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"ssid\">Wifi-name (SSID):</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"ssid\" placeholder=\"SSID\" name=\"ssid\" required>\ |
||||
|
<div class=\"invalid-feedback\">\ |
||||
|
Please enter name of wifi (SSID).\ |
||||
|
</div>\ |
||||
|
<label for=\"pwd\">Password:</label>\ |
||||
|
<input type=\"password\" class=\"form-control\" id=\"pwd\" placeholder=\"Passwort\" name=\"pwd\" required>\ |
||||
|
<label for=\"hostname\">Tonuino-name (hostname):</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"hostname\" placeholder=\"tonuino\" name=\"hostname\" value=\"%HOSTNAME%\" pattern=\"^[^-\\.]{2,32}\" required>\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container my-5\" id=\"rfidMusicTags\">\ |
||||
|
<h2>RFID-assignments</h2>\ |
||||
|
<form action=\"#rfidMusicTags\" method=\"POST\" onsubmit=\"rfidAssign('rfidMusicTags'); return false\">\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"rfidIdMusic\">RFID-chip-ID (12 digits)</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"rfidIdMusic\" maxlength=\"12\" pattern=\"[0-9]{12}\" placeholder=\"%RFID_TAG_ID%\" name=\"rfidIdMusic\" required>\ |
||||
|
<label for=\"fileOrUrl\">File, directory or URL (^ und # are not allowed)</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"fileOrUrl\" maxlength=\"255\" placeholder=\"z.B. /mp3/Hoerspiele/Yakari/Yakari_und_seine_Freunde.mp3\" pattern=\"^[^\\^#]+$\" name=\"fileOrUrl\" required>\ |
||||
|
<label for=\"playMode\">Playmode</label>\ |
||||
|
<select class=\"form-control\" id=\"playMode\" name=\"playMode\">\ |
||||
|
<option value=\"1\">Single track</option>\ |
||||
|
<option value=\"2\">Single track (infinite loop)</option>\ |
||||
|
<option value=\"3\">Audiobook</option>\ |
||||
|
<option value=\"4\">Audiobook (infinite loop)</option>\ |
||||
|
<option value=\"5\">All tracks of directory (sorted)</option>\ |
||||
|
<option value=\"6\">All tracks of directory (random)</option>\ |
||||
|
<option value=\"7\">All tracks of directory (sorted, inf. loop)</option>\ |
||||
|
<option value=\"9\">All tracks of directory (random, inf. loop)</option>\ |
||||
|
<option value=\"8\">Webradio</option>\ |
||||
|
</select>\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container my-5\" id=\"rfidModTags\">\ |
||||
|
<h2>RFID-modifications</h2>\ |
||||
|
<form class=\"needs-validation\" action=\"#rfidModTags\" method=\"POST\" onsubmit=\"rfidMods('rfidModTags'); return false\">\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"rfidIdMod\">RFID-chip-ID (12-digits)</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"rfidIdMod\" maxlength=\"12\" pattern=\"[0-9]{12}\" placeholder=\"%RFID_TAG_ID%\" name=\"rfidIdMod\" required>\ |
||||
|
<div class=\"invalid-feedback\">\ |
||||
|
Please enter a 12-digits-number.\ |
||||
|
</div>\ |
||||
|
<label for=\"modId\">Abspielmodus</label>\ |
||||
|
<select class=\"form-control\" id=\"modId\" name=\"modId\">\ |
||||
|
<option value=\"100\">Lock keys</option>\ |
||||
|
<option value=\"101\">Sleep after 15 minutes</option>\ |
||||
|
<option value=\"102\">Sleep after 30 minutes</option>\ |
||||
|
<option value=\"103\">Sleep after 1 hour</option>\ |
||||
|
<option value=\"104\">Sleep after 1 hours</option>\ |
||||
|
<option value=\"105\">Sleep after end of track</option>\ |
||||
|
<option value=\"106\">Sleep after end of playlist</option>\ |
||||
|
<option value=\"107\">Sleep after five tracks</option>\ |
||||
|
<option value=\"110\">Repeat playlist (inf. loop)</option>\ |
||||
|
<option value=\"111\">Repeat track (inf. loop)</option>\ |
||||
|
<option value=\"112\">Dimm LEDs (nightmode)</option>\ |
||||
|
</select>\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container my-5\" id=\"mqttConfig\">\ |
||||
|
<h2>MQTT-configuration</h2>\ |
||||
|
<form class=\"needs-validation\" action=\"#mqttConfig\" method=\"POST\" onsubmit=\"mqttSettings('mqttConfig'); return false\">\ |
||||
|
<div class=\"form-check col-md-6\">\ |
||||
|
<input class=\"form-check-input\" type=\"checkbox\" value=\"1\" id=\"mqttEnable\" name=\"mqttEnable\" %MQTT_ENABLE%>\ |
||||
|
<label class=\"form-check-label\" for=\"mqttEnable\">\ |
||||
|
Enable MQTT\ |
||||
|
</label>\ |
||||
|
</div>\ |
||||
|
<div class=\"form-group my-2 col-md-6\">\ |
||||
|
<label for=\"mqttServer\">MQTT-server (IP-address)</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"mqttServer\" pattern=\"^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$\" minlength=\"7\" maxlength=\"15\" placeholder=\"z.B. 192.168.2.89\" name=\"mqttServer\" value=\"%MQTT_SERVER%\">\ |
||||
|
<div class=\"invalid-feedback\">\ |
||||
|
Please enter a valid IPv4-address, e.g. 192.168.2.89.\ |
||||
|
</div>\ |
||||
|
<label for=\"mqttUser\">MQTT-username (optional):</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"mqttUser\" maxlength=\"15\" placeholder=\"Benutzername\" name=\"mqttUser\" value=\"%MQTT_USER%\">\ |
||||
|
<label for=\"mqttPwd\">Password (optional):</label>\ |
||||
|
<input type=\"password\" class=\"form-control\" id=\"mqttPwd\" maxlength=\"15\" placeholder=\"Passwort\" name=\"mqttPwd\" value=\"%MQTT_PWD%\">\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container\" id=\"ftpConfig\">\ |
||||
|
<h2>FTP-configuration</h2>\ |
||||
|
<form action=\"#ftpConfig\" method=\"POST\" onsubmit=\"ftpSettings('ftpConfig'); return false\">\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"ftpUser\">FTP-username:</label>\ |
||||
|
<input type=\"text\" class=\"form-control\" id=\"ftpUser\" maxlength=\"32\" placeholder=\"Benutzername\" name=\"ftpUser\" value=\"%FTP_USER%\" required>\ |
||||
|
<label for=\"pwd\">password:</label>\ |
||||
|
<input type=\"password\" class=\"form-control\" id=\"ftpPwd\" maxlength=\"32\" placeholder=\"Passwort\" name=\"ftpPwd\" value=\"%FTP_PWD%\" required>\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container my-5\" id=\"generalConfig\">\ |
||||
|
<h2>General configuration</h2>\ |
||||
|
<form action=\"#generalConfig\" method=\"POST\" onsubmit=\"genSettings('generalConfig'); return false\">\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"initialVolume\">Volume after start</label>\ |
||||
|
<input type=\"number\" min=\"1\" max=\"21\" class=\"form-control\" id=\"initialVolume\" name=\"initialVolume\" value=\"%INIT_VOLUME%\" required>\ |
||||
|
<label for=\"maxVolume\">Maximum volume</label>\ |
||||
|
<input type=\"number\" min=\"1\" max=\"21\" class=\"form-control\" id=\"maxVolume\" name=\"maxVolume\" value=\"%MAX_VOLUME%\" required>\ |
||||
|
</div>\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"initBrightness\">Neopixel-brightness after start</label>\ |
||||
|
<input type=\"number\" min=\"0\" max=\"255\" class=\"form-control\" id=\"initBrightness\" name=\"initBrightness\" value=\"%INIT_LED_BRIGHTBESS%\" required>\ |
||||
|
<label for=\"nightBrightness\">Neopixel-brightness in nightmode</label>\ |
||||
|
<input type=\"number\" min=\"0\" max=\"255\" class=\"form-control\" id=\"nightBrightness\" name=\"nightBrightness\" value=\"%NIGHT_LED_BRIGHTBESS%\" required>\ |
||||
|
</div>\ |
||||
|
<div class=\"form-group col-md-6\">\ |
||||
|
<label for=\"inactivityTime\">Deepsleep after inactivity (minutes)</label>\ |
||||
|
<input type=\"number\" min=\"1\" max=\"1440\" class=\"form-control\" id=\"inactivityTime\" name=\"inactivityTime\" value=\"%MAX_INACTIVITY%\" required>\ |
||||
|
</div>\ |
||||
|
<button type=\"reset\" class=\"btn btn-secondary\">Reset</button>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<div class=\"container my-5\" id=\"importNvs\">\ |
||||
|
<h2>NVS-importer</h2>\ |
||||
|
<form action=\"/upload\" enctype=\"multipart/form-data\" method=\"POST\">\ |
||||
|
<div class=\"form-group\">\ |
||||
|
<label for=\"nvsUpload\">Backup-files can be imported here.</label>\ |
||||
|
<input type=\"file\" class=\"form-control-file\" id=\"nvsUpload\" name=\"nvsUpload\" accept=\".txt\">\ |
||||
|
</div>\ |
||||
|
<button type=\"submit\" class=\"btn btn-primary\">Submit</button>\ |
||||
|
</form>\ |
||||
|
<div class=\"messages col-md-6 my-2\"></div>\ |
||||
|
</div>\ |
||||
|
<script>\ |
||||
|
var lastIdclicked = '';\ |
||||
|
var errorBox = '<div class=\"alert alert-danger alert-dismissible fade show\" role=\"alert\">Error occured!<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div>';\ |
||||
|
var okBox = '<div class=\"alert alert-success alert-dismissible fade show\" role=\"alert\">Action successful.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div>';\ |
||||
|
\ |
||||
|
var socket = new WebSocket(\"ws://%IPv4%/ws\");\ |
||||
|
\ |
||||
|
function connect() {\ |
||||
|
socket = new WebSocket(\"ws://%IPv4%/ws\");\ |
||||
|
}\ |
||||
|
\ |
||||
|
function ping() {\ |
||||
|
var myObj = {\ |
||||
|
\"ping\": {\ |
||||
|
ping: 'ping'\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
tm = setTimeout(function () {\ |
||||
|
alert(\"Connection to tonuino is broken!\\nPlease refresh this website.\");\ |
||||
|
}, 5000);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function pong() {\ |
||||
|
clearTimeout(tm);\ |
||||
|
}\ |
||||
|
\ |
||||
|
socket.onopen = function () {\ |
||||
|
setInterval(ping, 15000);\ |
||||
|
};\ |
||||
|
\ |
||||
|
socket.onclose = function(e) {\ |
||||
|
console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);\ |
||||
|
setTimeout(function() {\ |
||||
|
connect();\ |
||||
|
}, 5000);\ |
||||
|
};\ |
||||
|
\ |
||||
|
socket.onerror = function(err) {\ |
||||
|
console.error('Socket encountered error: ', err.message, 'Closing socket');\ |
||||
|
socket.close();\ |
||||
|
};\ |
||||
|
\ |
||||
|
socket.onmessage = function(event) {\ |
||||
|
console.log(event.data);\ |
||||
|
var socketMsg = JSON.parse(event.data);\ |
||||
|
if (socketMsg.rfidId != null) {\ |
||||
|
document.getElementById('rfidIdMod').value = socketMsg.rfidId;\ |
||||
|
document.getElementById('rfidIdMusic').value = socketMsg.rfidId;\ |
||||
|
$(\"#rfidIdMusic\").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);\ |
||||
|
$(\"#rfidIdMod\").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);\ |
||||
|
\ |
||||
|
} if (socketMsg.status != null) {\ |
||||
|
if (socketMsg.status == 'ok') {\ |
||||
|
$(\"#\" + lastIdclicked).find('.messages').html(okBox);\ |
||||
|
} else {\ |
||||
|
$(\"#\" + lastIdclicked).find('.messages').html(errorBox);\ |
||||
|
}\ |
||||
|
} if (socketMsg.pong != null) {\ |
||||
|
if (socketMsg.pong == 'pong') {\ |
||||
|
pong();\ |
||||
|
}\ |
||||
|
}\ |
||||
|
};\ |
||||
|
\ |
||||
|
function genSettings(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var myObj = {\ |
||||
|
\"general\": {\ |
||||
|
iVol: document.getElementById('initialVolume').value,\ |
||||
|
mVol: document.getElementById('maxVolume').value,\ |
||||
|
iBright: document.getElementById('initBrightness').value,\ |
||||
|
nBright: document.getElementById('nightBrightness').value,\ |
||||
|
iTime: document.getElementById('inactivityTime').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function ftpSettings(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var myObj = {\ |
||||
|
\"ftp\": {\ |
||||
|
ftpUser: document.getElementById('ftpUser').value,\ |
||||
|
ftpPwd: document.getElementById('ftpPwd').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function mqttSettings(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var val;\ |
||||
|
if (document.getElementById('mqttEnable').checked) {\ |
||||
|
val = document.getElementById('mqttEnable').value;\ |
||||
|
} else {\ |
||||
|
val = 0;\ |
||||
|
}\ |
||||
|
var myObj = {\ |
||||
|
\"mqtt\": {\ |
||||
|
mqttEnable: val,\ |
||||
|
mqttServer: document.getElementById('mqttServer').value,\ |
||||
|
mqttUser: document.getElementById('mqttUser').value,\ |
||||
|
mqttPwd: document.getElementById('mqttPwd').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function rfidMods(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var myObj = {\ |
||||
|
\"rfidMod\": {\ |
||||
|
rfidIdMod: document.getElementById('rfidIdMod').value,\ |
||||
|
modId: document.getElementById('modId').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function removeTrSlash(str) {\ |
||||
|
if(str.substr(-1) === '/') {\ |
||||
|
return str.substr(0, str.length - 1);\ |
||||
|
}\ |
||||
|
return str;\ |
||||
|
}\ |
||||
|
\ |
||||
|
function rfidAssign(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var myObj = {\ |
||||
|
\"rfidAssign\": {\ |
||||
|
rfidIdMusic: document.getElementById('rfidIdMusic').value,\ |
||||
|
fileOrUrl: removeTrSlash(document.getElementById('fileOrUrl').value),\ |
||||
|
playMode: document.getElementById('playMode').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
\ |
||||
|
function wifiConfig(clickedId) {\ |
||||
|
lastIdclicked = clickedId;\ |
||||
|
var myObj = {\ |
||||
|
\"wifiConfig\": {\ |
||||
|
ssid: document.getElementById('ssid').value,\ |
||||
|
pwd: document.getElementById('pwd').value,\ |
||||
|
hostname: document.getElementById('hostname').value\ |
||||
|
}\ |
||||
|
};\ |
||||
|
var myJSON = JSON.stringify(myObj);\ |
||||
|
socket.send(myJSON);\ |
||||
|
}\ |
||||
|
</script>\ |
||||
|
</body>\ |
||||
|
</html>\ |
||||
|
"; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue