reduce html size for QRG form
This commit is contained in:
parent
77df309009
commit
4bcdc958c2
|
|
@ -187,6 +187,10 @@ void setupChannelList() {
|
||||||
else if (space[1] == 'M') {
|
else if (space[1] == 'M') {
|
||||||
type = STYPE_M10;
|
type = STYPE_M10;
|
||||||
}
|
}
|
||||||
|
else if (space[1] == '2') {
|
||||||
|
type = STYPE_M10;
|
||||||
|
}
|
||||||
|
|
||||||
else continue;
|
else continue;
|
||||||
int active = space[3] == '+' ? 1 : 0;
|
int active = space[3] == '+' ? 1 : 0;
|
||||||
if (space[4] == ' ') {
|
if (space[4] == ' ') {
|
||||||
|
|
@ -205,19 +209,46 @@ void setupChannelList() {
|
||||||
|
|
||||||
const char *createQRGForm() {
|
const char *createQRGForm() {
|
||||||
char *ptr = message;
|
char *ptr = message;
|
||||||
strcpy(ptr, "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head><body><form action=\"qrg.html\" method=\"post\"><table><tr><th>ID</th><th>Active</th><th>Freq</th><th>Launchsite</th><th>Mode</th></tr>");
|
strcpy(ptr, "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">");
|
||||||
|
strcat(ptr, "<script type=\"text/javascript\">"
|
||||||
|
"let stypes=new Map();"
|
||||||
|
"stypes.set('4', 'RS41');"
|
||||||
|
"stypes.set('R', 'RS92');"
|
||||||
|
"stypes.set('9', 'DFM9 (old)');"
|
||||||
|
"stypes.set('6', 'DFM6 (old)');"
|
||||||
|
"stypes.set('D', 'DFM');"
|
||||||
|
"stypes.set('M', 'M10');"
|
||||||
|
"function prep() {"
|
||||||
|
" var stlist=document.querySelectorAll(\"input.stype\");"
|
||||||
|
" for(txt of stlist){"
|
||||||
|
" var val=txt.getAttribute('value'); var nam=txt.getAttribute('name'); "
|
||||||
|
" var sel=document.createElement('select');"
|
||||||
|
" sel.setAttribute('name',nam);"
|
||||||
|
" for(stype of stypes) { "
|
||||||
|
" var opt=document.createElement('option');"
|
||||||
|
" opt.value=stype[0];"
|
||||||
|
" opt.innerHTML=stype[1];"
|
||||||
|
" if(stype[0]==val) { opt.setAttribute('selected','selected'); }"
|
||||||
|
" sel.appendChild(opt);"
|
||||||
|
" } txt.replaceWith(sel); } } "
|
||||||
|
" window.onload = prep; "
|
||||||
|
"</script>");
|
||||||
|
|
||||||
|
strcat(ptr, "</head><body><form action=\"qrg.html\" method=\"post\"><table><tr><th>ID</th><th>Active</th><th>Freq</th><th>Launchsite</th><th>Mode</th></tr>");
|
||||||
for (int i = 0; i < sonde.config.maxsonde; i++) {
|
for (int i = 0; i < sonde.config.maxsonde; i++) {
|
||||||
String s = sondeTypeSelect(i >= sonde.nSonde ? 2 : sonde.sondeList[i].type);
|
//String s = sondeTypeSelect(i >= sonde.nSonde ? 2 : sonde.sondeList[i].type);
|
||||||
String site = sonde.sondeList[i].launchsite;
|
String site = sonde.sondeList[i].launchsite;
|
||||||
sprintf(ptr + strlen(ptr), "<tr><td>%d</td><td><input name=\"A%d\" type=\"checkbox\" %s/></td>"
|
sprintf(ptr + strlen(ptr), "<tr><td>%d</td><td><input name=\"A%d\" type=\"checkbox\" %s/></td>"
|
||||||
"<td><input name=\"F%d\" type=\"text\" value=\"%3.3f\"></td>"
|
"<td><input name=\"F%d\" type=\"text\" value=\"%3.3f\"></td>"
|
||||||
"<td><input name=\"S%d\" type=\"text\" value=\"%s\"></td>"
|
"<td><input name=\"S%d\" type=\"text\" value=\"%s\"></td>"
|
||||||
"<td><select name=\"T%d\">%s</select></td>",
|
//"<td><select name=\"T%d\">%s</select></td>",
|
||||||
|
"<td><input class='stype' name='T%d' value='%c'>",
|
||||||
i + 1,
|
i + 1,
|
||||||
i + 1, (i < sonde.nSonde && sonde.sondeList[i].active) ? "checked" : "",
|
i + 1, (i < sonde.nSonde && sonde.sondeList[i].active) ? "checked" : "",
|
||||||
i + 1, i >= sonde.nSonde ? 400.000 : sonde.sondeList[i].freq,
|
i + 1, i >= sonde.nSonde ? 400.000 : sonde.sondeList[i].freq,
|
||||||
i + 1, i >= sonde.nSonde ? " " : sonde.sondeList[i].launchsite,
|
i + 1, i >= sonde.nSonde ? " " : sonde.sondeList[i].launchsite,
|
||||||
i + 1, s.c_str());
|
i + 1, i >= sonde.nSonde ? 2 : sondeTypeChar[sonde.sondeList[i].type] );
|
||||||
|
//i + 1, s.c_str());
|
||||||
}
|
}
|
||||||
strcat(ptr, "</table><input type=\"submit\" value=\"Update\"/></form></body></html>");
|
strcat(ptr, "</table><input type=\"submit\" value=\"Update\"/></form></body></html>");
|
||||||
Serial.printf("QRG form: size=%d bytes\n", strlen(message));
|
Serial.printf("QRG form: size=%d bytes\n", strlen(message));
|
||||||
|
|
@ -260,7 +291,8 @@ const char *handleQRGPost(AsyncWebServerRequest *request) {
|
||||||
const char *tstr = tstring.c_str();
|
const char *tstr = tstring.c_str();
|
||||||
const char *sstr = sstring.c_str();
|
const char *sstr = sstring.c_str();
|
||||||
Serial.printf("Processing a=%s, f=%s, t=%s, site=%s\n", active ? "YES" : "NO", fstr, tstr, sstr);
|
Serial.printf("Processing a=%s, f=%s, t=%s, site=%s\n", active ? "YES" : "NO", fstr, tstr, sstr);
|
||||||
char typech = (tstr[2] == '4' ? '4' : tstr[2] == '9' ? 'R' : tstr[0] == 'M' ? 'M' : tstr[3] == ' ' ? 'D' : tstr[3]); // a bit ugly
|
//char typech = (tstr[2] == '4' ? '4' : tstr[2] == '9' ? 'R' : tstr[0] == 'M' ? 'M' : tstr[3] == ' ' ? 'D' : tstr[3]); // a bit ugly
|
||||||
|
char typech = tstr[0];
|
||||||
file.printf("%3.3f %c %c %s\n", atof(fstr), typech, active ? '+' : '-', sstr);
|
file.printf("%3.3f %c %c %s\n", atof(fstr), typech, active ? '+' : '-', sstr);
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ key2action=#,#,#,#
|
||||||
timeaction=#,D,+
|
timeaction=#,D,+
|
||||||
fonts=5,6
|
fonts=5,6
|
||||||
0,0=XScan
|
0,0=XScan
|
||||||
0,5,-3=S#:
|
0,8,-3=S#:
|
||||||
0,9,5=T
|
0,9,5=T
|
||||||
3,0=F MHz
|
3,0=F MHz
|
||||||
5,0,16=S
|
5,0,16=S
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ key2action=#,#,#,#
|
||||||
timeaction=#,D,+
|
timeaction=#,D,+
|
||||||
fonts=5,6
|
fonts=5,6
|
||||||
0,0=XScan
|
0,0=XScan
|
||||||
0,5,-3=S#:
|
0,8,-3=S#:
|
||||||
0,9,5.5=T
|
0,9,5.5=T
|
||||||
3,0=F MHz
|
3,0=F MHz
|
||||||
5,0,16=S
|
5,0,16=S
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const char *version_name = "rdzTTGOsonde";
|
const char *version_name = "rdzTTGOsonde";
|
||||||
const char *version_id = "devel20201201";
|
const char *version_id = "devel20201215";
|
||||||
const int SPIFFS_MAJOR=2;
|
const int SPIFFS_MAJOR=2;
|
||||||
const int SPIFFS_MINOR=6;
|
const int SPIFFS_MINOR=6;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,9 @@ extern SemaphoreHandle_t axpSemaphore;
|
||||||
|
|
||||||
SPIClass spiDisp(HSPI);
|
SPIClass spiDisp(HSPI);
|
||||||
|
|
||||||
const char *sondeTypeStr[NSondeTypes] = { "DFM ", "DFM9", "RS41", "RS92", "M10 ", "DFM6" };
|
const char *sondeTypeStr[NSondeTypes] = { "DFM ", "DFM9", "RS41", "RS92", "M10 ", "M20 ", "DFM6" };
|
||||||
const char *sondeTypeLongStr[NSondeTypes] = { "DFM (all)", "DFM9 (old)", "RS41", "RS92", "M10 ", "DFM6 (old)" };
|
const char *sondeTypeLongStr[NSondeTypes] = { "DFM (all)", "DFM9 (old)", "RS41", "RS92", "M10 ", "M20 ", "DFM6 (old)" };
|
||||||
|
const char sondeTypeChar[NSondeTypes] = { 'D', '9', '4', 'R', 'M', '2', '6' };
|
||||||
|
|
||||||
byte myIP_tiles[8*11];
|
byte myIP_tiles[8*11];
|
||||||
static uint8_t ap_tile[8]={0x00,0x04,0x22,0x92, 0x92, 0x22, 0x04, 0x00};
|
static uint8_t ap_tile[8]={0x00,0x04,0x22,0x92, 0x92, 0x22, 0x04, 0x00};
|
||||||
|
|
|
||||||
|
|
@ -438,6 +438,7 @@ void Sonde::setup() {
|
||||||
rs92.setup( sondeList[rxtask.currentSonde].freq * 1000000);
|
rs92.setup( sondeList[rxtask.currentSonde].freq * 1000000);
|
||||||
break;
|
break;
|
||||||
case STYPE_M10:
|
case STYPE_M10:
|
||||||
|
case STYPE_M20:
|
||||||
m10.setup( sondeList[rxtask.currentSonde].freq * 1000000);
|
m10.setup( sondeList[rxtask.currentSonde].freq * 1000000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -463,6 +464,7 @@ void Sonde::receive() {
|
||||||
res = rs92.receive();
|
res = rs92.receive();
|
||||||
break;
|
break;
|
||||||
case STYPE_M10:
|
case STYPE_M10:
|
||||||
|
case STYPE_M20:
|
||||||
res = m10.receive();
|
res = m10.receive();
|
||||||
break;
|
break;
|
||||||
case STYPE_DFM06_OLD:
|
case STYPE_DFM06_OLD:
|
||||||
|
|
@ -554,6 +556,7 @@ rxloop:
|
||||||
rs92.waitRXcomplete();
|
rs92.waitRXcomplete();
|
||||||
break;
|
break;
|
||||||
case STYPE_M10:
|
case STYPE_M10:
|
||||||
|
case STYPE_M20:
|
||||||
m10.waitRXcomplete();
|
m10.waitRXcomplete();
|
||||||
break;
|
break;
|
||||||
case STYPE_DFM06_OLD:
|
case STYPE_DFM06_OLD:
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,14 @@ extern const char *RXstr[];
|
||||||
// 01000000 => goto sonde -1
|
// 01000000 => goto sonde -1
|
||||||
// 01000001 => goto sonde +1
|
// 01000001 => goto sonde +1
|
||||||
|
|
||||||
#define NSondeTypes 6
|
#define NSondeTypes 7
|
||||||
enum SondeType { STYPE_DFM, STYPE_DFM09_OLD, STYPE_RS41, STYPE_RS92, STYPE_M10, STYPE_DFM06_OLD };
|
enum SondeType { STYPE_DFM, STYPE_DFM09_OLD, STYPE_RS41, STYPE_RS92, STYPE_M10, STYPE_M20, STYPE_DFM06_OLD };
|
||||||
extern const char *sondeTypeStr[NSondeTypes];
|
extern const char *sondeTypeStr[NSondeTypes];
|
||||||
extern const char *sondeTypeLongStr[NSondeTypes];
|
extern const char *sondeTypeLongStr[NSondeTypes];
|
||||||
|
extern const char sondeTypeChar[NSondeTypes];
|
||||||
|
|
||||||
#define TYPE_IS_DFM(t) ( (t)==STYPE_DFM || (t)==STYPE_DFM09_OLD || (t)==STYPE_DFM06_OLD )
|
#define TYPE_IS_DFM(t) ( (t)==STYPE_DFM || (t)==STYPE_DFM09_OLD || (t)==STYPE_DFM06_OLD )
|
||||||
#define TYPE_IS_METEO(t) ( (t)==STYPE_M10 )
|
#define TYPE_IS_METEO(t) ( (t)==STYPE_M10 || (t)==STYPE_M20 )
|
||||||
|
|
||||||
typedef struct st_sondeinfo {
|
typedef struct st_sondeinfo {
|
||||||
// receiver configuration
|
// receiver configuration
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue