Rename "cardOK" to "mounted"

Sync the Prusa firmware a little bit with Marlin 2.1
This commit is contained in:
gudnimg 2023-10-01 14:47:40 +00:00 committed by Guðni Már Gilbert
parent d94f263843
commit 40786a24e0
4 changed files with 19 additions and 19 deletions

View File

@ -1366,7 +1366,7 @@ void setup()
// but this times out if a blocking dialog is shown in setup(). // but this times out if a blocking dialog is shown in setup().
card.mount(); card.mount();
#ifdef DEBUG_SD_SPEED_TEST #ifdef DEBUG_SD_SPEED_TEST
if (card.cardOK) if (card.mounted)
{ {
uint8_t* buff = (uint8_t*)block_buffer; uint8_t* buff = (uint8_t*)block_buffer;
uint32_t block = 0; uint32_t block = 0;
@ -5305,7 +5305,7 @@ void process_commands()
- `S` - Index in bytes - `S` - Index in bytes
*/ */
case 26: case 26:
if(card.cardOK && code_seen('S')) { if(card.mounted && code_seen('S')) {
long index = code_value_long(); long index = code_value_long();
card.setIndex(index); card.setIndex(index);
// We don't disable interrupt during update of sdpos_atomic // We don't disable interrupt during update of sdpos_atomic
@ -5350,7 +5350,7 @@ void process_commands()
*/ */
case 30: case 30:
if (card.cardOK){ if (card.mounted){
card.closefile(); card.closefile();
card.removeFile(strchr_pointer + 4); card.removeFile(strchr_pointer + 4);
} }
@ -5380,7 +5380,7 @@ void process_commands()
if(strchr_pointer>namestartpos) if(strchr_pointer>namestartpos)
call_procedure=false; //false alert, 'P' found within filename call_procedure=false; //false alert, 'P' found within filename
if( card.cardOK ) if( card.mounted )
{ {
card.openFileReadFilteredGcode(namestartpos,!call_procedure); card.openFileReadFilteredGcode(namestartpos,!call_procedure);
if(code_seen('S')) if(code_seen('S'))

View File

@ -24,7 +24,7 @@ CardReader::CardReader()
filesize = 0; filesize = 0;
sdpos = 0; sdpos = 0;
sdprinting = false; sdprinting = false;
cardOK = false; mounted = false;
saving = false; saving = false;
logging = false; logging = false;
workDirDepth = 0; workDirDepth = 0;
@ -200,7 +200,7 @@ void CardReader::ls(ls_param params)
void CardReader::mount(bool doPresort/* = true*/) void CardReader::mount(bool doPresort/* = true*/)
{ {
cardOK = false; mounted = false;
if(root.isOpen()) if(root.isOpen())
root.close(); root.close();
#ifdef SDSLOW #ifdef SDSLOW
@ -226,12 +226,12 @@ void CardReader::mount(bool doPresort/* = true*/)
} }
else else
{ {
cardOK = true; mounted = true;
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK SERIAL_ECHOLNRPGM(_n("SD card ok"));////MSG_SD_CARD_OK
} }
if (cardOK) if (mounted)
{ {
cdroot(doPresort); cdroot(doPresort);
} }
@ -252,14 +252,14 @@ void __attribute__((noinline)) CardReader::cdroot(bool doPresort)
void CardReader::release() void CardReader::release()
{ {
sdprinting = false; sdprinting = false;
cardOK = false; mounted = false;
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNRPGM(_n("SD card released"));////MSG_SD_CARD_RELEASED SERIAL_ECHOLNRPGM(_n("SD card released"));////MSG_SD_CARD_RELEASED
} }
void CardReader::startFileprint() void CardReader::startFileprint()
{ {
if(cardOK) if(mounted)
{ {
sdprinting = true; sdprinting = true;
SetPrinterState(PrinterState::IsSDPrinting); //set printer state to hide LCD menu SetPrinterState(PrinterState::IsSDPrinting); //set printer state to hide LCD menu
@ -384,7 +384,7 @@ static const char ofSDPrinting[] PROGMEM = "SD-PRINTING";
static const char ofWritingToFile[] PROGMEM = "Writing to file: "; static const char ofWritingToFile[] PROGMEM = "Writing to file: ";
void CardReader::openFileReadFilteredGcode(const char* name, bool replace_current/* = false*/){ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_current/* = false*/){
if(!cardOK) if(!mounted)
return; return;
if(file.isOpen()){ //replacing current file by new file, or subfile call if(file.isOpen()){ //replacing current file by new file, or subfile call
@ -449,7 +449,7 @@ void CardReader::openFileReadFilteredGcode(const char* name, bool replace_curren
void CardReader::openFileWrite(const char* name) void CardReader::openFileWrite(const char* name)
{ {
if(!cardOK) if(!mounted)
return; return;
if(file.isOpen()){ //replacing current file by new file, or subfile call if(file.isOpen()){ //replacing current file by new file, or subfile call
#if 0 #if 0
@ -513,7 +513,7 @@ void CardReader::openFileWrite(const char* name)
void CardReader::removeFile(const char* name) void CardReader::removeFile(const char* name)
{ {
if(!cardOK) return; if(!mounted) return;
file.close(); file.close();
sdprinting = false; sdprinting = false;
@ -614,10 +614,10 @@ void CardReader::checkautostart(bool force)
return; return;
} }
autostart_stilltocheck = false; autostart_stilltocheck = false;
if(!cardOK) if(!mounted)
{ {
mount(); mount();
if(!cardOK) //fail if(!mounted) //fail
return; return;
} }

View File

@ -91,7 +91,7 @@ public:
bool saving; bool saving;
bool logging; bool logging;
bool sdprinting ; bool sdprinting ;
bool cardOK ; bool mounted;
char filename[FILENAME_LENGTH]; char filename[FILENAME_LENGTH];
// There are scenarios when simple modification time is not enough (on MS Windows) // There are scenarios when simple modification time is not enough (on MS Windows)
// Therefore these timestamps hold the most recent one of creation/modification date/times // Therefore these timestamps hold the most recent one of creation/modification date/times

View File

@ -5194,7 +5194,7 @@ static void lcd_main_menu()
// Menu item for reprint // Menu item for reprint
if(!printer_active() && (heating_status == HeatingStatus::NO_HEATING)) { if(!printer_active() && (heating_status == HeatingStatus::NO_HEATING)) {
if ((GetPrinterState() == PrinterState::SDPrintingFinished) && card.cardOK) { if ((GetPrinterState() == PrinterState::SDPrintingFinished) && card.mounted) {
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom); MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom);
} else if ((GetPrinterState() == PrinterState::HostPrintingFinished) && M79_timer_get_status()) { } else if ((GetPrinterState() == PrinterState::HostPrintingFinished) && M79_timer_get_status()) {
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_send_action_start); MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_send_action_start);
@ -5259,7 +5259,7 @@ static void lcd_main_menu()
) )
{ {
#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code #ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code
if (card.cardOK || lcd_commands_type != LcdCommands::Idle) { if (card.mounted || lcd_commands_type != LcdCommands::Idle) {
if (!card.isFileOpen()) { if (!card.isFileOpen()) {
if (!usb_timer.running() && (lcd_commands_type == LcdCommands::Idle)) { if (!usb_timer.running() && (lcd_commands_type == LcdCommands::Idle)) {
bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function
@ -7307,7 +7307,7 @@ void menu_lcd_lcdupdate_func(void)
backlight_wake(); backlight_wake();
if (lcd_oldcardstatus) if (lcd_oldcardstatus)
{ {
if (!card.cardOK) if (!card.mounted)
{ {
card.mount(false); //delay the sorting to the sd menu. Otherwise, removing the SD card while sorting will not menu_back() card.mount(false); //delay the sorting to the sd menu. Otherwise, removing the SD card while sorting will not menu_back()
card.presort_flag = true; //force sorting of the SD menu card.presort_flag = true; //force sorting of the SD menu