Browse Source

Merge with latest upstream changes

Scott Lahteine 9 years ago
parent
commit
0d6a7a2df0

+ 8
- 4
Marlin/LiquidCrystalRus.cpp View File

@@ -14,10 +14,14 @@
14 14
 // it is a Russian alphabet translation
15 15
 // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
16 16
 const PROGMEM uint8_t utf_recode[] = 
17
-       { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
18
-         0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
19
-         0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,
20
-         0xbe,0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
17
+       { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,
18
+         0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8,
19
+         0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,
20
+         0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
21
+         0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,
22
+         0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe,
23
+         0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,
24
+         0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
21 25
         };     
22 26
 
23 27
 // When the display powers up, it is configured as follows:

+ 2
- 1
Marlin/boards.h View File

@@ -50,10 +50,11 @@
50 50
 #define BOARD_LEAPFROG          999  // Leapfrog
51 51
 #define BOARD_WITBOX            41   // bq WITBOX
52 52
 #define BOARD_HEPHESTOS         42   // bq Prusa i3 Hephestos
53
+#define BOARD_BAM_DICE          401  // 2PrintBeta BAM&DICE with STK drivers
54
+#define BOARD_BAM_DICE_DUE      402  // 2PrintBeta BAM&DICE Due with STK drivers
53 55
 
54 56
 #define BOARD_99                99   // This is in pins.h but...?
55 57
 
56 58
 #define MB(board) (MOTHERBOARD==BOARD_##board)
57
-#define IS_RAMPS (MB(RAMPS_OLD) || MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF))
58 59
 
59 60
 #endif //__BOARDS_H

+ 1
- 1
Marlin/cardreader.cpp View File

@@ -65,7 +65,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
65 65
       createFilename(lfilename,p);
66 66
       
67 67
       path[0]=0;
68
-      if(strlen(prepend)==0) //avoid leading / if already in prepend
68
+      if(prepend[0]==0) //avoid leading / if already in prepend
69 69
       {
70 70
        strcat(path,"/");
71 71
       }

+ 5
- 5
Marlin/dogm_lcd_implementation.h View File

@@ -315,7 +315,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
315 315
 
316 316
 static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) {
317 317
   char c;
318
-  uint8_t n = LCD_WIDTH - 2 - (pgm ? strlen_P(data) : (strlen(data)));
318
+  uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
319 319
 
320 320
   lcd_implementation_mark_as_selected(row, pre_char);
321 321
 
@@ -377,18 +377,18 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
377 377
   uint8_t char_width = DOG_CHAR_WIDTH;
378 378
 
379 379
   #ifdef USE_BIG_EDIT_FONT
380
-    if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
380
+    if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
381 381
       u8g.setFont(FONT_MENU_EDIT);
382 382
       lcd_width = LCD_WIDTH_EDIT + 1;
383 383
       char_width = DOG_CHAR_WIDTH_EDIT;
384
-      if (strlen_P(pstr) >= LCD_WIDTH_EDIT - strlen(value)) rows = 2;
384
+      if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - lcd_strlen(value)) rows = 2;
385 385
     }
386 386
     else {
387 387
       u8g.setFont(FONT_MENU);
388 388
     }
389 389
   #endif
390 390
 
391
-  if (strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value)) rows = 2;
391
+  if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - lcd_strlen(value)) rows = 2;
392 392
 
393 393
   const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2;
394 394
   float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
@@ -396,7 +396,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
396 396
   u8g.setPrintPos(0, rowHeight + kHalfChar);
397 397
   lcd_printPGM(pstr);
398 398
   u8g.print(':');
399
-  u8g.setPrintPos((lcd_width-1-strlen(value)) * char_width, rows * rowHeight + kHalfChar);
399
+  u8g.setPrintPos((lcd_width-1-lcd_strlen(value)) * char_width, rows * rowHeight + kHalfChar);
400 400
   u8g.print(value);
401 401
 }
402 402
 

+ 15
- 15
Marlin/language_ru.h View File

@@ -13,7 +13,7 @@
13 13
 #define WELCOME_MSG                         MACHINE_NAME " Готов."
