Skip to content

Commit de7cfb9

Browse files
authored
Merge pull request #21 from tobozo/1.4.1
1.4.1
2 parents 36db8f1 + b941da0 commit de7cfb9

File tree

11 files changed

+103
-161
lines changed

11 files changed

+103
-161
lines changed

.github/workflows/ArduinoBuild.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ jobs:
5858

5959
platform-version:
6060
# ESP32 Core versions for multidimensional matrix
61-
- 1.0.6
62-
- 2.0.0
63-
- 2.0.1
64-
- 2.0.2
65-
- 2.0.3
66-
- 2.0.4
61+
- 2.0.15
62+
- 2.0.16
63+
- 2.0.17
64+
- 3.0.0
65+
- 3.0.1
6766
- latest
6867

6968
include:
@@ -84,27 +83,9 @@ jobs:
8483
- { board: esp32s3, platform: esp32, arch: esp32, ... }
8584
- { board: esp32c3, platform: esp32, arch: esp32, ... }
8685

87-
exclude:
88-
# multidimensional matrix excludes (no support or unstable):
89-
90-
- { board: esp32s2, platform-version: 1.0.6 }
91-
- { board: esp32s2, platform-version: 2.0.0 }
92-
93-
- { board: esp32s3, platform-version: 1.0.6 }
94-
- { board: esp32s3, platform-version: 2.0.0 }
95-
- { board: esp32s3, platform-version: 2.0.1 }
96-
- { board: esp32s3, platform-version: 2.0.2 }
97-
- { board: esp32s3, platform-version: 2.0.4 }
98-
99-
- { board: esp32c3, platform-version: 1.0.6 }
100-
- { board: esp32c3, platform-version: 2.0.0 }
101-
102-
103-
104-
10586
steps:
10687
- name: Checkout
107-
uses: actions/checkout@v3
88+
uses: actions/checkout@v4
10889
with:
10990
ref: ${{ github.event.pull_request.head.sha }}
11091

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
lint:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- uses: arduino/arduino-lint-action@v1
2727
with:
2828
project-type: library

examples/ReadWriteConfigFile/ReadWriteConfigFile.ino

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#include <ArduinoJson.h>
22
#include <YAMLDuino.h>
3-
#include <M5Stack.h>
3+
4+
#if defined ARDUINO_M5Stack_Core_ESP32
5+
#include <M5Stack.h>
6+
#define FS_t fs::FS
7+
#define File_t fs::File
8+
#define delay_fn vTaskDelay
9+
#elif defined CORE_TEENSY
10+
#include <FS.h>
11+
#include <SD.h>
12+
#define FS_t FS
13+
#define File_t File
14+
#define delay_fn delay
15+
#else
16+
#error "please implement"
17+
#endif
418

519

620
const char* yaml_example_str = R"_YAML_STRING_(
@@ -31,9 +45,9 @@ DynamicJsonDocument json_doc(2048);
3145
JsonObject myConfig; // json accessor
3246

3347

34-
bool writeTestYaml( fs::FS &fs, const char* path )
48+
bool writeTestYaml( FS_t &fs, const char* path )
3549
{
36-
fs::File file = fs.open( path, FILE_WRITE );
50+
File_t file = fs.open( path, FILE_WRITE );
3751
if( !file ) {
3852
Serial.println("Can't open file for writing");
3953
return false;
@@ -47,7 +61,7 @@ bool writeTestYaml( fs::FS &fs, const char* path )
4761

4862
bool loadYamlConfig()
4963
{
50-
fs::File file = SD.open( config_file );
64+
File_t file = SD.open( config_file );
5165
if( !file ) {
5266
Serial.println("Can't open test file for writing :-(");
5367
return false;
@@ -68,7 +82,7 @@ bool loadYamlConfig()
6882

6983
bool saveYamlConfig()
7084
{
71-
fs::File file = SD.open( config_file, FILE_WRITE);
85+
File_t file = SD.open( config_file, FILE_WRITE);
7286
if( !file ) {
7387
Serial.println("Can't open file for writing");
7488
return false;
@@ -93,14 +107,22 @@ bool toggleYamlProperty()
93107

94108
void setup()
95109
{
96-
M5.begin();
110+
#if defined ARDUINO_M5Stack_Core_ESP32
111+
M5.begin();
112+
if( M5.BtnA.isPressed() ) {
113+
SD.remove( config_file );
114+
Serial.println("Deleted config file");
115+
while( M5.BtnA.isPressed() ) { M5.update(); } // wait for release
116+
ESP.restart();
117+
}
118+
#elif defined CORE_TEENSY
119+
Serial.begin(115200);
120+
SD.begin( BUILTIN_SDCARD );
121+
#else
122+
#error "please implement"
123+
#endif
124+
97125

98-
if( M5.BtnA.isPressed() ) {
99-
SD.remove( config_file );
100-
Serial.println("Deleted config file");
101-
while( M5.BtnA.isPressed() ) { M5.update(); } // wait for release
102-
ESP.restart();
103-
}
104126

105127
_load_config:
106128
config_loaded = loadYamlConfig();
@@ -109,7 +131,7 @@ void setup()
109131
Serial.printf("Ceating config file %s\n", config_file );
110132
if( !writeTestYaml( SD, config_file ) ) {
111133
Serial.println("Could not create config file, aborting");
112-
while(1) vTaskDelay(1);
134+
while(1) delay_fn(1);
113135
}
114136
// write succeeded, reload config
115137
goto _load_config;
@@ -122,12 +144,14 @@ void setup()
122144

123145
void loop()
124146
{
147+
#if defined ARDUINO_M5Stack_Core_ESP32
125148
M5.update();
126149

127150
if( M5.BtnB.wasPressed() ) {
128151
if( !toggleYamlProperty() ) {
129152
Serial.println("Failed to save property");
130153
}
131154
}
155+
#endif
132156
}
133157

examples/deserializeYml/deserializeYml.ino

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
#include <ArduinoJson.h>
44
#include <YAMLDuino.h>
55

6+
#if ARDUINOJSON_VERSION_MAJOR<7
7+
#error "ArduinoJSON version is deprecated, please upgrade to 7.x"
8+
#endif
9+
610
const char* yaml_sample_str = R"_YAML_STRING_(
711
first: true
812
blah:
913
nope: ["n","o","p","e"]
1014
integer: 12345
1115
float: 12.3323
16+
qinteger: "12345"
17+
qfloat: "12.3323"
1218
last: true
1319
1420
)_YAML_STRING_";
@@ -20,6 +26,8 @@ const char* json_sample_str = R"_JSON_STRING_(
2026
"blah": { "nope": [ "n", "o", "p", "e" ] },
2127
"integer": 12345,
2228
"float": 12.3323,
29+
"qinteger": "12345"
30+
"qfloat": "12.3323"
2331
"last": true
2432
}
2533
@@ -45,7 +53,7 @@ void test_deserializeYml_JsonObject_YamlStream()
4553
#if defined TEST_YAML_Stream_To_ArduinoJsonObject
4654
String yaml_str = String( yaml_sample_str );
4755
StringStream yaml_stream( yaml_str );
48-
StaticJsonDocument<128> json_doc;
56+
JsonDocument json_doc;
4957
JsonObject json_obj = json_doc.to<JsonObject>();
5058
auto err = deserializeYml( json_obj, yaml_stream ); // deserialize yaml stream to JsonObject
5159
if( err ) {
@@ -60,7 +68,7 @@ void test_deserializeYml_JsonObject_YamlStream()
6068
void test_deserializeYml_JsonObject_YamlString()
6169
{
6270
#if defined TEST_YAML_String_To_ArduinoJsonObject
63-
StaticJsonDocument<128> json_doc;
71+
JsonDocument json_doc;
6472
JsonObject json_obj = json_doc.to<JsonObject>();
6573
auto err = deserializeYml( json_obj, yaml_sample_str ); // deserialize yaml string to JsonObject
6674
if( err ) {
@@ -75,7 +83,7 @@ void test_deserializeYml_JsonObject_YamlString()
7583
void test_deserializeYml_JsonDocument_YamlStream()
7684
{
7785
#if defined TEST_YAML_Stream_To_ArduinoJsonDocument
78-
StaticJsonDocument<128> json_doc;
86+
JsonDocument json_doc;
7987
String yaml_str = String( yaml_sample_str );
8088
StringStream yaml_stream( yaml_str );
8189
auto err = deserializeYml( json_doc, yaml_stream ); // deserialize yaml stream to JsonDocument
@@ -92,7 +100,7 @@ void test_deserializeYml_JsonDocument_YamlString()
92100
{
93101
#if defined TEST_YAML_String_To_ArduinoJsonDocument
94102
String yaml_str( yaml_sample_str );
95-
StaticJsonDocument<128> json_doc;
103+
JsonDocument json_doc;
96104
auto err = deserializeYml( json_doc, yaml_str.c_str() ); // deserialize yaml string to JsonDocument
97105
if( err ) {
98106
Serial.printf("Unable to deserialize demo YAML to JsonObject: %s", err.c_str() );

examples/test/include/README

Lines changed: 0 additions & 39 deletions
This file was deleted.

examples/test/lib/README

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)