Browse Source

Merge branch 'SAV-MkI_merge' into Development

Tested for SAV MKI and SAV 3D LCD on lewihe.
fmalpartida 10 years ago
parent
commit
ec33df0554

+ 7
- 5
Marlin/Configuration.h View File

656
 // Shift register panels
656
 // Shift register panels
657
 // ---------------------
657
 // ---------------------
658
 // 2 wire Non-latching LCD SR from:
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
 #endif
666
 #endif
665
 
667
 
666
 
668
 

+ 73
- 2
Marlin/Marlin_main.cpp View File

463
 void setup_killpin()
463
 void setup_killpin()
464
 {
464
 {
465
   #if defined(KILL_PIN) && KILL_PIN > -1
465
   #if defined(KILL_PIN) && KILL_PIN > -1
466
-    pinMode(KILL_PIN,INPUT);
466
+    SET_INPUT(KILL_PIN);
467
     WRITE(KILL_PIN,HIGH);
467
     WRITE(KILL_PIN,HIGH);
468
   #endif
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
 void setup_photpin()
481
 void setup_photpin()
472
 {
482
 {
473
   #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
483
   #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
600
   pinMode(SERVO0_PIN, OUTPUT);
610
   pinMode(SERVO0_PIN, OUTPUT);
601
   digitalWrite(SERVO0_PIN, LOW); // turn it off
611
   digitalWrite(SERVO0_PIN, LOW); // turn it off
602
 #endif // Z_PROBE_SLED
612
 #endif // Z_PROBE_SLED
613
+  setup_homepin();
603
 }
614
 }
604
 
615
 
605
 
616
 
4303
 
4314
 
4304
 void manage_inactivity()
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
   if(buflen < (BUFSIZE-1))
4329
   if(buflen < (BUFSIZE-1))
4307
     get_command();
4330
     get_command();
4308
 
4331
 
4332
   #endif
4355
   #endif
4333
   
4356
   
4334
   #if defined(KILL_PIN) && KILL_PIN > -1
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
     if( 0 == READ(KILL_PIN) )
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
   #endif
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
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
4401
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
4339
     controllerFan(); //Check if fan should be turned on to cool stepper drivers down
4402
     controllerFan(); //Check if fan should be turned on to cool stepper drivers down
4340
   #endif
4403
   #endif
4391
   SERIAL_ERROR_START;
4454
   SERIAL_ERROR_START;
4392
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
4455
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
4393
   LCD_ALERTMESSAGEPGM(MSG_KILLED);
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
   suicide();
4465
   suicide();
4395
   while(1) { /* Intentionally left empty */ } // Wait for reset
4466
   while(1) { /* Intentionally left empty */ } // Wait for reset
4396
 }
4467
 }

+ 3
- 0
Marlin/language.h View File

43
 #elif MB(5DPRINT)
43
 #elif MB(5DPRINT)
44
 	#define MACHINE_NAME "Makibox"
44
 	#define MACHINE_NAME "Makibox"
45
 	#define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/"
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
 #else
49
 #else
47
 	#ifdef CUSTOM_MENDEL_NAME
50
 	#ifdef CUSTOM_MENDEL_NAME
48
 		#define MACHINE_NAME CUSTOM_MENDEL_NAME
51
 		#define MACHINE_NAME CUSTOM_MENDEL_NAME

+ 18
- 6
Marlin/pins.h View File

1904
   #define X_STOP_PIN         13
1904
   #define X_STOP_PIN         13
1905
   #define Y_STOP_PIN         14
1905
   #define Y_STOP_PIN         14
1906
   #define Z_STOP_PIN         15
1906
   #define Z_STOP_PIN         15
1907
+//  #define Z_STOP_PIN         36  // For inductive sensor.
1908
+
1907
   #define TEMP_0_PIN          7  // Extruder / Analog pin numbering
1909
   #define TEMP_0_PIN          7  // Extruder / Analog pin numbering
1908
   #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
1910
   #define TEMP_BED_PIN        6  // Bed / Analog pin numbering
1909
 
1911
 
1914
 #define SDSS               20  // PB0 - 8 in marlin env.
1916
 #define SDSS               20  // PB0 - 8 in marlin env.
1915
 #define LED_PIN            -1
1917
 #define LED_PIN            -1
1916
 #define PS_ON_PIN          -1
1918
 #define PS_ON_PIN          -1
1917
-#define KILL_PIN           -1
1918
 #define ALARM_PIN          -1
1919
 #define ALARM_PIN          -1
1919
 #define SDCARDDETECT       -1
1920
 #define SDCARDDETECT       -1
1920
 
1921
 
1933
 #define LCD_PINS_D5        -1
1934
 #define LCD_PINS_D5        -1
1934
 #define LCD_PINS_D6        -1
1935
 #define LCD_PINS_D6        -1
1935
 #define LCD_PINS_D7        -1
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
 // For LCD SHIFT register LCD
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
 #endif // SAV_MKI
1956
 #endif // SAV_MKI
1945
 
1957
 

+ 3
- 3
Marlin/ultralcd.cpp View File

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

+ 2
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

190
 // 2 wire Non-latching LCD SR from:
190
 // 2 wire Non-latching LCD SR from:
191
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
191
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
192
 #elif defined(SR_LCD_2W_NL)
192
 #elif defined(SR_LCD_2W_NL)
193
-   
193
+
194
+  extern "C" void __cxa_pure_virtual() { while (1); }
194
   #include <LCD.h>
195
   #include <LCD.h>
195
   #include <LiquidCrystal_SR.h>
196
   #include <LiquidCrystal_SR.h>
196
   #define LCD_CLASS LiquidCrystal_SR
197
   #define LCD_CLASS LiquidCrystal_SR

Loading…
Cancel
Save