14 14
 #define MSG_SD_INSERTED                     "Карта вставлена"
15 15
 #define MSG_SD_REMOVED                      "Карта извлечена"
16
-#define MSG_MAIN                            "Меню \003"
16
+#define MSG_MAIN                            "Меню"
17 17
 #define MSG_AUTOSTART                       "Автостарт"
18 18
 #define MSG_DISABLE_STEPPERS                "Выкл. двигатели"
19 19
 #define MSG_AUTO_HOME                       "Парковка"
@@ -43,14 +43,14 @@
43 43
 #define MSG_MOVE_1MM                        "Move 1mm"
44 44
 #define MSG_MOVE_10MM                       "Move 10mm"
45 45
 #define MSG_SPEED                           "Скорость"
46
-#define MSG_NOZZLE                          "\002 Фильера"
47
-#define MSG_BED                             "\002 Кровать"
46
+#define MSG_NOZZLE                          LCD_STR_THERMOMETER " Фильера"
47
+#define MSG_BED                             LCD_STR_THERMOMETER " Кровать"
48 48
 #define MSG_FAN_SPEED                       "Куллер"
49 49
 #define MSG_FLOW                            "Поток"
50
-#define MSG_CONTROL                         "Настройки \003"
51
-#define MSG_MIN                             "\002 Минимум"
52
-#define MSG_MAX                             "\002 Максимум"
53
-#define MSG_FACTOR                          "\002 Фактор"
50
+#define MSG_CONTROL                         "Настройки"
51
+#define MSG_MIN                             LCD_STR_THERMOMETER " Минимум"
52
+#define MSG_MAX                             LCD_STR_THERMOMETER " Максимум"
53
+#define MSG_FACTOR                          LCD_STR_THERMOMETER " Фактор"
54 54
 #define MSG_AUTOTEMP                        "Autotemp"
55 55
 #define MSG_ON                              "Вкл. "
56 56
 #define MSG_OFF                             "Выкл. "
@@ -75,10 +75,10 @@
75 75
 #define MSG_YSTEPS                          "Y шаг/mm"
76 76
 #define MSG_ZSTEPS                          "Z шаг/mm"
77 77
 #define MSG_ESTEPS                          "E шаг/mm"
78
-#define MSG_TEMPERATURE                     "Температура     \x7E"
79
-#define MSG_MOTION                          "Скорости        \x7E"
78
+#define MSG_TEMPERATURE                     "Температура"
79
+#define MSG_MOTION                          "Скорости"
80 80
 #define MSG_VOLUMETRIC                      "Filament"
81
-#define MSG_VOLUMETRIC_ENABLED		        "E in mm3"
81
+#define MSG_VOLUMETRIC_ENABLED		          "E in mm3"
82 82
 #define MSG_FILAMENT_SIZE_EXTRUDER_0        "Fil. Dia. 1"
83 83
 #define MSG_FILAMENT_SIZE_EXTRUDER_1        "Fil. Dia. 2"
84 84
 #define MSG_FILAMENT_SIZE_EXTRUDER_2        "Fil. Dia. 3"
@@ -86,14 +86,14 @@
86 86
 #define MSG_STORE_EPROM                     "Сохранить в EPROM"
87 87
 #define MSG_LOAD_EPROM                      "Загруз. из EPROM"
88 88
 #define MSG_RESTORE_FAILSAFE                "Сброс настроек"
89
-#define MSG_REFRESH                         "\004Обновить"
90
-#define MSG_WATCH                           "Обзор           \003"
91
-#define MSG_PREPARE                         "Действия        \x7E"
92
-#define MSG_TUNE                            "Настройки       \x7E"
89
+#define MSG_REFRESH                         LCD_STR_REFRESH "Обновить"
90
+#define MSG_WATCH                           "Обзор"
91
+#define MSG_PREPARE                         "Действия"
92
+#define MSG_TUNE                            "Настройки"
93 93
 #define MSG_PAUSE_PRINT                     "Продолжить печать"
94 94
 #define MSG_RESUME_PRINT                    "возобн. печать"
95 95
 #define MSG_STOP_PRINT                      "Остановить печать"
