diff options
-rw-r--r-- | docs/DRIVER.noritake800 | 4 | ||||
-rw-r--r-- | glcddrivers/noritake800.c | 49 | ||||
-rw-r--r-- | glcddrivers/noritake800.h | 2 | ||||
-rw-r--r-- | graphlcd.conf | 6 |
4 files changed, 31 insertions, 30 deletions
diff --git a/docs/DRIVER.noritake800 b/docs/DRIVER.noritake800 index 1962900..410d999 100644 --- a/docs/DRIVER.noritake800 +++ b/docs/DRIVER.noritake800 @@ -93,7 +93,7 @@ Brightness Possible values: 0 <= x <= 100) Default value: 100 -AdjustTiming ---> not used in this driver (if there are problems, please report) +AdjustTiming To get a timing that is as accurate as possible, the drivers measure the time for port commands (see: benchmark in syslog). You might decrease or increase the time to wait after port commands with this @@ -101,7 +101,7 @@ AdjustTiming ---> not used in this driver (if there are problems, please report) Possible values: -50 <= x <= 50 Default value: 0 -RefreshDisplay ---> not used in this driver (if there are problems, please report) +RefreshDisplay Normally, most of the drivers do not update the whole display, but only the areas that have changed since last update. So it might be, that some faulty pixels would stay a longer time. To avoid this, the diff --git a/glcddrivers/noritake800.c b/glcddrivers/noritake800.c index 5a386a5..b1c5718 100644 --- a/glcddrivers/noritake800.c +++ b/glcddrivers/noritake800.c @@ -27,7 +27,7 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2004 - 2011 Lucian Muresan <lucianm AT users.sourceforge.net> */ #include <errno.h> @@ -270,19 +270,18 @@ int cDriverNoritake800::Init() m_pport->Claim(); syslog(LOG_DEBUG, "%s: benchmark started.\n", m_Config->name.c_str()); gettimeofday(&tv1, 0); - int nBenchFactor = 100000; - for (x = 0; x < nBenchFactor; x++) + int nBenchIterations = 10000; + for (x = 0; x < nBenchIterations; x++) { m_pport->WriteData(x % 0x100); } gettimeofday(&tv2, 0); nSleepDeInit(); - //m_nTimingAdjustCmd = ((tv2.tv_sec - tv1.tv_sec) * 10000 + (tv2.tv_usec - tv1.tv_usec)) / 1000; - m_nTimingAdjustCmd = long(double((tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec)) / double(nBenchFactor)); + // calculate port command duration in nanoseconds + m_nTimingAdjustCmd = long(double((tv2.tv_sec - tv1.tv_sec) * 1000000000 + (tv2.tv_usec - tv1.tv_usec) * 1000) / double(nBenchIterations)); syslog(LOG_DEBUG, "%s: benchmark stopped. Time for Port Command: %ldns\n", m_Config->name.c_str(), m_nTimingAdjustCmd); m_pport->Release(); - // initialize display N800Cmd(Init800A); @@ -326,31 +325,34 @@ int cDriverNoritake800::Init() void cDriverNoritake800::Refresh(bool refreshAll) { - // - // for VFD displays, we can safely ignore refreshAll, as they are "sticky" - // int xb, yb; if (CheckSetup() > 0) - refreshAll = true; // we don't use it + refreshAll = true; if (!m_pVFDMem || !m_pDrawMem) return; -// // just refresh if the time needed between refreshes is up -// m_nRefreshCounter = (m_nRefreshCounter + 1) % m_Config->refreshDisplay; -// if(!m_nRefreshCounter) -// { + if (m_Config->refreshDisplay > 0) + { + m_nRefreshCounter = (m_nRefreshCounter + 1) % m_Config->refreshDisplay; + if (m_nRefreshCounter == 0) + refreshAll = true; + } + m_pport->Claim(); for (xb = 0; xb < width; ++xb) { for (yb = 0; yb < m_iSizeYb; ++yb) { - if (m_pVFDMem[xb][yb] != m_pDrawMem[xb][yb]) + // if differenet or explicitly refresh all + if ( m_pVFDMem[xb][yb] != m_pDrawMem[xb][yb] || + refreshAll ) { m_pVFDMem[xb][yb] = m_pDrawMem[xb][yb]; - // reset RefreshCounter - m_nRefreshCounter = 0; + // reset RefreshCounter if doing a full refresh + if (refreshAll) + m_nRefreshCounter = 0; // actually write to display N800WriteByte( (m_pVFDMem[xb][yb]) ^ ((m_Config->invert != 0) ? 0xff : 0x00), @@ -361,7 +363,6 @@ void cDriverNoritake800::Refresh(bool refreshAll) } } m_pport->Release(); -// } } void cDriverNoritake800::N800Cmd(unsigned char data) @@ -373,13 +374,13 @@ void cDriverNoritake800::N800Cmd(unsigned char data) m_pport->WriteControl(m_pWiringMaskCache[0x00]); // write to data port m_pport->WriteData(data); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // set /WR on the control port m_pport->WriteControl(m_pWiringMaskCache[VFDSGN_WR]); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // reset /WR on the control port m_pport->WriteControl(m_pWiringMaskCache[0x00]); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // set direction to "port_input" m_pport->WriteControl(LPT_CTL_HI_DIR | m_pWiringMaskCache[0x00]); } @@ -393,13 +394,13 @@ void cDriverNoritake800::N800Data(unsigned char data) m_pport->WriteControl(m_pWiringMaskCache[VFDSGN_CD]); // write to data port m_pport->WriteData(data); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // set /WR on the control port m_pport->WriteControl(m_pWiringMaskCache[VFDSGN_CD | VFDSGN_WR]); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // reset /WR on the control port m_pport->WriteControl(m_pWiringMaskCache[VFDSGN_CD]); - //nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); + nSleep(100 + (100 * m_Config->adjustTiming) - m_nTimingAdjustCmd); // set direction to "port_input" m_pport->WriteControl(LPT_CTL_HI_DIR | m_pWiringMaskCache[0x00]); } diff --git a/glcddrivers/noritake800.h b/glcddrivers/noritake800.h index cb2dfb0..f34c476 100644 --- a/glcddrivers/noritake800.h +++ b/glcddrivers/noritake800.h @@ -27,7 +27,7 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2004 - 2011 Lucian Muresan <lucianm AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_NORITAKE800_H_ diff --git a/graphlcd.conf b/graphlcd.conf index b5db6f5..4c0ea52 100644 --- a/graphlcd.conf +++ b/graphlcd.conf @@ -99,7 +99,7 @@ WaitPriority=0 # decrease or increase the time to wait after port commands with this # parameter. Normally, there is no need to change this parameter. # (used by gu140x32f, gu256x64-372, gu256x64-3900, hd61830, ks0108, -# sed1330, sed1520, gu126x64D-K610A4) +# sed1330, sed1520, gu126x64D-K610A4, noritake800) # Possible values: -50 <= x <= 50 # Default value: 0 # @@ -497,8 +497,8 @@ Height=64 #UpsideDown=no #Invert=no Brightness=50 -#AdjustTiming=0 # not used -#RefreshDisplay=0 # not used +AdjustTiming=50 +RefreshDisplay=50 # Wiring # Select the type of wiring your display is connected with. |