Adding an option to disable frame differencing.
1.1 --- a/MiniDisplay/FutabaVfd.cpp Fri May 30 15:02:15 2014 +0200
1.2 +++ b/MiniDisplay/FutabaVfd.cpp Sun Jun 01 21:15:33 2014 +0200
1.3 @@ -74,7 +74,7 @@
1.4 GP1212A01A::GP1212A01A():
1.5 iDisplayPositionX(0),iDisplayPositionY(0),
1.6 iOffScreenMode(true),
1.7 - iUseFrameDiffAlgo(true),
1.8 + iUseFrameDifferencing(true),
1.9 iFrameNext(NULL),
1.10 iFrameCurrent(NULL),
1.11 iFramePrevious(NULL),
1.12 @@ -376,7 +376,7 @@
1.13 if (OffScreenMode())
1.14 {
1.15 //Send host back buffer to device back buffer
1.16 - if (!iUseFrameDiffAlgo || iNeedFullFrameUpdate<KNumberOfFrameBeforeDiffAlgo)
1.17 + if (!iUseFrameDifferencing || iNeedFullFrameUpdate<KNumberOfFrameBeforeDiffAlgo)
1.18 {
1.19 iNeedFullFrameUpdate++;
1.20 SetPixelBlock(0,0,63,FrameBufferSizeInBytes(),iFrameNext->Ptr());
1.21 @@ -406,20 +406,20 @@
1.22 }
1.23
1.24
1.25 +//Define the edge of our pixel block
1.26 +//Pixel blocks of 32x32 seems to run almost as fast as full screen update in worse case scenarii.
1.27 +//Though I wonder if in some situations 16 could be better. Make this an attribute at some point if need be.
1.28 +const int KPixelBlockEdge = 32;
1.29 +const int KPixelBlockSizeInBits = KPixelBlockEdge*KPixelBlockEdge;
1.30 +const int KPixelBlockSizeInBytes = KPixelBlockSizeInBits/8;
1.31 +
1.32 +
1.33 /**
1.34 * @brief GP1212A01A::SendModifiedPixelBlocks
1.35 * Compare our back and front buffer and send to the device only the modified pixels.
1.36 */
1.37 void GP1212A01A::SendModifiedPixelBlocks()
1.38 {
1.39 - //The largest pixel block we can sanely send with one report is 16*16
1.40 - //const int KBlocksPerRow = WidthInPixels()/16; //16
1.41 - //const int KBlocksPerColumn = HeightInPixels()/16; //4
1.42 -
1.43 - const int KPixelBlockEdge = 16;
1.44 - const int KPixelBlockSizeInBits = KPixelBlockEdge*KPixelBlockEdge;
1.45 - const int KPixelBlockSizeInBytes = KPixelBlockSizeInBits/8;
1.46 -
1.47 int w=WidthInPixels();
1.48 int h=HeightInPixels();
1.49
2.1 --- a/MiniDisplay/FutabaVfd.h Fri May 30 15:02:15 2014 +0200
2.2 +++ b/MiniDisplay/FutabaVfd.h Sun Jun 01 21:15:33 2014 +0200
2.3 @@ -159,8 +159,9 @@
2.4 void ToggleOffScreenMode();
2.5 void SetOffScreenMode(bool aOn);
2.6 bool OffScreenMode() const {return iOffScreenMode;}
2.7 - void SetFrameDiffAlgo(bool aOn);
2.8 - bool FrameDiffAlgo() const {return iUseFrameDiffAlgo;}
2.9 + //
2.10 + void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
2.11 + bool FrameDifferencing() const {return iUseFrameDifferencing;}
2.12 //
2.13 bool RequestPending(){return iRequest!=ERequestNone;}
2.14 Request CurrentRequest(){return iRequest;}
2.15 @@ -190,7 +191,7 @@
2.16 ///Though turning it off can be useful for debugging
2.17 bool iOffScreenMode;
2.18 ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
2.19 - bool iUseFrameDiffAlgo;
2.20 + bool iUseFrameDifferencing;
2.21 ///
2.22 //FutabaVfdReport iReport;
2.23 ///
3.1 --- a/MiniDisplay/minidisplay.cpp Fri May 30 15:02:15 2014 +0200
3.2 +++ b/MiniDisplay/minidisplay.cpp Sun Jun 01 21:15:33 2014 +0200
3.3 @@ -334,6 +334,25 @@
3.4 iDisplay.SetBrightness(aBrightness);
3.5 }
3.6
3.7 +/**
3.8 +@brief MiniDisplay::frameDifferencing
3.9 +@return
3.10 +*/
3.11 +bool MiniDisplay::frameDifferencing() const
3.12 +{
3.13 + return iDisplay.FrameDifferencing();
3.14 +}
3.15 +
3.16 +/**
3.17 +@brief MiniDisplay::setFrameDifferencing
3.18 +@param aOn
3.19 +*/
3.20 +void MiniDisplay::setFrameDifferencing(bool aOn)
3.21 +{
3.22 + iDisplay.SetFrameDifferencing(aOn);
3.23 +}
3.24 +
3.25 +
3.26 QPoint MiniDisplay::framePosition() const
3.27 {
3.28 return QPoint(iDisplay.DisplayPositionX(),iDisplay.DisplayPositionX());
4.1 --- a/MiniDisplay/minidisplay.h Fri May 30 15:02:15 2014 +0200
4.2 +++ b/MiniDisplay/minidisplay.h Sun Jun 01 21:15:33 2014 +0200
4.3 @@ -19,6 +19,8 @@
4.4 Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
4.5 Q_PROPERTY(int maxBrightness READ maxBrightness NOTIFY opened)
4.6 Q_PROPERTY(int minBrightness READ minBrightness NOTIFY opened)
4.7 + Q_PROPERTY(bool frameDifferencing READ frameDifferencing WRITE setFrameDifferencing NOTIFY frameDifferencingChanged)
4.8 + //Debug only
4.9 Q_PROPERTY(QPoint framePosition READ framePosition WRITE setFramePosition NOTIFY closed)
4.10
4.11 public:
4.12 @@ -61,6 +63,9 @@
4.13 int brightness() const;
4.14 void setBrightness(int aBrightness);
4.15 //
4.16 + bool frameDifferencing() const;
4.17 + void setFrameDifferencing(bool aOn);
4.18 + //Debug only
4.19 QPoint framePosition() const;
4.20 void setFramePosition(const QPoint& aPoint);
4.21
4.22 @@ -73,6 +78,7 @@
4.23 void fontChanged();
4.24 void brightnessChanged();
4.25 void offScreenModeChanged();
4.26 + void frameDifferencingChanged();
4.27 //
4.28 void powerStatus(bool powerOn);
4.29 void deviceId(QString deviceId);
5.1 --- a/TestsTab.qml Fri May 30 15:02:15 2014 +0200
5.2 +++ b/TestsTab.qml Sun Jun 01 21:15:33 2014 +0200
5.3 @@ -131,7 +131,7 @@
5.4
5.5 if (checkBoxRenderToDisplay.checked)
5.6 {
5.7 - if (checkBoxFillOnly.checked)
5.8 + if (checkBoxFillAndClearOnly.checked)
5.9 {
5.10 //Trying to make it a worse case scenario for our frame diff algo
5.11 if (doFill)
5.12 @@ -218,7 +218,7 @@
5.13 }
5.14
5.15 CheckBox {
5.16 - id: checkBoxFillOnly
5.17 + id: checkBoxFillAndClearOnly
5.18 text: qsTr("Only fill and clear")
5.19 checked: false
5.20 }
5.21 @@ -236,10 +236,16 @@
5.22 }
5.23
5.24 CheckBox {
5.25 - //id: checkBoxOnePixelOnly
5.26 text: qsTr("Off-Screen")
5.27 checked: true
5.28 onCheckedChanged: {display.offScreenMode = checked;}
5.29 }
5.30 +
5.31 + CheckBox {
5.32 + text: qsTr("Frame differencing")
5.33 + checked: true
5.34 + onCheckedChanged: {display.frameDifferencing = checked;}
5.35 + }
5.36 +
5.37 }
5.38 }