|
|
@ -27,13 +27,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
LOGMODULE ("ui"); |
|
|
|
LOGMODULE ("ui"); |
|
|
|
|
|
|
|
|
|
|
|
CUserInterface::CUserInterface ( |
|
|
|
CUserInterface::CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CI2CMaster *pI2CMaster, CConfig *pConfig) |
|
|
|
CMiniDexed *pMiniDexed,
|
|
|
|
: m_pMiniDexed (pMiniDexed), |
|
|
|
CGPIOManager *pGPIOManager,
|
|
|
|
|
|
|
|
CI2CMaster *pI2CMaster,
|
|
|
|
|
|
|
|
CConfig *pConfig |
|
|
|
|
|
|
|
) :
|
|
|
|
|
|
|
|
m_pMiniDexed (pMiniDexed), |
|
|
|
|
|
|
|
m_pGPIOManager (pGPIOManager), |
|
|
|
m_pGPIOManager (pGPIOManager), |
|
|
|
m_pI2CMaster (pI2CMaster), |
|
|
|
m_pI2CMaster (pI2CMaster), |
|
|
|
m_pConfig (pConfig), |
|
|
|
m_pConfig (pConfig), |
|
|
@ -236,91 +231,6 @@ void CUserInterface::DisplayWrite (const char *pMenu, const char *pParam, const |
|
|
|
LCDWrite (Msg); |
|
|
|
LCDWrite (Msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if defined(DEBUG) |
|
|
|
|
|
|
|
#include <sstream> |
|
|
|
|
|
|
|
#include <iomanip> |
|
|
|
|
|
|
|
#include <sstream> |
|
|
|
|
|
|
|
#include <cstring> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::clear() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
static size_t nbChars = this->m_pConfig->GetLCDColumns() * this->m_pConfig->GetLCDRows(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this->m_pLCDBuffered) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::string txt("\x1B[H\E[?25l"); |
|
|
|
|
|
|
|
txt.append(nbChars, ' '); |
|
|
|
|
|
|
|
txt.append("\x1B[K"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->m_pLCDBuffered->Write(txt.c_str(), txt.length()); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Update (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::log(const char* txt, bool clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (this->m_pLCDBuffered) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->m_pLCDBuffered->Write(txt, strlen(txt)); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Update (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::log(float32_t v, bool clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (this->m_pLCDBuffered) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::ostringstream ss; |
|
|
|
|
|
|
|
ss << std::fixed << std::setprecision(2) << v; |
|
|
|
|
|
|
|
std::string txt = ss.str(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->m_pLCDBuffered->Write(txt.c_str(), txt.length()); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Update (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::log(unsigned v, bool clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (this->m_pLCDBuffered) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string txt = std::to_string(v); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Write(txt.c_str(), txt.length()); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Update (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::log(int v, bool clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (this->m_pLCDBuffered) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(clear) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string txt = std::to_string(v); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Write(txt.c_str(), txt.length()); |
|
|
|
|
|
|
|
this->m_pLCDBuffered->Update (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CUserInterface::LCDWrite (const char *pString) |
|
|
|
void CUserInterface::LCDWrite (const char *pString) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_pLCDBuffered) |
|
|
|
if (m_pLCDBuffered) |
|
|
|