unspukify
This commit is contained in:
parent
d40af02e12
commit
2eb6a379b9
|
|
@ -70,6 +70,15 @@ static int currentDisplay = 1;
|
||||||
// timestamp when spectrum display was activated
|
// timestamp when spectrum display was activated
|
||||||
static unsigned long specTimer;
|
static unsigned long specTimer;
|
||||||
|
|
||||||
|
// Read line from file, independent of line termination (LF or CR LF)
|
||||||
|
String readLine(Stream &stream) {
|
||||||
|
String s = stream.readStringUntil('\n');
|
||||||
|
int len = s.length();
|
||||||
|
if(len==0) return s;
|
||||||
|
if(s.charAt(len-1)=='\r') s.remove(len-1);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// Replaces placeholder with LED state value
|
// Replaces placeholder with LED state value
|
||||||
String processor(const String& var) {
|
String processor(const String& var) {
|
||||||
Serial.println(var);
|
Serial.println(var);
|
||||||
|
|
@ -131,7 +140,7 @@ void setupChannelList() {
|
||||||
sonde.clearSonde();
|
sonde.clearSonde();
|
||||||
Serial.println("Reading channel config:");
|
Serial.println("Reading channel config:");
|
||||||
while (file.available()) {
|
while (file.available()) {
|
||||||
String line = file.readStringUntil('\n');
|
String line = readLine(file); //file.readStringUntil('\n');
|
||||||
String sitename;
|
String sitename;
|
||||||
if (!file.available()) break;
|
if (!file.available()) break;
|
||||||
if (line[0] == '#') continue;
|
if (line[0] == '#') continue;
|
||||||
|
|
@ -261,10 +270,10 @@ void setupWifiList() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (file.available()) {
|
while (file.available()) {
|
||||||
String line = file.readStringUntil('\n');
|
String line = readLine(file); //file.readStringUntil('\n');
|
||||||
if (!file.available()) break;
|
if (!file.available()) break;
|
||||||
networks[i].id = line;
|
networks[i].id = line;
|
||||||
networks[i].pw = file.readStringUntil('\n');
|
networks[i].pw = readLine(file); // file.readStringUntil('\n');
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
nNetworks = i;
|
nNetworks = i;
|
||||||
|
|
@ -377,7 +386,7 @@ void setupConfigData() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (file.available()) {
|
while (file.available()) {
|
||||||
String line = file.readStringUntil('\n');
|
String line = readLine(file); //file.readStringUntil('\n');
|
||||||
sonde.setConfig(line.c_str());
|
sonde.setConfig(line.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -657,7 +666,7 @@ const char *createEditForm(String filename) {
|
||||||
strcat(ptr, "\" method=\"post\">");
|
strcat(ptr, "\" method=\"post\">");
|
||||||
strcat(ptr, "<textarea name=\"text\" cols=\"80\" rows=\"40\">");
|
strcat(ptr, "<textarea name=\"text\" cols=\"80\" rows=\"40\">");
|
||||||
while (file.available()) {
|
while (file.available()) {
|
||||||
String line = file.readStringUntil('\n');
|
String line = readLine(file); //file.readStringUntil('\n');
|
||||||
strcat(ptr, line.c_str()); strcat(ptr, "\n");
|
strcat(ptr, line.c_str()); strcat(ptr, "\n");
|
||||||
}
|
}
|
||||||
strcat(ptr, "</textarea><input type=\"submit\" value=\"Save\"></input></form></body></html>");
|
strcat(ptr, "</textarea><input type=\"submit\" value=\"Save\"></input></form></body></html>");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const char *version_name = "rdzTTGOsonde";
|
const char *version_name = "rdzTTGOsonde";
|
||||||
const char *version_id = "devel20191102";
|
const char *version_id = "devel20191103";
|
||||||
const int SPIFFS_MAJOR=2;
|
const int SPIFFS_MAJOR=2;
|
||||||
const int SPIFFS_MINOR=1;
|
const int SPIFFS_MINOR=1;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "Sonde.h"
|
#include "Sonde.h"
|
||||||
|
|
||||||
|
extern String readLine(Stream &stream);
|
||||||
|
|
||||||
extern const char *version_name;
|
extern const char *version_name;
|
||||||
extern const char *version_id;
|
extern const char *version_id;
|
||||||
|
|
||||||
|
|
@ -703,11 +705,12 @@ static uint8_t ACTION(char c) {
|
||||||
return ACT_NONE;
|
return ACT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Display::countEntries(File f) {
|
int Display::countEntries(File f) {
|
||||||
int pos = f.position();
|
int pos = f.position();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
String line = f.readStringUntil('\n');
|
String line = readLine(f); //f.readStringUntil('\n');
|
||||||
line.trim();
|
line.trim();
|
||||||
const char *c=line.c_str();
|
const char *c=line.c_str();
|
||||||
if(*c=='#') continue;
|
if(*c=='#') continue;
|
||||||
|
|
@ -741,7 +744,7 @@ void Display::initFromFile() {
|
||||||
while(d.available()) {
|
while(d.available()) {
|
||||||
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
String line = d.readStringUntil('\n');
|
String line = readLine(d); // d.readStringUntil('\n');
|
||||||
line.trim();
|
line.trim();
|
||||||
const char *s = line.c_str();
|
const char *s = line.c_str();
|
||||||
Serial.printf("Line: '%s'\n", s);
|
Serial.printf("Line: '%s'\n", s);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue