Convert autostart_atmillis to ShortTimer
Saves 34 bytes of flash and 1 byte of SRAM
This commit is contained in:
parent
762a5db125
commit
a1abd094dd
2 changed files with 3 additions and 4 deletions
|
@ -25,7 +25,6 @@ CardReader::CardReader()
|
|||
cardOK = false;
|
||||
saving = false;
|
||||
logging = false;
|
||||
autostart_atmillis=0;
|
||||
workDirDepth = 0;
|
||||
file_subcall_ctr=0;
|
||||
memset(workDirParents, 0, sizeof(workDirParents));
|
||||
|
@ -39,7 +38,7 @@ CardReader::CardReader()
|
|||
WRITE(SDPOWER,HIGH);
|
||||
#endif //SDPOWER
|
||||
|
||||
autostart_atmillis=_millis()+5000;
|
||||
autostart_atmillis.start(); // reset timer
|
||||
}
|
||||
|
||||
char *createFilename(char *buffer,const dir_t &p) //buffer>12characters
|
||||
|
@ -619,7 +618,7 @@ void CardReader::checkautostart(bool force)
|
|||
{
|
||||
if(!autostart_stilltocheck)
|
||||
return;
|
||||
if(autostart_atmillis<_millis())
|
||||
if(autostart_atmillis.expired(5000))
|
||||
return;
|
||||
}
|
||||
autostart_stilltocheck=false;
|
||||
|
|
|
@ -130,7 +130,7 @@ private:
|
|||
char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
|
||||
uint32_t filesize;
|
||||
//int16_t n;
|
||||
unsigned long autostart_atmillis;
|
||||
ShortTimer autostart_atmillis;
|
||||
uint32_t sdpos ;
|
||||
|
||||
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
|
||||
|
|
Loading…
Add table
Reference in a new issue