96
-#define MSG_CARD_MENU                       "Меню карты      \x7E"
96
+#define MSG_CARD_MENU                       "Меню карты"
97 97
 #define MSG_NO_CARD                         "Нет карты"
98 98
 #define MSG_DWELL                           "Сон..."
99 99
 #define MSG_USERWAIT                        "Ожиданиие"

+ 5
- 1
Marlin/pins.h View File

@@ -36,7 +36,7 @@
36 36
   #include "pins_SETHI.h"
37 37
 #elif MB(RAMPS_OLD)
38 38
   #include "pins_RAMPS_OLD.h"
39
-#elif IS_RAMPS
39
+#elif MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF)
40 40
   #include "pins_RAMPS_13.h"
41 41
 #elif MB(DUEMILANOVE_328P)
42 42
   #include "pins_DUEMILANOVE_328P.h"
@@ -110,6 +110,10 @@
110 110
   #include "pins_WITBOX.h"
111 111
 #elif MB(HEPHESTOS)
112 112
   #include "pins_HEPHESTOS.h"
113
+#elif MB(BAM_DICE)
114
+  #include "pins_RAMPS_13.h"
115
+#elif MB(BAM_DICE_DUE)
116
+  #include "pins_BAM_DICE_DUE.h"
113 117
 #elif MB(99)
114 118
   #include "pins_99.h"
115 119
 #else

+ 8
- 0
Marlin/pins_AZTEEG_X3.h View File

@@ -3,3 +3,11 @@
3 3
  */
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6
+
7
+#define FAN_PIN            9 // (Sprinter config)
8
+#define HEATER_1_PIN       -1
9
+
10
+#ifdef TEMP_STAT_LEDS
11
+  #define STAT_LED_RED       6
12
+  #define STAT_LED_BLUE     11
13
+#endif

+ 9
- 5
Marlin/pins_AZTEEG_X3_PRO.h View File

@@ -4,6 +4,9 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#define FAN_PIN             9 // (Sprinter config)
8
+#define BEEPER             33
9
+
7 10
 #define E2_STEP_PIN        23
8 11
 #define E2_DIR_PIN         25
9 12
 #define E2_ENABLE_PIN      40
@@ -16,15 +19,16 @@
16 19
 #define E4_DIR_PIN         37
17 20
 #define E4_ENABLE_PIN      42
18 21
 
22
+#define HEATER_1_PIN       -1
19 23
 #define HEATER_2_PIN       16
20 24
 #define HEATER_3_PIN       17
21
-#define HEATER_4_PIN       4
22
-#define HEATER_5_PIN       5
23
-#define HEATER_6_PIN       6
25
+#define HEATER_4_PIN        4
26
+#define HEATER_5_PIN        5
27
+#define HEATER_6_PIN        6
24 28
 #define HEATER_7_PIN       11
25 29
 
26 30
 #define TEMP_2_PIN         12   // ANALOG NUMBERING
27 31
 #define TEMP_3_PIN         11   // ANALOG NUMBERING
28 32
 #define TEMP_4_PIN         10   // ANALOG NUMBERING
29
-#define TC1                4    // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
30
-#define TC2                5    // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
33
+#define TC1                 4   // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
34
+#define TC2                 5   // ANALOG NUMBERING Thermo couple on Azteeg X3Pro

+ 11
- 0
Marlin/pins_BAM_DICE_DUE.h View File

@@ -0,0 +1,11 @@
1
+/**
2
+ * BAM&DICE Due (Arduino Mega) pin assignments
3
+ */
4
+
5
+#include "pins_RAMPS_13.h"
6
+
7
+#define FAN_PIN             9 // (Sprinter config)
8
+#define HEATER_1_PIN       -1
9
+
10
+#define TEMP_0_PIN          9 // ANALOG NUMBERING
11
+#define TEMP_1_PIN         11 // ANALOG NUMBERING

+ 3
- 0
Marlin/pins_HEPHESTOS.h View File

@@ -3,3 +3,6 @@
3 3
  */
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6
+
7
+#define FAN_PIN             9 // (Sprinter config)
8
+#define HEATER_1_PIN       -1

