Browse Source

added suicide pin for a power supply to the arduino that is only active if the arduino is holding high for an output.

Bernhard 12 years ago
parent
commit
cee5f9020a
2 changed files with 35 additions and 4 deletions
  1. 34
    4
      Marlin/Marlin.pde
  2. 1
    0
      Marlin/pins.h

+ 34
- 4
Marlin/Marlin.pde View File

@@ -161,7 +161,7 @@ static bool fromsd[BUFSIZE];
161 161
 static int bufindr = 0;
162 162
 static int bufindw = 0;
163 163
 static int buflen = 0;
164
-static int i = 0;
164
+//static int i = 0;
165 165
 static char serial_char;
166 166
 static int serial_count = 0;
167 167
 static boolean comment_mode = false;
@@ -233,8 +233,30 @@ void setup_photpin()
233 233
     #endif
234 234
   #endif 
235 235
 }
236
+
237
+void setup_powerhold()
238
+{
239
+ #ifdef SUICIDE_PIN
240
+    #if (SUICIDE_PIN> -1) 
241
+      SET_OUTPUT(SUICIDE_PIN);
242
+      WRITE(SUICIDE_PIN, HIGH);
243
+    #endif
244
+  #endif
245
+}
246
+
247
+void suicide()
248
+{
249
+ #ifdef SUICIDE_PIN
250
+    #if (SUICIDE_PIN> -1) 
251
+      SET_OUTPUT(SUICIDE_PIN);
252
+      WRITE(SUICIDE_PIN, LOW);
253
+    #endif
254
+  #endif
255
+}
256
+
236 257
 void setup()
237 258
 { 
259
+  setup_powerhold();
238 260
   MSerial.begin(BAUDRATE);
239 261
   SERIAL_ECHO_START;
240 262
   SERIAL_ECHOLNPGM(VERSION_STRING);
@@ -912,10 +934,17 @@ FORCE_INLINE void process_commands()
912 934
       case 80: // M80 - ATX Power On
913 935
         SET_OUTPUT(PS_ON_PIN); //GND
914 936
         break;
937
+      #endif
938
+      
915 939
       case 81: // M81 - ATX Power Off
916
-        SET_INPUT(PS_ON_PIN); //Floating
917
-        break;
918
-    #endif
940
+      #if (SUICIDE_PIN >-1)
941
+        suicide();
942
+      #else
943
+        #if (PS_ON_PIN > -1) 
944
+          SET_INPUT(PS_ON_PIN); //Floating
945
+        #endif
946
+      #endif
947
+        
919 948
     case 82:
920 949
       axis_relative_modes[3] = false;
921 950
       break;
@@ -1314,6 +1343,7 @@ void kill()
1314 1343
   SERIAL_ERROR_START;
1315 1344
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1316 1345
   LCD_MESSAGEPGM("KILLED. ");
1346
+  suicide();
1317 1347
   while(1); // Wait for reset
1318 1348
 }
1319 1349
 

+ 1
- 0
Marlin/pins.h View File

@@ -582,6 +582,7 @@
582 582
 #define FAN_PIN            7
583 583
 #define PS_ON_PIN          12
584 584
 #define KILL_PIN           -1
585
+#define SUICIDE_PIN        54  //PIN that has to be turned on right after start, to keep power flowing.
585 586
 
586 587
 #ifdef ULTRA_LCD
587 588
 

Loading…
Cancel
Save