Comments (2)
Hi @DWilhelmLKKS,
I was about to tell you the same thing :-)
Indeed, printf()
is a legacy of the C language and knows nothing about String
and classes in general.
I don't know why they decided to integrate it into ESP32's core.
BTW, it was accidentally working with strings of 13 characters or less because of the short-string optimization (SSO) implemented in ESP32's String
:
struct _ptr {
char * buff;
uint32_t cap;
uint32_t len;
};
enum { SSOSIZE = sizeof(struct _ptr) + 4 - 1 };
struct _sso {
char buff[SSOSIZE];
unsigned char len : 7;
unsigned char isSSO: 1;
};
This gives an SSOSIZE
of 12 + 4 - 1 = 15
, enough room for 14 characters and the terminator.
So, in theory, 14-character strings should have worked too, but there is an off-by-one error in the length comparison that decides whether to use SSO or not:
if (maxStrLen < sizeof(sso.buff) - 1)
It should be <=
instead of <
; that's why SSO doesn't work with 14-character strings.
Best regard,
Benoit
from arduinojson.
I found the solution! It had nothing to do with ArduinoJson. :)
Using this code fixed it:
Serial.printf("%s / %s / %s\n", remotesList[i-1].link.c_str(), remotesList[i-1].manufacturer.c_str(), remotesList[i-1].serial.c_str());
from arduinojson.
Related Issues (20)
- How do i create JSON array of objects using ArduinoJson library. HOT 1
- Identifying JsonVariant type of a deserialized document HOT 4
- Example code results in compiler error: no match for 'operator+=' HOT 3
- Passing JsonDocument by reference HOT 4
- In Memory Deserialization HOT 4
- v7 equivalent of validateJson HOT 2
- conversion from ‘ArduinoJson::V704HB42::detail::enable_if<true, ArduinoJson::V704HB42::JsonVariantConst>::type’ {aka ‘ArduinoJson::V704HB42::JsonVariantConst’} to ‘ArduinoJson::V704HB42::JsonDocument’ is ambiguous HOT 1
- Assertion `poolIndex < count_' failed HOT 1
- V6 Documentation ArduinoJson PubSubClient with StreamUtils HOT 1
- deserialize file from LittleFS crash HOT 6
- Trying to compile a 2021 program HOT 2
- Bring back zero-copy mode in v7 HOT 6
- MQTT Publish destroying Json HOT 2
- Error compiling example code SimpleParser on Arduino Web Editor NodeMCU 0.9 HOT 1
- JSON output is truncated. HOT 1
- load an object into an absolute memory address, Cortex-M. HOT 4
- Cannot compile code that compiled last time it was used HOT 1
- There is a memory leak either in this library or in ESP32 LittleFS HOT 19
- Lint error ovl_no_viable_subscript has occured HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinojson.