Marlin Dev Mode for DOGM status screen

This commit is contained in:
Scott Lahteine 2018-12-02 18:03:29 -06:00
parent 998ce55be0
commit 4fbbce9a35

View file

@ -92,6 +92,12 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#define MAX_HOTEND_DRAW MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE))) #define MAX_HOTEND_DRAW MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
#define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1) #define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)
#if ENABLED(MARLIN_DEV_MODE)
#define SHOW_ON_STATE READ(X_MIN_PIN)
#else
#define SHOW_ON_STATE false
#endif
FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) {
#if !HEATER_IDLE_HANDLER #if !HEATER_IDLE_HANDLER
UNUSED(blink); UNUSED(blink);
@ -104,10 +110,21 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) {
#define IFBED(A,B) (B) #define IFBED(A,B) (B)
#endif #endif
#if ENABLED(MARLIN_DEV_MODE)
constexpr bool isHeat = true;
#else
const bool isHeat = IFBED(BED_ALT(), HOTEND_ALT(heater)); const bool isHeat = IFBED(BED_ALT(), HOTEND_ALT(heater));
#endif
const uint8_t tx = IFBED(STATUS_BED_TEXT_X, STATUS_HOTEND_TEXT_X(heater)); const uint8_t tx = IFBED(STATUS_BED_TEXT_X, STATUS_HOTEND_TEXT_X(heater));
#if ENABLED(MARLIN_DEV_MODE)
const float temp = 20 + (millis() >> 8) % IFBED(100, 200);
const float target = IFBED(100, 200);
#else
const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)), const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)),
target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater)); target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater));
#endif
#if DISABLED(STATUS_HOTEND_ANIM) #if DISABLED(STATUS_HOTEND_ANIM)
#define STATIC_HOTEND true #define STATIC_HOTEND true
@ -236,8 +253,17 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
} }
} }
#if ENABLED(MARLIN_DEV_MODE)
uint16_t count_renders = 0;
uint32_t total_cycles = 0;
#endif
void MarlinUI::draw_status_screen() { void MarlinUI::draw_status_screen() {
#if ENABLED(MARLIN_DEV_MODE)
if (first_page) count_renders++;
#endif
static char xstring[5], ystring[5], zstring[8]; static char xstring[5], ystring[5], zstring[8];
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY)
static char wstring[5], mstring[4]; static char wstring[5], mstring[4];
@ -248,10 +274,10 @@ void MarlinUI::draw_status_screen() {
#if ANIM_HOTEND || ANIM_BED #if ANIM_HOTEND || ANIM_BED
uint8_t new_bits = 0; uint8_t new_bits = 0;
#if ANIM_HOTEND #if ANIM_HOTEND
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, e); HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(new_bits, e);
#endif #endif
#if ANIM_BED #if ANIM_BED
if (thermalManager.isHeatingBed()) SBI(new_bits, 7); if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(new_bits, 7);
#endif #endif
heat_bits = new_bits; heat_bits = new_bits;
#endif #endif
@ -274,6 +300,10 @@ void MarlinUI::draw_status_screen() {
// Status Menu Font // Status Menu Font
set_font(FONT_STATUSMENU); set_font(FONT_STATUSMENU);
#if ENABLED(MARLIN_DEV_MODE)
TCNT5 = 0;
#endif
#if STATUS_LOGO_WIDTH #if STATUS_LOGO_WIDTH
if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1)) if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1))
u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp); u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp);
@ -356,6 +386,10 @@ void MarlinUI::draw_status_screen() {
#endif #endif
} }
#if ENABLED(MARLIN_DEV_MODE)
total_cycles += TCNT5;
#endif
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
// //
// SD Card Symbol // SD Card Symbol
@ -557,6 +591,17 @@ void MarlinUI::draw_status_screen() {
void MarlinUI::draw_status_message(const bool blink) { void MarlinUI::draw_status_message(const bool blink) {
#if ENABLED(MARLIN_DEV_MODE)
if (PAGE_CONTAINS(64-8, 64-1)) {
lcd_put_int(total_cycles);
lcd_put_wchar('/');
lcd_put_int(count_renders);
lcd_put_wchar('=');
lcd_put_int(int(total_cycles / count_renders));
return;
}
#endif
// Get the UTF8 character count of the string // Get the UTF8 character count of the string
uint8_t slen = utf8_strlen(status_message); uint8_t slen = utf8_strlen(status_message);