jasonacox / TM1637TinyDisplay

Arduino library to display numbers and text on a 4 and 6 digit 7-segment TM1637 display modules.
GNU Lesser General Public License v3.0
71 stars 19 forks source link

compile issue on raspberry pi pico #35

Open goephs opened 10 months ago

goephs commented 10 months ago

tm1637tinydisplay.cpp:29: In file included from tm1637tinydisplay.h: 34:6: error: expected unqualified-id before 'const 34 | ((const unsigned char )(addr)) \ workaround for non-AVR | ^~~~~ pgmspace.h:116: note in expansion of macro pgm_read_byte 116 | static inline unsigned char pgm_read_byte(const void *addr) { | ^~~~~

jasonacox commented 10 months ago

This is the header definition:

https://github.com/jasonacox/TM1637TinyDisplay/blob/f13913e803ccfbe56f9ac924371738d19d66a597/TM1637TinyDisplay.h#L26-L35

Ah, this may be a bug. I don't know that I have a device that would really test that last else case (not AVR and not ESP). Here are some suggestions to try:

If either of these work, we can update the project to fix that.

goephs commented 10 months ago

Hello Jason,

//#else//#define pgm_read_byte(addr)                                                    \//  ((const unsigned char )(addr)) // workaround for non-AVR

else#define pgm_read_byte(addr)  ((const unsigned char )(addr)) // workaround for non-AVR// (moved contents to line above and removed )#endif

The compiler is unhappy with the expansion:

tm1637tinydisplay.cpp:29: In file included from tm1637tinydisplay.h: 33:32: error: expected unqualified-id before 'const   33 | #define pgm_read_byte(addr) ((const unsigned char )(addr)) \ workaround for non-AVR   |                                ^~~pgmspace.h:116: note  in expansion of macro pgm_read_byte   116 | static inline unsigned char pgm_read_byte(const void *addr) {   |                             ^~~ tm1637tinydisplay.h: 33:32: error: expected ')' before 'const   33 | #define pgm_read_byte(addr) ((const unsigned char )(addr)) \ workaround for non-AVR   |                               ~^~~pgmspace.h:116: note  in expansion of macro pgm_read_byte   116 | static inline unsigned char pgm_read_byte(const void *addr) {   |                             ^~

In a few days, I'll test with a tm1637 display on the pico and let you know.  My functionality needs are only to display integers and float numbers.  Occasionally a degree sign (little o shifted up). Kind regards,Gavin Watson (goephs)

On Thursday, November 30, 2023 at 10:48:32 PM EST, Jason Cox ***@***.***> wrote:  

This is the header definition:

https://github.com/jasonacox/TM1637TinyDisplay/blob/f13913e803ccfbe56f9ac924371738d19d66a597/TM1637TinyDisplay.h#L26-L35

Ah, this may be a bug. I don't know that I have a device that would really test that last else case (not AVR and not ESP). Here are some suggestions to try:

If either of these work, we can update the project to fix that.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jasonacox commented 10 months ago

Thanks @goephs ! I suspect you just needed to remove that #else condition. The formatting in your email didn't come through very well but I think I get the gist.

Let us know if it work on the device.

goephs commented 10 months ago

Hello Jason,I tested the tm1637 display on the PICO with the #else condition removed and it worked perfectly with both your demo script and test script.  I'm good to go now.  Thank you for your help!

On Friday, December 1, 2023 at 10:42:03 PM EST, Jason Cox ***@***.***> wrote:  

Thanks @goephs ! I suspect you just needed to remove that #else condition. The formatting in your email didn't come through very well but I think I get the gist.

Let us know if it work on the device.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jasonacox commented 10 months ago

Thanks @goephs !