소스 검색

Merge pull request #1 from DinoMesina/master

Master
DinoMesina 9 년 전
부모
커밋
2d7d43b64c

+ 1
- 1
Marlin/Configuration.h 파일 보기

@@ -565,7 +565,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
565 565
 
566 566
 // The Elefu RA Board Control Panel
567 567
 // http://www.elefu.com/index.php?route=product/product&product_id=53
568
-// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
568
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
569 569
 //#define RA_CONTROL_PANEL
570 570
 
571 571
 //automatic expansion

+ 1
- 1
Marlin/example_configurations/SCARA/Configuration.h 파일 보기

@@ -571,7 +571,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
571 571
 
572 572
 // The Elefu RA Board Control Panel
573 573
 // http://www.elefu.com/index.php?route=product/product&product_id=53
574
-// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
574
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
575 575
 //#define RA_CONTROL_PANEL
576 576
 
577 577
 //automatic expansion

+ 1
- 1
Marlin/example_configurations/delta/Configuration.h 파일 보기

@@ -475,7 +475,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
475 475
 
476 476
 // The Elefu RA Board Control Panel
477 477
 // http://www.elefu.com/index.php?route=product/product&product_id=53
478
-// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
478
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
479 479
 //#define RA_CONTROL_PANEL
480 480
 
481 481
 // Delta calibration menu

+ 1
- 1
Marlin/example_configurations/makibox/Configuration.h 파일 보기

@@ -543,7 +543,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
543 543
 
544 544
 // The Elefu RA Board Control Panel
545 545
 // http://www.elefu.com/index.php?route=product/product&product_id=53
546
-// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
546
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
547 547
 //#define RA_CONTROL_PANEL
548 548
 
549 549
 //automatic expansion

+ 1
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h 파일 보기

@@ -557,7 +557,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
557 557
 
558 558
 // The Elefu RA Board Control Panel
559 559
 // http://www.elefu.com/index.php?route=product/product&product_id=53
560
-// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
560
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
561 561
 //#define RA_CONTROL_PANEL
562 562
 
563 563
 //automatic expansion

+ 38
- 38
Marlin/language_it.h 파일 보기

@@ -15,37 +15,37 @@
15 15
 #define MSG_AUTOSTART                       "Autostart"
16 16
 #define MSG_DISABLE_STEPPERS                "Disabilita Motori"
17 17
 #define MSG_AUTO_HOME                       "Auto Home"
18
-#define MSG_SET_HOME_OFFSETS                "Set home offsets"
18
+#define MSG_SET_HOME_OFFSETS                "Setta offset home"
19 19
 #define MSG_SET_ORIGIN                      "Imposta Origine"
20 20
 #define MSG_PREHEAT_PLA                     "Preriscalda PLA"
21 21
 #define MSG_PREHEAT_PLA0                    "Preriscalda PLA 1"
22 22
 #define MSG_PREHEAT_PLA1                    "Preriscalda PLA 2"
23 23
 #define MSG_PREHEAT_PLA2                    "Preriscalda PLA 3"
24
-#define MSG_PREHEAT_PLA012                  "Preris. PLA Tutto"
25
-#define MSG_PREHEAT_PLA_BEDONLY             "Preri. PLA Piatto"
26
-#define MSG_PREHEAT_PLA_SETTINGS            "Preris. PLA Conf"
24
+#define MSG_PREHEAT_PLA012                  "Prer. PLA Tutto"
25
+#define MSG_PREHEAT_PLA_BEDONLY             "Prer. PLA Piatto"
26
+#define MSG_PREHEAT_PLA_SETTINGS            "Config. prer. PLA"
27 27
 #define MSG_PREHEAT_ABS                     "Preriscalda ABS"
28 28
 #define MSG_PREHEAT_ABS0                    "Preriscalda ABS 1"
29 29
 #define MSG_PREHEAT_ABS1                    "Preriscalda ABS 2"
30 30
 #define MSG_PREHEAT_ABS2                    "Preriscalda ABS 3"
