Sfoglia il codice sorgente

Merge branch 'Marlin_v1' of https://github.com/makr3d/Marlin into makr3d-Marlin_v1

Erik van der Zalm 11 anni fa
parent
commit
cdaaad3df1

+ 23
- 4
Marlin/Configuration.h Vedi File

@@ -17,8 +17,7 @@
17 17
 #define SERIAL_PORT 0
18 18
 
19 19
 // This determines the communication speed of the printer
20
-#define BAUDRATE 250000
21
-//#define BAUDRATE 115200
20
+#define BAUDRATE 115200
22 21
 
23 22
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
24 23
 // 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
@@ -36,6 +35,7 @@
36 35
 // 63 = Melzi
37 36
 // 64 = STB V1.1
38 37
 // 65 = Azteeg X1
38
+// 66 = Melzi with ATmega1284 (MaKr3d version)
39 39
 // 7  = Ultimaker
40 40
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
41 41
 // 77 = 3Drag Controller
@@ -371,10 +371,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
371 371
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
372 372
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
373 373
 //define this to enable eeprom support
374
-//#define EEPROM_SETTINGS
374
+#define EEPROM_SETTINGS
375 375
 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
376 376
 // please keep turned on if you can.
377
-//#define EEPROM_CHITCHAT
377
+#define EEPROM_CHITCHAT
378 378
 
379 379
 // Preheat Constants
380 380
 #define PLA_PREHEAT_HOTEND_TEMP 180 
@@ -394,6 +394,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
394 394
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
395 395
 //#define ULTIPANEL  //the ultipanel as on thingiverse
396 396
 
397
+// The MaKr3d Makr-Panel with graphic controller and SD support
398
+// http://reprap.org/wiki/MaKr3d_MaKrPanel
399
+//#define MAKRPANEL
400
+
397 401
 // The RepRapDiscount Smart Controller (white PCB)
398 402
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
399 403
 //#define REPRAP_DISCOUNT_SMART_CONTROLLER
@@ -419,6 +423,14 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
419 423
 //#define RA_CONTROL_PANEL
420 424
 
421 425
 //automatic expansion
426
+#if defined (MAKRPANEL)
427
+ #define DOGLCD
428
+ #define SDSUPPORT
429
+ #define ULTIPANEL
430
+ #define NEWPANEL
431
+ #define DEFAULT_LCD_CONTRAST 17
432
+#endif
433
+
422 434
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
423 435
  #define DOGLCD
424 436
  #define U8GLIB_ST7920
@@ -505,6 +517,13 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
505 517
   #endif
506 518
 #endif
507 519
 
520
+// default LCD contrast for dogm-like LCD displays
521
+#ifdef DOGLCD
522
+# ifndef DEFAULT_LCD_CONTRAST
523
+#  define DEFAULT_LCD_CONTRAST 32
524
+# endif
525
+#endif
526
+
508 527
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
509 528
 //#define FAST_PWM_FAN
510 529
 

+ 12
- 1
Marlin/ConfigurationStore.cpp Vedi File

@@ -37,7 +37,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
37 37
 // the default values are used whenever there is a change to the data, to prevent
38 38
 // wrong data being written to the variables.
39 39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#define EEPROM_VERSION "V07"
40
+#define EEPROM_VERSION "V08"
41 41
 
42 42
 #ifdef EEPROM_SETTINGS
43 43
 void Config_StoreSettings() 
@@ -78,6 +78,10 @@ void Config_StoreSettings()
78 78
     EEPROM_WRITE_VAR(i,dummy);
79 79
     EEPROM_WRITE_VAR(i,dummy);
80 80
   #endif
81
+  #ifndef DOGLCD
82
+    int lcd_contrast = 32;
83
+  #endif
84
+  EEPROM_WRITE_VAR(i,lcd_contrast);
81 85
   char ver2[4]=EEPROM_VERSION;
82 86
   i=EEPROM_OFFSET;
83 87
   EEPROM_WRITE_VAR(i,ver2); // validate data
@@ -198,6 +202,10 @@ void Config_RetrieveSettings()
198 202
         EEPROM_READ_VAR(i,Kp);
