diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 41e1ed7ed..afcd9134c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -118,6 +118,7 @@ Here are some standard links for getting your machine calibrated: // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) +// 999 is a Dummy Table. It will ALWAYS read 25C.. Use it for Testing or Development purposes. NEVER for production machine. #define TEMP_SENSOR_0 -1 #define TEMP_SENSOR_1 -1 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4d3579d24..f2b312441 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -284,6 +284,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/LiquidCrystalRus.cpp b/Marlin/LiquidCrystalRus.cpp index 6ee2c112e..c74146236 100644 --- a/Marlin/LiquidCrystalRus.cpp +++ b/Marlin/LiquidCrystalRus.cpp @@ -14,10 +14,14 @@ // it is a Russian alphabet translation // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5 const PROGMEM uint8_t utf_recode[] = - { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f, - 0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, - 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f, - 0xbe,0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 + { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4, + 0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8, + 0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab, + 0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1, + 0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7, + 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe, + 0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0, + 0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7 }; // When the display powers up, it is configured as follows: diff --git a/Marlin/boards.h b/Marlin/boards.h index c6997fe87..2f1107b45 100644 --- a/Marlin/boards.h +++ b/Marlin/boards.h @@ -50,10 +50,11 @@ #define BOARD_LEAPFROG 999 // Leapfrog #define BOARD_WITBOX 41 // bq WITBOX #define BOARD_HEPHESTOS 42 // bq Prusa i3 Hephestos +#define BOARD_BAM_DICE 401 // 2PrintBeta BAM&DICE with STK drivers +#define BOARD_BAM_DICE_DUE 402 // 2PrintBeta BAM&DICE Due with STK drivers #define BOARD_99 99 // This is in pins.h but...? #define MB(board) (MOTHERBOARD==BOARD_##board) -#define IS_RAMPS (MB(RAMPS_OLD) || MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF)) #endif //__BOARDS_H diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 498a654c5..a2dd67831 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -65,7 +65,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m createFilename(lfilename,p); path[0]=0; - if(strlen(prepend)==0) //avoid leading / if already in prepend + if(prepend[0]==0) //avoid leading / if already in prepend { strcat(path,"/"); } diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index f512d3295..c7df306b3 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -315,7 +315,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) { char c; - uint8_t n = LCD_WIDTH - 2 - (pgm ? strlen_P(data) : (strlen(data))); + uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data))); lcd_implementation_mark_as_selected(row, pre_char); @@ -377,18 +377,18 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { uint8_t char_width = DOG_CHAR_WIDTH; #ifdef USE_BIG_EDIT_FONT - if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { + if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { u8g.setFont(FONT_MENU_EDIT); lcd_width = LCD_WIDTH_EDIT + 1; char_width = DOG_CHAR_WIDTH_EDIT; - if (strlen_P(pstr) >= LCD_WIDTH_EDIT - strlen(value)) rows = 2; + if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - lcd_strlen(value)) rows = 2; } else { u8g.setFont(FONT_MENU); } #endif - if (strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value)) rows = 2; + if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - lcd_strlen(value)) rows = 2; const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2; 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) { u8g.setPrintPos(0, rowHeight + kHalfChar); lcd_printPGM(pstr); u8g.print(':'); - u8g.setPrintPos((lcd_width-1-strlen(value)) * char_width, rows * rowHeight + kHalfChar); + u8g.setPrintPos((lcd_width-1-lcd_strlen(value)) * char_width, rows * rowHeight + kHalfChar); u8g.print(value); } diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 1412c9941..0a9c8a129 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -284,6 +284,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index b3d9ed840..bf2daede0 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -284,6 +284,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 215ee494d..a32669881 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -287,6 +287,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 1412c9941..0a9c8a129 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -284,6 +284,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/delta/Configuration_adv.h b/Marlin/example_configurations/delta/Configuration_adv.h index 79d2036a0..9b49bfe1e 100644 --- a/Marlin/example_configurations/delta/Configuration_adv.h +++ b/Marlin/example_configurations/delta/Configuration_adv.h @@ -279,6 +279,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 6c181fb55..1033b9989 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -283,6 +283,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 64fd9ecc9..df413f6e6 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -284,6 +284,11 @@ //=============================Additional Features=========================== //=========================================================================== +#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly +#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value +#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value +//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value + //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again diff --git a/Marlin/language_ru.h b/Marlin/language_ru.h index 03ea77851..bcab50b79 100644 --- a/Marlin/language_ru.h +++ b/Marlin/language_ru.h @@ -13,7 +13,7 @@ #define WELCOME_MSG MACHINE_NAME " Готов." #define MSG_SD_INSERTED "Карта вставлена" #define MSG_SD_REMOVED "Карта извлечена" -#define MSG_MAIN "Меню \003" +#define MSG_MAIN "Меню" #define MSG_AUTOSTART "Автостарт" #define MSG_DISABLE_STEPPERS "Выкл. двигатели" #define MSG_AUTO_HOME "Парковка" @@ -43,14 +43,14 @@ #define MSG_MOVE_1MM "Move 1mm" #define MSG_MOVE_10MM "Move 10mm" #define MSG_SPEED "Скорость" -#define MSG_NOZZLE "\002 Фильера" -#define MSG_BED "\002 Кровать" +#define MSG_NOZZLE LCD_STR_THERMOMETER " Фильера" +#define MSG_BED LCD_STR_THERMOMETER " Кровать" #define MSG_FAN_SPEED "Куллер" #define MSG_FLOW "Поток" -#define MSG_CONTROL "Настройки \003" -#define MSG_MIN "\002 Минимум" -#define MSG_MAX "\002 Максимум" -#define MSG_FACTOR "\002 Фактор" +#define MSG_CONTROL "Настройки" +#define MSG_MIN LCD_STR_THERMOMETER " Минимум" +#define MSG_MAX LCD_STR_THERMOMETER " Максимум" +#define MSG_FACTOR LCD_STR_THERMOMETER " Фактор" #define MSG_AUTOTEMP "Autotemp" #define MSG_ON "Вкл. " #define MSG_OFF "Выкл. " @@ -75,10 +75,10 @@ #define MSG_YSTEPS "Y шаг/mm" #define MSG_ZSTEPS "Z шаг/mm" #define MSG_ESTEPS "E шаг/mm" -#define MSG_TEMPERATURE "Температура \x7E" -#define MSG_MOTION "Скорости \x7E" +#define MSG_TEMPERATURE "Температура" +#define MSG_MOTION "Скорости" #define MSG_VOLUMETRIC "Filament" -#define MSG_VOLUMETRIC_ENABLED "E in mm3" +#define MSG_VOLUMETRIC_ENABLED "E in mm3" #define MSG_FILAMENT_SIZE_EXTRUDER_0 "Fil. Dia. 1" #define MSG_FILAMENT_SIZE_EXTRUDER_1 "Fil. Dia. 2" #define MSG_FILAMENT_SIZE_EXTRUDER_2 "Fil. Dia. 3" @@ -86,14 +86,14 @@ #define MSG_STORE_EPROM "Сохранить в EPROM" #define MSG_LOAD_EPROM "Загруз. из EPROM" #define MSG_RESTORE_FAILSAFE "Сброс настроек" -#define MSG_REFRESH "\004Обновить" -#define MSG_WATCH "Обзор \003" -#define MSG_PREPARE "Действия \x7E" -#define MSG_TUNE "Настройки \x7E" +#define MSG_REFRESH LCD_STR_REFRESH "Обновить" +#define MSG_WATCH "Обзор" +#define MSG_PREPARE "Действия" +#define MSG_TUNE "Настройки" #define MSG_PAUSE_PRINT "Продолжить печать" #define MSG_RESUME_PRINT "возобн. печать" #define MSG_STOP_PRINT "Остановить печать" -#define MSG_CARD_MENU "Меню карты \x7E" +#define MSG_CARD_MENU "Меню карты" #define MSG_NO_CARD "Нет карты" #define MSG_DWELL "Сон..." #define MSG_USERWAIT "Ожиданиие" diff --git a/Marlin/pins.h b/Marlin/pins.h index ea8f96c48..c33fa24e0 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -36,7 +36,7 @@ #include "pins_SETHI.h" #elif MB(RAMPS_OLD) #include "pins_RAMPS_OLD.h" -#elif IS_RAMPS +#elif MB(RAMPS_13_EFB) || MB(RAMPS_13_EEB) || MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF) #include "pins_RAMPS_13.h" #elif MB(DUEMILANOVE_328P) #include "pins_DUEMILANOVE_328P.h" @@ -110,6 +110,10 @@ #include "pins_WITBOX.h" #elif MB(HEPHESTOS) #include "pins_HEPHESTOS.h" +#elif MB(BAM_DICE) + #include "pins_RAMPS_13.h" +#elif MB(BAM_DICE_DUE) + #include "pins_BAM_DICE_DUE.h" #elif MB(99) #include "pins_99.h" #else diff --git a/Marlin/pins_AZTEEG_X3.h b/Marlin/pins_AZTEEG_X3.h index 7eb8eae49..d346e0bd2 100644 --- a/Marlin/pins_AZTEEG_X3.h +++ b/Marlin/pins_AZTEEG_X3.h @@ -3,3 +3,11 @@ */ #include "pins_RAMPS_13.h" + +#define FAN_PIN 9 // (Sprinter config) +#define HEATER_1_PIN -1 + +#ifdef TEMP_STAT_LEDS + #define STAT_LED_RED 6 + #define STAT_LED_BLUE 11 +#endif diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index ddb055ad9..5d0d70db6 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -4,6 +4,9 @@ #include "pins_RAMPS_13.h" +#define FAN_PIN 9 // (Sprinter config) +#define BEEPER 33 + #define E2_STEP_PIN 23 #define E2_DIR_PIN 25 #define E2_ENABLE_PIN 40 @@ -16,15 +19,16 @@ #define E4_DIR_PIN 37 #define E4_ENABLE_PIN 42 +#define HEATER_1_PIN -1 #define HEATER_2_PIN 16 #define HEATER_3_PIN 17 -#define HEATER_4_PIN 4 -#define HEATER_5_PIN 5 -#define HEATER_6_PIN 6 +#define HEATER_4_PIN 4 +#define HEATER_5_PIN 5 +#define HEATER_6_PIN 6 #define HEATER_7_PIN 11 #define TEMP_2_PIN 12 // ANALOG NUMBERING #define TEMP_3_PIN 11 // ANALOG NUMBERING #define TEMP_4_PIN 10 // ANALOG NUMBERING -#define TC1 4 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro -#define TC2 5 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro +#define TC1 4 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro +#define TC2 5 // ANALOG NUMBERING Thermo couple on Azteeg X3Pro diff --git a/Marlin/pins_BAM_DICE_DUE.h b/Marlin/pins_BAM_DICE_DUE.h new file mode 100644 index 000000000..c3123d043 --- /dev/null +++ b/Marlin/pins_BAM_DICE_DUE.h @@ -0,0 +1,11 @@ +/** + * BAM&DICE Due (Arduino Mega) pin assignments + */ + +#include "pins_RAMPS_13.h" + +#define FAN_PIN 9 // (Sprinter config) +#define HEATER_1_PIN -1 + +#define TEMP_0_PIN 9 // ANALOG NUMBERING +#define TEMP_1_PIN 11 // ANALOG NUMBERING diff --git a/Marlin/pins_HEPHESTOS.h b/Marlin/pins_HEPHESTOS.h index c5b7bcf79..8fc5ba643 100644 --- a/Marlin/pins_HEPHESTOS.h +++ b/Marlin/pins_HEPHESTOS.h @@ -3,3 +3,6 @@ */ #include "pins_RAMPS_13.h" + +#define FAN_PIN 9 // (Sprinter config) +#define HEATER_1_PIN -1 diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index e2f74fc83..840804a9d 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -7,10 +7,8 @@ * RAMPS_13_EEB (Extruder, Extruder, Bed) * RAMPS_13_EFF (Extruder, Fan, Fan) * RAMPS_13_EEF (Extruder, Extruder, Fan) - * 3DRAG - * K8200 - * AZTEEG_X3 - * AZTEEG_X3_PRO + * + * Other pins_MYBOARD.h files may override these defaults */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) @@ -63,7 +61,7 @@ #define FILWIDTH_PIN 5 #endif -#if MB(RAMPS_13_EFB) || MB(RAMPS_13_EFF) || MB(AZTEEG_X3) || MB(AZTEEG_X3_PRO) || MB(WITBOX) || MB(HEPHESTOS) +#if MB(RAMPS_13_EFB) || MB(RAMPS_13_EFF) #define FAN_PIN 9 // (Sprinter config) #if MB(RAMPS_13_EFF) #define CONTROLLERFAN_PIN -1 // Pin used for the fan to cool controller @@ -88,7 +86,7 @@ #define HEATER_0_PIN 10 // EXTRUDER 1 #endif -#if MB(RAMPS_13_EFB) || MB(AZTEEG_X3) || MB(WITBOX) || MB(HEPHESTOS) +#if MB(RAMPS_13_EFB) #define HEATER_1_PIN -1 #else #define HEATER_1_PIN 9 // EXTRUDER 2 (FAN On Sprinter) @@ -110,28 +108,14 @@ #ifdef NUM_SERVOS #define SERVO0_PIN 11 - #if NUM_SERVOS > 1 - #define SERVO1_PIN 6 - #endif - - #if NUM_SERVOS > 2 - #define SERVO2_PIN 5 - #endif - - #if NUM_SERVOS > 3 - #define SERVO3_PIN 4 - #endif -#endif - -#if MB(AZTEEG_X3_PRO) - #define BEEPER 33 -#endif - -#ifdef TEMP_STAT_LEDS - #if MB(AZTEEG_X3) - #define STAT_LED_RED 6 - #define STAT_LED_BLUE 11 + #define SERVO1_PIN 6 + #if NUM_SERVOS > 2 + #define SERVO2_PIN 5 + #if NUM_SERVOS > 3 + #define SERVO3_PIN 4 + #endif + #endif #endif #endif diff --git a/Marlin/pins_WITBOX.h b/Marlin/pins_WITBOX.h index 4deda2cba..a4eb0e313 100644 --- a/Marlin/pins_WITBOX.h +++ b/Marlin/pins_WITBOX.h @@ -3,3 +3,6 @@ */ #include "pins_RAMPS_13.h" + +#define FAN_PIN 9 // (Sprinter config) +#define HEATER_1_PIN -1 diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index d5bd2d63d..d50c4265b 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -455,19 +455,17 @@ void checkExtruderAutoFans() setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0); #endif #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1 - if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) + if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0); #endif #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1 - if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN - && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) + if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0); #endif #if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1 - if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN - && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) - && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) + if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN + && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN) setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0); #endif diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 599d0d05c..aa1019b0a 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -1095,6 +1095,16 @@ const short temptable_1047[][2] PROGMEM = { }; #endif +#if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) //User defined table +// Dummy Thermistor table.. It will ALWAYS read 25C. +const short temptable_999[][2] PROGMEM = { + {1*OVERSAMPLENR, 25}, + {1023*OVERSAMPLENR, 25} +}; +#endif + + + #define _TT_NAME(_N) temptable_ ## _N #define TT_NAME(_N) _TT_NAME(_N) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 3773ad324..51658f141 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -10,6 +10,9 @@ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ +bool encoderRateMultiplierEnabled; +int32_t lastEncoderMovementMillis; + /* Configuration settings */ int plaPreheatHotendTemp; int plaPreheatHPBTemp; @@ -41,11 +44,6 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG; #include "ultralcd_implementation_hitachi_HD44780.h" #endif -/** forward declarations **/ - -void copy_and_scalePID_i(); -void copy_and_scalePID_d(); - /* Different menus */ static void lcd_status_screen(); #ifdef ULTIPANEL @@ -119,6 +117,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l /* Helper macros for menus */ #define START_MENU() do { \ + encoderRateMultiplierEnabled = false; \ if (encoderPosition > 0x8000) encoderPosition = 0; \ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ @@ -143,9 +142,39 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l }\ _menuItemNr++;\ } while(0) +#ifdef ENCODER_RATE_MULTIPLIER + #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ + if (_menuItemNr == _lineNr) { \ + if (lcdDrawUpdate) { \ + const char* _label_pstr = PSTR(label); \ + if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \ + lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \ + } \ + else { \ + lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \ + } \ + } \ + if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \ + lcd_quick_feedback(); \ + encoderRateMultiplierEnabled = true; \ + lastEncoderMovementMillis = 0; \ + menu_action_ ## type ( args ); \ + return; \ + } \ + } \ + _menuItemNr++; \ + } while(0) +#endif //ENCODER_RATE_MULTIPLIER #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) +#ifdef ENCODER_RATE_MULTIPLIER + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) +#else //!ENCODER_RATE_MULTIPLIER + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) +#endif //!ENCODER_RATE_MULTIPLIER #define END_MENU() \ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \ if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ @@ -185,9 +214,8 @@ void* editValue; int32_t minEditValue, maxEditValue; menuFunc_t callbackFunc; -// place-holders for Ki and Kd edits, and the extruder # being edited +// place-holders for Ki and Kd edits float raw_Ki, raw_Kd; -int pid_current_extruder; static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) { if (currentMenu != menu) { @@ -205,6 +233,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */ static void lcd_status_screen() { + encoderRateMultiplierEnabled = false; #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) uint16_t mil = millis(); #ifndef PROGRESS_MSG_ONCE @@ -423,23 +452,23 @@ static void lcd_tune_menu() MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999); #if TEMP_SENSOR_0 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); #endif #if TEMP_SENSOR_1 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); #endif #if TEMP_SENSOR_2 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); #endif #if TEMP_SENSOR_3 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); #endif #if TEMP_SENSOR_BED != 0 - MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); #endif - MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW " 0", &extruder_multiply[0], 10, 999); #if TEMP_SENSOR_1 != 0 @@ -616,7 +645,7 @@ static void lcd_preheat_abs_menu() MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); MENU_ITEM(function, MSG_PREHEAT_ABS_N "1", lcd_preheat_abs0); #if TEMP_SENSOR_1 != 0 //2 extruder preheat - MENU_ITEM(function, MSG_PREHEAT_ABS_N "2", lcd_preheat_abs1); + MENU_ITEM(function, MSG_PREHEAT_ABS_N "2", lcd_preheat_abs1); #endif //2 extruder preheat #if TEMP_SENSOR_2 != 0 //3 extruder preheat MENU_ITEM(function, MSG_PREHEAT_ABS_N "3", lcd_preheat_abs2); @@ -811,76 +840,124 @@ static void lcd_control_menu() END_MENU(); } +#ifdef PIDTEMP + + // Helpers for editing PID Ki & Kd values + // grab the PID value out of the temp variable; scale it; then update the PID driver + void copy_and_scalePID_i(int e) { + PID_PARAM(Ki, e) = scalePID_i(raw_Ki); + updatePID(); + } + void copy_and_scalePID_d(int e) { + PID_PARAM(Kd, e) = scalePID_d(raw_Kd); + updatePID(); + } + void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); } + void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); } + #ifdef PID_PARAMS_PER_EXTRUDER + #if EXTRUDERS > 1 + void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); } + void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); } + #if EXTRUDERS > 2 + void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); } + void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); } + #if EXTRUDERS > 3 + void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); } + void copy_and_scalePID_d_E4() { copy_and_scalePID_d(3); } + #endif //EXTRUDERS > 3 + #endif //EXTRUDERS > 2 + #endif //EXTRUDERS > 1 + #endif //PID_PARAMS_PER_EXTRUDER + +#endif //PIDTEMP + static void lcd_control_temperature_menu() { START_MENU(); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); -#if TEMP_SENSOR_0 != 0 - MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); -#endif -#if TEMP_SENSOR_1 != 0 && EXTRUDERS > 1 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); -#endif -#if TEMP_SENSOR_2 != 0 && EXTRUDERS > 2 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); -#endif -#if TEMP_SENSOR_3 != 0 && EXTRUDERS > 3 - MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); -#endif -#if TEMP_SENSOR_BED != 0 - MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); -#endif - MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); -#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0) - MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled); - MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15); - MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15); - MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0); -#endif -#ifdef PIDTEMP - // set up temp variables - undo the default scaling - pid_current_extruder = 0; - raw_Ki = unscalePID_i(PID_PARAM(Ki,0)); - raw_Kd = unscalePID_d(PID_PARAM(Kd,0)); - MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990); - // i is typically a small value so allows values below 1 - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i); - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d); - #ifdef PID_ADD_EXTRUSION_RATE - MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990); - #endif//PID_ADD_EXTRUSION_RATE -#ifdef PID_PARAMS_PER_EXTRUDER + #if TEMP_SENSOR_0 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); + #endif #if EXTRUDERS > 1 - // set up temp variables - undo the default scaling - pid_current_extruder = 0; - raw_Ki = unscalePID_i(PID_PARAM(Ki,1)); - raw_Kd = unscalePID_d(PID_PARAM(Kd,1)); - MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990); - // i is typically a small value so allows values below 1 - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i); - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d); - #ifdef PID_ADD_EXTRUSION_RATE - MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990); - #endif//PID_ADD_EXTRUSION_RATE - #endif//EXTRUDERS > 1 - #if EXTRUDERS > 2 - // set up temp variables - undo the default scaling - pid_current_extruder = 0; - raw_Ki = unscalePID_i(PID_PARAM(Ki,2)); - raw_Kd = unscalePID_d(PID_PARAM(Kd,2)); - MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990); - // i is typically a small value so allows values below 1 - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i); - MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d); + #if TEMP_SENSOR_1 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15); + #endif + #if EXTRUDERS > 2 + #if TEMP_SENSOR_2 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15); + #endif + #if EXTRUDERS > 3 + #if TEMP_SENSOR_3 != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15); + #endif + #endif + #endif + #endif + #if TEMP_SENSOR_BED != 0 + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); + #endif + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); + #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0) + MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled); + MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15); + MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15); + MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0); + #endif + #ifdef PIDTEMP + // set up temp variables - undo the default scaling + raw_Ki = unscalePID_i(PID_PARAM(Ki,0)); + raw_Kd = unscalePID_d(PID_PARAM(Kd,0)); + MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990); + // i is typically a small value so allows values below 1 + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1); + #ifdef PID_ADD_EXTRUSION_RATE + MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990); + #endif//PID_ADD_EXTRUSION_RATE + #ifdef PID_PARAMS_PER_EXTRUDER + #if EXTRUDERS > 1 + // set up temp variables - undo the default scaling + raw_Ki = unscalePID_i(PID_PARAM(Ki,1)); + raw_Kd = unscalePID_d(PID_PARAM(Kd,1)); + MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990); + // i is typically a small value so allows values below 1 + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d_E2); #ifdef PID_ADD_EXTRUSION_RATE - MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990); + MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #endif//EXTRUDERS > 2 -#endif // PID_PARAMS_PER_EXTRUDER -#endif//PIDTEMP - MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu); - MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu); - END_MENU(); + + #if EXTRUDERS > 2 + // set up temp variables - undo the default scaling + raw_Ki = unscalePID_i(PID_PARAM(Ki,2)); + raw_Kd = unscalePID_d(PID_PARAM(Kd,2)); + MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990); + // i is typically a small value so allows values below 1 + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d_E3); + #ifdef PID_ADD_EXTRUSION_RATE + MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990); + #endif//PID_ADD_EXTRUSION_RATE + + #if EXTRUDERS > 3 + // set up temp variables - undo the default scaling + raw_Ki = unscalePID_i(PID_PARAM(Ki,3)); + raw_Kd = unscalePID_d(PID_PARAM(Kd,3)); + MENU_ITEM_EDIT(float52, MSG_PID_P " E4", &PID_PARAM(Kp,3), 1, 9990); + // i is typically a small value so allows values below 1 + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d_E4); + #ifdef PID_ADD_EXTRUSION_RATE + MENU_ITEM_EDIT(float3, MSG_PID_C " E4", &PID_PARAM(Kc,3), 1, 9990); + #endif//PID_ADD_EXTRUSION_RATE + #endif//EXTRUDERS > 3 + #endif//EXTRUDERS > 2 + #endif//EXTRUDERS > 1 + #endif //PID_PARAMS_PER_EXTRUDER + #endif//PIDTEMP + MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu); + MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu); + END_MENU(); } static void lcd_control_temperature_preheat_pla_settings_menu() @@ -961,16 +1038,16 @@ static void lcd_control_volumetric_menu() MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers); if (volumetric_enabled) { - MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers); -#if EXTRUDERS > 1 - MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers); -#if EXTRUDERS > 2 - MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers); -#if EXTRUDERS > 3 - MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_3, &filament_size[3], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers); -#endif //EXTRUDERS > 3 -#endif //EXTRUDERS > 2 -#endif //EXTRUDERS > 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers); + #if EXTRUDERS > 1 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], 1.5, 3.25, calculate_volumetric_multipliers); + #if EXTRUDERS > 2 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], 1.5, 3.25, calculate_volumetric_multipliers); + #if EXTRUDERS > 3 + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_3, &filament_size[3], 1.5, 3.25, calculate_volumetric_multipliers); + #endif //EXTRUDERS > 3 + #endif //EXTRUDERS > 2 + #endif //EXTRUDERS > 1 } END_MENU(); @@ -1260,6 +1337,26 @@ void lcd_init() #endif } +int lcd_strlen(char *s) { + int i = 0, j = 0; + while (s[i]) { + if ((s[i] & 0xc0) != 0x80) j++; + i++; + } + return j; +} + +int lcd_strlen_P(const char *s) { + int j = 0; + while (pgm_read_byte(s)) { + if ((pgm_read_byte(s) & 0xc0) != 0x80) j++; + s++; + } + return j; +} + + + void lcd_update() { static unsigned long timeoutToStatus = 0; @@ -1322,8 +1419,41 @@ void lcd_update() #endif if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP) { + int32_t encoderMultiplier = 1; + + #ifdef ENCODER_RATE_MULTIPLIER + + if (encoderRateMultiplierEnabled) { + int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP; + + if (lastEncoderMovementMillis != 0) { + // Note that the rate is always calculated between to passes through the + // loop and that the abs of the encoderDiff value is tracked. + float encoderStepRate = + (float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0; + + if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; + else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; + + #ifdef ENCODER_RATE_MULTIPLIER_DEBUG + SERIAL_ECHO_START; + SERIAL_ECHO("Enc Step Rate: "); + SERIAL_ECHO(encoderStepRate); + SERIAL_ECHO(" Multiplier: "); + SERIAL_ECHO(encoderMultiplier); + SERIAL_ECHO(" ENCODER_10X_STEPS_PER_SEC: "); + SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC); + SERIAL_ECHO(" ENCODER_100X_STEPS_PER_SEC: "); + SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC); + #endif //ENCODER_RATE_MULTIPLIER_DEBUG + } + + lastEncoderMovementMillis = millis(); + } + #endif //ENCODER_RATE_MULTIPLIER + lcdDrawUpdate = 1; - encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP; + encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP; encoderDiff = 0; timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; } @@ -1372,7 +1502,7 @@ void lcd_ignore_click(bool b) } void lcd_finishstatus() { - int len = strlen(lcd_status_message); + int len = lcd_strlen(lcd_status_message); if (len > 0) { while (len < LCD_WIDTH) { lcd_status_message[len++] = ' '; @@ -1785,24 +1915,4 @@ char *ftostr52(const float &x) return conv; } -// Callback for after editing PID i value -// grab the PID i value out of the temp variable; scale it; then update the PID driver -void copy_and_scalePID_i() -{ -#ifdef PIDTEMP - PID_PARAM(Ki, pid_current_extruder) = scalePID_i(raw_Ki); - updatePID(); -#endif -} - -// Callback for after editing PID d value -// grab the PID d value out of the temp variable; scale it; then update the PID driver -void copy_and_scalePID_d() -{ -#ifdef PIDTEMP - PID_PARAM(Kd, pid_current_extruder) = scalePID_d(raw_Kd); - updatePID(); -#endif -} - #endif //ULTRA_LCD diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 30175be39..d861e9d73 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -4,7 +4,8 @@ #include "Marlin.h" #ifdef ULTRA_LCD - + int lcd_strlen(char *s); + int lcd_strlen_P(const char *s); void lcd_update(); void lcd_init(); void lcd_setstatus(const char* message); diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 9eeee1e15..1628bf8f4 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -636,7 +636,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c { lcd.print(c); pstr++; - n--; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } while(n--) lcd.print(' '); @@ -648,9 +648,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char c; //Use all characters in narrow LCDs #if LCD_WIDTH < 20 - uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data); + uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen(data); #else - uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); + uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen(data); #endif lcd.setCursor(0, row); lcd.print(pre_char); @@ -658,7 +658,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const { lcd.print(c); pstr++; - n--; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } lcd.print(':'); while(n--) @@ -670,9 +670,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons char c; //Use all characters in narrow LCDs #if LCD_WIDTH < 20 - uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data); + uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen_P(data); #else - uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data); + uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen_P(data); #endif lcd.setCursor(0, row); lcd.print(pre_char); @@ -680,7 +680,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons { lcd.print(c); pstr++; - n--; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; } lcd.print(':'); while(n--) @@ -733,9 +733,9 @@ void lcd_implementation_drawedit(const char* pstr, char* value) lcd_printPGM(pstr); lcd.print(':'); #if LCD_WIDTH < 20 - lcd.setCursor(LCD_WIDTH - strlen(value), 1); + lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1); #else - lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); + lcd.setCursor(LCD_WIDTH -1 - lcd_strlen(value), 1); #endif lcd.print(value); }