From 034319ed6765b1ba659d8b08484bc26b6aff51e1 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Fri, 8 Oct 2021 01:44:12 +0300 Subject: [PATCH] conf save fixed, group chann polling. tested --- lighthub/config.cpp | 5 +---- lighthub/flashstream.cpp | 5 ++--- lighthub/main.cpp | 16 ++++++++-------- lighthub/options.h | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) 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<