diff --git a/lighthub/config.cpp b/lighthub/config.cpp index a6645a4..5ca8655 100644 --- a/lighthub/config.cpp +++ b/lighthub/config.cpp @@ -58,10 +58,7 @@ bool systemConfig::isValidSysConf() stream->seek(offsetof(systemConfigData,MQTTpwd)); short bytes=stream->readBytesUntil(0,buffer,bufLen-1); stream->close(); - Serial.println("valid"); - Serial.println(offsetof(systemConfigData,MQTTpwd)); - Serial.println(bytes); - Serial.write(buffer,bytes); + if (bytes) { buffer[bytes]=0; diff --git a/lighthub/flashstream.cpp b/lighthub/flashstream.cpp index 907e834..e87f6db 100644 --- a/lighthub/flashstream.cpp +++ b/lighthub/flashstream.cpp @@ -121,7 +121,7 @@ NRFFlashStorage EEPROM; switch (fileNum) { case FN_CONFIG_JSON: pos = 0; - //streamSize = _size; + streamSize = MAX_JSON_CONF_SIZE; startPos = EEPROM_offsetJSON; textMode = true; contentType = HTTP_TEXT_JSON; @@ -204,7 +204,6 @@ NRFFlashStorage EEPROM; #if defined(__SAM3X8E__) size_t flashStream::write(const uint8_t *buffer, size_t size) { - //debugSerial<<("Write from:")<1) aJsonStringStream stringStream(NULL, outBuf, MAX_JSON_CONF_SIZE); aJson.print(root, &stringStream); int len = strlen(outBuf); - outBuf[len++]= 255; - //JSONStream.seek(); + outBuf[len++]= EOFchar; + size_t res = sysConfStream.write((byte*) outBuf,len); free (outBuf); infoSerial<