31
-#define MSG_PREHEAT_ABS012                  "Preris. ABS Tutto"
32
-#define MSG_PREHEAT_ABS_BEDONLY             "Preri. ABS Piatto"
33
-#define MSG_PREHEAT_ABS_SETTINGS            "Preris. ABS Conf"
31
+#define MSG_PREHEAT_ABS012                  "Prer. ABS Tutto"
32
+#define MSG_PREHEAT_ABS_BEDONLY             "Prer. ABS Piatto"
33
+#define MSG_PREHEAT_ABS_SETTINGS            "Config. prer. ABS"
34 34
 #define MSG_COOLDOWN                        "Raffredda"
35
-#define MSG_SWITCH_PS_ON                    "Switch Power On"
36
-#define MSG_SWITCH_PS_OFF                   "Switch Power Off"
35
+#define MSG_SWITCH_PS_ON                    "Accendi aliment."
36
+#define MSG_SWITCH_PS_OFF                   "Spegni aliment."
37 37
 #define MSG_EXTRUDE                         "Estrudi"
38 38
 #define MSG_RETRACT                         "Ritrai"
39 39
 #define MSG_MOVE_AXIS                       "Muovi Asse"
40
-#define MSG_MOVE_X                          "Move X"
41
-#define MSG_MOVE_Y                          "Move Y"
42
-#define MSG_MOVE_Z                          "Move Z"
43
-#define MSG_MOVE_E                          "Extruder"
44
-#define MSG_MOVE_E1                         "Extruder2"
45
-#define MSG_MOVE_E2                         "Extruder3"
46
-#define MSG_MOVE_01MM                       "Move 0.1mm"
47
-#define MSG_MOVE_1MM                        "Move 1mm"
48
-#define MSG_MOVE_10MM                       "Move 10mm"
40
+#define MSG_MOVE_X                          "Muovi X"
41
+#define MSG_MOVE_Y                          "Muovi Y"
42
+#define MSG_MOVE_Z                          "Muovi Z"
43
+#define MSG_MOVE_E                          "Estrusore"
44
+#define MSG_MOVE_E1                         "Estrusore 2"
45
+#define MSG_MOVE_E2                         "Estrusore 3"
46
+#define MSG_MOVE_01MM                       "Muovi di 0.1mm"
47
+#define MSG_MOVE_1MM                        "Muovi di   1mm"
48
+#define MSG_MOVE_10MM                       "Muovi di  10mm"
49 49
 #define MSG_SPEED                           "Velcità"
50 50
 #define MSG_NOZZLE                          "Ugello"
51 51
 #define MSG_NOZZLE1                         "Ugello2"
@@ -61,13 +61,13 @@
61 61
 #define MSG_MAX                             " \002 Max:"
62 62
 #define MSG_FACTOR                          " \002 Fact:"
63 63
 #define MSG_AUTOTEMP                        "Autotemp"
64
-#define MSG_ON                              "On "
65
-#define MSG_OFF                             "Off"
64
+#define MSG_ON                              "ON "
65
+#define MSG_OFF                             "OFF"
66 66
 #define MSG_PID_P                           "PID-P"
67 67
 #define MSG_PID_I                           "PID-I"
68 68
 #define MSG_PID_D                           "PID-D"
69 69
 #define MSG_PID_C                           "PID-C"
70
-#define MSG_ACC                             "Accel"
70
+#define MSG_ACC                             "Accel."
71 71
 #define MSG_VXY_JERK                        "Vxy-jerk"
72 72
 #define MSG_VZ_JERK                         "Vz-jerk"
73 73
 #define MSG_VE_JERK                         "Ve-jerk"
@@ -87,11 +87,11 @@
87 87
 #define MSG_TEMPERATURE                     "Temperatura"
88 88
 #define MSG_MOTION                          "Movimento"
89 89
 #define MSG_VOLUMETRIC                      "Filament"
