Browse Source

Generate menu item texts Cut filament <nr.> during runtime to conserve flash.

Marek Bel 5 years ago
parent
commit
150787efbd
4 changed files with 8 additions and 11 deletions
  1. 1 0
      Firmware/messages.c
  2. 1 0
      Firmware/messages.h
  3. 1 0
      Firmware/mmu.cpp
  4. 5 11
      Firmware/ultralcd.cpp

+ 1 - 0
Firmware/messages.c

@@ -51,6 +51,7 @@ const char MSG_CHOOSE_FILAMENT[] PROGMEM_I1 = ISTR("Choose filament:"); ////c=20
 const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); //// Number 1 to 5 is added behind text e.g. "Load filament 1" c=16
 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20
 const char MSG_EJECT_FILAMENT[] PROGMEM_I1 = ISTR("Eject filament"); //// Number 1 to 5 is added behind text e.g. "Eject filament 1" c=16
+const char MSG_CUT_FILAMENT[] PROGMEM_I1 = ISTR("Cut filament"); //// Number 1 to 5 is added behind text e.g. "Cut filament 1" c=16
 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1
 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////
 const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////

+ 1 - 0
Firmware/messages.h

@@ -126,6 +126,7 @@ extern const char MSG_POWERUP[];
 extern const char MSG_ERR_STOPPED[];
 extern const char MSG_ENDSTOP_HIT[];
 extern const char MSG_EJECT_FILAMENT[];
+extern const char MSG_CUT_FILAMENT[];
 
 #if defined(__cplusplus)
 }

+ 1 - 0
Firmware/mmu.cpp

@@ -1387,6 +1387,7 @@ bFilamentAction=false;                            // NOT in "mmu_load_to_nozzle_
 #ifdef MMU_HAS_CUTTER
 void mmu_cut_filament(uint8_t filament_nr)
 {
+    menu_back();
     bFilamentAction=false;                            // NOT in "mmu_load_to_nozzle_menu()"
     if (degHotend0() > EXTRUDE_MINTEMP)
     {

+ 5 - 11
Firmware/ultralcd.cpp

@@ -5992,12 +5992,6 @@ static void mmu_fil_eject_menu()
 }
 
 #ifdef MMU_HAS_CUTTER
-template <uint8_t filament>
-static void mmu_cut_filament()
-{
-    menu_back();
-    mmu_cut_filament(filament);
-}
 
 static void mmu_cut_filament_menu()
 {
@@ -6005,11 +5999,11 @@ if(bFilamentAction)
 {
     MENU_BEGIN();
     MENU_ITEM_BACK_P(_T(MSG_MAIN));
-    MENU_ITEM_FUNCTION_P(_i("Cut filament 1"), mmu_cut_filament<0>);
-    MENU_ITEM_FUNCTION_P(_i("Cut filament 2"), mmu_cut_filament<1>);
-    MENU_ITEM_FUNCTION_P(_i("Cut filament 3"), mmu_cut_filament<2>);
-    MENU_ITEM_FUNCTION_P(_i("Cut filament 4"), mmu_cut_filament<3>);
-    MENU_ITEM_FUNCTION_P(_i("Cut filament 5"), mmu_cut_filament<4>);
+    MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 1, mmu_cut_filament, 0);
+    MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 2, mmu_cut_filament, 1);
+    MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 3, mmu_cut_filament, 2);
+    MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 4, mmu_cut_filament, 3);
+    MENU_ITEM_FUNCTION_NR_P(_T(MSG_EJECT_FILAMENT), 5, mmu_cut_filament, 4);
     MENU_END();
 }
 else {