diff --git a/compiled/due/upload.sh b/compiled/due/upload.sh new file mode 100755 index 0000000..e7d678a --- /dev/null +++ b/compiled/due/upload.sh @@ -0,0 +1,3 @@ +export PORT=cu.usbmodem14201 +echo . | stty -f /dev/$PORT speed 1200 +../tools/mac/tool-bossac/bossac -U false -p $PORT -i -e -w -v -b firmware.bin -R \ No newline at end of file diff --git a/lighthub/config.cpp b/lighthub/config.cpp index a801d66..a29c700 100644 --- a/lighthub/config.cpp +++ b/lighthub/config.cpp @@ -1,6 +1,7 @@ #include "config.h" #include "main.h" + String systemConfig::getMACString() { String res; @@ -293,11 +294,40 @@ return false; String systemConfig::getETAG() { -return "123"; +debugSerial<=0) && (lastPos>0)) currentConfigETAG=etag.substring(firstPos+1,lastPos); + else currentConfigETAG=etag; +debugSerial<=sizeof(systemConfigData::ETAG))) return false; + openStream('r'); + stream->seek(offsetof(systemConfigData,ETAG)); + stream->print(currentConfigETAG); + int bytes = stream->write((uint8_t)'\0'); + stream->close(); + if (bytes) debugSerial<seek(offsetof(systemConfigData,ETAG)); + currentConfigETAG=stream->readStringUntil(0); + stream->close(); + debugSerial<1) sysConfStream.close(); infoSerial<1) infoSerial<=HAVE_IP_ADDRESS) +{ +configOk=false; +lanStatus=LIBS_INITIALIZED; +return 200; +} +errorSerial<1) // Not Loaded if (configLoaded) lanStatus =IP_READY_CONFIG_LOADED_CONNECTING_TO_BROKER; else lanStatus = READ_RE_CONFIG; - return 500; + return 500; */ } void printBool(bool arg) { (arg) ? infoSerial< 1) { - strncpy(configServer, args[1], sizeof(configServer) - 1); - sysConf.setServer(configServer); - //saveFlash(OFFSET_CONFIGSERVER, configServer); - infoSerial< 0) { - infoSerial.printf("[HTTP] GET... code: %d\n", httpResponseCode); - if (httpResponseCode == HTTP_CODE_OK) { - String response = httpClient.getString(); - - httpClient.end(); - - debugSerial< 0) { + infoSerial.printf("[HTTP] GET... code: %d\n", responseStatusCode); + if (responseStatusCode == HTTP_CODE_OK) + { + WiFiClient * stream = httpClient.getStreamPtr(); + if (stream) + { + aJsonStream socketStream = aJsonStream(stream); + sysConf.setETAG(httpClient.header("ETag")); + //String response = httpClient.getString(); + //debugSerial<