90
-#define MSG_VOLUMETRIC_ENABLED		        "E in mm3"
91
-#define MSG_FILAMENT_SIZE_EXTRUDER_0        "Fil. Dia. 1"
92
-#define MSG_FILAMENT_SIZE_EXTRUDER_1        "Fil. Dia. 2"
93
-#define MSG_FILAMENT_SIZE_EXTRUDER_2        "Fil. Dia. 3"
94
-#define MSG_CONTRAST                        "LCD contrast"
90
+#define MSG_VOLUMETRIC_ENABLED		        "E in mm³"
91
+#define MSG_FILAMENT_SIZE_EXTRUDER_0        "Diam. filo 1"
92
+#define MSG_FILAMENT_SIZE_EXTRUDER_1        "Diam. filo 2"
93
+#define MSG_FILAMENT_SIZE_EXTRUDER_2        "Diam. filo 3"
94
+#define MSG_CONTRAST                        "Contrasto LCD"
95 95
 #define MSG_STORE_EPROM                     "Salva in EEPROM"
96 96
 #define MSG_LOAD_EPROM                      "Carica da EEPROM"
97 97
 #define MSG_RESTORE_FAILSAFE                "Impostaz. default"
@@ -100,17 +100,17 @@
100 100
 #define MSG_PREPARE                         "Prepara"
101 101
 #define MSG_TUNE                            "Adatta"
102 102
 #define MSG_PAUSE_PRINT                     "Pausa"
103
-#define MSG_RESUME_PRINT                    "Riprendi Stampa"
104
-#define MSG_STOP_PRINT                      "Arresta Stampa"
103
+#define MSG_RESUME_PRINT                    "Riprendi stampa"
104
+#define MSG_STOP_PRINT                      "Arresta stampa"
105 105
 #define MSG_CARD_MENU                       "SD Card Menu"
106 106
 #define MSG_NO_CARD                         "No SD Card"
107 107
 #define MSG_DWELL                           "Sospensione..."
108 108
 #define MSG_USERWAIT                        "Attendi Utente..."
109 109
 #define MSG_RESUMING                        "Riprendi Stampa"
110
-#define MSG_PRINT_ABORTED                   "Print aborted"
111
-#define MSG_NO_MOVE                         "Nessun Movimento."
112
-#define MSG_KILLED                          "UCCISO. "
113
-#define MSG_STOPPED                         "ARRESTATO. "
110
+#define MSG_PRINT_ABORTED                   "Stampa abortita"
111
+#define MSG_NO_MOVE                         "Nessun Movimento"
112
+#define MSG_KILLED                          "UCCISO "
113
+#define MSG_STOPPED                         "ARRESTATO "
114 114
 #define MSG_CONTROL_RETRACT                 "Ritrai mm"
115 115
 #define MSG_CONTROL_RETRACT_SWAP            "Scamb. Ritrai mm"
116 116
 #define MSG_CONTROL_RETRACTF                "Ritrai  V"
@@ -128,16 +128,16 @@
128 128
 #define MSG_BABYSTEP_X                      "Babystep X"
129 129
 #define MSG_BABYSTEP_Y                      "Babystep Y"
130 130
 #define MSG_BABYSTEP_Z                      "Babystep Z"
131
-#define MSG_ENDSTOP_ABORT                   "Endstop abort"
131
+#define MSG_ENDSTOP_ABORT                   "Finecorsa abort"
132 132
 
133 133
 #define MSG_RECTRACT                        "Ritrai"
134 134
 
135 135
 #ifdef DELTA_CALIBRATION_MENU
136
-    #define MSG_DELTA_CALIBRATE             "Delta Calibration"
137
-    #define MSG_DELTA_CALIBRATE_X           "Calibrate X"
138
-    #define MSG_DELTA_CALIBRATE_Y           "Calibrate Y"
139
-    #define MSG_DELTA_CALIBRATE_Z           "Calibrate Z"
140
-    #define MSG_DELTA_CALIBRATE_CENTER      "Calibrate Center"
136
+    #define MSG_DELTA_CALIBRATE             "Calibraz. Delta"
137
+    #define MSG_DELTA_CALIBRATE_X           "Calibra X"
138
+    #define MSG_DELTA_CALIBRATE_Y           "Calibra Y"
139
+    #define MSG_DELTA_CALIBRATE_Z           "Calibra Z"
140
+    #define MSG_DELTA_CALIBRATE_CENTER      "Calibra Center"
141 141
 #endif // DELTA_CALIBRATION_MENU