199 203
         EEPROM_READ_VAR(i,Ki);
200 204
         EEPROM_READ_VAR(i,Kd);
205
+        #ifndef DOGLCD
206
+        int lcd_contrast;
207
+        #endif
208
+        EEPROM_READ_VAR(i,lcd_contrast);
201 209
 
202 210
 		// Call updatePID (similar to when we have processed M301)
203 211
 		updatePID();
@@ -244,6 +252,9 @@ void Config_ResetDefault()
244 252
     absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
245 253
     absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
246 254
 #endif
255
+#ifdef DOGLCD
256
+    lcd_contrast = DEFAULT_LCD_CONTRAST;
257
+#endif
247 258
 #ifdef PIDTEMP
248 259
     Kp = DEFAULT_Kp;
249 260
     Ki = scalePID_i(DEFAULT_Ki);

+ 6
- 0
Marlin/Makefile Vedi File

@@ -114,6 +114,12 @@ MCU              ?= atmega644p
114 114
 else ifeq  ($(HARDWARE_MOTHERBOARD),63)
115 115
 HARDWARE_VARIANT ?= Sanguino
116 116
 MCU              ?= atmega644p
117
+else ifeq  ($(HARDWARE_MOTHERBOARD),65)
118
+HARDWARE_VARIANT ?= Sanguino
119
+MCU              ?= atmega1284p
120
+else ifeq  ($(HARDWARE_MOTHERBOARD),66)
121
+HARDWARE_VARIANT ?= Sanguino
122
+MCU              ?= atmega1284p
117 123
 
118 124
 #Ultimaker
119 125
 else ifeq  ($(HARDWARE_MOTHERBOARD),7)

+ 14
- 0
Marlin/Marlin_main.cpp Vedi File

@@ -125,6 +125,7 @@
125 125
 // M220 S<factor in percent>- set speed factor override percentage
126 126
 // M221 S<factor in percent>- set extrude factor override percentage
127 127
 // M240 - Trigger a camera to take a photograph
128
+// M250 - Set LCD contrast C<contrast value> (value 0..63)
128 129
 // M280 - set servo position absolute. P: servo index, S: angle or microseconds
129 130
 // M300 - Play beepsound S<frequency Hz> P<duration ms>
130 131
 // M301 - Set PID parameters P I and D
@@ -421,6 +422,7 @@ void setup()
421 422
   servo_init();
422 423
 
423 424
   lcd_init();
425
+  _delay_ms(1000);	// wait 1sec to display the splash screen
424 426
   
425 427
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
426 428
     SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
@@ -1699,6 +1701,18 @@ void process_commands()
1699 1701
       #endif
1700 1702
      }
1701 1703
     break;
1704
+#ifdef DOGLCD
1705
+    case 250: // M250  Set LCD contrast value: C<value> (value 0..63)
1706
+     {
1707
+	  if (code_seen('C')) {
1708
+	   lcd_setcontrast( ((int)code_value())&63 );
1709
+          }
1710
+          SERIAL_PROTOCOLPGM("lcd contrast value: ");
1711
+          SERIAL_PROTOCOL(lcd_contrast);
1712
+          SERIAL_PROTOCOLLN("");
1713
+     }
1714
+    break;
1715
+#endif
1702 1716
     #ifdef PREVENT_DANGEROUS_EXTRUDE
1703 1717
     case 302: // allow cold extrudes, or set the minimum extrude temperature
