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