mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 22:15:41 +00:00
Added temperature to drive selection window
Also removed 1. 2. etc from drive selection to reduce the line length. Also removed the space between > and [, ie "> [wipe]" becomes ">[wipe]" These changes remove 3 characters and help to reduce the affect of the additional temperature field [30C] which add 5 characters. Therefore the line length overall, increased by 5-3 = 2 characters. This helps to reduce line wrapping on 80 character terminals, when the drive model length exceeds 24 characters.
This commit is contained in:
@@ -299,7 +299,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
|
||||
{
|
||||
snprintf( next_device->device_label,
|
||||
NWIPE_DEVICE_LABEL_LENGTH,
|
||||
"%s %s (%s) %s/%s",
|
||||
"%s %s [%s] %s/%s",
|
||||
next_device->device_name,
|
||||
next_device->device_type_str,
|
||||
next_device->device_size_text,
|
||||
@@ -310,7 +310,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
|
||||
{
|
||||
snprintf( next_device->device_label,
|
||||
NWIPE_DEVICE_LABEL_LENGTH,
|
||||
"%s %s (%s) %s",
|
||||
"%s %s [%s] %s",
|
||||
next_device->device_name,
|
||||
next_device->device_type_str,
|
||||
next_device->device_size_text,
|
||||
|
||||
184
src/gui.c
184
src/gui.c
@@ -727,30 +727,30 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
{
|
||||
case NWIPE_SELECT_TRUE:
|
||||
|
||||
wprintw( main_window, " [wipe] %i. %s", ( i + offset + 1 ), c[i + offset]->device_label );
|
||||
wprintw( main_window, "[wipe] %s ", c[i + offset]->device_label );
|
||||
break;
|
||||
|
||||
case NWIPE_SELECT_FALSE:
|
||||
/* Print an element that is not selected. */
|
||||
wprintw( main_window, " [ ] %i. %s", ( i + offset + 1 ), c[i + offset]->device_label );
|
||||
wprintw( main_window, "[ ] %s ", c[i + offset]->device_label );
|
||||
break;
|
||||
|
||||
case NWIPE_SELECT_TRUE_PARENT:
|
||||
|
||||
/* This element will be wiped when its parent is wiped. */
|
||||
wprintw( main_window, " [****] %i. %s", ( i + offset + 1 ), c[i + offset]->device_label );
|
||||
wprintw( main_window, "[****] %s ", c[i + offset]->device_label );
|
||||
break;
|
||||
|
||||
case NWIPE_SELECT_FALSE_CHILD:
|
||||
|
||||
/* We can't wipe this element because it has a child that is being wiped. */
|
||||
wprintw( main_window, " [----] %i. %s", ( i + offset + 1 ), c[i + offset]->device_label );
|
||||
wprintw( main_window, "[----] %s ", c[i + offset]->device_label );
|
||||
break;
|
||||
|
||||
case NWIPE_SELECT_DISABLED:
|
||||
|
||||
/* We don't know how to wipe this device. (Iomega Zip drives.) */
|
||||
wprintw( main_window, " [????] %s", "Unrecognized Device" );
|
||||
wprintw( main_window, "[????] %s ", "Unrecognized Device" );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -759,6 +759,8 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
|
||||
break;
|
||||
|
||||
} /* switch select */
|
||||
|
||||
wprintw_temperature( c[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2714,87 +2716,8 @@ void* nwipe_gui_status( void* ptr )
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the current temperature, if available */
|
||||
if( c[i]->temp1_input != 1000000 )
|
||||
{
|
||||
/* if drive temperature has exceeded critical continuous running
|
||||
* temperature && critical value is valid
|
||||
*/
|
||||
if( c[i]->temp1_input >= c[i]->temp1_crit && c[i]->temp1_crit != 1000000 )
|
||||
{
|
||||
temp1_flash( c[i] );
|
||||
|
||||
if( c[i]->temp1_flash_rate_status == 0 )
|
||||
{
|
||||
/* blue on blue */
|
||||
wattron( main_window, COLOR_PAIR( 12 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 12 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* red on blue */
|
||||
wattron( main_window, COLOR_PAIR( 3 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 3 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature has exceeded maximum continuous running temperature && max value is
|
||||
* valid */
|
||||
if( c[i]->temp1_input >= c[i]->temp1_max && c[i]->temp1_max != 1000000 )
|
||||
{
|
||||
/* red on blue */
|
||||
wattron( main_window, COLOR_PAIR( 3 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 3 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature is below the critical temperature && critical value is valid */
|
||||
if( c[i]->temp1_input <= c[i]->temp1_lcrit && c[i]->temp1_lcrit != 1000000 )
|
||||
{
|
||||
temp1_flash( c[i] );
|
||||
if( c[i]->temp1_flash_rate_status == 0 )
|
||||
{
|
||||
/* blue on blue */
|
||||
wattron( main_window, COLOR_PAIR( 12 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 12 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* black on blue */
|
||||
wattron( main_window, COLOR_PAIR( 11 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 11 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature is below the minimum continuous running temperature && minimum
|
||||
* value is valid */
|
||||
if( c[i]->temp1_input <= c[i]->temp1_min && c[i]->temp1_min != 1000000 )
|
||||
{
|
||||
/* black on blue */
|
||||
wattron( main_window, COLOR_PAIR( 11 ) );
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 11 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Default white on blue */
|
||||
wprintw( main_window, "[%dC] ", c[i]->temp1_input );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wprintw( main_window, "[--C] " );
|
||||
}
|
||||
/* print the temperature to the screen */
|
||||
wprintw_temperature( c[i] );
|
||||
|
||||
/* Determine throughput nomenclature for this drive and output drives throughput to GUI */
|
||||
Determine_C_B_nomenclature( c[i]->throughput, nomenclature_result_str, NOMENCLATURE_RESULT_STR_SIZE );
|
||||
@@ -3102,3 +3025,92 @@ void temp1_flash( nwipe_context_t* c )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wprintw_temperature( nwipe_context_t* c )
|
||||
{
|
||||
/* If available, print the current temperature. This function determines
|
||||
* whether the temperature should be printed as white, solid red, flashing red
|
||||
* solid black or flashing black and then prints it to the main_window.
|
||||
*/
|
||||
if( c->temp1_input != 1000000 )
|
||||
{
|
||||
/* if drive temperature has exceeded critical continuous running
|
||||
* temperature && critical value is valid
|
||||
*/
|
||||
if( c->temp1_input >= c->temp1_crit && c->temp1_crit != 1000000 )
|
||||
{
|
||||
temp1_flash( c );
|
||||
|
||||
if( c->temp1_flash_rate_status == 0 )
|
||||
{
|
||||
/* blue on blue */
|
||||
wattron( main_window, COLOR_PAIR( 12 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 12 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* red on blue */
|
||||
wattron( main_window, COLOR_PAIR( 3 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 3 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature has exceeded maximum continuous running
|
||||
* temperature && max value is valid
|
||||
*/
|
||||
if( c->temp1_input >= c->temp1_max && c->temp1_max != 1000000 )
|
||||
{
|
||||
/* red on blue */
|
||||
wattron( main_window, COLOR_PAIR( 3 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 3 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature is below the critical temperature && critical value is valid */
|
||||
if( c->temp1_input <= c->temp1_lcrit && c->temp1_lcrit != 1000000 )
|
||||
{
|
||||
temp1_flash( c );
|
||||
if( c->temp1_flash_rate_status == 0 )
|
||||
{
|
||||
/* blue on blue */
|
||||
wattron( main_window, COLOR_PAIR( 12 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 12 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* black on blue */
|
||||
wattron( main_window, COLOR_PAIR( 11 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 11 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if drive temperature is below the minimum continuous running temperature && minimum
|
||||
* value is valid */
|
||||
if( c->temp1_input <= c->temp1_min && c->temp1_min != 1000000 )
|
||||
{
|
||||
/* black on blue */
|
||||
wattron( main_window, COLOR_PAIR( 11 ) );
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
wattroff( main_window, COLOR_PAIR( 11 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Default white on blue */
|
||||
wprintw( main_window, "[%dC] ", c->temp1_input );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wprintw( main_window, "[--C] " );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ void nwipe_gui_verify( void ); // Change the verify option.
|
||||
void nwipe_gui_noblank( void ); // Change the noblank option.
|
||||
int spinner( nwipe_context_t** ptr, int ); // Return the next spinner character
|
||||
void temp1_flash( nwipe_context_t* ); // toggles term1_flash_status, which flashes the temperature
|
||||
void wprintw_temperature( nwipe_context_t* );
|
||||
|
||||
int compute_stats( void* ptr );
|
||||
void nwipe_update_speedring( nwipe_speedring_t* speedring, u64 speedring_done, time_t speedring_now );
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* used by configure to dynamically assign those values
|
||||
* to documentation files.
|
||||
*/
|
||||
const char* version_string = "0.32.003";
|
||||
const char* version_string = "0.32.004";
|
||||
const char* program_name = "nwipe";
|
||||
const char* author_name = "Martijn van Brummelen";
|
||||
const char* email_address = "git@brumit.nl";
|
||||
@@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
|
||||
FOR A PARTICULAR PURPOSE.\n";
|
||||
const char* banner = "nwipe 0.32.003";
|
||||
const char* banner = "nwipe 0.32.004";
|
||||
|
||||
Reference in New Issue
Block a user