Reduce code size

This commit is contained in:
3d-gussner 2021-02-08 03:34:01 +01:00
parent ae48e7c3ce
commit 91c767b0f2
4 changed files with 29 additions and 50 deletions

View File

@ -17,7 +17,7 @@ extern PGM_P sPrinterName;
// Firmware version
#define FW_VERSION "3.9.3"
#define FW_COMMIT_NR 3556
#define FW_COMMIT_NR 5002
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN

View File

@ -438,8 +438,6 @@ extern void cancel_saved_printing();
//estimated time to end of the print
extern uint16_t print_time_remaining();
extern uint16_t print_time_to_change_remaining();
extern uint8_t calc_percent_done();

View File

@ -6423,7 +6423,7 @@ Sigma_Exit:
if(code_seen('C'))
{
print_time_to_change = code_value();
printf_P(_N("Time to next change in mins: %d\n"), print_time_to_change);
printf_P(_N("Change in mins: %d\n"), print_time_to_change);
}
break;
}
@ -11664,32 +11664,6 @@ void print_mesh_bed_leveling_table()
SERIAL_ECHOLN();
}
uint16_t print_time_remaining()
{
uint16_t print_t = PRINT_TIME_REMAINING_INIT;
#ifdef TMC2130
if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_remaining_normal;
else print_t = print_time_remaining_silent;
#else
print_t = print_time_remaining_normal;
#endif //TMC2130
if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
return print_t;
}
uint16_t print_time_to_change_remaining()
{
uint16_t print_t = PRINT_TIME_REMAINING_INIT;
#ifdef TMC2130
if (SilentModeMenu == SILENT_MODE_OFF) print_t = print_time_to_change;
else print_t = print_time_to_change - (print_time_remaining_normal - print_time_remaining_silent);
#else
print_t = print_time_to_change;
#endif //TMC2130
if ((print_t != PRINT_TIME_REMAINING_INIT) && (feedmultiply != 0)) print_t = 100ul * print_t / feedmultiply;
return print_t;
}
uint8_t calc_percent_done()
{
//in case that we have information from M73 gcode return percentage counted by slicer, else return percentage counted as byte_printed/filesize

View File

@ -672,30 +672,37 @@ void lcdui_print_cmd_diag(void)
void lcdui_print_time(void)
{
//if remaining print time estimation is available print it else print elapsed time
uint16_t print_t = 0;
int chars = 0;
char suff = ' ';
char suff_doubt = ' ';
if ((PRINTER_ACTIVE) && (starttime != 0))
{
uint16_t print_t = 0;
char suff = ' ';
char suff_doubt = ' ';
if(print_time_to_change != PRINT_TIME_REMAINING_INIT)
{
print_t = print_time_to_change_remaining();
suff = 'C';
if (print_time_to_change != PRINT_TIME_REMAINING_INIT)
{
print_t = print_time_to_change;
suff = 'C';
}
else
{
suff = 'R';
#ifdef TMC2130
if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT && (SilentModeMenu != SILENT_MODE_OFF))
{
print_t = print_time_remaining_silent;
}
else
#endif //TMC2130
print_t = print_time_remaining_normal;
}
if (feedmultiply != 100)
{
suff_doubt = '?';
}
else if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT)
{
print_t = print_time_remaining();
suff = 'R';
if (feedmultiply != 100)
suff_doubt = '?';
}
else if(starttime != 0)
print_t = _millis() / 60000 - starttime / 60000;
if ((PRINTER_ACTIVE) && ((print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) || (print_time_to_change != PRINT_TIME_REMAINING_INIT) || (starttime != 0)))
{
print_t = 100ul * print_t / feedmultiply;
}
if (print_t < 6000) //time<100h
chars = lcd_printf_P(_N("%c%02u:%02u%c%c"), LCD_STR_CLOCK[0], print_t / 60, print_t % 60, suff, suff_doubt);
else //time>=100h