Browse Source

Add Debug Menu with LCD_PROGRESS_BAR_TEST as an example

pull/1/head
Scott Lahteine 8 years ago
parent
commit
18ba31e9b5
  1. 2
      Marlin/Conditionals_LCD.h
  2. 2
      Marlin/Configuration_adv.h
  3. 2
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  4. 2
      Marlin/example_configurations/Felix/Configuration_adv.h
  5. 2
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  6. 2
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  7. 2
      Marlin/example_configurations/K8200/Configuration_adv.h
  8. 2
      Marlin/example_configurations/K8400/Configuration_adv.h
  9. 2
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  10. 2
      Marlin/example_configurations/SCARA/Configuration_adv.h
  11. 2
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  12. 2
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  13. 2
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  14. 2
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  15. 2
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  16. 2
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  17. 2
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  18. 2
      Marlin/example_configurations/makibox/Configuration_adv.h
  19. 2
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  20. 6
      Marlin/language_en.h
  21. 49
      Marlin/ultralcd.cpp
  22. 36
      Marlin/ultralcd_impl_HD44780.h

2
Marlin/Conditionals_LCD.h

@ -278,6 +278,8 @@
#define BOOTSCREEN_TIMEOUT 2500 #define BOOTSCREEN_TIMEOUT 2500
#endif #endif
#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
/** /**
* Extruders have some combination of stepper motors and hotends * Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines: * so we separate these concepts into the defines:

2
Marlin/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/Cartesio/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/Felix/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/Hephestos/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/Hephestos_2/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/K8200/Configuration_adv.h

@ -467,6 +467,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/K8400/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/RigidBot/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/SCARA/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/TAZ4/Configuration_adv.h

@ -462,6 +462,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/WITBOX/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h

@ -456,6 +456,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/delta/generic/Configuration_adv.h

@ -456,6 +456,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h

@ -456,6 +456,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h

@ -461,6 +461,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h

@ -456,6 +456,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/makibox/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

2
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h

@ -454,6 +454,8 @@
#define PROGRESS_MSG_EXPIRE 0 #define PROGRESS_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_MSG_ONCE //#define PROGRESS_MSG_ONCE
// Add a menu item to test the progress bar:
//#define LCD_PROGRESS_BAR_TEST
#endif #endif
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33

6
Marlin/language_en.h

@ -51,6 +51,12 @@
#ifndef MSG_DISABLE_STEPPERS #ifndef MSG_DISABLE_STEPPERS
#define MSG_DISABLE_STEPPERS _UxGT("Disable steppers") #define MSG_DISABLE_STEPPERS _UxGT("Disable steppers")
#endif #endif
#ifndef MSG_DEBUG_MENU
#define MSG_DEBUG_MENU _UxGT("Debug Menu")
#endif
#ifndef MSG_PROGRESS_BAR_TEST
#define MSG_PROGRESS_BAR_TEST _UxGT("Progress Bar Test")
#endif
#ifndef MSG_AUTO_HOME #ifndef MSG_AUTO_HOME
#define MSG_AUTO_HOME _UxGT("Auto home") #define MSG_AUTO_HOME _UxGT("Auto home")
#endif #endif

49
Marlin/ultralcd.cpp

@ -316,6 +316,7 @@ uint16_t max_display_update_time = 0;
#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0) #define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
// Used to print static text with no visible cursor. // Used to print static text with no visible cursor.
// Parameters: label [, bool center [, bool invert [, char *value] ] ]
#define STATIC_ITEM(LABEL, ...) \ #define STATIC_ITEM(LABEL, ...) \
if (_menuLineNr == _thisItemNr) { \ if (_menuLineNr == _thisItemNr) { \
if (_skipStatic && encoderLine <= _thisItemNr) { \ if (_skipStatic && encoderLine <= _thisItemNr) { \
@ -623,6 +624,47 @@ void kill_screen(const char* lcd_msg) {
#endif // MENU_ITEM_CASE_LIGHT #endif // MENU_ITEM_CASE_LIGHT
#if ENABLED(LCD_PROGRESS_BAR_TEST)
static void progress_bar_test() {
static int8_t bar_percent = 0;
if (lcd_clicked) {
lcd_goto_previous_menu();
lcd_set_custom_characters(false);
return;
}
bar_percent += (int8_t)encoderPosition;
bar_percent = constrain(bar_percent, 0, 100);
encoderPosition = 0;
lcd_implementation_drawmenu_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true);
lcd.setCursor((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2);
lcd.print(itostr3(bar_percent)); lcd.print('%');
lcd.setCursor(0, LCD_HEIGHT - 1); lcd_draw_progress_bar(bar_percent);
}
void _progress_bar_test() {
lcd_goto_screen(progress_bar_test);
lcd_set_custom_characters();
}
#endif // LCD_PROGRESS_BAR_TEST
#if HAS_DEBUG_MENU
void lcd_debug_menu() {
START_MENU();
MENU_BACK(MSG_MAIN); // ^ Main
#if ENABLED(LCD_PROGRESS_BAR_TEST)
MENU_ITEM(submenu, MSG_PROGRESS_BAR_TEST, _progress_bar_test);
#endif
END_MENU();
}
#endif // HAS_DEBUG_MENU
/** /**
* *
* "Main" menu * "Main" menu
@ -633,6 +675,13 @@ void kill_screen(const char* lcd_msg) {
START_MENU(); START_MENU();
MENU_BACK(MSG_WATCH); MENU_BACK(MSG_WATCH);
//
// Debug Menu when certain options are enabled
//
#if HAS_DEBUG_MENU
MENU_ITEM(submenu, MSG_DEBUG_MENU, lcd_debug_menu);
#endif
// //
// Switch case light on/off // Switch case light on/off
// //

36
Marlin/ultralcd_impl_HD44780.h

@ -573,6 +573,25 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
} }
} }
#if ENABLED(LCD_PROGRESS_BAR)
inline void lcd_draw_progress_bar(const uint8_t percent) {
int tix = (int)(percent * (LCD_WIDTH) * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH + 1], b = ' ';
msg[i] = '\0';
while (i--) {
if (i == cel - 1)
b = LCD_STR_PROGRESS[2];
else if (i == cel && rem != 0)
b = LCD_STR_PROGRESS[rem - 1];
msg[i] = b;
}
lcd.print(msg);
}
#endif // LCD_PROGRESS_BAR
/** /**
Possible status screens: Possible status screens:
16x2 |000/000 B000/000| 16x2 |000/000 B000/000|
@ -759,21 +778,8 @@ static void lcd_implementation_status_screen() {
if (card.isFileOpen()) { if (card.isFileOpen()) {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
// or if there is no message set. // or if there is no message set.
if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0]) { if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])
int tix = (int)(card.percentDone() * (LCD_WIDTH) * 3) / 100, return lcd_draw_progress_bar(card.percentDone());
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH + 1], b = ' ';
msg[i] = '\0';
while (i--) {
if (i == cel - 1)
b = LCD_STR_PROGRESS[2];
else if (i == cel && rem != 0)
b = LCD_STR_PROGRESS[rem - 1];
msg[i] = b;
}
lcd.print(msg);
return;
}
} //card.isFileOpen } //card.isFileOpen
#elif ENABLED(FILAMENT_LCD_DISPLAY) #elif ENABLED(FILAMENT_LCD_DISPLAY)

Loading…
Cancel
Save