Skip to content

Commit abeb59d

Browse files
authored
Merge pull request #1 from tobozo/1.2.1
misc fixes
2 parents aa51e15 + dadaebf commit abeb59d

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

examples/test/test.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <ArduinoJson.h> // optional
22
//#include <cJSON.h> // implicit with esp32, otherwise optional
3-
#include <ArduinoYaml.h>
3+
#include <YAMLDuino.h>
44

55

66
// sorry about the notation, but it looks nicer than chunk-splitting+quoting
@@ -77,8 +77,8 @@ void setup()
7777
YAMLParser::setLogLevel( YAML::LogLevelDebug ); // override sketch debug level (otherwise inherited)
7878

7979

80-
#if __has_include(<ArduinoJson.h>)
81-
80+
#if defined HAS_ARDUINOJSON
81+
#pragma message "Enabling ArduinoJson tests"
8282

8383
YAML_LOG_n("YAML=>JSON and JSON=>YAML using ArduinoJson\n\n");
8484

@@ -153,6 +153,7 @@ void setup()
153153

154154

155155
#if defined USE_STREAM_TO_STREAM // stream to stream unavailable on esp8266 (not enough memory)
156+
#pragma message "Enabling ArduinoJson stream<=>stream tests"
156157
{
157158
YAML_LOG_n( "[TEST #%d] JSON stream to JsonObject to YAML stream -> serializeYml(stream_in, Serial):", test_number++ );
158159
String str_json = String( json_example_str );
@@ -171,6 +172,7 @@ void setup()
171172

172173

173174
#if __has_include(<cJSON.h>)
175+
#pragma message "Enabling cJSON tests"
174176

175177

176178

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name=YAMLDuino
2-
version=1.2.0
2+
version=1.2.1
33
author=tobozo <[email protected]>
44
maintainer=tobozo <[email protected]>
55
sentence=A simple and efficient YAML library for embedded C++
6-
paragraph=ArduinoYaml is syntax friendly with ArduinoJson and cJSON, supports ✔ serialization, ✔ deserialization
6+
paragraph=ArduinoYaml is syntax friendly with ArduinoJson and cJSON, supports ✔ serialization, ✔ deserialization, ✔ conversion
77
category=Data Processing
8-
url=https://github.com/tobozo/esp32-yaml
8+
url=https://github.com/tobozo/YAMLDuino
99
architectures=esp32,esp8266,samd,rp2040,mbed_rp2040,mbed_nano
1010
includes=ArduinoYaml.h,YAMLDuino.h
1111
license=MIT

src/ArduinoYaml.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ void YAMLParser::handle_emitter_error(yaml_emitter_t *e)
216216

217217

218218

219-
#if __has_include(<ArduinoJson.h>)
220-
219+
#if defined HAS_ARDUINOJSON
221220

222221
// yaml_node_t deconstructor => JsonObject
223222
void deserializeYml_JsonObject( yaml_document_t* document, yaml_node_t* yamlNode, JsonObject &jsonNode, YAMLParser::JNestingType_t nt, const char *nodename, int depth )

src/ArduinoYaml.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ extern "C" {
4141

4242
#if defined ARDUINO_ARCH_SAMD || defined ARDUINO_ARCH_RP2040 || defined ESP8266
4343
#include <Arduino.h>
44+
#include <ArduinoJson.h>
4445
#include <assert.h>
4546
#undef USE_STREAM_TO_STREAM
47+
#define HAS_ARDUINOJSON
48+
#endif
49+
50+
#if !defined HAS_ARDUINOJSON && __has_include(<Arduino.h>)
51+
#define HAS_ARDUINOJSON
4652
#endif
4753

4854

@@ -57,7 +63,6 @@ class StringStream : public Stream
5763
virtual size_t write(uint8_t c) { str += (char)c; return 1; }
5864
private:
5965
String &str;
60-
//unsigned int length = 0;
6166
unsigned int pos;
6267
};
6368

@@ -93,7 +98,7 @@ class YAMLParser
9398

9499

95100

96-
#if __has_include(<ArduinoJson.h>)
101+
#if defined HAS_ARDUINOJSON
97102

98103
#include <ArduinoJson.h>
99104

0 commit comments

Comments
 (0)