Explorar el Código

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

neildarlow hace 11 años
padre
commit
efb6d61413

+ 21
- 5
Marlin/Marlin_main.cpp Ver fichero

@@ -119,6 +119,7 @@
119 119
 // M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
120 120
 //        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
121 121
 //        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
122
+// M112 - Emergency stop
122 123
 // M114 - Output current position to serial port
123 124
 // M115 - Capabilities string
124 125
 // M117 - display message
@@ -673,6 +674,11 @@ void get_command()
673 674
           }
674 675
 
675 676
         }
677
+
678
+        //If command was e-stop process now
679
+        if(strcmp(cmdbuffer[bufindw], "M112") == 0)
680
+          kill();
681
+        
676 682
         bufindw = (bufindw + 1)%BUFSIZE;
677 683
         buflen += 1;
678 684
       }
@@ -1177,19 +1183,21 @@ void process_commands()
1177 1183
         //ClearToSend();
1178 1184
         return;
1179 1185
       }
1180
-      //break;
1186
+      break;
1181 1187
     case 2: // G2  - CW ARC
1182 1188
       if(Stopped == false) {
1183 1189
         get_arc_coordinates();
1184 1190
         prepare_arc_move(true);
1185 1191
         return;
1186 1192
       }
1193
+      break;
1187 1194
     case 3: // G3  - CCW ARC
1188 1195
       if(Stopped == false) {
1189 1196
         get_arc_coordinates();
1190 1197
         prepare_arc_move(false);
1191 1198
         return;
1192 1199
       }
1200
+      break;
1193 1201
     case 4: // G4 dwell
1194 1202
       LCD_MESSAGEPGM(MSG_DWELL);
1195 1203
       codenum = 0;
@@ -1799,7 +1807,7 @@ void process_commands()
1799 1807
         int pin_number = LED_PIN;
1800 1808
         if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
1801 1809
           pin_number = code_value();
1802
-        for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
1810
+        for(int8_t i = 0; i < (int8_t)(sizeof(sensitive_pins)/sizeof(int)); i++)
1803 1811
         {
1804 1812
           if (sensitive_pins[i] == pin_number)
1805 1813
           {
@@ -1830,6 +1838,9 @@ void process_commands()
1830 1838
 #endif
1831 1839
       setWatch();
1832 1840
       break;
1841
+    case 112: //  M112 -Emergency Stop
1842
+      kill();
1843
+      break;
1833 1844
     case 140: // M140 set bed temp
1834 1845
       if (code_seen('S')) setTargetBed(code_value());
1835 1846
       break;
@@ -2153,8 +2164,9 @@ void process_commands()
2153 2164
       }
2154 2165
       break;
2155 2166
     case 85: // M85
2156
-      code_seen('S');
2157
-      max_inactive_time = code_value() * 1000;
2167
+      if(code_seen('S')) {
2168
+        max_inactive_time = code_value() * 1000;
2169
+      }
2158 2170
       break;
2159 2171
     case 92: // M92
2160 2172
       for(int8_t i=0; i < NUM_AXIS; i++)
@@ -2275,6 +2287,7 @@ void process_commands()
2275 2287
           if(tmp_extruder >= EXTRUDERS) {
2276 2288
             SERIAL_ECHO_START;
2277 2289
             SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
2290
+            break;
2278 2291
           }
2279 2292
         }
2280 2293
         volumetric_multiplier[tmp_extruder] = 1 / area;
@@ -2466,7 +2479,7 @@ void process_commands()
2466 2479
 
2467 2480
         if(pin_state >= -1 && pin_state <= 1){
2468 2481
 
2469
-          for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
2482
+          for(int8_t i = 0; i < (int8_t)(sizeof(sensitive_pins)/sizeof(int)); i++)
2470 2483
           {
2471 2484
             if (sensitive_pins[i] == pin_number)
2472 2485
             {
@@ -3424,6 +3437,9 @@ void handle_status_leds(void) {
3424 3437
 
3425 3438
 void manage_inactivity()
3426 3439
 {
3440
+  if(buflen < (BUFSIZE-1))
3441
+    get_command();
3442
+
3427 3443
   if( (millis() - previous_millis_cmd) >  max_inactive_time )
3428 3444
     if(max_inactive_time)
3429 3445
       kill();

+ 4
- 3
Marlin/temperature.cpp Ver fichero

@@ -179,7 +179,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
179 179
   float Kp, Ki, Kd;
180 180
   float max = 0, min = 10000;
181 181
 
182
-  if ((extruder > EXTRUDERS)
182
+  if ((extruder >= EXTRUDERS)
183 183
   #if (TEMP_BED_PIN <= -1)
184 184
        ||(extruder < 0)
185 185
   #endif
@@ -609,6 +609,7 @@ static float analog2temp(int raw, uint8_t e) {
609 609
       SERIAL_ERROR((int)e);
610 610
       SERIAL_ERRORLNPGM(" - Invalid extruder number !");
611 611
       kill();
612
+      return 0.0;
612 613
   } 
613 614
   #ifdef HEATER_0_USES_MAX6675
614 615
     if (e == 0)
@@ -909,7 +910,7 @@ void disable_heater()
909 910
    #endif
910 911
   #endif
911 912
      
912
-  #if defined(TEMP_1_PIN) && TEMP_1_PIN > -1
913
+  #if defined(TEMP_1_PIN) && TEMP_1_PIN > -1 && EXTRUDERS > 1
913 914
     target_temperature[1]=0;
914 915
     soft_pwm[1]=0;
915 916
     #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 
@@ -917,7 +918,7 @@ void disable_heater()
917 918
     #endif
918 919
   #endif
919 920
       
920
-  #if defined(TEMP_2_PIN) && TEMP_2_PIN > -1
921
+  #if defined(TEMP_2_PIN) && TEMP_2_PIN > -1 && EXTRUDERS > 2
921 922
     target_temperature[2]=0;
922 923
     soft_pwm[2]=0;
923 924
     #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1  

+ 1
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h Ver fichero

@@ -305,7 +305,7 @@ static void lcd_implementation_init()
305 305
         B00000
306 306
     }; //thanks Sonny Mounicou
307 307
 
308
-#if defined(LCDI2C_TYPE_PCF8575)
308
+#if defined(LCD_I2C_TYPE_PCF8575)
309 309
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
310 310
   #ifdef LCD_I2C_PIN_BL
311 311
     lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);

+ 3
- 0
README.md Ver fichero

@@ -1,6 +1,8 @@
1 1
 ==========================
2 2
 Marlin 3D Printer Firmware
3 3
 ==========================
4
+[![Coverity Scan Build Status](https://scan.coverity.com/projects/2224/badge.svg)](https://scan.coverity.com/projects/2224)
5
+
4 6
 Marlin has a GPL license because I believe in open development.
5 7
 Please do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent.
6 8
 
@@ -193,6 +195,7 @@ M Codes
193 195
 *  M107 - Fan off
194 196
 *  M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
195 197
 *         Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
198
+*  M112 - Emergency stop
196 199
 *  M114 - Output current position to serial port
197 200
 *  M115 - Capabilities string
198 201
 *  M117 - display message

Loading…
Cancelar
Guardar