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

ArduinoJson 5->7 #141

Merged
merged 2 commits into from
Nov 29, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ DEVICE_DEBUG ; Validate fields are mapped to response object ( rtl_433
MEMORY_DEBUG ; display heap usage information
RESOURCE_DEBUG : Monitor HEAP and STACK usage and report large jumps
MY_DEVICES ; Only include my personal subset of devices
NO_DEAF_WORKAROUND ; Workaround for issue #16 ( by default the workaround is enabaled )
NO_DEAF_WORKAROUND ; Workaround for issue #16 ( by default the workaround is enabled )
PUBLISH_UNPARSED ; Enable publishing of MQTT messages for unparsed signals, e.g. {model":"unknown","protocol":"signal parsing failed"…
RAW_SIGNAL_DEBUG ; display raw received messages
RSSI_SAMPLES ; Number of rssi samples to collect for average calculation, defaults to 50,000
Expand Down
13 changes: 7 additions & 6 deletions example/OOK_Receiver/OOK_Receiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ rtl_433_ESP rf; // use -1 to disable transmitter
int count = 0;

void rtl_433_Callback(char* message) {
DynamicJsonBuffer jsonBuffer2(JSON_MSG_BUFFER);
JsonObject& RFrtl_433_ESPdata = jsonBuffer2.parseObject(message);
logJson(RFrtl_433_ESPdata);
JsonDocument jsonDocument;
deserializeJson(jsonDocument,message);
logJson(jsonDocument);
count++;
}

void logJson(JsonObject& jsondata) {
void logJson(JsonDocument jsondata) {
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
char JSONmessageBuffer[jsondata.measureLength() + 1];
char JSONmessageBuffer[measureJson(jsondata) + 1];
serializeJson(jsondata, JSONmessageBuffer, measureJson(jsondata) + 1);
#else
char JSONmessageBuffer[JSON_MSG_BUFFER];
serializeJson(jsondata, JSONmessageBuffer, JSON_MSG_BUFFER);
#endif
jsondata.printTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
#if defined(setBitrate) || defined(setFreqDev) || defined(setRxBW)
Log.setShowLevel(false);
Log.notice(F("."));
Expand Down
6 changes: 5 additions & 1 deletion example/OOK_Receiver/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ src_dir = .

[libraries]
arduinolog = https://github.com/1technophile/Arduino-Log.git#d13cd80
arduinojson = ArduinoJson@5.13.4
arduinojson =
ArduinoJson
; ArduinoJson @ 7.0.4
; ArduinoJson @ 6.21.5
; ArduinoJson @ 5.13.4 ; deprecated
rtl_433_ESP = symlink://../../../rtl_433_ESP ; Builds library from source directory

[env]
Expand Down