1704 1718
     {

+ 14
- 2
Marlin/dogm_lcd_implementation.h Vedi File

@@ -74,16 +74,28 @@
74 74
 
75 75
 #define FONT_STATUSMENU	u8g_font_6x9
76 76
 
77
+int lcd_contrast;
78
+
77 79
 // LCD selection
78 80
 #ifdef U8GLIB_ST7920
79 81
 //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
80 82
 U8GLIB_ST7920_128X64_RRD u8g(0);
83
+#elsif defined(MAKRPANEL)
84
+// The MaKrPanel display, ST7565 controller as well
85
+U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
81 86
 #else
87
+// for regular DOGM128 display with HW-SPI
82 88
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
83 89
 #endif
84 90
 
85 91
 static void lcd_implementation_init()
86 92
 {
93
+#ifdef LCD_PIN_BL
94
+	pinMode(LCD_PIN_BL, OUTPUT);	// Enable LCD backlight
95
+	digitalWrite(LCD_PIN_BL, HIGH);
96
+#endif
97
+
98
+        u8g.setContrast(lcd_contrast);	
87 99
 	//  Uncomment this if you have the first generation (V1.10) of STBs board
88 100
 	//  pinMode(17, OUTPUT);	// Enable LCD backlight
89 101
 	//  digitalWrite(17, HIGH);
@@ -117,14 +129,14 @@ static void lcd_implementation_init()
117 129
 			u8g.setFont(u8g_font_6x10_marlin);
118 130
 			u8g.drawStr(62,10,"MARLIN"); 
119 131
 			u8g.setFont(u8g_font_5x8);
120
-			u8g.drawStr(62,19,"V1.0.0 RC2");
132
+			u8g.drawStr(62,19,"V1.0.0 RC2-mm");
121 133
 			u8g.setFont(u8g_font_6x10_marlin);
122 134
 			u8g.drawStr(62,28,"by ErikZalm");
123 135
 			u8g.drawStr(62,41,"DOGM128 LCD");
124 136
 			u8g.setFont(u8g_font_5x8);
125 137
 			u8g.drawStr(62,48,"enhancements");
126 138
 			u8g.setFont(u8g_font_5x8);
127
-			u8g.drawStr(62,55,"by STB");
139
+			u8g.drawStr(62,55,"by STB, MM");
128 140
 			u8g.drawStr(62,61,"uses u");
129 141
 			u8g.drawStr90(92,57,"8");
130 142
 			u8g.drawStr(100,61,"glib");

+ 9
- 2
Marlin/language.h Vedi File

@@ -101,6 +101,7 @@
101 101
 	#define MSG_RECTRACT "Rectract"
102 102
 	#define MSG_TEMPERATURE "Temperature"
103 103
 	#define MSG_MOTION "Motion"
104
+	#define MSG_CONTRAST "LCD contrast"
104 105
 	#define MSG_STORE_EPROM "Store memory"
105 106
 	#define MSG_LOAD_EPROM "Load memory"
106 107
 	#define MSG_RESTORE_FAILSAFE "Restore Failsafe"
@@ -260,6 +261,7 @@
260 261
 	#define MSG_RECTRACT "Wycofanie"
261 262
 	#define MSG_TEMPERATURE "Temperatura"
262 263
 	#define MSG_MOTION "Ruch"
264
+	#define MSG_CONTRAST "LCD contrast"
263 265
 	#define MSG_STORE_EPROM "Zapisz w pamieci"
264 266
 	#define MSG_LOAD_EPROM "Wczytaj z pamieci"
265 267
 	#define MSG_RESTORE_FAILSAFE " Ustawienia fabryczne"
@@ -423,6 +425,7 @@
423 425
 #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
424 426
 #define MSG_TEMPERATURE_RTN " Temperature \003"
425 427
 #define MSG_MOTION_WIDE " Mouvement \x7E"
428
+	#define MSG_CONTRAST "LCD contrast"
426 429
 #define MSG_STORE_EPROM " Sauvegarder memoire"
427 430
 #define MSG_LOAD_EPROM " Lire memoire"
428 431
 #define MSG_RESTORE_FAILSAFE " Restaurer memoire"
@@ -535,7 +538,7 @@
535 538
 
536 539
 	#define MSG_SD_INSERTED      "SDKarte erkannt"
537 540
 	#define MSG_SD_REMOVED       "SDKarte entfernt"
538
-	#define MSG_MAIN             "Hauptmneü"
541
+	#define MSG_MAIN             "Hauptmenü"
539 542
 	#define MSG_AUTOSTART        "Autostart"
540 543
 	#define MSG_DISABLE_STEPPERS "Stepper abschalten"
541 544
 	#define MSG_AUTO_HOME        "Auto Nullpunkt"
@@ -554,7 +557,7 @@
554 557
 	#define MSG_NOZZLE2          "Düse3"
555 558
 	#define MSG_BED              "Bett"
556 559
 	#define MSG_FAN_SPEED        "Lüftergeschw."
557
-	#define MSG_FLOW             "Fluß"
560
+	#define MSG_FLOW             "Fluss"
558 561
 	#define MSG_CONTROL          "Einstellungen"
559 562
 	#define MSG_MIN              "\002 Min"
560 563
 	#define MSG_MAX              "\002 Max"
@@ -587,6 +590,7 @@
587 590
 	#define MSG_WATCH            "Beobachten"
588 591
 	#define MSG_TEMPERATURE      "Temperatur"
589 592
 	#define MSG_MOTION           "Bewegung"
593
+	#define MSG_CONTRAST "LCD contrast"
590 594
 	#define MSG_STORE_EPROM      "EPROM speichern"
591 595
 	#define MSG_LOAD_EPROM       "EPROM laden"
592 596
 	#define MSG_RESTORE_FAILSAFE "Standardkonfig."
@@ -913,6 +917,7 @@
913 917
 #define MSG_RECTRACT    					" Откат подачи      \x7E"
914 918
 #define MSG_TEMPERATURE  				" Температура       \x7E"
915 919
 #define MSG_MOTION						" Скорости          \x7E"
920
+	#define MSG_CONTRAST "LCD contrast"
916 921
 #define MSG_STORE_EPROM						" Сохранить настройки"
917 922
 #define MSG_LOAD_EPROM						" Загрузить настройки"
918 923
 #define MSG_RESTORE_FAILSAFE				" Сброс настроек     "
@@ -1068,6 +1073,7 @@
1068 1073
 	#define MSG_RECTRACT             "Ritrai"
1069 1074
 	#define MSG_TEMPERATURE          "Temperatura"
1070 1075
 	#define MSG_MOTION               "Movimento"
1076
+	#define MSG_CONTRAST "LCD contrast"
1071 1077
 	#define MSG_STORE_EPROM          "Salva in EEPROM"
1072 1078
 	#define MSG_LOAD_EPROM           "Carica da EEPROM"
1073 1079
 	#define MSG_RESTORE_FAILSAFE     "Impostaz. default"
@@ -1398,6 +1404,7 @@
1398 1404
 	#define MSG_RECTRACT "Veda takaisin"
1399 1405
 	#define MSG_TEMPERATURE "Lampotila"
1400 1406
 	#define MSG_MOTION "Liike"
1407
+	#define MSG_CONTRAST "LCD contrast"
1401 1408
 	#define MSG_STORE_EPROM "Tallenna muistiin"
1402 1409
 	#define MSG_LOAD_EPROM "Lataa muistista"
1403 1410
 	#define MSG_RESTORE_FAILSAFE "Palauta oletus"

+ 25
- 2
Marlin/pins.h Vedi File

@@ -843,13 +843,13 @@
843 843
 #if MOTHERBOARD == 64
844 844
 #define STB
845 845
 #endif
846
-#if MOTHERBOARD == 63
846
+#if MOTHERBOARD == 63 || MOTHERBOARD == 66
847 847
 #define MELZI
848 848
 #endif
849 849
 #if MOTHERBOARD == 65
850 850
 #define AZTEEG_X1
851 851
 #endif
852
-#if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64 || MOTHERBOARD == 65
852
+#if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64 || MOTHERBOARD == 65 || MOTHERBOARD == 66
853 853
 #undef MOTHERBOARD
854 854
 #define MOTHERBOARD 6
855 855
 #define SANGUINOLOLU_V_1_2
@@ -891,6 +891,8 @@
891 891
 
892 892
 #ifdef STB
893 893
 #define FAN_PIN            4
894
+	//  Uncomment this if you have the first generation (V1.10) of STBs board
895
+#define LCD_PIN_BL         17 // LCD backlight LED
894 896
 #endif
895 897
 
896 898
 #ifdef AZTEEG_X1
@@ -975,6 +977,27 @@
975 977
    #endif //Newpanel
976 978
  #endif //Ultipanel
977 979
 
980
+ #ifdef MAKRPANEL
981
+     #define BEEPER 29
982
+     // Pins for DOGM SPI LCD Support
983
+     #define DOGLCD_A0  30
984
+     #define DOGLCD_CS  17
985
+     #define LCD_PIN_BL	28	// backlight LED on PA3
986
+     // GLCD features
987
+     #define LCD_CONTRAST 1
988
+     // Uncomment screen orientation
989
+     #define LCD_SCREEN_ROT_0
990
+       // #define LCD_SCREEN_ROT_90
991
+       // #define LCD_SCREEN_ROT_180
992
+       // #define LCD_SCREEN_ROT_270
993
+     //The encoder and click button
994
+     #define BTN_EN1 11
995
+     #define BTN_EN2 10
996
+     #define BTN_ENC 16  //the click switch
997
+     //not connected to a pin
998
+     #define SDCARDDETECT -1    
999
+ #endif //Makrpanel
1000
+
978 1001
 #endif
979 1002
 
980 1003
 

+ 40
- 0
Marlin/ultralcd.cpp Vedi File

@@ -49,6 +49,9 @@ static void lcd_control_temperature_menu();
49 49
 static void lcd_control_temperature_preheat_pla_settings_menu();
50 50
 static void lcd_control_temperature_preheat_abs_settings_menu();
51 51
 static void lcd_control_motion_menu();
52
+#ifdef DOGLCD
53
+static void lcd_set_contrast();
54
+#endif
52 55
 static void lcd_control_retract_menu();
53 56
 static void lcd_sdcard_menu();
54 57
 
@@ -492,6 +495,10 @@ static void lcd_control_menu()
492 495
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
493 496
     MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
494 497
     MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
498
+#ifdef DOGLCD
499
+//    MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
500
+    MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
501
+#endif
495 502
 #ifdef FWRETRACT
496 503
     MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
497 504
 #endif
@@ -603,6 +610,31 @@ static void lcd_control_motion_menu()
603 610
     END_MENU();
604 611
 }
605 612
 
613
+#ifdef DOGLCD
614
+static void lcd_set_contrast()
615
+{
616
+    if (encoderPosition != 0)
617
+    {
618
+        lcd_contrast -= encoderPosition;
619
+        if (lcd_contrast < 0) lcd_contrast = 0;
620
+        else if (lcd_contrast > 63) lcd_contrast = 63;
621
+        encoderPosition = 0;
622
+        lcdDrawUpdate = 1;
623
+        u8g.setContrast(lcd_contrast);
624
+    }
625
+    if (lcdDrawUpdate)
626
+    {
627
+        lcd_implementation_drawedit(PSTR("Contrast"), itostr2(lcd_contrast));
628
+    }
629
+    if (LCD_CLICKED)
630
+    {
631
+        lcd_quick_feedback();
632
+        currentMenu = lcd_control_menu;
633
+        encoderPosition = 0;
634
+    }
635
+}
636
+#endif
637
+
606 638
 #ifdef FWRETRACT
607 639
 static void lcd_control_retract_menu()
608 640
 {
@@ -992,6 +1024,14 @@ void lcd_reset_alert_level()
992 1024
     lcd_status_message_level = 0;
993 1025
 }
994 1026
 
1027
+#ifdef DOGLCD
1028
+void lcd_setcontrast(uint8_t value)
1029
+{
1030
+    lcd_contrast = value & 63;
1031
+    u8g.setContrast(lcd_contrast);	
1032
+}
1033
+#endif
1034
+
995 1035
 #ifdef ULTIPANEL
996 1036
 /* Warning: This function is called from interrupt context */
997 1037
 void lcd_buttons_update()

+ 6
- 1
Marlin/ultralcd.h Vedi File

@@ -11,7 +11,12 @@
11 11
   void lcd_setstatuspgm(const char* message);
12 12
   void lcd_setalertstatuspgm(const char* message);
13 13
   void lcd_reset_alert_level();
14
-  
14
+
15
+#ifdef DOGLCD
16
+  extern int lcd_contrast;
17
+  void lcd_setcontrast(uint8_t value);
18
+#endif
19
+
15 20
   static unsigned char blink = 0;	// Variable for visualisation of fan rotation in GLCD
16 21
 
17 22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))

Loading…
Annulla
Salva