Merge branch 'develop'

This commit is contained in:
Kai Lauterbach 2023-06-17 08:33:37 +02:00
commit 66873fa735
13 changed files with 169 additions and 179 deletions

Binary file not shown.

Before

(image error) Size: 2 MiB

After

(image error) Size: 2 MiB

View file

@ -95,34 +95,17 @@ var indexFloat = lowerIndex + timeDiff / ((upperTime[0] - lowerTime[0]) + ((uppe
if (indexFloat > index) {
index = indexFloat;
}
var trace1 = {
var traces = [];
for (var i = 1; i <= 4; i++) {
var trace = {
x: time,
y: channel1,
name: 'Channel 1',
type: 'scatter',
mode: 'lines+markers',
};
var trace2 = {
x: time,
y: channel2,
name: 'Channel 2',
type: 'scatter',
mode: 'lines+markers',
};
var trace3 = {
x: time,
y: channel3,
name: 'Channel 3',
type: 'scatter',
mode: 'lines+markers',
};
var trace4 = {
x: time,
y: channel4,
name: 'Channel 4',
y: eval("channel" + i),
name: 'Channel ' + i,
type: 'scatter',
mode: 'lines+markers',
};
traces.push(trace);
}
var layout = {
title: 'Timing Control Data Blocks',
xaxis: {
@ -146,7 +129,7 @@ dash: 'dot'
}
}]
};
Plotly.newPlot('plot_chart', [trace1, trace2, trace3, trace4], layout);
Plotly.newPlot('plot_chart', traces, layout);
});
}
setInterval(loadGraphData, 10000);
@ -206,34 +189,17 @@ var indexFloat = lowerIndex + timeDiff / ((upperTime[0] - lowerTime[0]) + ((uppe
if (indexFloat > index) {
index = indexFloat;
}
var trace1 = {
var traces = [];
for (var i = 1; i <= 4; i++) {
var trace = {
x: time,
y: channel1,
name: 'Channel 1',
type: 'scatter',
mode: 'lines+markers',
};
var trace2 = {
x: time,
y: channel2,
name: 'Channel 2',
type: 'scatter',
mode: 'lines+markers',
};
var trace3 = {
x: time,
y: channel3,
name: 'Channel 3',
type: 'scatter',
mode: 'lines+markers',
};
var trace4 = {
x: time,
y: channel4,
name: 'Channel 4',
y: eval("channel" + i),
name: 'Channel ' + i,
type: 'scatter',
mode: 'lines+markers',
};
traces.push(trace);
}
var layout = {
title: 'Timing Control Data Blocks',
xaxis: {
@ -257,7 +223,7 @@ dash: 'dot'
}
}]
};
Plotly.newPlot('tc_plot_chart', [trace1, trace2, trace3, trace4], layout);
Plotly.newPlot('tc_plot_chart', traces, layout);
var plot = document.getElementById('tc_plot_chart');
}
function rgbaToHex(rgba) {
@ -485,6 +451,11 @@ showToast('Error while verifying timing control data. The timestamps are not inc
return null;
}
}
if (tcdata[0].ch1 > 0 || tcdata[0].ch2 > 0 || tcdata[0].ch3 > 0 || tcdata[0].ch4 > 0 ||
tcdata[9].ch1 > 0 || tcdata[9].ch2 > 0 || tcdata[9].ch3 > 0 || tcdata[9].ch4 > 0) {
showToast('Error: Values for ch1 to ch4 must be 0 for the first and last entry.', 'error');
return null;
}
var currentTime = {hour: new Date().getHours(), min: new Date().getMinutes()};
var jsonData = {tcdata: tcdata, currenttime: currentTime};
return JSON.stringify(jsonData);

View file

@ -19,6 +19,7 @@
</tr>
</table>
<a href="#" id="save-button" class="pure-button pure-button-primary" onclick="sendDataToServer();">save</a>
<a href="#" id="save-button" class="pure-button pure-button-primary" onclick="fillTableFromJson();">reset</a>
</div>
</div> <!-- end of tab-tde -->
<script src="http://{{IP_ADDRESS}}/js_bottom">

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Light setup - {{LIGHT_NAME}}</title>
<title>Light setup - {{LIGHT_NAME}}{{LIGHT_NAME_DEV_POSTFIX}}</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

View file

@ -1,20 +1,24 @@
#tab-lights, #tab-config, #tab-tde {
body {
font-family: Arial, sans-serif;
}
#tab-lights,
#tab-config,
#tab-tde {
display: none;
background-color: #ffffff;
color: black;
font-weight: bold;
padding: 10px;
border-radius: 3px;
}
#tab-lights.visible {
display: block;
}
#tab-config.visible {
display: block;
}
#tab-lights.visible,
#tab-config.visible,
#tab-tde.visible {
display: block;
}
.pure-table td {
padding: 4px;
vertical-align: top;
}
.pure-form input[type="number"] {
width: 60px;
@ -41,9 +45,6 @@ cursor: pointer;
.pure-button:hover {
background-color: #333;
}
.top-align {
vertical-align: top;
}
.toast {
position: fixed;
bottom: 10px;
@ -59,7 +60,7 @@ opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.toast.success {
background-color: #4CAF50;
background-color: #4caf50;
}
.toast.error {
background-color: #f44336;
@ -75,5 +76,8 @@ input[type=range]:focus {
outline: none;
}
[id^="bri"] {
width: 50%;
width: 50%;
}
.top-align {
vertical-align: top;
}

View file

@ -9,7 +9,6 @@ function addTabListener() {
var acfg = document.getElementById("tab-a-config");
var atde = document.getElementById("tab-a-tde");
amain.addEventListener("click", function() {
//console.log("Switch to main lights tab");
tabMain.classList.add("visible");
@ -121,34 +120,18 @@ function loadGraphData() {
index = indexFloat;
}
//console.log("index in graph >>>" + index);
var trace1 = {
x: time,
y: channel1,
name: 'Channel 1',
type: 'scatter',
mode: 'lines+markers',
};
var trace2 = {
x: time,
y: channel2,
name: 'Channel 2',
type: 'scatter',
mode: 'lines+markers',
};
var trace3 = {
x: time,
y: channel3,
name: 'Channel 3',
type: 'scatter',
mode: 'lines+markers',
};
var trace4 = {
x: time,
y: channel4,
name: 'Channel 4',
type: 'scatter',
mode: 'lines+markers',
};
var traces = [];
for (var i = 1; i <= 4; i++) {
var trace = {
x: time,
y: eval("channel" + i),
name: 'Channel ' + i,
type: 'scatter',
mode: 'lines+markers',
};
traces.push(trace);
}
var layout = {
title: 'Timing Control Data Blocks',
xaxis: {
@ -172,7 +155,7 @@ function loadGraphData() {
}
}]
};
Plotly.newPlot('plot_chart', [trace1, trace2, trace3, trace4], layout);
Plotly.newPlot('plot_chart', traces, layout);
});
}
setInterval(loadGraphData, 10000);
@ -246,34 +229,18 @@ function loadTCGraphData() {
index = indexFloat;
}
//console.log("index in graph >>>" + index);
var trace1 = {
x: time,
y: channel1,
name: 'Channel 1',
type: 'scatter',
mode: 'lines+markers',
};
var trace2 = {
x: time,
y: channel2,
name: 'Channel 2',
type: 'scatter',
mode: 'lines+markers',
};
var trace3 = {
x: time,
y: channel3,
name: 'Channel 3',
type: 'scatter',
mode: 'lines+markers',
};
var trace4 = {
x: time,
y: channel4,
name: 'Channel 4',
type: 'scatter',
mode: 'lines+markers',
};
var traces = [];
for (var i = 1; i <= 4; i++) {
var trace = {
x: time,
y: eval("channel" + i),
name: 'Channel ' + i,
type: 'scatter',
mode: 'lines+markers',
};
traces.push(trace);
}
var layout = {
title: 'Timing Control Data Blocks',
xaxis: {
@ -297,7 +264,7 @@ function loadTCGraphData() {
}
}]
};
Plotly.newPlot('tc_plot_chart', [trace1, trace2, trace3, trace4], layout);
Plotly.newPlot('tc_plot_chart', traces, layout);
var plot = document.getElementById('tc_plot_chart'); // Das HTML-Div-Element, in dem der Plot angezeigt wird
}
@ -593,6 +560,13 @@ function createJsonFromTable() {
}
}
// Überprüft die Werte für ch1 bis ch4 bei i=0 und i=9
if (tcdata[0].ch1 > 0 || tcdata[0].ch2 > 0 || tcdata[0].ch3 > 0 || tcdata[0].ch4 > 0 ||
tcdata[9].ch1 > 0 || tcdata[9].ch2 > 0 || tcdata[9].ch3 > 0 || tcdata[9].ch4 > 0) {
showToast('Error: Values for ch1 to ch4 must be 0 for the first and last entry.', 'error');
return null;
}
var currentTime = {hour: new Date().getHours(), min: new Date().getMinutes()};
var jsonData = {tcdata: tcdata, currenttime: currentTime};
//console.log("jsonData = " + JSON.stringify(jsonData));

