optimisation: cleanup print statistics
Change in memory: Flash: -104 bytes SRAM: 0 bytes
This commit is contained in:
parent
b9717b03e7
commit
768319f1e7
|
|
@ -312,8 +312,12 @@ extern ShortTimer usb_timer;
|
|||
extern bool processing_tcode;
|
||||
extern bool homing_flag;
|
||||
extern bool loading_flag;
|
||||
extern unsigned long total_filament_used;
|
||||
void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time);
|
||||
extern uint32_t total_filament_used; // mm/100 or 10um
|
||||
|
||||
/// @brief Save print statistics to EEPROM
|
||||
/// @param _total_filament_used has unit mm/100 or 10um
|
||||
/// @param _total_print_time has unit minutes, for example 123 minutes
|
||||
void save_statistics(uint32_t _total_filament_used, uint32_t _total_print_time);
|
||||
extern uint8_t heating_status_counter;
|
||||
|
||||
extern bool fan_state[2];
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static LongTimer crashDetTimer;
|
|||
|
||||
bool mesh_bed_leveling_flag = false;
|
||||
|
||||
unsigned long total_filament_used;
|
||||
uint32_t total_filament_used;
|
||||
HeatingStatus heating_status;
|
||||
uint8_t heating_status_counter;
|
||||
bool loading_flag = false;
|
||||
|
|
@ -9691,11 +9691,11 @@ void setPwmFrequency(uint8_t pin, int val)
|
|||
}
|
||||
#endif //FAST_PWM_FAN
|
||||
|
||||
void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time) { //_total_filament_used unit: mm/100; print time in s
|
||||
uint32_t _previous_filament = eeprom_init_default_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); //_previous_filament unit: cm
|
||||
void save_statistics(uint32_t _total_filament_used, uint32_t _total_print_time) {
|
||||
uint32_t _previous_filament = eeprom_init_default_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); //_previous_filament unit: meter
|
||||
uint32_t _previous_time = eeprom_init_default_dword((uint32_t *)EEPROM_TOTALTIME, 0); //_previous_time unit: min
|
||||
|
||||
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, _previous_time + (_total_print_time / 60)); // EEPROM_TOTALTIME unit: min
|
||||
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, _previous_time + _total_print_time); // EEPROM_TOTALTIME unit: min
|
||||
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, _previous_filament + (_total_filament_used / 1000));
|
||||
|
||||
total_filament_used = 0;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ static void prusa_stat_printinfo() {
|
|||
SERIAL_ECHO(card.longFilename[0] ? card.longFilename : card.filename);
|
||||
SERIAL_ECHOPGM("][TIM:");
|
||||
if (starttime != 0) {
|
||||
SERIAL_ECHO(_millis() / 1000 - starttime / 1000);
|
||||
SERIAL_ECHO((_millis() - starttime) / 1000);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO(0);
|
||||
|
|
|
|||
|
|
@ -640,11 +640,11 @@ void get_command()
|
|||
SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED
|
||||
stoptime=_millis();
|
||||
char time[30];
|
||||
unsigned long t=(stoptime-starttime-pause_time)/1000;
|
||||
uint32_t t = (stoptime-starttime-pause_time) / 60000;
|
||||
pause_time = 0;
|
||||
int hours, minutes;
|
||||
minutes=(t/60)%60;
|
||||
hours=t/60/60;
|
||||
minutes = t % 60;
|
||||
hours = t / 60;
|
||||
save_statistics(total_filament_used, t);
|
||||
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
|
||||
SERIAL_ECHO_START;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| ^ | ^ | ^ | fah 250 | ^ | needs XYZ calibration | ^ | ^
|
||||
| ^ | ^ | ^ | 00h 0 | ^ | Unknown (legacy) | ^ | ^
|
||||
| 0x0FF5 4085 | uint16 | EEPROM_BABYSTEP_Z0 | ??? | ff ffh 65535 | Babystep for Z ??? | ??? | D3 Ax0ff5 C2
|
||||
| 0x0FF1 4081 | unint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in meters | ??? | D3 Ax0ff1 C4
|
||||
| 0x0FED 4077 | unint32 | EEPROM_TOTALTIME | ??? | 00 00 00 00h 0 __S/P__| Total print time | ??? | D3 Ax0fed C4
|
||||
| 0x0FF1 4081 | uint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in meters | ??? | D3 Ax0ff1 C4
|
||||
| 0x0FED 4077 | uint32 | EEPROM_TOTALTIME | ??? | 00 00 00 00h 0 __S/P__| Total print time in minutes | ??? | D3 Ax0fed C4
|
||||
| 0x0FE5 4069 | float | EEPROM_BED_CALIBRATION_CENTER | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fe5 C8
|
||||
| 0x0FDD 4061 | float | EEPROM_BED_CALIBRATION_VEC_X | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fdd C8
|
||||
| 0x0FD5 4053 | float | EEPROM_BED_CALIBRATION_VEC_Y | ??? | ff ff ff ffh | ??? | ??? | D3 Ax0fd5 C8
|
||||
|
|
|
|||
|
|
@ -498,11 +498,11 @@ void lcdui_print_time(void)
|
|||
print_t = print_tr;
|
||||
suff = 'R';
|
||||
} else
|
||||
print_t = _millis() / 60000 - starttime / 60000;
|
||||
print_t = (_millis() - starttime) / 60000;
|
||||
|
||||
if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) {
|
||||
suff_doubt = '?';
|
||||
print_t = 100ul * print_t / feedmultiply;
|
||||
print_t = (100 * print_t) / feedmultiply;
|
||||
}
|
||||
|
||||
if (print_t < 6000) //time<100h
|
||||
|
|
@ -2346,8 +2346,8 @@ void lcd_menu_statistics()
|
|||
}
|
||||
else
|
||||
{
|
||||
unsigned long _filament = eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED);
|
||||
unsigned long _time = eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME); //in minutes
|
||||
uint32_t _filament = eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED); // in meters
|
||||
uint32_t _time = eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME); // in minutes
|
||||
uint8_t _hours, _minutes;
|
||||
uint32_t _days;
|
||||
float _filament_m = (float)_filament/100;
|
||||
|
|
@ -5672,7 +5672,9 @@ void lcd_print_stop_finish()
|
|||
{
|
||||
// save printing time
|
||||
stoptime = _millis();
|
||||
unsigned long t = (stoptime - starttime - pause_time) / 1000; //time in s
|
||||
|
||||
// Convert the time from ms to minutes, divide by 60 * 1000
|
||||
uint32_t t = (stoptime - starttime - pause_time) / 60000;
|
||||
save_statistics(total_filament_used, t);
|
||||
|
||||
// lift Z
|
||||
|
|
|
|||
Loading…
Reference in New Issue