kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
sync w7 DL2MF: web interface enhancements
rodzic
ef82ae9da2
commit
7ae1f7d187
|
@ -308,7 +308,10 @@ void HTMLBODYEND(char *ptr) {
|
|||
strcat(ptr, "</div></form></body></html>");
|
||||
}
|
||||
void HTMLSAVEBUTTON(char *ptr) {
|
||||
strcat(ptr, "</div><div class=\"footer\"><input type=\"submit\" class=\"save\" value=\"Save changes\"/>");
|
||||
strcat(ptr, "</div><div class=\"footer\"><input type=\"submit\" class=\"save\" value=\"Save changes\"/>"
|
||||
"<span class=\"ttgoinfo\">rdzTTGOserver ");
|
||||
strcat(ptr, version_id);
|
||||
strcat(ptr, "</span>");
|
||||
}
|
||||
|
||||
const char *createQRGForm() {
|
||||
|
@ -419,7 +422,8 @@ void setupWifiList() {
|
|||
const char *createWIFIForm() {
|
||||
char *ptr = message;
|
||||
char tmp[4];
|
||||
strcpy(ptr, HTMLHEAD); strcat(ptr, "</head>");
|
||||
strcpy(ptr, HTMLHEAD);
|
||||
strcat(ptr, "<script src=\"rdz.js\"></script></head>");
|
||||
HTMLBODY(ptr, "wifi.html");
|
||||
strcat(ptr, "<table><tr><th>Nr</th><th>SSID</th><th>Password</th></tr>");
|
||||
for (int i = 0; i < MAX_WIFI; i++) {
|
||||
|
@ -430,7 +434,7 @@ const char *createWIFIForm() {
|
|||
i + 1, i < nNetworks ? networks[i].id.c_str() : "",
|
||||
i + 1, i < nNetworks ? networks[i].pw.c_str() : "");
|
||||
}
|
||||
strcat(ptr, "</table>");
|
||||
strcat(ptr, "</table><script>footer()</script>");
|
||||
//</div><div class=\"footer\"><input type=\"submit\" class=\"update\" value=\"Update\"/>");
|
||||
HTMLSAVEBUTTON(ptr);
|
||||
HTMLBODYEND(ptr);
|
||||
|
@ -827,7 +831,8 @@ const char *ctrllabel[] = {"Receiver/next freq. (short keypress)", "Scanner (dou
|
|||
|
||||
const char *createControlForm() {
|
||||
char *ptr = message;
|
||||
strcpy(ptr, HTMLHEAD); strcat(ptr, "</head>");
|
||||
strcpy(ptr, HTMLHEAD);
|
||||
strcat(ptr, "<script src=\"rdz.js\"></script></head>");
|
||||
HTMLBODY(ptr, "control.html");
|
||||
for (int i = 0; i < 9; i++) {
|
||||
strcat(ptr, "<input class=\"ctlbtn\" type=\"submit\" name=\"");
|
||||
|
@ -839,6 +844,7 @@ const char *createControlForm() {
|
|||
strcat(ptr, "<p></p>");
|
||||
}
|
||||
}
|
||||
strcat(ptr, "<script> footer() </script>\n");
|
||||
HTMLBODYEND(ptr);
|
||||
Serial.printf("Control form: size=%d bytes\n", strlen(message));
|
||||
return message;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="wrapper"><div class="header">
|
||||
<h2>rdzTTGOSonde Server</h2>
|
||||
<div class="topnav" id="myTopnav">
|
||||
<a href="#qrg" onclick="selTab(event,'QRG')" class="tablinks" id="defaultTab">QRG</a>
|
||||
<a href="#data" onclick="selTab(event,'Data')" class="tablinks">Data</a>
|
||||
|
@ -76,6 +75,7 @@
|
|||
See <a href="https://www.gnu.org/licenses/gpl-2.0.txt">https://www.gnu.org/licenses/gpl-2.0.txt</a>
|
||||
for details.
|
||||
</div>
|
||||
<div class="footer"><span></span><span class="ttgoinfo">rdzTTGOserver %VERSION_ID%</span></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -3,10 +3,20 @@ stypes.set('4', 'RS41');
|
|||
stypes.set('R', 'RS92');
|
||||
stypes.set('D', 'DFM');
|
||||
stypes.set('M', 'M10/M20');
|
||||
//stypes.set('2', 'M10/M20');
|
||||
stypes.set('3', 'MP3H');
|
||||
|
||||
/* (no longer) Used by qrg.html in RX_FSK.ino */
|
||||
function footer() {
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
var form = document.querySelector(".wrapper");
|
||||
form.addEventListener("input", function() {
|
||||
document.querySelector(".save").disabled = false;
|
||||
});
|
||||
document.querySelector(".save").disabled = true;
|
||||
document.querySelector(".ttgoinfo").innerHTML = "rdzTTGOserver %VERSION_ID%";
|
||||
});
|
||||
}
|
||||
|
||||
/* Used by qrg.html in RX_FSK.ino */
|
||||
function prep() {
|
||||
var stlist=document.querySelectorAll("input.stype");
|
||||
for(txt of stlist){
|
||||
|
@ -28,16 +38,18 @@ function prep() {
|
|||
function qrgTable() {
|
||||
var tab=document.getElementById("divTable");
|
||||
|
||||
var table = "<table><tr><th>Ch</th><th>Active</th><th>Frequency</th><th>Launchsite</th><th>Decoder</th></tr>";
|
||||
var table = "<table><tr><th>Ch</th><th>Active</th><th>Frequency</th><th>Decoder</th><th>Launchsite</th></tr>";
|
||||
for(i=0; i<qrgs.length; i++) {
|
||||
var ck = "";
|
||||
if(qrgs[i][0]) ck="checked";
|
||||
table += "<tr><td>" + (i+1) + "</td><td><input name=\"A" + (i+1) + "\" type=\"checkbox\" " + ck + "/></td>";
|
||||
table += "<td><input name=\"F" + (i+1) + "\" type=\"text\" width=12 value=\"" + qrgs[i][1] + "\"></td>";
|
||||
table += "<td><input name=\"S" + (i+1) + "\" type=\"text\" value=\"" + qrgs[i][2] +"\"></td>";
|
||||
table += "<td><input class=\"stype\" name=\"T" + (i+1) + "\" value=\"" + qrgs[i][3] + "\"></td></tr>";
|
||||
table += "<tr><td class=\"ch\">" + (i+1) + "</td><td class=\"act\"><input name=\"A" + (i+1) + "\" type=\"checkbox\" " + ck + "/></td>";
|
||||
table += "<td><input name=\"F" + (i+1) + "\" type=\"text\" size=7 value=\"" + qrgs[i][1] + "\"></td>";
|
||||
table += "<td><input class=\"stype\" name=\"T" + (i+1) + "\" value=\"" + qrgs[i][3] + "\"></td>";
|
||||
table += "<td><input name=\"S" + (i+1) + "\" type=\"text\" value=\"" + qrgs[i][2] +"\"></td></tr>";
|
||||
}
|
||||
table += "</table>";
|
||||
tab.innerHTML = table;
|
||||
prep();
|
||||
footer();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,18 @@ th.cfg {
|
|||
flex-grow: 1; border: none; margin: 0; padding: 0;
|
||||
}
|
||||
.footer {
|
||||
background-color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
td.ch {
|
||||
text-align: right;
|
||||
padding: 0px 8px;
|
||||
}
|
||||
td.act {
|
||||
text-align: center;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
|
@ -71,7 +81,6 @@ td#sfreq {
|
|||
.tabcontent {
|
||||
display: none;
|
||||
flex: 1;
|
||||
padding: 6px 12px;
|
||||
border-top: none;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
|
@ -90,24 +99,16 @@ h1{
|
|||
p{
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
.canberemoved_button {
|
||||
display: inline-block;
|
||||
background-color: #008CBA;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
padding: 16px 40px;
|
||||
text-decoration: none;
|
||||
font-size: 30px;
|
||||
margin: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button2 {
|
||||
background-color: #f44336;
|
||||
}
|
||||
:disabled.save {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.save {
|
||||
background-color: #0F3376;
|
||||
border: black;
|
||||
background-color: #CC1111; /* 0F33C6; */
|
||||
border: white;
|
||||
border-width: 1;
|
||||
color: white;
|
||||
padding: 8px 30px;
|
||||
|
@ -117,6 +118,14 @@ p{
|
|||
font-size: 14px;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
.ttgoinfo {
|
||||
color: white;
|
||||
padding: 8px 10px;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
margin: 0
|
||||
}
|
||||
.ctlbtn {
|
||||
background-color: #ccc;
|
||||
border: black;
|
||||
|
|
|
@ -96,7 +96,7 @@ int sonde2json(char *buf, int maxlen, SondeInfo *si)
|
|||
|
||||
// add only if available
|
||||
if(s->batteryVoltage > 0) {
|
||||
n = snprintf(buf, maxlen, ",\"bat\": %.1f", s->batteryVoltage);
|
||||
n = snprintf(buf, maxlen, ",\"batt\": %.1f", s->batteryVoltage);
|
||||
if(n>=maxlen) return -1;
|
||||
buf += n; maxlen -= n;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ void MQTT::publishUptime()
|
|||
// rxlat, rxlon only if not empty
|
||||
snprintf(payload, 256, "{\"uptime\": %lu, \"user\": \"%s\", ", millis(), username);
|
||||
if( !isnan(sonde.config.rxlat) && !isnan(sonde.config.rxlon) ) {
|
||||
snprintf(payload, 256, "%s\"rxlat\": %.5f, \"rxlon\": %.5f, ", payload, sonde.config.rxlat, sonde.config.rxlon);
|
||||
snprintf(payload, 256, "%s\"rxlat\": %.5f, \"rxlon\": %.5f, ", payload, sonde.config.rxlat, sonde.config.rxlon);
|
||||
}
|
||||
snprintf(payload, 256, "%s\"sw\": \"%s\", \"ver\": \"%s\"}", version_name, version_id);
|
||||
Serial.println(payload);
|
||||
char topic[128];
|
||||
|
|
|
@ -25,7 +25,8 @@ lib_deps_external =
|
|||
https://github.com/dx168b/async-mqtt-client
|
||||
|
||||
[env:ttgo-lora32]
|
||||
platform = https://github.com/platformio/platform-espressif32.git#v3.3.2
|
||||
#platform = https://github.com/platformio/platform-espressif32.git#v3.3.2
|
||||
platform = https://github.com/platformio/platform-espressif32.git#v4.4.0
|
||||
board = ttgo-lora32-v1
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
|
|
Ładowanie…
Reference in New Issue