Added bytes alignment calculation on ESP8266
This commit is contained in:
parent
61d36940d9
commit
976095f3ef
|
@ -249,10 +249,10 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
|
||||||
// + Value + '\0'
|
// + Value + '\0'
|
||||||
size_t size ;
|
size_t size ;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
lgname = xPortWantedSizeAlign(lgname+1); // Align name buffer
|
lgname = ESP8266_allocAlign(lgname+1); // Align name buffer
|
||||||
lgvalue = xPortWantedSizeAlign(lgvalue+1); // Align value buffer
|
lgvalue = ESP8266_allocAlign(lgvalue+1); // Align value buffer
|
||||||
// Align the whole structure
|
// Align the whole structure
|
||||||
size = xPortWantedSizeAlign( sizeof(ValueList) + lgname + lgvalue ) ;
|
size = ESP8266_allocAlign( sizeof(ValueList) + lgname + lgvalue ) ;
|
||||||
#else
|
#else
|
||||||
size = sizeof(ValueList) + lgname + 1 + lgvalue + 1 ;
|
size = sizeof(ValueList) + lgname + 1 + lgvalue + 1 ;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
|
|
||||||
// Using ESP8266 ?
|
// Using ESP8266 ?
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//#include "stdlib_noniso.h"
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Define this if you want library to be verbose
|
// Define this if you want library to be verbose
|
||||||
//#define TI_DEBUG
|
//#define TI_DEBUG
|
||||||
|
|
||||||
|
@ -67,6 +67,12 @@
|
||||||
#define TI_Debugflush
|
#define TI_Debugflush
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
// For 4 bytes Aligment boundaries
|
||||||
|
#define ESP8266_allocAlign(size) ((size + 3) & ~((size_t) 3))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(push) // push current alignment to stack
|
#pragma pack(push) // push current alignment to stack
|
||||||
#pragma pack(1) // set alignment to 1 byte boundary
|
#pragma pack(1) // set alignment to 1 byte boundary
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue