Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4.1 #21

Merged
merged 6 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 6 additions & 25 deletions .github/workflows/ArduinoBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ jobs:

platform-version:
# ESP32 Core versions for multidimensional matrix
- 1.0.6
- 2.0.0
- 2.0.1
- 2.0.2
- 2.0.3
- 2.0.4
- 2.0.15
- 2.0.16
- 2.0.17
- 3.0.0
- 3.0.1
- latest

include:
Expand All @@ -84,27 +83,9 @@ jobs:
- { board: esp32s3, platform: esp32, arch: esp32, ... }
- { board: esp32c3, platform: esp32, arch: esp32, ... }

exclude:
# multidimensional matrix excludes (no support or unstable):

- { board: esp32s2, platform-version: 1.0.6 }
- { board: esp32s2, platform-version: 2.0.0 }

- { board: esp32s3, platform-version: 1.0.6 }
- { board: esp32s3, platform-version: 2.0.0 }
- { board: esp32s3, platform-version: 2.0.1 }
- { board: esp32s3, platform-version: 2.0.2 }
- { board: esp32s3, platform-version: 2.0.4 }

- { board: esp32c3, platform-version: 1.0.6 }
- { board: esp32c3, platform-version: 2.0.0 }




steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
with:
project-type: library
Expand Down
50 changes: 37 additions & 13 deletions examples/ReadWriteConfigFile/ReadWriteConfigFile.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#include <ArduinoJson.h>
#include <YAMLDuino.h>
#include <M5Stack.h>

#if defined ARDUINO_M5Stack_Core_ESP32
#include <M5Stack.h>
#define FS_t fs::FS
#define File_t fs::File
#define delay_fn vTaskDelay
#elif defined CORE_TEENSY
#include <FS.h>
#include <SD.h>
#define FS_t FS
#define File_t File
#define delay_fn delay
#else
#error "please implement"
#endif


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


bool writeTestYaml( fs::FS &fs, const char* path )
bool writeTestYaml( FS_t &fs, const char* path )
{
fs::File file = fs.open( path, FILE_WRITE );
File_t file = fs.open( path, FILE_WRITE );
if( !file ) {
Serial.println("Can't open file for writing");
return false;
Expand All @@ -47,7 +61,7 @@ bool writeTestYaml( fs::FS &fs, const char* path )

bool loadYamlConfig()
{
fs::File file = SD.open( config_file );
File_t file = SD.open( config_file );
if( !file ) {
Serial.println("Can't open test file for writing :-(");
return false;
Expand All @@ -68,7 +82,7 @@ bool loadYamlConfig()

bool saveYamlConfig()
{
fs::File file = SD.open( config_file, FILE_WRITE);
File_t file = SD.open( config_file, FILE_WRITE);
if( !file ) {
Serial.println("Can't open file for writing");
return false;
Expand All @@ -93,14 +107,22 @@ bool toggleYamlProperty()

void setup()
{
M5.begin();
#if defined ARDUINO_M5Stack_Core_ESP32
M5.begin();
if( M5.BtnA.isPressed() ) {
SD.remove( config_file );
Serial.println("Deleted config file");
while( M5.BtnA.isPressed() ) { M5.update(); } // wait for release
ESP.restart();
}
#elif defined CORE_TEENSY
Serial.begin(115200);
SD.begin( BUILTIN_SDCARD );
#else
#error "please implement"
#endif


if( M5.BtnA.isPressed() ) {
SD.remove( config_file );
Serial.println("Deleted config file");
while( M5.BtnA.isPressed() ) { M5.update(); } // wait for release
ESP.restart();
}

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

void loop()
{
#if defined ARDUINO_M5Stack_Core_ESP32
M5.update();

if( M5.BtnB.wasPressed() ) {
if( !toggleYamlProperty() ) {
Serial.println("Failed to save property");
}
}
#endif
}

16 changes: 12 additions & 4 deletions examples/deserializeYml/deserializeYml.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
#include <ArduinoJson.h>
#include <YAMLDuino.h>

#if ARDUINOJSON_VERSION_MAJOR<7
#error "ArduinoJSON version is deprecated, please upgrade to 7.x"
#endif

const char* yaml_sample_str = R"_YAML_STRING_(
first: true
blah:
nope: ["n","o","p","e"]
integer: 12345
float: 12.3323
qinteger: "12345"
qfloat: "12.3323"
last: true

)_YAML_STRING_";
Expand All @@ -20,6 +26,8 @@ const char* json_sample_str = R"_JSON_STRING_(
"blah": { "nope": [ "n", "o", "p", "e" ] },
"integer": 12345,
"float": 12.3323,
"qinteger": "12345"
"qfloat": "12.3323"
"last": true
}

Expand All @@ -45,7 +53,7 @@ void test_deserializeYml_JsonObject_YamlStream()
#if defined TEST_YAML_Stream_To_ArduinoJsonObject
String yaml_str = String( yaml_sample_str );
StringStream yaml_stream( yaml_str );
StaticJsonDocument<128> json_doc;
JsonDocument json_doc;
JsonObject json_obj = json_doc.to<JsonObject>();
auto err = deserializeYml( json_obj, yaml_stream ); // deserialize yaml stream to JsonObject
if( err ) {
Expand All @@ -60,7 +68,7 @@ void test_deserializeYml_JsonObject_YamlStream()
void test_deserializeYml_JsonObject_YamlString()
{
#if defined TEST_YAML_String_To_ArduinoJsonObject
StaticJsonDocument<128> json_doc;
JsonDocument json_doc;
JsonObject json_obj = json_doc.to<JsonObject>();
auto err = deserializeYml( json_obj, yaml_sample_str ); // deserialize yaml string to JsonObject
if( err ) {
Expand All @@ -75,7 +83,7 @@ void test_deserializeYml_JsonObject_YamlString()
void test_deserializeYml_JsonDocument_YamlStream()
{
#if defined TEST_YAML_Stream_To_ArduinoJsonDocument
StaticJsonDocument<128> json_doc;
JsonDocument json_doc;
String yaml_str = String( yaml_sample_str );
StringStream yaml_stream( yaml_str );
auto err = deserializeYml( json_doc, yaml_stream ); // deserialize yaml stream to JsonDocument
Expand All @@ -92,7 +100,7 @@ void test_deserializeYml_JsonDocument_YamlString()
{
#if defined TEST_YAML_String_To_ArduinoJsonDocument
String yaml_str( yaml_sample_str );
StaticJsonDocument<128> json_doc;
JsonDocument json_doc;
auto err = deserializeYml( json_doc, yaml_str.c_str() ); // deserialize yaml string to JsonDocument
if( err ) {
Serial.printf("Unable to deserialize demo YAML to JsonObject: %s", err.c_str() );
Expand Down
39 changes: 0 additions & 39 deletions examples/test/include/README

This file was deleted.

46 changes: 0 additions & 46 deletions examples/test/lib/README

This file was deleted.

Loading
Loading