Skip to content

Commit a4887b5

Browse files
authored
Merge pull request prusa3d#3467 from gudnimg/autostart_stilltocheck-optimisation
Optimise `autostart_stilltocheck` variable
2 parents 453e2f1 + 15b41e7 commit a4887b5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Firmware/cardreader.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ CardReader::CardReader()
3030
memset(workDirParents, 0, sizeof(workDirParents));
3131
presort_flag = false;
3232

33-
autostart_stilltocheck=true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
3433
lastnr=0;
3534
//power to SD reader
3635
#if SDPOWER > -1
@@ -614,14 +613,17 @@ void CardReader::write_command_no_newline(char *buf)
614613

615614
void CardReader::checkautostart(bool force)
616615
{
616+
// The SD start is delayed because otherwise the serial cannot answer
617+
// fast enough to make contact with the host software.
618+
static bool autostart_stilltocheck = true;
617619
if(!force)
618620
{
619621
if(!autostart_stilltocheck)
620622
return;
621623
if(autostart_atmillis.expired(5000))
622624
return;
623625
}
624-
autostart_stilltocheck=false;
626+
autostart_stilltocheck = false;
625627
if(!cardOK)
626628
{
627629
initsd();

Firmware/cardreader.h

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ class CardReader
133133
ShortTimer autostart_atmillis;
134134
uint32_t sdpos ;
135135

136-
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
137-
138136
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
139137

140138
bool diveSubfolder (const char *&fileName);

0 commit comments

Comments
 (0)