MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.18k stars 19.22k forks source link

Compilation warning with #define U8GLIB_SSD1306 #4614

Closed ghost closed 8 years ago

ghost commented 8 years ago

When #define U8GLIB_SSD1306 is enabled with newest RCBugFix, it occurs compilation error.

error message ``` AppData\Local\Temp\build6674025c445f92d0b07185e4e4080804.tmp\sketch\ultralcd.cpp: In function 'void lcd_update()': ultralcd.cpp:2699: error: 'currentScreen' was not declared in this scope (*currentScreen)(); ^ AppData\Local\Temp\build6674025c445f92d0b07185e4e4080804.tmp\sketch\ultralcd.cpp:426:13: warning: 'void lcd_status_screen()' defined but not used [-Wunused-function] static void lcd_status_screen() { ^ exit status 1 'currentScreen' was not declared in this scope ```
thinkyhead commented 8 years ago

I think this might be the right way to fix it…

#if ENABLED(DOGLCD)  // Changes due to different driver architecture of the DOGM display
  static int8_t dot_color = 0;
  dot_color = 1 - dot_color;
  u8g.firstPage();
  do {
    lcd_setFont(FONT_MENU);
    u8g.setPrintPos(125, 0);
    u8g.setColorIndex(dot_color); // Set color for the alive dot
    u8g.drawPixel(127, 63); // draw alive dot
    u8g.setColorIndex(1); // black on white
-   (*currentScreen)();
+   #if ENABLED(ULTIPANEL)
+     (*currentScreen)();
+   #else
+     lcd_status_screen();
+   #endif
  } while (u8g.nextPage());
#elif ENABLED(ULTIPANEL)
  (*currentScreen)();
#else
  lcd_status_screen();
#endif
ghost commented 8 years ago

I got new compilation warnings.

new warning message ``` AppData\Local\Temp\build6674025c445f92d0b07185e4e4080804.tmp\sketch\ultralcd_impl_DOGM.h:513:13: warning: 'lcd_implementation_drawmenu_generic' defined but not used [-Wunused-function] static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { ^ AppData\Local\Temp\build6674025c445f92d0b07185e4e4080804.tmp\sketch\ultralcd_impl_DOGM.h:531:13: warning: '_drawmenu_setting_edit_generic' defined but not used [-Wunused-function] static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) { ^ ```

I'm not sure that these are problem or not, but compilation error and warning in my previous comment is gone. Thanks for the fixing.

thinkyhead commented 8 years ago

It looks like they just aren't used if ULTIPANEL isn't set. So it's another patch I need to make.

zenmetsu commented 8 years ago

XD @thinkyhead i'd kiss ya if I could. I am working on adding my SSD1351 SPI OLED to the code and ran right into this issue. Your suggested code change came just seconds after I needed it. It works brilliantly.

boelle commented 8 years ago

@esenapaj does it now compile without error?

ghost commented 8 years ago

Yes it is, compilation error was fixed by commit 132322e4d94cf776ea3d42af68406bf7b012120a. But new compilation warning was occured, and it looks like that @thinkyhead work in preparation for another patch, therefore I reopened this Issue.

boelle commented 8 years ago

maybe close this one and open a new on with the new warning?

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.