Skip to content

Commit

Permalink
console api_data
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Nov 14, 2023
1 parent fae876d commit 50590f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,14 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
if (return_code == CommandRet::OK && json.size()) {
if (json.containsKey("api_data")) {
JsonVariant data = json["api_data"];
shell.println(data.as<const char *>());
if (data.is<int>()) {
shell.printfln("%d", data.as<int>());
} else if (data.is<float>()) {
char s[10];
shell.println(Helpers::render_value(s, data.as<float>(), 1));
} else {
shell.println(data.as<const char *>());
}
return;
}
serializeJsonPretty(doc, shell);
Expand Down

0 comments on commit 50590f4

Please sign in to comment.