JSON RAM optimization (update libs needed), HTTP

This commit is contained in:
Климов Андрей Николаевич
2023-04-09 21:37:37 +03:00
parent ec306c4934
commit bab472d2d1
11 changed files with 118 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -59,8 +59,8 @@ PING -n %WAIT_ERASED% 127.0.0.1>NUL
REM Execute bossac.exe REM Execute bossac.exe
ECHO Execute bossac with command line: ECHO Execute bossac with command line:
ECHO "%BOSSACPATH%" -i -d --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -u -w -v -b "%BINFILE%" -R
START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R REM START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R
GOTO end GOTO end

View File

@@ -0,0 +1,91 @@
@ECHO off
REM Wait X second for memory on Arduino Due is erased.
SET WAIT_ERASED=4
ECHO ------ External tool BossacArduinoDue started ------
REM number of command line arguments ok?
REM IF [%1]==[] GOTO error_args
REM IF [%2]==[] GOTO error_args
REM set command line arguments
SET BOSSACPATH=..\tools\win\tool-bossac\bossac.exe
SET BINFILE=firmware.bin
REM parse command line arguments
SET BOSSACPATH=%BOSSACPATH:"=%
SET BINFILE=%BINFILE:"=%
REM workeround for bug in Atmel Studio 6.0.1996 Service Pack 2
SET BINFILE=%BINFILE:\\=\%
SET BINFILE=%BINFILE:.cproj=%
REM bossac path exist?
IF NOT EXIST "%BOSSACPATH%" GOTO error_arg1
REM bin file exist?
IF NOT EXIST "%BINFILE%" GOTO error_binfile
REM fetch DeviceID of Arduino Due Programming Port from WMI Service
FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%BOSSA%%'" get DeviceID') DO (
SET COMX=%%a
GOTO exit1
)
REM Arduino Due Programming Port not exist
GOTO error_comport
:exit1
REM remove blank
SET COMPORT=%COMX: =%
REM report in Atmel Studio 6.0 IDE output window
ECHO BossacPath=%BOSSACPATH%
ECHO BinFile=%BINFILE%
ECHO Arduino Due Programming Port is detected as %COMPORT%.
REM The bossac bootloader only runs if the memory on Arduino Due is erased.
REM The Arduino IDE does this by opening and closing the COM port at 1200 baud.
REM This causes the Due to execute a soft erase command.
ECHO Forcing reset using 1200bps open/close on port
ECHO MODE %COMPORT%:1200,N,8,1
MODE %COMPORT%:1200,N,8,1
REM Wait X second for memory on Arduino Due is erased.
ECHO Wait for memory on Arduino Due is erased...
PING -n %WAIT_ERASED% 127.0.0.1>NUL
REM Execute bossac.exe
ECHO Execute bossac with command line:
"%BOSSACPATH%" -i --port=%COMPORT% -u -e -w -v -b "%BINFILE%" -R
REM START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -u -e -w -v -b "%BINFILE%" -R
GOTO end
:error_args
ECHO Error: wrong number of command line arguments passed!
GOTO end
:error_arg1
ECHO Error: command line argument 1 - path to bossac.exe not exist! - "C:\Program Files (x86)\arduino-1.5.2\hardware\tools\bossac.exe"
ECHO Error: command line argument 1 - argument passed = %1
GOTO end
:error_arg2
ECHO Error: command line argument 2 - path to bin file not exist! - use $(OutputDirectory)\$(OutputFileName).bin
ECHO Error: command line argument 2 - argument passed = %1
GOTO end
:error_binfile
ECHO Error: bin file "%BINFILE%" not exist!
GOTO end
:error_comport
ECHO Error: Arduino Due Programming Port not found!
:end
ECHO ======================== Done ========================

Binary file not shown.

View File

