Clean up gfReset()
This commit is contained in:
parent
b2cf5b7b6c
commit
d1fd5a555f
|
|
@ -34,10 +34,10 @@ SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) {
|
||||||
//size=100B
|
//size=100B
|
||||||
bool SdFile::openFilteredGcode(SdBaseFile* dirFile, const char* path){
|
bool SdFile::openFilteredGcode(SdBaseFile* dirFile, const char* path){
|
||||||
if( open(dirFile, path, O_READ) ){
|
if( open(dirFile, path, O_READ) ){
|
||||||
gfReset(0,0);
|
|
||||||
// compute the block to start with
|
// compute the block to start with
|
||||||
if( ! gfComputeNextFileBlock() )
|
if( ! gfComputeNextFileBlock() )
|
||||||
return false;
|
return false;
|
||||||
|
gfReset();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -50,20 +50,15 @@ bool SdFile::seekSetFilteredGcode(uint32_t pos){
|
||||||
// SERIAL_PROTOCOLLN(pos);
|
// SERIAL_PROTOCOLLN(pos);
|
||||||
if(! seekSet(pos) )return false;
|
if(! seekSet(pos) )return false;
|
||||||
if(! gfComputeNextFileBlock() )return false;
|
if(! gfComputeNextFileBlock() )return false;
|
||||||
gfCachePBegin = vol_->cache()->data;
|
gfReset();
|
||||||
// reset cache read ptr to its begin
|
|
||||||
gfCacheP = gfCachePBegin + gfOffset;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//size=50B
|
//size=50B
|
||||||
void SdFile::gfReset(uint32_t blk, uint16_t ofs){
|
void SdFile::gfReset(){
|
||||||
// @@TODO clean up
|
|
||||||
gfBlock = blk;
|
|
||||||
gfOffset = ofs;
|
|
||||||
gfCachePBegin = vol_->cache()->data;
|
gfCachePBegin = vol_->cache()->data;
|
||||||
// reset cache read ptr to its begin
|
// reset cache read ptr to its begin
|
||||||
gfCacheP = gfCachePBegin;
|
gfCacheP = gfCachePBegin + gfOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FORCE_INLINE const uint8_t * find_endl(const uint8_t *p){
|
//FORCE_INLINE const uint8_t * find_endl(const uint8_t *p){
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class SdFile : public SdBaseFile/*, public Print*/ {
|
||||||
const uint8_t *gfCacheP;
|
const uint8_t *gfCacheP;
|
||||||
uint32_t gfBlock; // remember the current file block to be kept in cache - due to reuse of the memory, the block may fall out a must be read back
|
uint32_t gfBlock; // remember the current file block to be kept in cache - due to reuse of the memory, the block may fall out a must be read back
|
||||||
uint16_t gfOffset;
|
uint16_t gfOffset;
|
||||||
void gfReset(uint32_t blk, uint16_t ofs);
|
void gfReset();
|
||||||
bool gfEnsureBlock();
|
bool gfEnsureBlock();
|
||||||
bool gfComputeNextFileBlock();
|
bool gfComputeNextFileBlock();
|
||||||
void gfUpdateCurrentPosition(uint16_t inc);
|
void gfUpdateCurrentPosition(uint16_t inc);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue