New ML support - lcd optimalization - lcd_menu_statistics
+fix LiquidCrystal_Prusa/createChar
This commit is contained in:
parent
80db01e48e
commit
30a7530b47
@ -344,9 +344,8 @@ void LiquidCrystal_Prusa::noAutoscroll(void) {
|
|||||||
void LiquidCrystal_Prusa::createChar(uint8_t location, uint8_t charmap[]) {
|
void LiquidCrystal_Prusa::createChar(uint8_t location, uint8_t charmap[]) {
|
||||||
location &= 0x7; // we only have 8 locations 0-7
|
location &= 0x7; // we only have 8 locations 0-7
|
||||||
command(LCD_SETCGRAMADDR | (location << 3));
|
command(LCD_SETCGRAMADDR | (location << 3));
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++)
|
||||||
write(charmap[i]);
|
send(charmap[i], HIGH);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********** mid level commands, for sending data/cmds */
|
/*********** mid level commands, for sending data/cmds */
|
||||||
|
@ -1564,7 +1564,7 @@ static void lcd_menu_fails_stats_total()
|
|||||||
uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
|
uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
|
||||||
uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT);
|
uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT);
|
||||||
uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT);
|
uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT);
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(0,0) "Total failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
lcd_printf_P(PSTR(ESC_H(0,0) "Total failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
@ -1584,7 +1584,7 @@ static void lcd_menu_fails_stats_print()
|
|||||||
uint8_t filam = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
|
uint8_t filam = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
|
||||||
uint8_t crashX = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X);
|
uint8_t crashX = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X);
|
||||||
uint8_t crashY = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y);
|
uint8_t crashY = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y);
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY);
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
@ -1626,7 +1626,7 @@ static void lcd_menu_fails_stats()
|
|||||||
{
|
{
|
||||||
uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
|
uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT);
|
||||||
uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
|
uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT);
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Filam. runouts %-3d" ESC_H(0,2) "Total failures" ESC_H(1,3) "Filam. runouts %-3d"), filamentLast, filamentTotal);
|
lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Filam. runouts %-3d" ESC_H(0,2) "Total failures" ESC_H(1,3) "Filam. runouts %-3d"), filamentLast, filamentTotal);
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
menu_action_back();
|
menu_action_back();
|
||||||
@ -1645,7 +1645,7 @@ extern char* __malloc_heap_end;
|
|||||||
static void lcd_menu_debug()
|
static void lcd_menu_debug()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_STACK_MONITOR
|
#ifdef DEBUG_STACK_MONITOR
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(1,1) "RAM statistics" ESC_H(5,1) "SP_min: 0x%04x" ESC_H(1,2) "heap_start: 0x%04x" ESC_H(3,3) "heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end);
|
lcd_printf_P(PSTR(ESC_H(1,1) "RAM statistics" ESC_H(5,1) "SP_min: 0x%04x" ESC_H(1,2) "heap_start: 0x%04x" ESC_H(3,3) "heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end);
|
||||||
#endif //DEBUG_STACK_MONITOR
|
#endif //DEBUG_STACK_MONITOR
|
||||||
|
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
@ -1658,11 +1658,11 @@ static void lcd_menu_debug()
|
|||||||
|
|
||||||
static void lcd_menu_temperatures()
|
static void lcd_menu_temperatures()
|
||||||
{
|
{
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(1,0) "Nozzle: %d%c" ESC_H(1,1) "Bed: %d%c"), (int)current_temperature[0], '\x01', (int)current_temperature_bed, '\x01');
|
lcd_printf_P(PSTR(ESC_H(1,0) "Nozzle: %d%c" ESC_H(1,1) "Bed: %d%c"), (int)current_temperature[0], '\x01', (int)current_temperature_bed, '\x01');
|
||||||
#ifdef AMBIENT_THERMISTOR
|
#ifdef AMBIENT_THERMISTOR
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(1,2) "Ambient: %d%c" ESC_H(1,3) "PINDA: %d%c"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01');
|
lcd_printf_P(PSTR(ESC_H(1,2) "Ambient: %d%c" ESC_H(1,3) "PINDA: %d%c"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01');
|
||||||
#else //AMBIENT_THERMISTOR
|
#else //AMBIENT_THERMISTOR
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_pinda, '\x01');
|
lcd_printf_P(PSTR(ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_pinda, '\x01');
|
||||||
#endif //AMBIENT_THERMISTOR
|
#endif //AMBIENT_THERMISTOR
|
||||||
|
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
@ -1680,8 +1680,8 @@ static void lcd_menu_voltages()
|
|||||||
{
|
{
|
||||||
float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
||||||
// float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
// float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
||||||
// fprintf_P(lcdout, PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed)));
|
// lcd_printf_P(PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed)));
|
||||||
fprintf_P(lcdout, PSTR( ESC_H(1,1)"PWR: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr))) ;
|
lcd_printf_P(PSTR( ESC_H(1,1)"PWR: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr))) ;
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
menu_action_back();
|
menu_action_back();
|
||||||
@ -1692,7 +1692,7 @@ static void lcd_menu_voltages()
|
|||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
static void lcd_menu_belt_status()
|
static void lcd_menu_belt_status()
|
||||||
{
|
{
|
||||||
fprintf_P(lcdout, PSTR(ESC_H(1,0) "Belt status" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y)));
|
lcd_printf_P(PSTR(ESC_H(1,0) "Belt status" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y)));
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
menu_action_back();
|
menu_action_back();
|
||||||
@ -2084,37 +2084,32 @@ static void lcd_LoadFilament()
|
|||||||
|
|
||||||
void lcd_menu_statistics()
|
void lcd_menu_statistics()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (IS_SD_PRINTING)
|
if (IS_SD_PRINTING)
|
||||||
{
|
{
|
||||||
int _met = total_filament_used / 100000;
|
int _met = total_filament_used / 100000;
|
||||||
int _cm = (total_filament_used - (_met * 100000)) / 10;
|
int _cm = (total_filament_used - (_met * 100000)) / 10;
|
||||||
|
|
||||||
int _t = (millis() - starttime) / 1000;
|
int _t = (millis() - starttime) / 1000;
|
||||||
int _h = _t / 3600;
|
int _h = _t / 3600;
|
||||||
int _m = (_t - (_h * 3600)) / 60;
|
int _m = (_t - (_h * 3600)) / 60;
|
||||||
int _s = _t - ((_h * 3600) + (_m * 60));
|
int _s = _t - ((_h * 3600) + (_m * 60));
|
||||||
|
//|01234567890123456789|
|
||||||
lcd.setCursor(0, 0);
|
//|Filament used: |
|
||||||
lcd_printPGM(_i("Filament used: "));////MSG_STATS_FILAMENTUSED c=20 r=0
|
//| 000m 00.000cm |
|
||||||
|
//|Print time: |
|
||||||
lcd.setCursor(6, 1);
|
//| 00h 00m 00s |
|
||||||
lcd.print(itostr3(_met));
|
//----------------------
|
||||||
lcd.print("m ");
|
lcd_printf_P(_N(
|
||||||
lcd.print(ftostr32ns(_cm));
|
ESC_2J
|
||||||
lcd.print("cm");
|
"%S:"
|
||||||
|
ESC_H(6,1) "%8.2f m\n"
|
||||||
lcd.setCursor(0, 2);
|
"%S :"
|
||||||
lcd_printPGM(_i("Print time: "));////MSG_STATS_PRINTTIME c=20 r=0
|
ESC_H(8,3) "%2dh %02dm %02d"
|
||||||
|
),
|
||||||
lcd.setCursor(8, 3);
|
_i("Filament used"),
|
||||||
lcd.print(itostr2(_h));
|
_met, _cm,
|
||||||
lcd.print("h ");
|
_i("Print time"),
|
||||||
lcd.print(itostr2(_m));
|
_h, _m, _s
|
||||||
lcd.print("m ");
|
);
|
||||||
lcd.print(itostr2(_s));
|
|
||||||
lcd.print("s");
|
|
||||||
|
|
||||||
if (lcd_clicked())
|
if (lcd_clicked())
|
||||||
{
|
{
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
@ -2125,62 +2120,32 @@ void lcd_menu_statistics()
|
|||||||
{
|
{
|
||||||
unsigned long _filament = eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED);
|
unsigned long _filament = eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED);
|
||||||
unsigned long _time = eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME); //in minutes
|
unsigned long _time = eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME); //in minutes
|
||||||
|
|
||||||
uint8_t _hours, _minutes;
|
uint8_t _hours, _minutes;
|
||||||
uint32_t _days;
|
uint32_t _days;
|
||||||
|
float _filament_m = (float)_filament/100;
|
||||||
float _filament_m = (float)_filament;
|
// int _filament_km = (_filament >= 100000) ? _filament / 100000 : 0;
|
||||||
int _filament_km = (_filament >= 100000) ? _filament / 100000 : 0;
|
// if (_filament_km > 0) _filament_m = _filament - (_filament_km * 100000);
|
||||||
if (_filament_km > 0) _filament_m = _filament - (_filament_km * 100000);
|
|
||||||
|
|
||||||
_days = _time / 1440;
|
_days = _time / 1440;
|
||||||
_hours = (_time - (_days * 1440)) / 60;
|
_hours = (_time - (_days * 1440)) / 60;
|
||||||
_minutes = _time - ((_days * 1440) + (_hours * 60));
|
_minutes = _time - ((_days * 1440) + (_hours * 60));
|
||||||
|
//|01234567890123456789|
|
||||||
lcd_implementation_clear();
|
//|Total filament : |
|
||||||
|
//| 000.00 m |
|
||||||
lcd.setCursor(0, 0);
|
//|Total print time : |
|
||||||
lcd_printPGM(_i("Total filament :"));////MSG_STATS_TOTALFILAMENT c=20 r=0
|
//| 00d :00h :00 m |
|
||||||
lcd.setCursor(17 - strlen(ftostr32ns(_filament_m)), 1);
|
//----------------------
|
||||||
lcd.print(ftostr32ns(_filament_m));
|
lcd_printf_P(_N(
|
||||||
|
ESC_2J
|
||||||
if (_filament_km > 0)
|
"%S :"
|
||||||
{
|
ESC_H(9,1) "%8.2f m\n"
|
||||||
lcd.setCursor(17 - strlen(ftostr32ns(_filament_m)) - 3, 1);
|
"%S :\n"
|
||||||
lcd.print("km");
|
"%7ldd :%2hhdh :%02hhd m"
|
||||||
lcd.setCursor(17 - strlen(ftostr32ns(_filament_m)) - 8, 1);
|
),
|
||||||
lcd.print(itostr4(_filament_km));
|
_i("Total filament"),
|
||||||
}
|
_filament_m,
|
||||||
|
_i("Total print time"),
|
||||||
|
_days, _hours, _minutes
|
||||||
lcd.setCursor(18, 1);
|
);
|
||||||
lcd.print("m");
|
|
||||||
|
|
||||||
lcd.setCursor(0, 2);
|
|
||||||
lcd_printPGM(_i("Total print time :"));;////MSG_STATS_TOTALPRINTTIME c=20 r=0
|
|
||||||
|
|
||||||
lcd.setCursor(18, 3);
|
|
||||||
lcd.print("m");
|
|
||||||
lcd.setCursor(14, 3);
|
|
||||||
lcd.print(itostr3(_minutes));
|
|
||||||
|
|
||||||
lcd.setCursor(14, 3);
|
|
||||||
lcd.print(":");
|
|
||||||
|
|
||||||
lcd.setCursor(12, 3);
|
|
||||||
lcd.print("h");
|
|
||||||
lcd.setCursor(9, 3);
|
|
||||||
lcd.print(itostr3(_hours));
|
|
||||||
|
|
||||||
lcd.setCursor(9, 3);
|
|
||||||
lcd.print(":");
|
|
||||||
|
|
||||||
lcd.setCursor(7, 3);
|
|
||||||
lcd.print("d");
|
|
||||||
lcd.setCursor(4, 3);
|
|
||||||
lcd.print(itostr3(_days));
|
|
||||||
|
|
||||||
|
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
while (!lcd_clicked())
|
while (!lcd_clicked())
|
||||||
{
|
{
|
||||||
@ -2189,7 +2154,6 @@ void lcd_menu_statistics()
|
|||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
KEEPALIVE_STATE(NOT_BUSY);
|
KEEPALIVE_STATE(NOT_BUSY);
|
||||||
|
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
menu_action_back();
|
menu_action_back();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user