142 142
 
143 143
 #endif // LANGUAGE_IT_H

+ 277
- 34
Marlin/temperature.cpp 파일 보기

@@ -497,7 +497,7 @@ void manage_heater()
497 497
     SERIAL_ECHO(" iTerm ");
498 498
     SERIAL_ECHO(iTerm[e]);
499 499
     SERIAL_ECHO(" dTerm ");
500
-    SERIAL_ECHOLN(dTerm[e]);  
500
+    SERIAL_ECHOLN(dTerm[e]);
501 501
     #endif //PID_DEBUG
502 502
   #else /* PID off */
503 503
     pid_output = 0;
@@ -1221,68 +1221,311 @@ ISR(TIMER0_COMPB_vect)
1221 1221
   static unsigned char temp_state = 10;
1222 1222
   static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
1223 1223
   static unsigned char soft_pwm_0;
1224
-  #if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL)
1224
+#ifdef SLOW_PWM_HEATERS
1225
+  static unsigned char slow_pwm_count = 0;
1226
+  static unsigned char state_heater_0 = 0;
1227
+  static unsigned char state_timer_heater_0 = 0;
1228
+#endif 
1229
+#if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL)
1225 1230
   static unsigned char soft_pwm_1;
1226
-  #endif
1227
-  #if EXTRUDERS > 2
1231
+#ifdef SLOW_PWM_HEATERS
1232
+  static unsigned char state_heater_1 = 0;
1233
+  static unsigned char state_timer_heater_1 = 0;
1234
+#endif 
1235
+#endif
1236
+#if EXTRUDERS > 2
1228 1237
   static unsigned char soft_pwm_2;
1229
-  #endif
1230
-  #if HEATER_BED_PIN > -1
1238
+#ifdef SLOW_PWM_HEATERS
1239
+  static unsigned char state_heater_2 = 0;
1240
+  static unsigned char state_timer_heater_2 = 0;
1241
+#endif 
1242
+#endif
1243
+#if HEATER_BED_PIN > -1
1231 1244
   static unsigned char soft_pwm_b;
1232
-  #endif
1245
+#ifdef SLOW_PWM_HEATERS
1246
+  static unsigned char state_heater_b = 0;
1247
+  static unsigned char state_timer_heater_b = 0;
1248
+#endif 
1249
+#endif
1233 1250
   
1234
-  #if defined(FILWIDTH_PIN) &&(FILWIDTH_PIN > -1)
1235
-   static unsigned long raw_filwidth_value = 0;  //added for filament width sensor
1236
-  #endif
1251
+#if defined(FILWIDTH_PIN) &&(FILWIDTH_PIN > -1)
1252
+  static unsigned long raw_filwidth_value = 0;  //added for filament width sensor
1253
+#endif
1237 1254
   
1255
+#ifndef SLOW_PWM_HEATERS
1256
+  /*
1257
+   * standard PWM modulation
1258
+   */
1238 1259
   if(pwm_count == 0){
1239 1260
     soft_pwm_0 = soft_pwm[0];
1240 1261
     if(soft_pwm_0 > 0) { 
1241 1262
       WRITE(HEATER_0_PIN,1);
1242
-      #ifdef HEATERS_PARALLEL
1263
+#ifdef HEATERS_PARALLEL
1243 1264
       WRITE(HEATER_1_PIN,1);
1244
-      #endif
1265
+#endif
1245 1266
     } else WRITE(HEATER_0_PIN,0);
1246
-	
1247
-    #if EXTRUDERS > 1
1267
+    
1268
+#if EXTRUDERS > 1
1248 1269
     soft_pwm_1 = soft_pwm[1];
1249 1270
     if(soft_pwm_1 > 0) WRITE(HEATER_1_PIN,1); else WRITE(HEATER_1_PIN,0);
1250
-    #endif
1251
-    #if EXTRUDERS > 2
1271
+#endif
1272
+#if EXTRUDERS > 2
1252 1273
     soft_pwm_2 = soft_pwm[2];
1253 1274
     if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1); else WRITE(HEATER_2_PIN,0);