+ 11
- 27
Marlin/pins_RAMPS_13.h View File

@@ -7,10 +7,8 @@
7 7
  *  RAMPS_13_EEB (Extruder, Extruder, Bed)
8 8
  *  RAMPS_13_EFF (Extruder, Fan, Fan)
9 9
  *  RAMPS_13_EEF (Extruder, Extruder, Fan)
10
- *  3DRAG
11
- *  K8200
12
- *  AZTEEG_X3
13
- *  AZTEEG_X3_PRO
10
+ *
11
+ *  Other pins_MYBOARD.h files may override these defaults
14 12
  */
15 13
 
16 14
 #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
@@ -63,7 +61,7 @@
63 61
   #define FILWIDTH_PIN        5
64 62
 #endif
65 63
 
66
-#if MB(RAMPS_13_EFB) || MB(RAMPS_13_EFF) || MB(AZTEEG_X3) || MB(AZTEEG_X3_PRO) || MB(WITBOX) || MB(HEPHESTOS)
64
+#if MB(RAMPS_13_EFB) || MB(RAMPS_13_EFF)
67 65
   #define FAN_PIN            9 // (Sprinter config)
68 66
   #if MB(RAMPS_13_EFF)
69 67
     #define CONTROLLERFAN_PIN  -1 // Pin used for the fan to cool controller
@@ -88,7 +86,7 @@
88 86
   #define HEATER_0_PIN       10   // EXTRUDER 1
89 87
 #endif
90 88
 
91
-#if MB(RAMPS_13_EFB) || MB(AZTEEG_X3) || MB(WITBOX) || MB(HEPHESTOS)
89
+#if MB(RAMPS_13_EFB)
92 90
   #define HEATER_1_PIN       -1
93 91
 #else
94 92
   #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
@@ -110,28 +108,14 @@
110 108
 
111 109
 #ifdef NUM_SERVOS
112 110
   #define SERVO0_PIN         11
113
-
114 111
   #if NUM_SERVOS > 1
115
-    #define SERVO1_PIN         6
116
-  #endif
117
-
118
-  #if NUM_SERVOS > 2
119
-    #define SERVO2_PIN         5
120
-  #endif
121
-
122
-  #if NUM_SERVOS > 3
123
-    #define SERVO3_PIN         4
124
-  #endif
125
-#endif
126
-
127
-#if MB(AZTEEG_X3_PRO)
128
-  #define BEEPER 33
129
-#endif
130
-
131
-#ifdef TEMP_STAT_LEDS
132
-  #if MB(AZTEEG_X3)
133
-    #define STAT_LED_RED       6
134
-    #define STAT_LED_BLUE     11
112
+    #define SERVO1_PIN        6
113
+    #if NUM_SERVOS > 2
114
+      #define SERVO2_PIN      5
115
+      #if NUM_SERVOS > 3
116
+        #define SERVO3_PIN    4
117
+      #endif
118
+    #endif
135 119
   #endif
136 120
 #endif
137 121
 

+ 3
- 0
Marlin/pins_WITBOX.h View File

@@ -3,3 +3,6 @@
3 3
  */
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6
+
7
+#define FAN_PIN             9 // (Sprinter config)
8
+#define HEATER_1_PIN       -1

+ 4
- 6
Marlin/temperature.cpp View File

@@ -455,19 +455,17 @@ void checkExtruderAutoFans()
455 455
     setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
456 456
   #endif 
457 457
   #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
458
-    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) 
458
+    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
459 459
       setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
460 460
   #endif 
461 461
   #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
462
-    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
463
-        && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
462
+    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
464 463
         && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
465 464
       setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
466 465
   #endif
467 466
   #if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
468
-    if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
469
-        && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
470
-        && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
467
+    if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
468
+        && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN
471 469
         && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
472 470
       setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0);
473 471
   #endif

+ 132
- 89
Marlin/ultralcd.cpp View File

@@ -44,11 +44,6 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
44 44
 #include "ultralcd_implementation_hitachi_HD44780.h"
45 45
 #endif
46 46
 
