threads: add logging

This commit is contained in:
Vasily Davydov
2023-05-12 00:57:55 +03:00
parent 90656fae95
commit 1a4c09c4ad
6 changed files with 45 additions and 6 deletions

View File

@@ -5,16 +5,19 @@
*/
#include "UserInterface.h"
#include "Log.h"
#include <cstring>
UserInterface::UserInterface(ThreadCommon::QueueManager* qm) :
_qm(qm), lcd1(nullptr)
{
LOG_DEBUG("Creating UserInterface");
this->initLCD1();
}
UserInterface::~UserInterface()
{
LOG_ERROR("Deleting UserInterface");
delete this->lcd1;
delete this->lcd1_rs;
delete this->lcd1_en;
@@ -45,7 +48,7 @@ void UserInterface::handleEvent(InterfaceWithData* ui_data)
break;
default:
//Should never happen.
printf("WARNING: [UserInterface::handleEvent] executed default case.\n");
LOG_ERROR("[UserInterface::handleEvent] executed default case");
break;
}
}
@@ -59,11 +62,13 @@ void UserInterface::handleLCD(LiquidCrystal *lcd, const char *str)
//Interpret empty string as clear.
if(!strlen(str))
lcd->clear();
LOG_INFO("Clear up LCD");
//Print the text otherwise.
else
{
lcd->setCursor(0, 0);
lcd->print(str);
LOG_INFO("Printing [%s] on LCD");
}
}