From a347bf433c6db593fae412cc5a538a3717a1bbc4 Mon Sep 17 00:00:00 2001 From: localhorst Date: Wed, 24 Aug 2022 16:27:51 +0200 Subject: [PATCH] display temperature alert if drive too hot --- include/reHDD.h | 3 ++- include/tui.h | 2 +- src/tui.cpp | 13 ++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/reHDD.h b/include/reHDD.h index 6b3c79d..6938d45 100644 --- a/include/reHDD.h +++ b/include/reHDD.h @@ -13,8 +13,9 @@ // Drive handling Settings #define WORSE_HOURS 19200 //mark drive if at this limit or beyond #define WORSE_POWERUP 10000 //mark drive if at this limit or beyond +#define WORSE_TEMPERATURE 55 //mark drive if at this limit or beyond #define SHRED_ITERATIONS 2U -#define FROZEN_TIMEOUT 20 //After this timeout (minutes) the drive will be marked as frozen +#define FROZEN_TIMEOUT 20 //After this timeout (minutes) the drive will be marked as frozen, if no progress #define METRIC_THRESHOLD 3L*1000L*1000L*1000L //calc shred speed with this minimum of time delta // Logger Settings diff --git a/include/tui.h b/include/tui.h index ed37805..c4595fa 100644 --- a/include/tui.h +++ b/include/tui.h @@ -61,7 +61,7 @@ private: static WINDOW *createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate); static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, string selectedTask, string optionA, string optionB); static WINDOW* createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, string sProgress); - static WINDOW* createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount); + static WINDOW* createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature); static WINDOW* createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, string sModelFamily, string sModelName, string sSerial, uint32_t u32Checksum); void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY); diff --git a/src/tui.cpp b/src/tui.cpp index 78ca451..d299bdb 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -88,10 +88,10 @@ void TUI::updateTUI(list * plistDrives, uint8_t u8SelectedEntry) bSelectedEntry = true; //mark this drive in entries list displaySelectedDrive(*it, u16StdscrX, u16StdscrY); - if((it->getPowerOnHours() >= WORSE_HOURS) || (it->getPowerCycles() >= WORSE_POWERUP) || (it->getErrorCount() > 0)) + if((it->getPowerOnHours() >= WORSE_HOURS) || (it->getPowerCycles() >= WORSE_POWERUP) || (it->getErrorCount() > 0) || (it->getTemperature() >= WORSE_TEMPERATURE)) { // smart values are bad --> show warning - smartWarning=createSmartWarning(50, 10, ((u16StdscrX)-(int)(u16StdscrX/2)+35),(int)(u16StdscrY/2)-5, it->getPath(), it->getPowerOnHours(), it->getPowerCycles(), it->getErrorCount()); + smartWarning=createSmartWarning(50, 10, ((u16StdscrX)-(int)(u16StdscrX/2)+35),(int)(u16StdscrY/2)-5, it->getPath(), it->getPowerOnHours(), it->getPowerCycles(), it->getErrorCount(), it->getTemperature()); wrefresh(smartWarning); } } @@ -582,7 +582,7 @@ void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY) } } -WINDOW* TUI::createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount) +WINDOW* TUI::createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature) { WINDOW *newWindow; newWindow = newwin(iYSize, iXSize, iYStart, iXStart); @@ -617,6 +617,13 @@ WINDOW* TUI::createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart { string sLineTmp = "S.M.A.R.T. erros detected: " + to_string(u32ErrorCount); mvwaddstr(newWindow,u16Line++, (iXSize/2)-(sLine01.size()/2), sLineTmp.c_str()); + u16Line++; + } + + if(u32Temperature >= WORSE_TEMPERATURE) + { + string sLineTmp = "Drive too hot: " + to_string(u32Temperature)+" C"; + mvwaddstr(newWindow,u16Line++, (iXSize/2)-(sLine01.size()/2), sLineTmp.c_str()); } return newWindow; } \ No newline at end of file