Files
pti-ledy/index.h
T
2026-02-05 14:40:45 +01:00

83 lines
2.7 KiB
C

const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
<title>LED Panel Control</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family: Arial; text-align: center; margin:0px auto; padding-top: 30px;}
.button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
textarea {
width: 80%;
height: 200px;
margin-top: 20px;
}
.text-controls {
margin-top: 20px;
}
.text-input-group {
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>LED Panel Control</h1>
<button class="button" onclick="location.href='/upload-page'">Upload Image</button>
<br>
<div>
<label for="brightness">Brightness: </label>
<input type="range" id="brightness" min="0" max="100" value="100" onchange="updateBrightness()">
<span id="brightnessValue">100</span>
</div>
<br>
<div class="text-controls">
<h3>Send Text</h3>
<div class="text-input-group">
<input type="text" id="textInput" placeholder="Enter text...">
<input type="color" id="textColorPicker" value="#ffffff">
<input type="number" id="slownessInput" placeholder="Slowness" value="2" min="0" max="255">
</div>
<div class="text-buttons">
<button class="button" onclick="sendText('top')">Send to Top</button>
<button class="button" onclick="sendText('bottom')">Send to Bottom</button>
</div>
</div>
<br>
<script>
function updateBrightness() {
var brightness = document.getElementById("brightness").value;
document.getElementById("brightnessValue").innerText = brightness;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/brightness", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("value=" + brightness);
}
function sendText(position) {
const text = document.getElementById('textInput').value;
const color = document.getElementById('textColorPicker').value;
const slowness = document.getElementById('slownessInput').value;
if (!text) {
alert('Please enter some text.');
return;
}
var xhr = new XMLHttpRequest();
xhr.open("POST", "/text", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("text=" + encodeURIComponent(text) + "&color=" + encodeURIComponent(color) + "&position=" + position + "&slowness=" + slowness);
}
</script>
</body>
</html>
)rawliteral";