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

Fixed size json payload & other WS bugfixes #1843

Merged
merged 43 commits into from
Aug 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5283638
TEST-2: keep arduinojson v5, force capacity cap
mcspr Jul 30, 2019
fe83a0e
fixup webdebug buffer size
mcspr Aug 4, 2019
ed6d260
Use Core BSSID string method
mcspr Aug 4, 2019
11e65b3
refactor ws cb names, move to the loop
mcspr Aug 4, 2019
ff75e5c
Save a bit by using a single callback vector
mcspr Aug 4, 2019
6053be3
brace initializer
mcspr Aug 4, 2019
4dbdbfd
single buffer for ha device config
mcspr Aug 4, 2019
e05674c
need to forward declare ha_config_t
mcspr Aug 6, 2019
6193a10
revert ff75e5c, use avoid using cb struct directly
mcspr Aug 6, 2019
fdce9e6
group ..Visible cb data, separate magnitude config from data
mcspr Aug 6, 2019
42f409e
typo fix, generic method for tspk & dcz visibility
mcspr Aug 6, 2019
e9ca489
move back to 1 cb per loop
mcspr Aug 6, 2019
f307301
force sensor ws callback to happen before any other modules that depe…
mcspr Aug 6, 2019
564fbf5
xxx: dont need this
mcspr Aug 6, 2019
2d1deed
update webui for tests
mcspr Aug 6, 2019
de35886
properly measure json in wssend for send callbacks
mcspr Aug 6, 2019
6c80e95
fix travis
mcspr Aug 6, 2019
85fd5f2
Merge remote-tracking branch 'origin/dev' into web/fixed-size-json-v5
mcspr Aug 7, 2019
da69523
comments
mcspr Aug 9, 2019
2288537
debugsend should count 2 separate objects
mcspr Aug 9, 2019
465c9ae
payload lengths is in bytes
mcspr Aug 9, 2019
47b186b
default ctor, fix travis warnings
mcspr Aug 9, 2019
ba693a2
use new register syntax
mcspr Aug 9, 2019
8e87d04
fix warning
mcspr Aug 9, 2019
d3d8abc
send on_visible separatly
mcspr Aug 9, 2019
6823121
todo: maybe measure debug json
mcspr Aug 9, 2019
0194ff7
draft out data callback
mcspr Aug 9, 2019
474ed19
fixup! use new register syntax
mcspr Aug 9, 2019
2867765
move state management to the client class
mcspr Aug 10, 2019
a84191a
try vector-per-cb again
mcspr Aug 10, 2019
0a4bbf5
clean up ws data queue
mcspr Aug 10, 2019
4c34ca8
naming
mcspr Aug 10, 2019
6e291ea
remove wssend from rfbridge cb
mcspr Aug 10, 2019
8cc0b1f
fix queue object modification
mcspr Aug 11, 2019
0094a6d
other way around...
mcspr Aug 11, 2019
2bd213c
implement postponed wssend
mcspr Aug 11, 2019
bb30e17
use wspost for ondata callback
mcspr Aug 11, 2019
e1a6ccb
one more rfbridge unused webui action
mcspr Aug 11, 2019
0177a9c
move mqtt handlers outside of ws.ino
mcspr Aug 12, 2019
2d04b21
same ntpsynced status for now
mcspr Aug 12, 2019
111badf
update webui again
mcspr Aug 12, 2019
9162f28
more onvisible
mcspr Aug 12, 2019
c47e247
fix warnings
mcspr Aug 12, 2019
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
Prev Previous commit
Next Next commit
fixup webdebug buffer size
  • Loading branch information
mcspr committed Aug 4, 2019
commit fe83a0eb73378e3e3071d1b066a97e192aed33a7
12 changes: 9 additions & 3 deletions code/espurna/ws.ino
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ bool _wsAuth(AsyncWebSocketClient * client) {

bool wsDebugSend(const char* prefix, const char* message) {
if (!wsConnected()) return false;
if ((strlen(message) * 3) > getFreeHeap()) return false;

DynamicJsonBuffer jsonBuffer(256);
JsonObject& root = jsonBuffer.createObject();
const size_t len = strlen(message) + strlen(prefix)
+ strlen("{\"weblog\":}")
+ strlen("{\"message\":\"\"}")
+ (strlen(prefix) ? strlen("\",\"prefix\":\"\"") : 0);

// via: https://arduinojson.org/v6/assistant/
// we use 1 object for "weblog", 2nd one for "message". "prefix", optional
StaticJsonBuffer<JSON_OBJECT_SIZE(3)> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
JsonObject& weblog = root.createNestedObject("weblog");

weblog["message"] = message;
if (prefix && (prefix[0] != '\0')) {
weblog["prefix"] = prefix;
Expand Down