1254
-    #endif
1255
-    #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1275
+#endif
1276
+#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1256 1277
     soft_pwm_b = soft_pwm_bed;
1257 1278
     if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0);
1258
-    #endif
1259
-    #ifdef FAN_SOFT_PWM
1279
+#endif
1280
+#ifdef FAN_SOFT_PWM
1260 1281
     soft_pwm_fan = fanSpeedSoftPwm / 2;
1261 1282
     if(soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
1262
-    #endif
1283
+#endif
1263 1284
   }
1264 1285
   if(soft_pwm_0 < pwm_count) { 
1265
-      WRITE(HEATER_0_PIN,0);
1266
-      #ifdef HEATERS_PARALLEL
1267
-      WRITE(HEATER_1_PIN,0);
1268
-      #endif
1269
-    }
1270
-  #if EXTRUDERS > 1
1286
+    WRITE(HEATER_0_PIN,0);
1287
+#ifdef HEATERS_PARALLEL
1288
+    WRITE(HEATER_1_PIN,0);
1289
+#endif
1290
+  }
1291
+#if EXTRUDERS > 1
1271 1292
   if(soft_pwm_1 < pwm_count) WRITE(HEATER_1_PIN,0);
1272
-  #endif
1273
-  #if EXTRUDERS > 2
1293
+#endif
1294
+#if EXTRUDERS > 2
1274 1295
   if(soft_pwm_2 < pwm_count) WRITE(HEATER_2_PIN,0);
1275
-  #endif
1276
-  #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1296
+#endif
1297
+#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1277 1298
   if(soft_pwm_b < pwm_count) WRITE(HEATER_BED_PIN,0);
