Browse Source

Moved LCD initialization out of constructor

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.
MaikStohn 12 years ago
parent
commit
032df0b2c6
3 changed files with 7 additions and 5 deletions
  1. 2
    0
      Marlin/Marlin.pde
  2. 2
    1
      Marlin/ultralcd.h
  3. 3
    4
      Marlin/ultralcd.pde

+ 2
- 0
Marlin/Marlin.pde View File

@@ -300,6 +300,8 @@ void setup()
300 300
   st_init();    // Initialize stepper;
301 301
   wd_init();
302 302
   setup_photpin();
303
+  
304
+  LCD_INIT;
303 305
 }
304 306
 
305 307
 

+ 2
- 1
Marlin/ultralcd.h View File

@@ -134,11 +134,12 @@
134 134
   char *ftostr3(const float &x);
135 135
 
136 136
 
137
-
137
+  #define LCD_INIT lcd_init();
138 138
   #define LCD_MESSAGE(x) lcd_status(x);
139 139
   #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
140 140
   #define LCD_STATUS lcd_status()
141 141
 #else //no lcd
142
+  #define LCD_INIT
142 143
   #define LCD_STATUS
143 144
   #define LCD_MESSAGE(x)
144 145
   #define LCD_MESSAGEPGM(x)

+ 3
- 4
Marlin/ultralcd.pde View File

@@ -99,6 +99,9 @@ FORCE_INLINE void clear()
99 99
 void lcd_init()
100 100
 {
101 101
   //beep();
102
+  #ifdef ULTIPANEL
103
+    buttons_init();
104
+  #endif
102 105
   
103 106
   byte Degree[8] =
104 107
   {
@@ -306,10 +309,6 @@ MainMenu::MainMenu()
306 309
   displayStartingRow=0;
307 310
   activeline=0;
308 311
   force_lcd_update=true;
309
-  #ifdef ULTIPANEL
310
-    buttons_init();
311
-  #endif
312
-  lcd_init();
313 312
   linechanging=false;
314 313
   tune=false;
315 314
 }

Loading…
Cancel
Save