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.
1.1 --- a/DisplayTab.qml Thu May 29 17:25:06 2014 +0200
1.2 +++ b/DisplayTab.qml Thu May 29 19:46:57 2014 +0200
1.3 @@ -120,7 +120,6 @@
1.4 anchors.margins: 8
1.5 anchors.right: parent.right
1.6 anchors.top: parent.top
1.7 - //anchors.bottom: parent.bottom-parent.height/2
1.8 height:parent.height/2
1.9 //
1.10 orientation: Qt.Vertical
2.1 --- a/MiniDisplay/FutabaVfd.cpp Thu May 29 17:25:06 2014 +0200
2.2 +++ b/MiniDisplay/FutabaVfd.cpp Thu May 29 19:46:57 2014 +0200
2.3 @@ -109,20 +109,27 @@
2.4 */
2.5 void GP1212A01A::SetPixel(unsigned char aX, unsigned char aY, bool aOn)
2.6 {
2.7 - //Just specify a one pixel block
2.8 - //SetPixelBlock(aX,aY,0x00,0x01,aOn);
2.9 //
2.10 //int byteOffset=(aX*HeightInPixels()+aY)/8;
2.11 //int bitOffset=(aX*HeightInPixels()+aY)%8;
2.12 //iFrameBuffer[byteOffset] |= ( (aOn?0x01:0x00) << bitOffset );
2.13 - if (aOn)
2.14 - {
2.15 - iFrameBuffer->SetBit(aX*HeightInPixels()+aY);
2.16 - }
2.17 - else
2.18 - {
2.19 - iFrameBuffer->ClearBit(aX*HeightInPixels()+aY);
2.20 - }
2.21 +
2.22 + if (iOffScreenMode)
2.23 + {
2.24 + if (aOn)
2.25 + {
2.26 + iFrameBuffer->SetBit(aX*HeightInPixels()+aY);
2.27 + }
2.28 + else
2.29 + {
2.30 + iFrameBuffer->ClearBit(aX*HeightInPixels()+aY);
2.31 + }
2.32 + }
2.33 + else
2.34 + {
2.35 + //Just specify a one pixel block
2.36 + SetPixelBlock(aX,aY,0x00,0x01,aOn);
2.37 + }
2.38 }
2.39
2.40 /**
2.41 @@ -151,38 +158,19 @@
2.42 //memset(screen,0xFF,sizeof(screen));
2.43 //SetPixelBlock(0,0,63,sizeof(screen),screen);
2.44
2.45 - //Using pattern SetPixelBlock variant.
2.46 - memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes());
2.47 +
2.48 + if (iOffScreenMode)
2.49 + {
2.50 + memset(iFrameBuffer->Ptr(),aPattern,FrameBufferSizeInBytes());
2.51 + }
2.52 + else
2.53 + {
2.54 + //Using pattern SetPixelBlock variant.
2.55 + SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),aPattern);
2.56 + }
2.57 //
2.58 -
2.59 -
2.60 }
2.61
2.62 -/**
2.63 -Set our screen brightness.
2.64 -@param The desired brightness level. Must be between MinBrightness and MaxBrightness.
2.65 -*/
2.66 -void GP1212A01A::SetBrightness(int aBrightness)
2.67 - {
2.68 - if (aBrightness<MinBrightness()||aBrightness>MaxBrightness())
2.69 - {
2.70 - //Brightness out of range.
2.71 - //Just ignore that request.
2.72 - return;
2.73 - }
2.74 -
2.75 - FutabaVfdReport report;
2.76 - report[0]=0x00; //Report ID
2.77 - report[1]=0x06; //Report size
2.78 - report[2]=0x1B; //Command ID
2.79 - report[3]=0x5C; //Command ID
2.80 - report[4]=0x3F; //Command ID
2.81 - report[5]=0x4C; //Command ID
2.82 - report[6]=0x44; //Command ID
2.83 - report[7]=0x30+aBrightness; //Brightness level
2.84 - Write(report);
2.85 -
2.86 - }
2.87
2.88 /**
2.89 Set the defined pixel block to the given value.
2.90 @@ -272,7 +260,14 @@
2.91 void GP1212A01A::Clear()
2.92 {
2.93 //memset(iFrameBuffer->Ptr(),0x00,FrameBufferSizeInBytes());
2.94 - iFrameBuffer->ClearAll();
2.95 + if (iOffScreenMode)
2.96 + {
2.97 + iFrameBuffer->ClearAll();
2.98 + }
2.99 + else
2.100 + {
2.101 + SendClearCommand();
2.102 + }
2.103 }
2.104
2.105 /**
2.106 @@ -468,6 +463,28 @@
2.107 }
2.108
2.109 /**
2.110 + * @brief GP1212A01A::SetOffScreenMode
2.111 + * @param aOn
2.112 + * @return
2.113 + */
2.114 +void GP1212A01A::SetOffScreenMode(bool aOn)
2.115 + {
2.116 + if (aOn==iOffScreenMode)
2.117 + {
2.118 + //Nothing to do here
2.119 + return;
2.120 + }
2.121 +
2.122 + iOffScreenMode=aOn;
2.123 +
2.124 + //Clean up our buffers upon switching modes
2.125 + SetDisplayPosition(0,0);
2.126 + Clear();
2.127 + SwapBuffers();
2.128 + Clear();
2.129 + }
2.130 +
2.131 +/**
2.132 */
2.133 GP1212A01A::Request GP1212A01A::AttemptRequestCompletion()
2.134 {
2.135 @@ -502,3 +519,31 @@
2.136
2.137 return completed;
2.138 }
2.139 +
2.140 +
2.141 +/**
2.142 +Set our screen brightness.
2.143 +@param The desired brightness level. Must be between MinBrightness and MaxBrightness.
2.144 +*/
2.145 +void GP1212A01A::SetBrightness(int aBrightness)
2.146 + {
2.147 + if (aBrightness<MinBrightness()||aBrightness>MaxBrightness())
2.148 + {
2.149 + //Brightness out of range.
2.150 + //Just ignore that request.
2.151 + return;
2.152 + }
2.153 +
2.154 + FutabaVfdReport report;
2.155 + report[0]=0x00; //Report ID
2.156 + report[1]=0x06; //Report size
2.157 + report[2]=0x1B; //Command ID
2.158 + report[3]=0x5C; //Command ID
2.159 + report[4]=0x3F; //Command ID
2.160 + report[5]=0x4C; //Command ID
2.161 + report[6]=0x44; //Command ID
2.162 + report[7]=0x30+aBrightness; //Brightness level
2.163 + Write(report);
2.164 + }
2.165 +
2.166 +
3.1 --- a/MiniDisplay/FutabaVfd.h Thu May 29 17:25:06 2014 +0200
3.2 +++ b/MiniDisplay/FutabaVfd.h Thu May 29 19:46:57 2014 +0200
3.3 @@ -157,6 +157,7 @@
3.4 void RequestPowerSupplyStatus();
3.5 //
3.6 void ToggleOffScreenMode();
3.7 + void SetOffScreenMode(bool aOn);
3.8 bool OffScreenMode() const {return iOffScreenMode;}
3.9 //
3.10 bool RequestPending(){return iRequest!=ERequestNone;}
4.1 --- a/MiniDisplay/minidisplay.cpp Thu May 29 17:25:06 2014 +0200
4.2 +++ b/MiniDisplay/minidisplay.cpp Thu May 29 19:46:57 2014 +0200
4.3 @@ -210,10 +210,36 @@
4.4 return;
4.5 }
4.6
4.7 - iDisplay.SetPixel(x,y,true);
4.8 + iDisplay.SetPixel(x,y,on);
4.9 }
4.10
4.11 /**
4.12 + * @brief MiniDisplay::offScreenMode
4.13 + * @return
4.14 + */
4.15 +bool MiniDisplay::offScreenMode()
4.16 +{
4.17 + return iDisplay.OffScreenMode();
4.18 +}
4.19 +
4.20 +/**
4.21 + * @brief MiniDisplay::setOffScreenMode
4.22 + * @param aOn
4.23 + */
4.24 +void MiniDisplay::setOffScreenMode(bool aOn)
4.25 +{
4.26 + if (!iDisplay.IsOpen())
4.27 + {
4.28 + return;
4.29 + }
4.30 +
4.31 + iDisplay.SetOffScreenMode(aOn);
4.32 +}
4.33 +
4.34 +
4.35 +
4.36 +
4.37 +/**
4.38 * @brief MiniDisplay::vendor
4.39 * @return
4.40 */
5.1 --- a/MiniDisplay/minidisplay.h Thu May 29 17:25:06 2014 +0200
5.2 +++ b/MiniDisplay/minidisplay.h Thu May 29 19:46:57 2014 +0200
5.3 @@ -11,6 +11,7 @@
5.4 Q_DISABLE_COPY(MiniDisplay)
5.5 //
5.6 Q_PROPERTY(bool isOpen READ isOpen NOTIFY statusChanged)
5.7 + Q_PROPERTY(bool offScreenMode READ offScreenMode WRITE setOffScreenMode NOTIFY offScreenModeChanged)
5.8 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
5.9 Q_PROPERTY(QString vendor READ vendor)
5.10 Q_PROPERTY(QString product READ product)
5.11 @@ -48,6 +49,9 @@
5.12 QFont font() const {return iFont;}
5.13 void setFont(const QFont& aFont);
5.14 //
5.15 + bool offScreenMode();
5.16 + void setOffScreenMode(bool aOn);
5.17 + //
5.18 QString vendor();
5.19 QString product();
5.20 QString serialNumber();
5.21 @@ -68,6 +72,7 @@
5.22 void statusChanged();
5.23 void fontChanged();
5.24 void brightnessChanged();
5.25 + void offScreenModeChanged();
5.26 //
5.27 void powerStatus(bool powerOn);
5.28 void deviceId(QString deviceId);
6.1 --- a/TestsTab.qml Thu May 29 17:25:06 2014 +0200
6.2 +++ b/TestsTab.qml Thu May 29 19:46:57 2014 +0200
6.3 @@ -14,7 +14,7 @@
6.4 //anchors.fill:parent
6.5
6.6
6.7 -
6.8 + //This window is our VFD frame
6.9 Window {
6.10 //parent: appWindow
6.11 id: splash
6.12 @@ -133,7 +133,7 @@
6.13 }
6.14 else if (checkBoxOnePixelOnly.checked)
6.15 {
6.16 - display.setPixel(0,0,true);
6.17 + display.setPixel(0,0,splash.frameCounter%2);
6.18 }
6.19 else
6.20 {
6.21 @@ -217,5 +217,12 @@
6.22 text: qsTr("One pixel only")
6.23 checked: false
6.24 }
6.25 +
6.26 + CheckBox {
6.27 + //id: checkBoxOnePixelOnly
6.28 + text: qsTr("Off-Screen")
6.29 + checked: true
6.30 + onCheckedChanged: {display.offScreenMode = checked;}
6.31 + }
6.32 }
6.33 }