47
-/** forward declarations **/
48
-
49
-void copy_and_scalePID_i();
50
-void copy_and_scalePID_d();
51
-
52 47
 /* Different menus */
53 48
 static void lcd_status_screen();
54 49
 #ifdef ULTIPANEL
@@ -219,9 +214,8 @@ void* editValue;
219 214
 int32_t minEditValue, maxEditValue;
220 215
 menuFunc_t callbackFunc;
221 216
 
222
-// place-holders for Ki and Kd edits, and the extruder # being edited
217
+// place-holders for Ki and Kd edits
223 218
 float raw_Ki, raw_Kd;
224
-int pid_current_extruder;
225 219
 
226 220
 static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
227 221
   if (currentMenu != menu) {
@@ -846,76 +840,125 @@ static void lcd_control_menu()
846 840
     END_MENU();
847 841
 }
848 842
 
843
+#ifdef PIDTEMP
844
+
845
+  // Helpers for editing PID Ki & Kd values
846
+  // grab the PID value out of the temp variable; scale it; then update the PID driver
847
+  void copy_and_scalePID_i(int e) {
848
+    PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
849
+    updatePID();
850
+  }
851
+  void copy_and_scalePID_d(int e) {
852
+    PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
853
+    updatePID();
854
+  }
855
+  void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
856
+  void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
857
+  #ifdef PID_PARAMS_PER_EXTRUDER
858
+    #if EXTRUDERS > 1
859
+      void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
860
+      void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
861
+      #if EXTRUDERS > 2
862
+        void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); }
863
+        void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
864
+        #if EXTRUDERS > 3
865
+          void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
866
+          void copy_and_scalePID_d_E5() { copy_and_scalePID_d(3); }
867
+        #endif //EXTRUDERS > 3
868
+      #endif //EXTRUDERS > 2
869
+    #endif //EXTRUDERS > 1
870
+  #endif //PID_PARAMS_PER_EXTRUDER
871
+
872
+#endif //PIDTEMP
873
+
849 874
 static void lcd_control_temperature_menu()
850 875
 {
851 876
   START_MENU();
852 877
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
853
-#if TEMP_SENSOR_0 != 0
854
-  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
855
-#endif
856
-#if TEMP_SENSOR_1 != 0 && EXTRUDERS > 1
857
-  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
858
-#endif
859
-#if TEMP_SENSOR_2 != 0 && EXTRUDERS > 2
860
-  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
861
-#endif
862
-#if TEMP_SENSOR_3 != 0 && EXTRUDERS > 3
863
-  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
864
-#endif
865
-#if TEMP_SENSOR_BED != 0
866
-  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
867
-#endif
878
+  #if TEMP_SENSOR_0 != 0
879
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
880
+  #endif
881
+  #if EXTRUDERS > 1
882
+    #if TEMP_SENSOR_1 != 0
883
+      MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
884
+    #endif
885
+    #if EXTRUDERS > 2
886
+      #if TEMP_SENSOR_2 != 0
887
+        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
888
+      #endif
889
+      #if EXTRUDERS > 3
890
+        #if TEMP_SENSOR_3 != 0
891
+          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
892
+        #endif
893
+      #endif
894
+    #endif
895
+  #endif
896
+  #if TEMP_SENSOR_BED != 0
897
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
898
+  #endif
868 899
   MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
869
-#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0)
870
-  MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
871
-  MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
872
-  MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
873
-  MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
874
-#endif
875
-#ifdef PIDTEMP
876
-	// set up temp variables - undo the default scaling
877
-	pid_current_extruder = 0;
878
-	raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
879
-	raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
880
-	MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
881
-	// i is typically a small value so allows values below 1
882
-	MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
883
-	MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
900
+  #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
901
+    MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
902
+    MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
903
+    MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
904
+    MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
905
+  #endif
906
+  #ifdef PIDTEMP
907
+    // set up temp variables - undo the default scaling
908
+    pid_current_extruder = 0;
909
+    raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
910
+    raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
911
+    MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
912
+    // i is typically a small value so allows values below 1
913
+    MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
914
+    MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
884 915
     #ifdef PID_ADD_EXTRUSION_RATE
885
-	  MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
916
+      MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
886 917
     #endif//PID_ADD_EXTRUSION_RATE
887
-#ifdef PID_PARAMS_PER_EXTRUDER
888
-  #if EXTRUDERS > 1
889
-	  // set up temp variables - undo the default scaling
890
-	  pid_current_extruder = 0;
891
-	  raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
892
-	  raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
893
-	  MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
894
-	  // i is typically a small value so allows values below 1
895
-	  MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
896
-	  MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d);
897
-      #ifdef PID_ADD_EXTRUSION_RATE
898
-	    MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
899
-      #endif//PID_ADD_EXTRUSION_RATE
900
-  #endif//EXTRUDERS > 1
901
-  #if EXTRUDERS > 2
902
-	    // set up temp variables - undo the default scaling
903
-	    pid_current_extruder = 0;
904
-	    raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
905
-	    raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
906
-	    MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
907
-	    // i is typically a small value so allows values below 1
908
-	    MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
909
-	    MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d);
918
+    #ifdef PID_PARAMS_PER_EXTRUDER
919
+      #if EXTRUDERS > 1
920
+        // set up temp variables - undo the default scaling
921
+        raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
922
+        raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
923
+        MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
924
+        // i is typically a small value so allows values below 1
925
+        MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
926
+        MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
910 927
         #ifdef PID_ADD_EXTRUSION_RATE