@@ -248,7 +248,7 @@ NRFFlashStorage EEPROM;
return 1; return 1;
#endif #endif
}; };
/*
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
size_t flashStream::write(const uint8_t *buffer, size_t size) size_t flashStream::write(const uint8_t *buffer, size_t size)
{ {
@@ -258,7 +258,7 @@ NRFFlashStorage EEPROM;
}; };
#endif #endif
*/
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
void flashStream::putEOF() void flashStream::putEOF()
{ {
@@ -269,7 +269,11 @@ NRFFlashStorage EEPROM;
void flashStream::close() void flashStream::close()
{ {
if (openmode == 'w') putEOF(); if (openmode == 'w')
{
putEOF();
debugSerial<<F("EOF")<<endl;
}
#if defined(__SAM3X8E__) #if defined(__SAM3X8E__)
if (samBufferPos) flush(); if (samBufferPos) flush();
#endif #endif

View File

@@ -67,11 +67,11 @@ public:
virtual void flush(); virtual void flush();
virtual size_t write(uint8_t ch) ; virtual size_t write(uint8_t ch) ;
#if defined(__SAM3X8E__) //#if defined(__SAM3X8E__)
virtual size_t write(const uint8_t *buffer, size_t size) override; //virtual size_t write(const uint8_t *buffer, size_t size) override;
#else //#else
using Print::write;//(const uint8_t *buffer, size_t size); using Print::write;//(const uint8_t *buffer, size_t size);
#endif //#endif
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
virtual void putEOF() override ; virtual void putEOF() override ;

View File

@@ -4,6 +4,7 @@
#include "Streaming.h" #include "Streaming.h"
#include "item.h" #include "item.h"
#include "bright.h" #include "bright.h"
#include <utility/stringbuffer.h>>
#ifndef HSV_DISABLE #ifndef HSV_DISABLE
#ifdef ADAFRUIT_LED #ifdef ADAFRUIT_LED
@@ -1170,7 +1171,7 @@ return false;
int cmd = txt2cmd(verb->valuestring); int cmd = txt2cmd(verb->valuestring);
if (cmd>0) if (cmd>0)
{ {
free(verb->valuestring); freeString(verb->valuestring);
verb->valueint=cmd; verb->valueint=cmd;
verb->type=aJson_Int; verb->type=aJson_Int;
return verb->valueint; return verb->valueint;

View File

@@ -1510,6 +1510,7 @@ int loadConfigFromEEPROM()
#endif #endif
if (sysConfStream.peek() == '{') { if (sysConfStream.peek() == '{') {
debugSerial<<F("Trying Load from EEPROM")<<endl;
aJsonStream as = aJsonStream(&sysConfStream); aJsonStream as = aJsonStream(&sysConfStream);
cleanConf(); cleanConf();
root = aJson.parse(&as); root = aJson.parse(&as);

View File

@@ -8,6 +8,11 @@
#include "textconst.h" #include "textconst.h"
#include "main.h" #include "main.h"
#include "config.h"
#include "streamlog.h"
extern systemConfig sysConf;
extern bool disableCMD;
#ifndef AC_Serial #ifndef AC_Serial
#define AC_Serial Serial3 #define AC_Serial Serial3
#endif #endif
@@ -237,6 +242,12 @@ debugSerial<<F("AC Init: ")<<portNum<<endl;
if (!portNum)// && (g_APinDescription[0].ulPinType == PIO_PA8A_URXD)) if (!portNum)// && (g_APinDescription[0].ulPinType == PIO_PA8A_URXD))
{ {
pinMode(0, INPUT_PULLUP); pinMode(0, INPUT_PULLUP);
#if debugSerial == Serial
infoSerial<<F("Serial used by AC - disabling serial logging and cmd")<<
sysConf.setSerialDebuglevel(0);
serialDebugLevel = 0;
disableCMD=true;
#endif
} }
ACSerial->begin(9600); ACSerial->begin(9600);
item->itemArr->subtype = CST_INITIALIZED; item->itemArr->subtype = CST_INITIALIZED;