View file

@ -20,6 +20,7 @@
</table>
<a href="#" id="save-button" class="pure-button pure-button-primary" onclick="sendDataToServer();">save</a>
<a href="#" id="save-button" class="pure-button pure-button-primary" onclick="fillTableFromJson();">reset</a>
</div>
</div> <!-- end of tab-tde -->

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Light setup - {{LIGHT_NAME}}</title>
<title>Light setup - {{LIGHT_NAME}}{{LIGHT_NAME_DEV_POSTFIX}}</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

View file

@ -1,79 +1,107 @@
#tab-lights, #tab-config, #tab-tde {
display: none;
background-color: #ffffff;
color: black;
font-weight: bold;
/* Vereinheitlichter Look */
body {
font-family: Arial, sans-serif;
}
#tab-lights.visible {
display: block;
}
#tab-config.visible {
display: block;
/* Gemeinsame Regeln für die Tabs */
#tab-lights,
#tab-config,
#tab-tde {
display: none;
background-color: #ffffff;
color: black;
font-weight: bold;
padding: 10px;
border-radius: 3px;
}
/* Sichtbarkeitsregeln für die Tabs */
#tab-lights.visible,
#tab-config.visible,
#tab-tde.visible {
display: block;
display: block;
}
/* Gemeinsame Regeln für Tabellenzellen */
.pure-table td {
padding: 4px;
padding: 4px;
vertical-align: top;
/* Hinzugefügt: vertikale Ausrichtung oben */
}
/* Stil für Formularelemente */
.pure-form input[type="number"] {
width: 60px;
height: 20px;
border-radius: 3px;
border: 1px solid #ccc;
width: 60px;
height: 20px;
border-radius: 3px;
border: 1px solid #ccc;
}
.pure-form select {
width: 80px;
height: 26px;
border-radius: 3px;
border: 1px solid #ccc;
background-color: #fff;
width: 80px;
height: 26px;
border-radius: 3px;
border: 1px solid #ccc;
background-color: #fff;
}
/* Stil für Buttons */
.pure-button {
background-color: #5a5a5a;
color: #fff;
border-radius: 3px;
border: none;
padding: 8px 12px;
font-size: 14px;
cursor: pointer;
background-color: #5a5a5a;
color: #fff;
border-radius: 3px;
border: none;
padding: 8px 12px;
font-size: 14px;
cursor: pointer;
}
.pure-button:hover {
background-color: #333;
}
.top-align {
vertical-align: top;
background-color: #333;
}
/* Stil für die Toast-Nachrichten */
.toast {
position: fixed;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
padding: 10px;
border-radius: 5px;
color: #fff;
font-size: 16px;
font-weight: bold;
text-align: center;
opacity: 0;
transition: opacity 0.5s ease-in-out;
position: fixed;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
padding: 10px;
border-radius: 5px;
color: #fff;
font-size: 16px;
font-weight: bold;
text-align: center;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.toast.success {
background-color: #4CAF50;
background-color: #4caf50;
}
.toast.error {
background-color: #f44336;
background-color: #f44336;
}
/* Stil für den Range-Slider */
input[type=range] {
-webkit-appearance: none;
width: 70%;
height: 7px;
margin: 4px 0;
background-color: #ddd;
-webkit-appearance: none;
width: 70%;
height: 7px;
margin: 4px 0;
background-color: #ddd;
}
input[type=range]:focus {
outline: none;
outline: none;
}
/* Spezifischer Stil für Elemente mit ID, die mit "bri" beginnen */
[id^="bri"] {
width: 50%;
}
.top-align {
vertical-align: top;
}

View file

@ -4,7 +4,10 @@
sed -e 's/^[[:space:]]*//' -e '/^\/\/.*/d' $1 |
# Remove one line comments starting with //
sed -e 's/^\/\/.*$//' |
# Remove trailing comments starting with //
# Remove trailing comments starting with space //
sed -e 's/ \/\/.*$//' |
# Remove one-line comments starting with /*
sed -e 's/\/\*.*//g' |
# Remove empty lines
sed '/^\s*$/d'
sed -e '/^\s*$/d'

View file

@ -20,5 +20,13 @@ bash ../../tools/html2string.sh ../html/config_template.html > config_template.h
bash ../../tools/html2string.sh ../html/light_control_template.html > light_control_template.html
bash ../../tools/html2string.sh ../html/top.js > top.js
bash ../../tools/html2string.sh ../html/bottom.js > bottom.js
cp -av ../html/style.css . > /dev/null
bash ../../tools/html2string.sh ../html/style.css > style.css
#for file in *"_tmp"; do
# if [[ -f "$file" ]]; then
# new_file="${file%_tmp}"
# html-minifier --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true "$file" > "$new_file"
# rm "$file"
# fi
#done