Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Library modifications

Hello,

I'm not sure if this is the correct place to request changes/additions to the library, but I coun't locate any other method on the site so please excuse if this is not the correct venue.

I have made some modifications to the library (version Feb 2016), which I need for my project, and would like to request these changes be added to the library functionality.

There are 4 basic changes:

1) Add a TouchPoint structure which is used to return the x/y values of the point touched on the screen.

2) Add timeout for I2C version of function read1 (because my Moteino would sometimes hang without it).

3) Allow the readTouchScreen to accept optional parameter which allows the programmer to select Instance or Wait type read, and to return the TouchPoint structure for the x/y position read.

4) Add setTrueBgColor function.

 

And please change all your function definitions to return type "void" when they don't return any type of data (my compiler, gcc++11, doesn't like functions not including a "return" statement for functions which specify a return type)... such as the following (and all like it):

    size_t println(const __FlashStringHelper *v) {
        preprint();
        Print::println(v);
        write((uint8_t) 0);
        Print::print("TRT");
    }
-- Should be--

    void println(const __FlashStringHelper *v) {
        preprint();
        Print::println(v);
        write((uint8_t) 0);
        Print::print("TRT");
    }
 

Furthermore, there are several coding errors in the library, which I fixed.  The 'diff' outputs below show all the changes I made to both the .h and .cpp files.

Cheers!

 

--The diff output for each of the files--

==DigoleSerial.h==
29a30,34
>     struct TouchPoint {
>         unsigned int x = 0xFFFF;
>         unsigned int y = 0xFFFF;
>     };
>
93c98,99
<         while (_myWire->available() == 0);
---
>         unsigned long timeOut = (millis() + 3000);
>         while (_myWire->available() == 0 && millis() < timeOut);
176c182
<     size_t println(const __FlashStringHelper *v) {
---
>     void println(const __FlashStringHelper *v) {
183c189
<     size_t println(const String &v) {
---
>     void println(const String &v) {
190c196
<     size_t println(const char v[]) {
---
>     void println(const char v[]) {
197c203
<     size_t println(char v) {
---
>     void println(char v) {
203c209
<     size_t println(unsigned char v, int base = DEC) {
---
>     void println(unsigned char v, int base = DEC) {
209c215
<     size_t println(int v, int base = DEC) {
---
>     void println(int v, int base = DEC) {
216c222
<     size_t println(unsigned int v, int base = DEC) {
---
>     void println(unsigned int v, int base = DEC) {
223c229
<     size_t println(long v, int base = DEC) {
---
>     void println(long v, int base = DEC) {
230c236
<     size_t println(unsigned long v, int base = DEC) {
---
>     void println(unsigned long v, int base = DEC) {
237c243
<     size_t println(double v, int base = 2) {
---
>     void println(double v, int base = 2) {
244c250
<     size_t println(const Printable& v) {
---
>     void println(const Printable& v) {
251c257
<     size_t println(void) {
---
>     void println(void) {
256c262
<     size_t print(const __FlashStringHelper *v) {
---
>     void print(const __FlashStringHelper *v) {
262c268
<     size_t print(const String &v) {
---
>     void print(const String &v) {
268c274
<     size_t print(const char v[]) {
---
>     void print(const char v[]) {
274c280
<     size_t print(char v) {
---
>     void print(char v) {
280c286
<     size_t print(unsigned char v, int base = DEC) {
---
>     void print(unsigned char v, int base = DEC) {
286c292
<     size_t print(int v, int base = DEC) {
---
>     void print(int v, int base = DEC) {
292c298
<     size_t print(unsigned int v, int base = DEC) {
---
>     void print(unsigned int v, int base = DEC) {
298c304
<     size_t print(long v, int base = DEC) {
---
>     void print(long v, int base = DEC) {
304c310
<     size_t print(unsigned long v, int base = DEC) {
---
>     void print(unsigned long v, int base = DEC) {
310c316
<     size_t print(double v, int base = 2) {
---
>     void print(double v, int base = 2) {
316c322
<     size_t print(const Printable& v) {
---
>     void print(const Printable& v) {
365c371
<     void readTouchScreen(void);
---
>     TouchPoint readTouchScreen(boolean wait = false);
399a406,412
>     void setTrueBgColor (uint8_t r, uint8_t g, uint8_t b) {
>         Print::print("ESC");
>         write(r);
>         write(g);
>         write(b);
>         Print::print("BGC");
>     }

 



==DigoleSerial.cpp==60c60
<     for (int j = 0; j < h * ((w >> 3) + i); j++) {
---
>     for (unsigned int j = 0; j < h * ((w >> 3) + i); j++) {
185d184
<     uint8_t i = 0;
191c190
<     for (int j = 0; j < h * w; j++) {
---
>     for (unsigned int j = 0; j < h * w; j++) {
198d196
<     uint8_t i = 0;
204c202
<     for (int j = 0; (j < h * w * 3); j++) {
---
>     for (unsigned int j = 0; (j < h * w * 3); j++) {
211d208
<     uint8_t i = 0;
263c260,261
< void DigoleSerialDisp::readTouchScreen() {
---
> DigoleSerialDisp::TouchPoint DigoleSerialDisp::readTouchScreen(boolean wait) {
>     TouchPoint point;
269c267,279
<     write('W'); //change to 'I' if you don't want wait till pen touched
---
>     if (wait) {
>         write('W'); // 'W' = Wait till pen touched
>     } else {
>         write('I'); // 'I' = Don't want wait till pen touched
>     }
>     point.x = read1();
>     point.x <<= 8;
>     point.x |= read1();
>     point.y = read1();
>     point.y <<= 8;
>     point.y |= read1();
>
>     return point;
378c388
<     for (int i = 0; i < len; i++) {
---
>     for (unsigned int i = 0; i < len; i++) {
421c431
< }
\ No newline at end of file
---
> }
 

RE:Library modifications

 I will forward your message to our developers.

Thanks!

RE:Library modifications

 Thanks for providing details of the problems you found inthe Digole library, and your corrections.  I'm seeing the same.  Unfortunately, Digole did not incorporate your fixes into the March 2016 library update.  Hopefully they will get around to this soon!

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun