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 13 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
 static int bufindr = 0;
161
 static int bufindr = 0;
162
 static int bufindw = 0;
162
 static int bufindw = 0;
163
 static int buflen = 0;
163
 static int buflen = 0;
164
-static int i = 0;
164
+//static int i = 0;
165
 static char serial_char;
165
 static char serial_char;
166
 static int serial_count = 0;
166
 static int serial_count = 0;
167
 static boolean comment_mode = false;
167
 static boolean comment_mode = false;
233
     #endif
233
     #endif
234
   #endif 
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
 void setup()
257
 void setup()
237
 { 
258
 { 
259
+  setup_powerhold();
238
   MSerial.begin(BAUDRATE);
260
   MSerial.begin(BAUDRATE);
239
   SERIAL_ECHO_START;
261
   SERIAL_ECHO_START;
240
   SERIAL_ECHOLNPGM(VERSION_STRING);
262
   SERIAL_ECHOLNPGM(VERSION_STRING);
912
       case 80: // M80 - ATX Power On
934
       case 80: // M80 - ATX Power On
913
         SET_OUTPUT(PS_ON_PIN); //GND
935
         SET_OUTPUT(PS_ON_PIN); //GND
914
         break;
936
         break;
937
+      #endif
938
+      
915
       case 81: // M81 - ATX Power Off
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
     case 82:
948
     case 82:
920
       axis_relative_modes[3] = false;
949
       axis_relative_modes[3] = false;
921
       break;
950
       break;
1314
   SERIAL_ERROR_START;
1343
   SERIAL_ERROR_START;
1315
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1344
   SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
1316
   LCD_MESSAGEPGM("KILLED. ");
1345
   LCD_MESSAGEPGM("KILLED. ");
1346
+  suicide();
1317
   while(1); // Wait for reset
1347
   while(1); // Wait for reset
1318
 }
1348
 }
1319
 
1349
 

+ 1
- 0
Marlin/pins.h View File

582
 #define FAN_PIN            7
582
 #define FAN_PIN            7
583
 #define PS_ON_PIN          12
583
 #define PS_ON_PIN          12
584
 #define KILL_PIN           -1
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
 #ifdef ULTRA_LCD
587
 #ifdef ULTRA_LCD
587
 
588
 

Loading…
Cancel
Save