diff --git a/include/reHDD.h b/include/reHDD.h index 44c260d..fe7a087 100644 --- a/include/reHDD.h +++ b/include/reHDD.h @@ -8,7 +8,7 @@ #ifndef REHDD_H_ #define REHDD_H_ -//#define DRYRUN +#define DRYRUN #define WORSE_HOURS 19200 //mark drive if at this limit or beyond #define WORSE_POWERUP 4000 //mark drive if at this limit or beyond @@ -72,9 +72,7 @@ private: static void handleEnter(); static void handleESC(); static void handleAbort(); - static void checkShredComplete(vector * pvecDrives); static Drive* getSelectedDrive(); - }; diff --git a/src/reHDD.cpp b/src/reHDD.cpp index 47f12c5..5e97f98 100644 --- a/src/reHDD.cpp +++ b/src/reHDD.cpp @@ -75,8 +75,6 @@ void reHDD::app_logic(void) { char dummy; read (fdShredInformPipe[0],&dummy,1); - - checkShredComplete(&vecDrives); } ui->updateTUI(&vecDrives, u8SelectedEntry); } //endless loop @@ -457,17 +455,5 @@ void reHDD::handleAbort() } } -void reHDD::checkShredComplete(vector * pvecDrives) -{ - vector ::iterator it; - for (it = pvecDrives->begin(); it != pvecDrives->end(); ++it) - { - if(it->getTaskPercentage() == 100 ) - { - it->bWasShredded = true; //mark this drive as shredded - it->setTaskPercentage(0); //reset for an other shredding - it->state = Drive::NONE; //reset for an other task - } - } -} + diff --git a/src/shred/shred.cpp b/src/shred/shred.cpp index d896f43..8abbeb1 100644 --- a/src/shred/shred.cpp +++ b/src/shred/shred.cpp @@ -34,16 +34,16 @@ static double d32Percent; void Shred::shredDrive(Drive* drive, int* ipSignalFd) { #ifdef DRYRUN - for(int i = 0; i<=10; i++) + for(int i = 0; i<=100; i++) { if(drive->state != Drive::SHRED_ACTIVE) { return; } - drive->setTaskPercentage(i*10); + drive->setTaskPercentage(i+0.05); write(*ipSignalFd, "A",1); - sleep(2); + usleep(20000); } #endif @@ -152,6 +152,7 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd) if(drive->state != Drive::SHRED_ACTIVE) { + drive->setTaskPercentage(0); goto _return; } @@ -267,14 +268,13 @@ void Shred::shredDrive(Drive* drive, int* ipSignalFd) _return: optind++; close(rsf); - +#endif if(drive->state == Drive::SHRED_ACTIVE) { drive->bWasShredded = true; + drive->state= Drive::NONE; + drive->setTaskPercentage(0); } - - -#endif } #ifndef DRYRUN diff --git a/src/tui.cpp b/src/tui.cpp index 4dd0c29..439b654 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -88,7 +88,7 @@ void TUI::updateTUI(vector * pvecDrives, uint8_t u8SelectedEntry) stringstream stream; switch (it->state) - { + { case Drive::SHRED_ACTIVE: stream << fixed << setprecision(2) << (it->getTaskPercentage());