# HG changeset patch # User sl # Date 1401385617 -7200 # Node ID 79801cc3bc947f04705a594970aefc780d26a2cd # Parent aa257fdcd093dea4908fa42349570a2a6bc92719 Restoring some of our on-screen functionality for debug purposes. We could prove that updating a single pixel is much faster than updating our whole screen. Single pixel updates runs at full 24 FPS. diff -r aa257fdcd093 -r 79801cc3bc94 DisplayTab.qml --- a/DisplayTab.qml Thu May 29 17:25:06 2014 +0200 +++ b/DisplayTab.qml Thu May 29 19:46:57 2014 +0200 @@ -120,7 +120,6 @@ anchors.margins: 8 anchors.right: parent.right anchors.top: parent.top - //anchors.bottom: parent.bottom-parent.height/2 height:parent.height/2 // orientation: Qt.Vertical diff -r aa257fdcd093 -r 79801cc3bc94 MiniDisplay/FutabaVfd.cpp --- a/MiniDisplay/FutabaVfd.cpp Thu May 29 17:25:06 2014 +0200 +++ b/MiniDisplay/FutabaVfd.cpp Thu May 29 19:46:57 2014 +0200 @@ -109,20 +109,27 @@ */ void GP1212A01A::SetPixel(unsigned char aX, unsigned char aY, bool aOn) { - //Just specify a one pixel block - //SetPixelBlock(aX,aY,0x00,0x01,aOn); // //int byteOffset=(aX*HeightInPixels()+aY)/8; //int bitOffset=(aX*HeightInPixels()+aY)%8; //iFrameBuffer[byteOffset] |= ( (aOn?0x01:0x00) << bitOffset ); - if (aOn) - { - iFrameBuffer->SetBit(aX*HeightInPixels()+aY); - } - else - { - iFrameBuffer->ClearBit(aX*HeightInPixels()+aY); - } + + if (iOffScreenMode) + { + if (aOn) + { + iFrameBuffer->SetBit(aX*HeightInPixels()+aY); + } + else + { + iFrameBuffer->ClearBit(aX*HeightInPixels()+aY); + } + } + else + { + //Just specify a one pixel block + SetPixelBlock(aX,aY,0x00,0x01,aOn); + } } /** @@ -151,38 +158,19 @@ //memset(screen,0xFF,sizeof(screen)); //SetPixelBlock(0,0,63,sizeof(screen),screen); - //Using pattern SetPixelBlock variant. - memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes()); + + if (iOffScreenMode) + { + memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes()); + } + else + { + //Using pattern SetPixelBlock variant. + SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),aPattern); + } // - - } -/** -Set our screen brightness. -@param The desired brightness level. Must be between MinBrightness and MaxBrightness. -*/ -void GP1212A01A::SetBrightness(int aBrightness) - { - if (aBrightnessMaxBrightness()) - { - //Brightness out of range. - //Just ignore that request. - return; - } - - FutabaVfdReport report; - report[0]=0x00; //Report ID - report[1]=0x06; //Report size - report[2]=0x1B; //Command ID - report[3]=0x5C; //Command ID - report[4]=0x3F; //Command ID - report[5]=0x4C; //Command ID - report[6]=0x44; //Command ID - report[7]=0x30+aBrightness; //Brightness level - Write(report); - - } /** Set the defined pixel block to the given value. @@ -272,7 +260,14 @@ void GP1212A01A::Clear() { //memset(iFrameBuffer->Ptr(),0x00,FrameBufferSizeInBytes()); - iFrameBuffer->ClearAll(); + if (iOffScreenMode) + { + iFrameBuffer->ClearAll(); + } + else + { + SendClearCommand(); + } } /** @@ -468,6 +463,28 @@ } /** + * @brief GP1212A01A::SetOffScreenMode + * @param aOn + * @return + */ +void GP1212A01A::SetOffScreenMode(bool aOn) + { + if (aOn==iOffScreenMode) + { + //Nothing to do here + return; + } + + iOffScreenMode=aOn; + + //Clean up our buffers upon switching modes + SetDisplayPosition(0,0); + Clear(); + SwapBuffers(); + Clear(); + } + +/** */ GP1212A01A::Request GP1212A01A::AttemptRequestCompletion() { @@ -502,3 +519,31 @@ return completed; } + + +/** +Set our screen brightness. +@param The desired brightness level. Must be between MinBrightness and MaxBrightness. +*/ +void GP1212A01A::SetBrightness(int aBrightness) + { + if (aBrightnessMaxBrightness()) + { + //Brightness out of range. + //Just ignore that request. + return; + } + + FutabaVfdReport report; + report[0]=0x00; //Report ID + report[1]=0x06; //Report size + report[2]=0x1B; //Command ID + report[3]=0x5C; //Command ID + report[4]=0x3F; //Command ID + report[5]=0x4C; //Command ID + report[6]=0x44; //Command ID + report[7]=0x30+aBrightness; //Brightness level + Write(report); + } + + diff -r aa257fdcd093 -r 79801cc3bc94 MiniDisplay/FutabaVfd.h --- a/MiniDisplay/FutabaVfd.h Thu May 29 17:25:06 2014 +0200 +++ b/MiniDisplay/FutabaVfd.h Thu May 29 19:46:57 2014 +0200 @@ -157,6 +157,7 @@ void RequestPowerSupplyStatus(); // void ToggleOffScreenMode(); + void SetOffScreenMode(bool aOn); bool OffScreenMode() const {return iOffScreenMode;} // bool RequestPending(){return iRequest!=ERequestNone;} diff -r aa257fdcd093 -r 79801cc3bc94 MiniDisplay/minidisplay.cpp --- a/MiniDisplay/minidisplay.cpp Thu May 29 17:25:06 2014 +0200 +++ b/MiniDisplay/minidisplay.cpp Thu May 29 19:46:57 2014 +0200 @@ -210,10 +210,36 @@ return; } - iDisplay.SetPixel(x,y,true); + iDisplay.SetPixel(x,y,on); } /** + * @brief MiniDisplay::offScreenMode + * @return + */ +bool MiniDisplay::offScreenMode() +{ + return iDisplay.OffScreenMode(); +} + +/** + * @brief MiniDisplay::setOffScreenMode + * @param aOn + */ +void MiniDisplay::setOffScreenMode(bool aOn) +{ + if (!iDisplay.IsOpen()) + { + return; + } + + iDisplay.SetOffScreenMode(aOn); +} + + + + +/** * @brief MiniDisplay::vendor * @return */ diff -r aa257fdcd093 -r 79801cc3bc94 MiniDisplay/minidisplay.h --- a/MiniDisplay/minidisplay.h Thu May 29 17:25:06 2014 +0200 +++ b/MiniDisplay/minidisplay.h Thu May 29 19:46:57 2014 +0200 @@ -11,6 +11,7 @@ Q_DISABLE_COPY(MiniDisplay) // Q_PROPERTY(bool isOpen READ isOpen NOTIFY statusChanged) + Q_PROPERTY(bool offScreenMode READ offScreenMode WRITE setOffScreenMode NOTIFY offScreenModeChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(QString vendor READ vendor) Q_PROPERTY(QString product READ product) @@ -48,6 +49,9 @@ QFont font() const {return iFont;} void setFont(const QFont& aFont); // + bool offScreenMode(); + void setOffScreenMode(bool aOn); + // QString vendor(); QString product(); QString serialNumber(); @@ -68,6 +72,7 @@ void statusChanged(); void fontChanged(); void brightnessChanged(); + void offScreenModeChanged(); // void powerStatus(bool powerOn); void deviceId(QString deviceId); diff -r aa257fdcd093 -r 79801cc3bc94 TestsTab.qml --- a/TestsTab.qml Thu May 29 17:25:06 2014 +0200 +++ b/TestsTab.qml Thu May 29 19:46:57 2014 +0200 @@ -14,7 +14,7 @@ //anchors.fill:parent - + //This window is our VFD frame Window { //parent: appWindow id: splash @@ -133,7 +133,7 @@ } else if (checkBoxOnePixelOnly.checked) { - display.setPixel(0,0,true); + display.setPixel(0,0,splash.frameCounter%2); } else { @@ -217,5 +217,12 @@ text: qsTr("One pixel only") checked: false } + + CheckBox { + //id: checkBoxOnePixelOnly + text: qsTr("Off-Screen") + checked: true + onCheckedChanged: {display.offScreenMode = checked;} + } } }