Przeglądaj źródła

Merge branch 'SAV-MkI_merge' into Development

Tested for SAV MKI and SAV 3D LCD on lewihe.
fmalpartida 10 lat temu
rodzic
commit
ec33df0554

+ 7
- 5
Marlin/Configuration.h Wyświetl plik

@@ -656,11 +656,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
656 656
 // Shift register panels
657 657
 // ---------------------
658 658
 // 2 wire Non-latching LCD SR from:
659
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
660
-//#define SR_LCD
661
-#ifdef SR_LCD
662
-   #define SR_LCD_2W_NL    // Non latching 2 wire shift register
663
-   //#define NEWPANEL
659
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
660
+
661
+//#define SAV_3DLCD
662
+#ifdef SAV_3DLCD
663
+   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
664
+   #define NEWPANEL
665
+   #define ULTIPANEL
664 666
 #endif
665 667
 
666 668
 

+ 73
- 2
Marlin/Marlin_main.cpp Wyświetl plik

@@ -463,11 +463,21 @@ void enquecommand_P(const char *cmd)
463 463
 void setup_killpin()
464 464
 {
465 465
   #if defined(KILL_PIN) && KILL_PIN > -1
466
-    pinMode(KILL_PIN,INPUT);
466
+    SET_INPUT(KILL_PIN);
467 467
     WRITE(KILL_PIN,HIGH);
468 468
   #endif
469 469
 }
470 470
 
471
+// Set home pin
472
+void setup_homepin(void)
473
+{
474
+#if defined(HOME_PIN) && HOME_PIN > -1
475
+   SET_INPUT(HOME_PIN);
476
+   WRITE(HOME_PIN,HIGH);
477
+#endif
478
+}
479
+
480
+
471 481
 void setup_photpin()
472 482
 {
473 483
   #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
@@ -600,6 +610,7 @@ void setup()
600 610
   pinMode(SERVO0_PIN, OUTPUT);
601 611
   digitalWrite(SERVO0_PIN, LOW); // turn it off
602 612
 #endif // Z_PROBE_SLED
613
+  setup_homepin();
603 614
 }
604 615
 
605 616
 
