wave11 correction crlf

pull/495/head
Vincent 2 years ago
parent 73c62d2171
commit fa4e3ddbdf
  1. 94
      src/userinterface.cpp
  2. 17
      src/userinterface.h

@ -27,13 +27,8 @@
LOGMODULE ("ui");
CUserInterface::CUserInterface (
CMiniDexed *pMiniDexed,
CGPIOManager *pGPIOManager,
CI2CMaster *pI2CMaster,
CConfig *pConfig
) :
m_pMiniDexed (pMiniDexed),
CUserInterface::CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CI2CMaster *pI2CMaster, CConfig *pConfig)
: m_pMiniDexed (pMiniDexed),
m_pGPIOManager (pGPIOManager),
m_pI2CMaster (pI2CMaster),
m_pConfig (pConfig),
@ -236,91 +231,6 @@ void CUserInterface::DisplayWrite (const char *pMenu, const char *pParam, const
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)
{
if (m_pLCDBuffered)

@ -23,7 +23,6 @@
#include "config.h"
#include "uimenu.h"
#include "uibuttons.h"
#include <arm_math_types.h>
#include <sensor/ky040.h>
#include <display/hd44780device.h>
#include <display/ssd1306device.h>
@ -36,11 +35,7 @@ class CMiniDexed;
class CUserInterface
{
public:
CUserInterface (
CMiniDexed *pMiniDexed,
CGPIOManager *pGPIOManager,
CI2CMaster *pI2CMaster,
CConfig *pConfig);
CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CI2CMaster *pI2CMaster, CConfig *pConfig);
~CUserInterface (void);
bool Initialize (void);
@ -60,19 +55,9 @@ public:
// To be called from the MIDI device on reception of a MIDI CC message
void UIMIDICmdHandler (unsigned nMidiCh, unsigned nMidiCmd, unsigned nMidiData1, unsigned nMidiData2);
#if defined(DEBUG)
public:
void clear();
void log(const char* txt, bool clear = true);
void log(float32_t v, bool clear = true);
void log(unsigned v, bool clear = true);
void log(int v, bool clear = true);
#endif
private:
void LCDWrite (const char *pString); // Print to optional HD44780 display
private:
void EncoderEventHandler (CKY040::TEvent Event);
static void EncoderEventStub (CKY040::TEvent Event, void *pParam);
void UIButtonsEventHandler (CUIButton::BtnEvent Event);

Loading…
Cancel
Save