1
0

More documentation cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-11-03 12:00:05 +00:00
parent b8eccbe162
commit 737e3b8225
6 changed files with 45 additions and 130 deletions

View File

@ -12,8 +12,8 @@ bool CommandHandler::parseJSON(const char *cmd)
{
Serial.print("Handling: ");
Serial.println(cmd);
StaticJsonDocument<32> doc;
DeserializationError error = deserializeJson(doc, cmd);
StaticJsonDocument<32> json;
DeserializationError error = deserializeJson(json, cmd);
// Test if parsing succeeds.
if (error)
@ -23,12 +23,12 @@ bool CommandHandler::parseJSON(const char *cmd)
return false;
}
const char *command = doc["cmd"];
if (strcmp("write", command) == 0 && doc["text"].is<const char*>() && doc["x"].is<int>() && doc["y"].is<int>())
const char *command = json["cmd"];
if (strcmp("write", command) == 0 && json["text"].is<const char*>() && json["x"].is<int>() && json["y"].is<int>())
{
const char *text = doc["text"];
int x = doc["x"];
int y = doc["y"];
const char *text = json["text"];
int x = json["x"];
int y = json["y"];
this->debugWrite(x, y, text);
this->display->write(x, y, text);
@ -42,8 +42,9 @@ bool CommandHandler::parseJSON(const char *cmd)
if (strcmp("offset", command) == 0)
{
int x = doc["x"];
int y = doc["y"];
int x = json["x"];
int y = json["y"];
debugWrite(x,y,"offset unhandled");
//this->display->setOffset(x, y);
}