911
-	      MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
928
+          MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
912 929
         #endif//PID_ADD_EXTRUSION_RATE
913
-  #endif//EXTRUDERS > 2
914
-#endif // PID_PARAMS_PER_EXTRUDER
915
-#endif//PIDTEMP
916
-    MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
917
-    MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
918
-    END_MENU();
930
+
931
+        #if EXTRUDERS > 2
932
+          // set up temp variables - undo the default scaling
933
+          raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
934
+          raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
935
+          MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
936
+          // i is typically a small value so allows values below 1
937
+          MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
938
+          MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
939
+          #ifdef PID_ADD_EXTRUSION_RATE
940
+            MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
941
+          #endif//PID_ADD_EXTRUSION_RATE
942
+
943
+          #if EXTRUDERS > 3
944
+            // set up temp variables - undo the default scaling
945
+            raw_Ki = unscalePID_i(PID_PARAM(Ki,3));
946
+            raw_Kd = unscalePID_d(PID_PARAM(Kd,3));
947
+            MENU_ITEM_EDIT(float52, MSG_PID_P " E4", &PID_PARAM(Kp,3), 1, 9990);
948
+            // i is typically a small value so allows values below 1
949
+            MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
950
+            MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
951
+            #ifdef PID_ADD_EXTRUSION_RATE
952
+              MENU_ITEM_EDIT(float3, MSG_PID_C " E4", &PID_PARAM(Kc,3), 1, 9990);
953
+            #endif//PID_ADD_EXTRUSION_RATE
954
+          #endif//EXTRUDERS > 3
955
+        #endif//EXTRUDERS > 2
956
+      #endif//EXTRUDERS > 1
957
+    #endif //PID_PARAMS_PER_EXTRUDER
958
+  #endif//PIDTEMP
959
+  MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
960
+  MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
961
+  END_MENU();
919 962
 }
920 963
 
921 964
 static void lcd_control_temperature_preheat_pla_settings_menu()
@@ -1295,6 +1338,26 @@ void lcd_init()
1295 1338
 #endif
1296 1339
 }
1297 1340
 
1341
+int lcd_strlen(char *s) {
1342
+     int i = 0, j = 0;
1343
+   while (s[i]) {
1344
+     if ((s[i] & 0xc0) != 0x80) j++;
1345
+     i++;
1346
+   }
1347
+   return j;
1348
+}
1349
+
1350
+int lcd_strlen_P(const char *s) {
1351
+     int j = 0;
1352
+   while (pgm_read_byte(s)) {
1353
+     if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
1354
+     s++;
1355
+   }
1356
+   return j;
1357
+}
1358
+
1359
+
1360
+
1298 1361
 void lcd_update()
