shadow578 / Marlin-H32

Marlin for HC32F460 based printers (now in upstream)
http://marlinfw.org
GNU General Public License v3.0
13 stars 7 forks source link

[BUG] CR10_STOCKDISPLAY (12864) support now fails. #56

Closed classicrocker883 closed 11 months ago

classicrocker883 commented 11 months ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

Remember when having monochrome 12864 LCD was supported, I think the same kind of error is back.

.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t   

sorry for the long list, but basically it shows the same message... struct "pin_info_t" has no field "bit_mask"

this is within .pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c

static void u8g_com_arduino_no_en_parallel_init(u8g_t *u8g)
{ ...
  u8g_data_mask[0] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
|             #1-#6                                                      #1-#6   |
...
  u8g_data_mask[7] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
}
In file included from C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/Arduino.h:115,
                 from .pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:69:
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c: In function 'u8g_com_arduino_no_en_parallel_init':
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:89:34: note: in expansion of macro 'digitalPinToBitMask'     
   89 |   u8g_data_mask[0] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:91:34: note: in expansion of macro 'digitalPinToBitMask'     
   91 |   u8g_data_mask[1] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D1]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:93:34: note: in expansion of macro 'digitalPinToBitMask'     
   93 |   u8g_data_mask[2] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D2]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:95:34: note: in expansion of macro 'digitalPinToBitMask'     
   95 |   u8g_data_mask[3] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D3]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:98:34: note: in expansion of macro 'digitalPinToBitMask'     
   98 |   u8g_data_mask[4] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D4]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:100:34: note: in expansion of macro 'digitalPinToBitMask'    
  100 |   u8g_data_mask[5] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D5]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:102:34: note: in expansion of macro 'digitalPinToBitMask'    
  102 |   u8g_data_mask[6] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D6]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_no_en_parallel.c:104:34: note: in expansion of macro 'digitalPinToBitMask'    
  104 |   u8g_data_mask[7] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
      |                                  ^~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/Arduino.h:115,
                 from .pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:56:
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c: In function 'u8g_com_arduino_fast_parallel_init':
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:104:34: note: in expansion of macro 'digitalPinToBitMask'     
  104 |   u8g_data_mask[0] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:106:34: note: in expansion of macro 'digitalPinToBitMask'     
  106 |   u8g_data_mask[1] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D1]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:108:34: note: in expansion of macro 'digitalPinToBitMask'     
  108 |   u8g_data_mask[2] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D2]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:110:34: note: in expansion of macro 'digitalPinToBitMask'     
  110 |   u8g_data_mask[3] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D3]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:113:34: note: in expansion of macro 'digitalPinToBitMask'     
  113 |   u8g_data_mask[4] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D4]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:115:34: note: in expansion of macro 'digitalPinToBitMask'     
  115 |   u8g_data_mask[5] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D5]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:117:34: note: in expansion of macro 'digitalPinToBitMask'     
  117 |   u8g_data_mask[6] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D6]);
      |                                  ^~~~~~~~~~~~~~~~~~~
C:\Users\Andrew\.platformio\packages\framework-arduino-hc32f46x\cores\arduino/drivers/gpio/direct_access.h:28:28: error: 'pin_info_t' has no member named 'bit_mask'
   28 |     ((uint16_t)PIN_MAP[pin].bit_mask()) // (uint16_t)en_pin_t     
      |                            ^
.pio\libdeps\HC32F460C_aquila_101\U8glib-HAL\src\clib\u8g_com_arduino_fast_parallel.c:119:34: note: in expansion of macro 'digitalPinToBitMask'     
  119 |   u8g_data_mask[7] = (u8g_data_t)digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
      |                                  ^~~~~~~~~~~~~~~~~~~
*** [.pio\build\HC32F460C_aquila_101\libd6b\U8glib-HAL\clib\u8g_com_arduino_no_en_parallel.c.o] Error 1
*** [.pio\build\HC32F460C_aquila_101\libd6b\U8glib-HAL\clib\u8g_com_arduino_fast_parallel.c.o] Error 1

Bug Timeline

since recent update

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

No response

Version of Marlin Firmware

current up to date

Printer model

No response

Electronics

No response

LCD/Controller

No response

Other add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

No response

classicrocker883 commented 11 months ago

I took a quick look back (in time) at a previous commit optimize PIN_MAP array from your framework-arduino-hc32f46x

I changed:

#define digitalPinToBitMask(pin) \
-    ((uint16_t)PIN_MAP[pin].bit_mask())
#define digitalPinToBitMask(pin) \
+    ((uint16_t)PIN_MAP[pin].bit_mask)

from .platformio\packages\framework-arduino-hc32f46x\cores\arduino\drivers\gpio\direct_access.h

and

#ifdef __cplusplus
        /**
         * @brief bit mask of the pin in the port
         */
        en_pin_t bit_mask() const
        {
            return (en_pin_t)(1 << bit_pos);
        }
+#else

+       en_pin_t bit_mask;

#endif

from .platformio\packages\framework-arduino-hc32f46x\cores\arduino\WVariant.h

I got a successful compile from this with no other warnings... however, I do not feel this is the actual correct way it should be permanently. I mean I haven't test if it will even work regarding flashing. I'll try to get someone to test using the correct LCD in the meantime. maybe we can find a better solution??

but maybe its a step in the right direction?

shadow578 commented 11 months ago

u8g_com_arduino_no_en_parallel.c is a c source file, and the bit_mask() shorthand is only available for C++ (since in c, you cannot have a function in a struct afaik).

could you check if changing digitalPinToBitMask to the following fixes the issue?

#define digitalPinToBitMask(pin) \
    ((uint16_t)(1 << PIN_MAP[pin].bit_pos))
classicrocker883 commented 11 months ago

could you check if changing digitalPinToBitMask to the following fixes the issue?

#define digitalPinToBitMask(pin) \
    ((uint16_t)(1 << PIN_MAP[pin].bit_pos))

yes it does fix that issue. that results in success. again, I am not sure if this flashes correctly with that kind of LCD. I imagine it would.

shadow578 commented 11 months ago

fixed by 222eb2b in arduino repo