1278
-  #endif
1279
-  #ifdef FAN_SOFT_PWM
1299
+#endif
1300
+#ifdef FAN_SOFT_PWM
1280 1301
   if(soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
1281
-  #endif
1302
+#endif
1303
+  
1304
+  pwm_count += (1 << SOFT_PWM_SCALE);
1305
+  pwm_count &= 0x7f;
1306
+  
1307
+#else //ifndef SLOW_PWM_HEATERS
1308
+  /*
1309
+   * SLOW PWM HEATERS
1310
+   *
1311
+   * for heaters drived by relay
1312
+   */
1313
+#ifndef MIN_STATE_TIME
1314
+#define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds
1315
+#endif
1316
+  if (slow_pwm_count == 0) {
1317
+    // EXTRUDER 0 
1318
+    soft_pwm_0 = soft_pwm[0];
1319
+    if (soft_pwm_0 > 0) {
1320
+      // turn ON heather only if the minimum time is up 
1321
+      if (state_timer_heater_0 == 0) { 
1322
+	// if change state set timer 
1323
+	if (state_heater_0 == 0) {
1324
+	  state_timer_heater_0 = MIN_STATE_TIME;
1325
+	}
1326
+	state_heater_0 = 1;
1327
+	WRITE(HEATER_0_PIN, 1);
1328
+#ifdef HEATERS_PARALLEL
1329
+	WRITE(HEATER_1_PIN, 1);
1330
+#endif
1331
+      }
1332
+    } else {
1333
+      // turn OFF heather only if the minimum time is up 
1334
+      if (state_timer_heater_0 == 0) {
1335
+	// if change state set timer 
1336
+	if (state_heater_0 == 1) {
1337
+	  state_timer_heater_0 = MIN_STATE_TIME;
1338
+	}
1339
+	state_heater_0 = 0;
1340
+	WRITE(HEATER_0_PIN, 0);
1341
+#ifdef HEATERS_PARALLEL
1342
+	WRITE(HEATER_1_PIN, 0);
1343
+#endif
1344
+      }
1345
+    }
1346
+    
1347
+#if EXTRUDERS > 1
1348
+    // EXTRUDER 1
1349
+    soft_pwm_1 = soft_pwm[1];
1350
+    if (soft_pwm_1 > 0) {
1351
+      // turn ON heather only if the minimum time is up 
1352
+      if (state_timer_heater_1 == 0) { 
1353
+	// if change state set timer 
1354
+	if (state_heater_1 == 0) {
1355
+	  state_timer_heater_1 = MIN_STATE_TIME;
1356
+	}
1357
+	state_heater_1 = 1;
1358
+	WRITE(HEATER_1_PIN, 1);
1359
+      }
1360
+    } else {
1361
+      // turn OFF heather only if the minimum time is up 
1362
+      if (state_timer_heater_1 == 0) {
1363
+	// if change state set timer 
1364
+	if (state_heater_1 == 1) {
1365
+	  state_timer_heater_1 = MIN_STATE_TIME;
1366
+	}
1367
+	state_heater_1 = 0;
1368
+	WRITE(HEATER_1_PIN, 0);
1369
+      }
1370
+    }
1371
+#endif
1372
+    
1373
+#if EXTRUDERS > 2
1374
+    // EXTRUDER 2
1375
+    soft_pwm_2 = soft_pwm[2];
1376
+    if (soft_pwm_2 > 0) {
1377
+      // turn ON heather only if the minimum time is up 
1378
+      if (state_timer_heater_2 == 0) { 
1379
+	// if change state set timer 
1380
+	if (state_heater_2 == 0) {
1381
+	  state_timer_heater_2 = MIN_STATE_TIME;
1382
+	}
1383
+	state_heater_2 = 1;
1384
+	WRITE(HEATER_2_PIN, 1);
1385
+      }
1386
+    } else {
1387
+      // turn OFF heather only if the minimum time is up 
1388
+      if (state_timer_heater_2 == 0) {
1389
+	// if change state set timer 
1390
+	if (state_heater_2 == 1) {
1391
+	  state_timer_heater_2 = MIN_STATE_TIME;
1392
+	}
1393
+	state_heater_2 = 0;
1394
+	WRITE(HEATER_2_PIN, 0);
1395
+      }
1396
+    }
1397
+#endif
1398
+    
1399
+#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1400
+    // BED
1401
+    soft_pwm_b = soft_pwm_bed;
1402
+    if (soft_pwm_b > 0) {
1403
+      // turn ON heather only if the minimum time is up 
1404
+      if (state_timer_heater_b == 0) { 
1405
+	// if change state set timer 
1406
+	if (state_heater_b == 0) {
1407
+	  state_timer_heater_b = MIN_STATE_TIME;
1408
+	}
1409
+	state_heater_b = 1;
1410
+	WRITE(HEATER_BED_PIN, 1);
1411
+      }
1412
+    } else {
1413
+      // turn OFF heather only if the minimum time is up 
1414
+      if (state_timer_heater_b == 0) {
1415
+	// if change state set timer 
1416
+	if (state_heater_b == 1) {
1417
+	  state_timer_heater_b = MIN_STATE_TIME;
1418
+	}
1419
+	state_heater_b = 0;
1420
+	WRITE(HEATER_BED_PIN, 0);
1421
+      }
1422
+    }
1423
+#endif
1424
+  } // if (slow_pwm_count == 0)
1425
+  
1426
+  // EXTRUDER 0 
1427
+  if (soft_pwm_0 < slow_pwm_count) {
1428
+    // turn OFF heather only if the minimum time is up 
1429
+    if (state_timer_heater_0 == 0) { 
1430
+      // if change state set timer 
1431
+      if (state_heater_0 == 1) {
1432
+	state_timer_heater_0 = MIN_STATE_TIME;
1433
+      }
1434
+      state_heater_0 = 0;
1435
+      WRITE(HEATER_0_PIN, 0);
1436
+#ifdef HEATERS_PARALLEL
1437
+      WRITE(HEATER_1_PIN, 0);
1438
+#endif
1439
+    }
1440
+  }
1441
+    
1442
+#if EXTRUDERS > 1
1443
+  // EXTRUDER 1 
1444
+  if (soft_pwm_1 < slow_pwm_count) {
1445
+    // turn OFF heather only if the minimum time is up 
1446
+    if (state_timer_heater_1 == 0) { 
1447
+      // if change state set timer 
1448
+      if (state_heater_1 == 1) {
1449
+	state_timer_heater_1 = MIN_STATE_TIME;
1450
+      }
1451
+      state_heater_1 = 0;
1452
+      WRITE(HEATER_1_PIN, 0);
1453
+    }
1454
+  }
1455
+#endif
1456
+  
1457
+#if EXTRUDERS > 2
1458
+  // EXTRUDER 2
1459
+  if (soft_pwm_2 < slow_pwm_count) {
1460
+    // turn OFF heather only if the minimum time is up 
1461
+    if (state_timer_heater_2 == 0) { 
1462
+      // if change state set timer 
1463
+      if (state_heater_2 == 1) {
1464
+	state_timer_heater_2 = MIN_STATE_TIME;
1465
+      }
1466
+      state_heater_2 = 0;
1467
+      WRITE(HEATER_2_PIN, 0);
1468
+    }
1469
+  }
1470
+#endif
1471
+  
1472
+#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1473
+  // BED
1474
+  if (soft_pwm_b < slow_pwm_count) {
1475
+    // turn OFF heather only if the minimum time is up 
1476
+    if (state_timer_heater_b == 0) { 
1477
+      // if change state set timer 
1478
+      if (state_heater_b == 1) {
1479
+	state_timer_heater_b = MIN_STATE_TIME;
1480
+      }
1481
+      state_heater_b = 0;
1482
+      WRITE(HEATER_BED_PIN, 0);
1483
+    }
1484
+  }
1485
+#endif
1486
+  
1487
+#ifdef FAN_SOFT_PWM
1488
+  if (pwm_count == 0){
1489
+    soft_pwm_fan = fanSpeedSoftPwm / 2;
1490
+    if (soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
1491
+  }
1492
+  if (soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
1493
+#endif
1282 1494
   
1283 1495
   pwm_count += (1 << SOFT_PWM_SCALE);
1284 1496
   pwm_count &= 0x7f;
1285 1497
   
1498
+  // increment slow_pwm_count only every 64 pwm_count circa 65.5ms
1499
+  if ((pwm_count % 64) == 0) {
1500
+    slow_pwm_count++;
1501
+    slow_pwm_count &= 0x7f;
1502
+    
1503
+    // Extruder 0
1504
+    if (state_timer_heater_0 > 0) {
1505
+      state_timer_heater_0--;
1506
+    } 
1507
+  
1508
+#if EXTRUDERS > 1
1509
+    // Extruder 1
1510
+    if (state_timer_heater_1 > 0) 
1511
+      state_timer_heater_1--;
1512
+#endif
1513
+    
1514
+#if EXTRUDERS > 2
1515
+    // Extruder 2
1516
+    if (state_timer_heater_2 > 0) 
1517
+      state_timer_heater_2--;
1518
+#endif
1519
+    
1520
+#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
1521
+    // Bed   
1522
+    if (state_timer_heater_b > 0) 
1523
+      state_timer_heater_b--;
1524
+#endif
1525
+  } //if ((pwm_count % 64) == 0) {
1526
+  
1527
+#endif //ifndef SLOW_PWM_HEATERS
1528
+  
1286 1529
   switch(temp_state) {
1287 1530
     case 0: // Prepare TEMP_0
1288 1531
       #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)

Loading…
취소
저장