SDCARDINSERTED is always defined, and thus we do not need the #ifdefs.

This commit is contained in:
daid303 2012-11-12 09:16:27 +01:00
parent 57834776ad
commit f4a89ec776

View File

@ -2295,11 +2295,7 @@ void MainMenu::showSD()
// if(force_lcd_update) // if(force_lcd_update)
// { // {
// lcd.setCursor(0,line); // lcd.setCursor(0,line);
// #ifdef CARDINSERTED
// if(CARDINSERTED) // if(CARDINSERTED)
// #else
// if(true)
// #endif
// { // {
// LCD_PRINT_PGM(" \004Refresh"); // LCD_PRINT_PGM(" \004Refresh");
// } // }
@ -2455,11 +2451,7 @@ void MainMenu::showMainMenu()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line); lcd.setCursor(0,line);
#ifdef CARDINSERTED if(CARDINSERTED)
if(CARDINSERTED)
#else
if(true)
#endif
{ {
if(card.sdprinting) if(card.sdprinting)
LCD_PRINT_PGM(MSG_STOP_PRINT); LCD_PRINT_PGM(MSG_STOP_PRINT);
@ -2471,10 +2463,7 @@ void MainMenu::showMainMenu()
LCD_PRINT_PGM(MSG_NO_CARD); LCD_PRINT_PGM(MSG_NO_CARD);
} }
} }
#ifdef CARDINSERTED if(CARDINSERTED&&(activeline==line)&&CLICKED)
if(CARDINSERTED)
#endif
if((activeline==line)&&CLICKED)
{ {
card.printingHasFinished(); card.printingHasFinished();
BLOCK; BLOCK;
@ -2487,41 +2476,34 @@ void MainMenu::showMainMenu()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line); lcd.setCursor(0,line);
#ifdef CARDINSERTED
if(CARDINSERTED) if(CARDINSERTED)
#else
if(true)
#endif
{
if(card.sdprinting)
LCD_PRINT_PGM(MSG_PAUSE_PRINT);
else
LCD_PRINT_PGM(MSG_RESUME_PRINT);
}
else
{
//LCD_PRINT_PGM(MSG_NO_CARD);
}
}
#ifdef CARDINSERTED
if(CARDINSERTED)
#endif
if((activeline==line) && CLICKED)
{ {
if(card.sdprinting) if(card.sdprinting)
{ LCD_PRINT_PGM(MSG_PAUSE_PRINT);
card.pauseSDPrint();
beepshort();
status = Main_Status;
}
else else
{ LCD_PRINT_PGM(MSG_RESUME_PRINT);
card.startFileprint();
starttime=millis();
beepshort();
status = Main_Status;
}
} }
else
{
//LCD_PRINT_PGM(MSG_NO_CARD);
}
}
if(CARDINSERTED && (activeline==line) && CLICKED)
{
if(card.sdprinting)
{
card.pauseSDPrint();
beepshort();
status = Main_Status;
}
else
{
card.startFileprint();
starttime=millis();
beepshort();
status = Main_Status;
}
}
}break; }break;
#else #else
case ItemM_file: case ItemM_file:
@ -2550,8 +2532,9 @@ void MainMenu::update()
{ {
static MainStatus oldstatus=Main_Menu; //init automatically causes foce_lcd_update=true static MainStatus oldstatus=Main_Menu; //init automatically causes foce_lcd_update=true
static unsigned long timeoutToStatus=0; static unsigned long timeoutToStatus=0;
static bool oldcardstatus=false; #if (SDCARDDETECT > -1)
#ifdef CARDINSERTED //This code is only relivant if you have an SDcard detect pin.
static bool oldcardstatus=false;
if((CARDINSERTED != oldcardstatus)) if((CARDINSERTED != oldcardstatus))
{ {
force_lcd_update=true; force_lcd_update=true;