chiark / gitweb /
Moved LCD initialization out of constructor
authorMaikStohn <git@stohn.de>
Thu, 3 May 2012 12:28:17 +0000 (14:28 +0200)
committerMaikStohn <git@stohn.de>
Thu, 3 May 2012 12:28:17 +0000 (14:28 +0200)
Since the class "MainMenu" was used within a static variable the
initialization of the object (constructor call) was done before Arduino
library startup. It always caused a crash when using AVRStudio with
JTAG debugger (caused from calling the LCD initialization / the lot of
I/O work / the stack used during this calls). By moving the LCD_INIT
out of the constructor and using an explicit call inside of Arduino
setup() implementation immediately fixed all problems and the JTAG
debugger runs fine.

Marlin/Marlin.pde
Marlin/ultralcd.h
Marlin/ultralcd.pde

index 2facb9429cfafbbeeefda0fd4da3193d87c7c1fd..c9cff67de0009032f61d43d6210436b6dcaa70d0 100644 (file)
@@ -300,6 +300,8 @@ void setup()
   st_init();    // Initialize stepper;
   wd_init();
   setup_photpin();
+  
+  LCD_INIT;
 }
 
 
index 253149cbba5804424d703e0fa46fa7b6833933de..39d262222e35297709edd3e5ca13af7f548f71cc 100644 (file)
   char *ftostr3(const float &x);
 
 
-
+  #define LCD_INIT lcd_init();
   #define LCD_MESSAGE(x) lcd_status(x);
   #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
   #define LCD_STATUS lcd_status()
 #else //no lcd
+  #define LCD_INIT
   #define LCD_STATUS
   #define LCD_MESSAGE(x)
   #define LCD_MESSAGEPGM(x)
index a10fbb342177fe96ec517bab915fd78ab9079265..9124022944ddfc8c07de915adcceb51dc2836a65 100644 (file)
@@ -99,6 +99,9 @@ FORCE_INLINE void clear()
 void lcd_init()
 {
   //beep();
+  #ifdef ULTIPANEL
+    buttons_init();
+  #endif
   
   byte Degree[8] =
   {
@@ -306,10 +309,6 @@ MainMenu::MainMenu()
   displayStartingRow=0;
   activeline=0;
   force_lcd_update=true;
-  #ifdef ULTIPANEL
-    buttons_init();
-  #endif
-  lcd_init();
   linechanging=false;
   tune=false;
 }