1299 1362
 {
1300 1363
     static unsigned long timeoutToStatus = 0;
@@ -1446,7 +1509,7 @@ void lcd_ignore_click(bool b)
1446 1509
 }
1447 1510
 
1448 1511
 void lcd_finishstatus() {
1449
-  int len = strlen(lcd_status_message);
1512
+  int len = lcd_strlen(lcd_status_message);
1450 1513
   if (len > 0) {
1451 1514
     while (len < LCD_WIDTH) {
1452 1515
       lcd_status_message[len++] = ' ';
@@ -1859,24 +1922,4 @@ char *ftostr52(const float &x)
1859 1922
   return conv;
1860 1923
 }
1861 1924
 
1862
-// Callback for after editing PID i value
1863
-// grab the PID i value out of the temp variable; scale it; then update the PID driver
1864
-void copy_and_scalePID_i()
1865
-{
1866
-#ifdef PIDTEMP
1867
-  PID_PARAM(Ki, pid_current_extruder) = scalePID_i(raw_Ki);
1868
-  updatePID();
1869
-#endif
1870
-}
1871
-
1872
-// Callback for after editing PID d value
1873
-// grab the PID d value out of the temp variable; scale it; then update the PID driver
1874
-void copy_and_scalePID_d()
1875
-{
1876
-#ifdef PIDTEMP
1877
-	PID_PARAM(Kd, pid_current_extruder) = scalePID_d(raw_Kd);
1878
-  updatePID();
1879
-#endif
1880
-}
1881
-
1882 1925
 #endif //ULTRA_LCD

+ 2
- 1
Marlin/ultralcd.h View File

@@ -4,7 +4,8 @@
4 4
 #include "Marlin.h"
5 5
 
6 6
 #ifdef ULTRA_LCD
7
-
7
+  int lcd_strlen(char *s);
8
+  int lcd_strlen_P(const char *s);
8 9
   void lcd_update();
9 10
   void lcd_init();
10 11
   void lcd_setstatus(const char* message);

+ 9
- 9
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -636,7 +636,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
636 636
     {
637 637
         lcd.print(c);
638 638
         pstr++;
639
-        n--;
639
+        if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
640 640
     }
641 641
     while(n--)
642 642
         lcd.print(' ');
@@ -648,9 +648,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
648 648
     char c;
649 649
     //Use all characters in narrow LCDs
650 650
   #if LCD_WIDTH < 20
651
-      uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
651
+      uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen(data);
652 652
     #else
653
-      uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
653
+      uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen(data);
654 654
   #endif
655 655
     lcd.setCursor(0, row);
656 656
     lcd.print(pre_char);
@@ -658,7 +658,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
658 658
     {
659 659
         lcd.print(c);
660 660
         pstr++;
661
-        n--;
661
+        if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
662 662
     }
663 663
     lcd.print(':');
664 664
     while(n--)
@@ -670,9 +670,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
670 670
     char c;
671 671
     //Use all characters in narrow LCDs
672 672
   #if LCD_WIDTH < 20
673
-      uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
673
+      uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen_P(data);
674 674
     #else
675
-      uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
675
+      uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen_P(data);
676 676
   #endif
677 677
     lcd.setCursor(0, row);
678 678
     lcd.print(pre_char);
@@ -680,7 +680,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
680 680
     {
681 681
         lcd.print(c);
682 682
         pstr++;
683
-        n--;
683
+        if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
684 684
     }
685 685
     lcd.print(':');
686 686
     while(n--)
@@ -733,9 +733,9 @@ void lcd_implementation_drawedit(const char* pstr, char* value)
733 733
     lcd_printPGM(pstr);
734 734
     lcd.print(':');
735 735
    #if LCD_WIDTH < 20
736
-      lcd.setCursor(LCD_WIDTH - strlen(value), 1);
736
+      lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
737 737
     #else
738
-      lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
738
+      lcd.setCursor(LCD_WIDTH -1 - lcd_strlen(value), 1);
739 739
    #endif
740 740
     lcd.print(value);
741 741
 }

Loading…
Cancel
Save