mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +00:00
Add boot.cmd script
This commit is contained in:
parent
beee7f5a4a
commit
dd44892c72
@ -705,27 +705,25 @@ void dispatch_exec(const char*, const char* payload, uint8_t source)
|
|||||||
|
|
||||||
// char buffer[512]; // use stack
|
// char buffer[512]; // use stack
|
||||||
String buffer((char*)0); // use heap
|
String buffer((char*)0); // use heap
|
||||||
buffer.reserve(256);
|
buffer.reserve(512);
|
||||||
|
|
||||||
ReadBufferingStream bufferedFile{cmdfile, 256};
|
ReadBufferingStream bufferedFile{cmdfile, 512};
|
||||||
cmdfile.seek(0);
|
cmdfile.seek(0);
|
||||||
|
|
||||||
while(bufferedFile.available()) {
|
while(bufferedFile.available()) {
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
buffer = "";
|
buffer = "";
|
||||||
// while(index < sizeof(buffer) - 1) {
|
|
||||||
while(index < MQTT_MAX_PACKET_SIZE) {
|
while(index < MQTT_MAX_PACKET_SIZE) {
|
||||||
int c = bufferedFile.read();
|
int c = bufferedFile.read();
|
||||||
if(c < 0 || c == '\n' || c == '\r') { // CR or LF
|
if(c < 0 || c == '\n' || c == '\r') { // CR or LF
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// buffer[index] = (char)c;
|
|
||||||
buffer += (char)c;
|
buffer += (char)c;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
// buffer[index] = 0; // terminate string
|
if(index > 0 && buffer.charAt(0) != '#') { // Check for comments
|
||||||
// if(index > 0 && buffer[0] != '#') dispatch_text_line(buffer.c_str(), TAG_FILE); // # for comments
|
dispatch_text_line(buffer.c_str(), TAG_FILE);
|
||||||
if(index > 0 && buffer.charAt(0) != '#') dispatch_text_line(buffer.c_str(), TAG_FILE); // # for comments
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdfile.close();
|
cmdfile.close();
|
||||||
|
@ -121,6 +121,7 @@ void setup()
|
|||||||
|
|
||||||
mainLastLoopTime = -1000; // reset loop counter
|
mainLastLoopTime = -1000; // reset loop counter
|
||||||
delay(20);
|
delay(20);
|
||||||
|
dispatch_exec(NULL, "/boot.cmd", TAG_HASP);
|
||||||
// guiStart();
|
// guiStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user