# HG changeset patch # User sl # Date 1400763431 -7200 # Node ID 7d89d719583e297fe9047f11c00b2d12dc4e9dc5 # Parent 23cacc1d17a3d410ab3046cd916aa62e8caaa1c9 Adding support for setting GP1212A01A display position. diff -r 23cacc1d17a3 -r 7d89d719583e inc/FutabaVfd.h --- a/inc/FutabaVfd.h Thu May 22 13:46:37 2014 +0200 +++ b/inc/FutabaVfd.h Thu May 22 14:57:11 2014 +0200 @@ -110,6 +110,12 @@ class GP1212A01A : public GP1212XXXX { public: + enum DW + { + DW1=12, + DW2=13 + }; + int Open(); //From FutabaGraphicVfd virtual int WidthInPixels(){return 256;}; @@ -124,6 +130,8 @@ void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char aValue); void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char* aPixels); // + void SetDisplayPosition(DW aDw,int aX, int aY); + // void RequestId(); void RequestFirmwareRevision(); void RequestPowerSupplyStatus(); diff -r 23cacc1d17a3 -r 7d89d719583e inc/MainWindow.h --- a/inc/MainWindow.h Thu May 22 13:46:37 2014 +0200 +++ b/inc/MainWindow.h Thu May 22 14:57:11 2014 +0200 @@ -40,6 +40,7 @@ ID_FUTABA_SET_PIXEL, ID_FUTABA_RESET_PIXEL, ID_FUTABA_SET_ALL_PIXELS, + ID_FUTABA_SET_DISPLAY_POSITION, ID_SELECT_FONT, ID_LAST }; @@ -71,6 +72,7 @@ long onFutabaSetAllPixels(FXObject *sender, FXSelector sel, void *ptr); long onFutabaSetPixel(FXObject *sender, FXSelector sel, void *ptr); long onFutabaResetPixel(FXObject *sender, FXSelector sel, void *ptr); + long onFutabaSetDisplayPosition(FXObject *sender, FXSelector sel, void *ptr); // long onSelectFont(FXObject *sender, FXSelector sel, void *ptr); // @@ -112,6 +114,7 @@ FXButton *iButtonSetPixel; FXButton *iButtonResetPixel; FXButton *iButtonSetAllPixels; + FXButton *iButtonSetDisplayPosition; //Font FXButton *iButtonSelectFont; diff -r 23cacc1d17a3 -r 7d89d719583e src/FutabaVfd.cpp --- a/src/FutabaVfd.cpp Thu May 22 13:46:37 2014 +0200 +++ b/src/FutabaVfd.cpp Thu May 22 14:57:11 2014 +0200 @@ -213,7 +213,8 @@ */ void GP1212A01A::Clear() { - //Send Clear display command + //1BH,5BH,32H,4AH + //Send Clear Display Command FutabaVfdReport report; report[0]=0x00; //Report ID report[1]=0x04; //Report length @@ -225,6 +226,24 @@ } /** +Change our display position within our buffer. +*/ +void GP1212A01A::SetDisplayPosition(DW aDw,int aX, int aY) + { + //1BH,5BH,Dw,Px,Py + //Send Display Position Settings Command + FutabaVfdReport report; + report[0]=0x00; //Report ID + report[1]=0x05; //Report length + report[2]=0x1B; //Command ID + report[3]=0x5B; //Command ID + report[4]=aDw; //Specify our DW + report[5]=aX; //X coordinate of our DW top-left corner + report[5]=aY; //Y coordinate of our DW top-left corner + Write(report); + } + +/** */ void GP1212A01A::RequestId() { diff -r 23cacc1d17a3 -r 7d89d719583e src/test.cpp --- a/src/test.cpp Thu May 22 13:46:37 2014 +0200 +++ b/src/test.cpp Thu May 22 14:57:11 2014 +0200 @@ -120,6 +120,7 @@ iButtonResetPixel = new FXButton(matrix, "Reset Pixel", NULL, this, ID_FUTABA_RESET_PIXEL, BUTTON_NORMAL|LAYOUT_FILL_X); // iButtonSetAllPixels = new FXButton(matrix, "Set All Pixels", NULL, this, ID_FUTABA_SET_ALL_PIXELS, BUTTON_NORMAL|LAYOUT_FILL_X); + iButtonSetDisplayPosition = new FXButton(matrix, "Set Display Position", NULL, this, ID_FUTABA_SET_ALL_PIXELS, BUTTON_NORMAL|LAYOUT_FILL_X); // // Output Group Box @@ -287,6 +288,7 @@ iButtonSetPixel->enable(); iButtonResetPixel->enable(); iButtonSetAllPixels->enable(); + iButtonSetDisplayPosition->enable(); } } else @@ -312,6 +314,7 @@ iButtonSetPixel->disable(); iButtonResetPixel->disable(); iButtonSetAllPixels->disable(); + iButtonSetDisplayPosition->disable(); // } @@ -721,6 +724,23 @@ return 1; } + +/** + +*/ +long MainWindow::onFutabaSetDisplayPosition(FXObject *sender, FXSelector sel, void *ptr) + { + int x=0; + int y=0; + iTextFieldX->getText().scan("%d",&x); + iTextFieldY->getText().scan("%d",&y); + //Set both positions for now until we understand how to use that stuff + iVfd01.SetDisplayPosition(GP1212A01A::DW1,x,y); + iVfd01.SetDisplayPosition(GP1212A01A::DW2,x,y); + return 1; + } + + long MainWindow::onFutabaReadId(FXObject *sender, FXSelector sel, void *ptr) {