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.
This commit is contained in:
MaikStohn 2012-05-03 14:28:17 +02:00
parent bd1ad7c76a
commit 032df0b2c6
3 changed files with 7 additions and 5 deletions

View File

@ -300,6 +300,8 @@ void setup()
st_init(); // Initialize stepper; st_init(); // Initialize stepper;
wd_init(); wd_init();
setup_photpin(); setup_photpin();
LCD_INIT;
} }

View File

@ -134,11 +134,12 @@
char *ftostr3(const float &x); char *ftostr3(const float &x);
#define LCD_INIT lcd_init();
#define LCD_MESSAGE(x) lcd_status(x); #define LCD_MESSAGE(x) lcd_status(x);
#define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x)); #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
#define LCD_STATUS lcd_status() #define LCD_STATUS lcd_status()
#else //no lcd #else //no lcd
#define LCD_INIT
#define LCD_STATUS #define LCD_STATUS
#define LCD_MESSAGE(x) #define LCD_MESSAGE(x)
#define LCD_MESSAGEPGM(x) #define LCD_MESSAGEPGM(x)

View File

@ -99,6 +99,9 @@ FORCE_INLINE void clear()
void lcd_init() void lcd_init()
{ {
//beep(); //beep();
#ifdef ULTIPANEL
buttons_init();
#endif
byte Degree[8] = byte Degree[8] =
{ {
@ -306,10 +309,6 @@ MainMenu::MainMenu()
displayStartingRow=0; displayStartingRow=0;
activeline=0; activeline=0;
force_lcd_update=true; force_lcd_update=true;
#ifdef ULTIPANEL
buttons_init();
#endif
lcd_init();
linechanging=false; linechanging=false;
tune=false; tune=false;
} }