@@ -4303,6 +4314,18 @@ void handle_status_leds(void) {
4303 4314
 
4304 4315
 void manage_inactivity()
4305 4316
 {
4317
+	
4318
+#if defined(KILL_PIN) && KILL_PIN > -1
4319
+	static int killCount = 0;   // make the inactivity button a bit less responsive
4320
+   const int KILL_DELAY = 10000;
4321
+#endif
4322
+
4323
+#if defined(HOME_PIN) && HOME_PIN > -1
4324
+   static int homeDebounceCount = 0;   // poor man's debouncing count
4325
+   const int HOME_DEBOUNCE_DELAY = 10000;
4326
+#endif
4327
+   
4328
+	
4306 4329
   if(buflen < (BUFSIZE-1))
4307 4330
     get_command();
4308 4331
 
@@ -4332,9 +4355,49 @@ void manage_inactivity()
4332 4355
   #endif
4333 4356
   
4334 4357
   #if defined(KILL_PIN) && KILL_PIN > -1
4358
+    
4359
+    // Check if the kill button was pressed and wait just in case it was an accidental
4360
+    // key kill key press
4361
+    // -------------------------------------------------------------------------------
4335 4362
     if( 0 == READ(KILL_PIN) )
4336
-      kill();
4363
+    {
4364
+       killCount++;
4365
+    }
4366
+    else if (killCount > 0)
4367
+    {
4368
+       killCount--;
4369
+    }
4370
+    // Exceeded threshold and we can confirm that it was not accidental
4371
+    // KILL the machine
4372
+    // ----------------------------------------------------------------
4373
+    if ( killCount >= KILL_DELAY)
4374
+    {
4375
+       kill();
4376
+    }
4337 4377
   #endif
4378
+
4379
+#if defined(HOME_PIN) && HOME_PIN > -1
4380
+    // Check to see if we have to home, use poor man's debouncer
4381
+    // ---------------------------------------------------------
4382
+    if ( 0 == READ(HOME_PIN) )
4383
+    {
4384
+       if (homeDebounceCount == 0)
4385
+       {
4386
+          enquecommand_P((PSTR("G28")));
4387
+          homeDebounceCount++;
4388
+          LCD_ALERTMESSAGEPGM(MSG_AUTO_HOME);
4389
+       }
4390
+       else if (homeDebounceCount < HOME_DEBOUNCE_DELAY)
4391
+       {
4392
+          homeDebounceCount++;
4393
+       }
4394
+       else
4395
+       {
4396
+          homeDebounceCount = 0;
4397
+       }
4398
+    }
4399
+#endif
4400
+    
4338 4401
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
4339 4402
     controllerFan(); //Check if fan should be turned on to cool stepper drivers down
4340 4403
   #endif
@@ -4391,6 +4454,14 @@ void kill()
4391 4454
   SERIAL_ERROR_START;
4392 4455
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
4393 4456
   LCD_ALERTMESSAGEPGM(MSG_KILLED);
4457
+  
4458
+  // FMC small patch to update the LCD before ending
4459
+  sei();   // enable interrupts
4460
+  for ( int i=5; i--; lcd_update())
4461
+  {
4462
+     delay(200);	
4463
+  }
4464
+  cli();   // disable interrupts
4394 4465
   suicide();
4395 4466
   while(1) { /* Intentionally left empty */ } // Wait for reset
4396 4467
 }

+ 3
- 0
Marlin/language.h Wyświetl plik

@@ -43,6 +43,9 @@
43 43
 #elif MB(5DPRINT)
44 44
 	#define MACHINE_NAME "Makibox"
45 45
 	#define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/"
46
+#elif MB(SAV_MKI)
47
+	#define MACHINE_NAME "SAV MkI"
48
+	#define FIRMWARE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config"
46 49
 #else
47 50
 	#ifdef CUSTOM_MENDEL_NAME
48 51
 		#define MACHINE_NAME CUSTOM_MENDEL_NAME

+ 18
- 6
Marlin/pins.h Wyświetl plik

@@ -1904,6 +1904,8 @@
1904 1904
   #define X_STOP_PIN         13
1905 1905
   #define Y_STOP_PIN         14
1906 1906
   #define Z_STOP_PIN         15
1907
+//  #define Z_STOP_PIN         36  // For inductive sensor.
1908
+
1907 1909
   #define TEMP_0_PIN          7  // Extruder / Analog pin numbering
1908 1910
   #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
1909 1911
 
@@ -1914,7 +1916,6 @@
1914 1916
 #define SDSS               20  // PB0 - 8 in marlin env.
1915 1917
 #define LED_PIN            -1
1916 1918
 #define PS_ON_PIN          -1
1917
-#define KILL_PIN           -1
1918 1919
 #define ALARM_PIN          -1
1919 1920
 #define SDCARDDETECT       -1
1920 1921
 
@@ -1933,13 +1934,24 @@
1933 1934
 #define LCD_PINS_D5        -1
1934 1935
 #define LCD_PINS_D6        -1
1935 1936
 #define LCD_PINS_D7        -1
1936
-#define BTN_EN1            -1
1937
-#define BTN_EN2            -1
1938
-#define BTN_ENC            -1
1939 1937
 
1938
+#ifdef SAV_3DLCD
1940 1939
 // For LCD SHIFT register LCD
1941
-#define SR_DATA_PIN         0
1942
-#define SR_CLK_PIN          1
1940
+#define SR_DATA_PIN         1
1941
+#define SR_CLK_PIN          0
1942
+
1943
+#define BTN_EN1            41
1944
+#define BTN_EN2            40
1945
+#define BTN_ENC            12
1946
+
1947
+#define KILL_PIN           42 // A2 = 42 - teensy = 40
1948
+#define HOME_PIN          -1 // A4 = marlin 44 - teensy = 42
1949
+
1950
+#ifdef NUM_SERVOS
1951
+  #define SERVO0_PIN       41 // In teensy's pin definition for pinMode (in Servo.cpp)
1952
+#endif
1953
+
1954
+#endif
1943 1955
 
1944 1956
 #endif // SAV_MKI
1945 1957
 

+ 3
- 3
Marlin/ultralcd.cpp Wyświetl plik

@@ -1075,12 +1075,12 @@ void lcd_init()
1075 1075
     lcd_implementation_init();
1076 1076
 
1077 1077
 #ifdef NEWPANEL
1078
-    pinMode(BTN_EN1,INPUT);
1079
-    pinMode(BTN_EN2,INPUT);
1078
+    SET_INPUT(BTN_EN1);
1079
+    SET_INPUT(BTN_EN2);
1080 1080
     WRITE(BTN_EN1,HIGH);
1081 1081
     WRITE(BTN_EN2,HIGH);
1082 1082
   #if BTN_ENC > 0
1083
-    pinMode(BTN_ENC,INPUT);
1083
+    SET_INPUT(BTN_ENC);
1084 1084
     WRITE(BTN_ENC,HIGH);
1085 1085
   #endif
1086 1086
   #ifdef REPRAPWORLD_KEYPAD

+ 2
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h Wyświetl plik

@@ -190,7 +190,8 @@ extern volatile uint16_t buttons;  //an extended version of the last checked but
190 190
 // 2 wire Non-latching LCD SR from:
191 191
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
192 192
 #elif defined(SR_LCD_2W_NL)
193
-   
193
+
194
+  extern "C" void __cxa_pure_virtual() { while (1); }
194 195
   #include <LCD.h>
195 196
   #include <LiquidCrystal_SR.h>
196 197
   #define LCD_CLASS LiquidCrystal_SR

Ładowanie…
Anuluj
Zapisz