소스 검색

Fix: set digipot mcp4018 Vrefmax to 1.666V

Paweł Stawicki 7 년 전
부모
커밋
1e47c17b46
3개의 변경된 파일118개의 추가작업 그리고 14개의 파일을 삭제
  1. 4
    4
      Marlin/digipot_mcp4018.cpp
  2. 23
    6
      Marlin/example_configurations/wt150/Configuration.h
  3. 91
    4
      Marlin/example_configurations/wt150/Configuration_adv.h

+ 4
- 4
Marlin/digipot_mcp4018.cpp 파일 보기

@@ -34,17 +34,17 @@
34 34
 #define DIGIPOT_I2C_ADDRESS             0x2F
35 35
 
36 36
 #define DIGIPOT_A4988_Rsx               0.250
37
-#define DIGIPOT_A4988_Vrefmax           5.0
37
+#define DIGIPOT_A4988_Vrefmax           1.666
38 38
 #define DIGIPOT_A4988_MAX_VALUE         127
39 39
 
40 40
 #define DIGIPOT_A4988_Itripmax(Vref)    ((Vref)/(8.0*DIGIPOT_A4988_Rsx))
41 41
 
42 42
 #define DIGIPOT_A4988_FACTOR            ((DIGIPOT_A4988_MAX_VALUE)/DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
43
-//TODO: MAX_CURRENT -0.5A ?? (currently set to 2A, max possible current 2.5A)
44
-#define DIGIPOT_A4988_MAX_CURRENT       (DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax) - 0.5)
43
+#define DIGIPOT_A4988_MAX_CURRENT       2.0
45 44
 
46 45
 static byte current_to_wiper(const float current) {
47
-  return byte(CEIL(float(DIGIPOT_A4988_FACTOR) * current));
46
+  const int16_t value = ceil(float(DIGIPOT_A4988_FACTOR) * current);
47
+  return byte(constrain(value, 0, DIGIPOT_A4988_MAX_VALUE));
48 48
 }
49 49
 
50 50
 const uint8_t sda_pins[DIGIPOT_I2C_NUM_CHANNELS] = {

+ 23
- 6
Marlin/example_configurations/wt150/Configuration.h 파일 보기

@@ -58,8 +58,8 @@
58 58
 //===========================================================================
59 59
 //============================= DELTA Printer ===============================
60 60
 //===========================================================================
61
-// For Delta printers start with one of the configuration files in the
62
-// example_configurations/delta directory and customize for your machine.
61
+// For a Delta printer replace the configuration files with the files in the
62
+// example_configurations/delta directory.
63 63
 //
64 64
 
65 65
 //===========================================================================
@@ -311,13 +311,13 @@
311 311
                                   // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
312 312
   #define K1 0.95 //smoothing factor within the PID
313 313
 
314
+  // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
315
+
314 316
   //WT150, based on: M303 E0 S220 C8
315 317
   #define  DEFAULT_Kp 22.10
316 318
   #define  DEFAULT_Ki 1.10
317 319
   #define  DEFAULT_Kd 110.78
318 320
 
319
-  // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
320
-
321 321
   // Ultimaker
322 322
   //#define  DEFAULT_Kp 22.2
323 323
   //#define  DEFAULT_Ki 1.08
@@ -534,6 +534,7 @@
534 534
 #define DEFAULT_ZJERK                  0.4
535 535
 #define DEFAULT_EJERK                  5.0
536 536
 
537
+
537 538
 //===========================================================================
538 539
 //============================= Z Probe Options =============================
539 540
 //===========================================================================
@@ -575,7 +576,7 @@
575 576
  * Probe Type
576 577
  *
577 578
  * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc.
578
- * Activate one of these to use Auto Bed Leveling below.
579
+ * You must activate one of these to use Auto Bed Leveling below.
579 580
  */
580 581
 
581 582
 /**
@@ -1492,7 +1493,23 @@
1492 1493
 //define PCA9632 PWM LED driver Support
1493 1494
 //#define PCA9632
1494 1495
 
1495
-// Support for an RGB LED using 3 separate pins with optional PWM
1496
+/**
1497
+ * RGB LED / LED Strip Control
1498
+ *
1499
+ * Enable support for an RGB LED connected to 5V digital pins, or
1500
+ * an RGB Strip connected to MOSFETs controlled by digital pins.
1501
+ *
1502
+ * Adds the M150 command to set the LED (or LED strip) color.
1503
+ * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of
1504
+ * luminance values can be set from 0 to 255.
1505
+ *
1506
+ * *** CAUTION ***
1507
+ *  LED Strips require a MOFSET Chip between PWM lines and LEDs,
1508
+ *  as the Arduino cannot handle the current the LEDs will require.
1509
+ *  Failure to follow this precaution can destroy your Arduino!
1510
+ * *** CAUTION ***
1511
+ *
1512
+ */
1496 1513
 //#define RGB_LED
1497 1514
 //#define RGBW_LED
1498 1515
 #if ENABLED(RGB_LED) || ENABLED(RGBW_LED)

+ 91
- 4
Marlin/example_configurations/wt150/Configuration_adv.h 파일 보기

@@ -428,7 +428,7 @@
428 428
 #define DIGIPOT_MCP4018          // Requires library from https://github.com/stawel/SlowSoftI2CMaster
429 429
 #define DIGIPOT_I2C_NUM_CHANNELS 5 // 5DPRINT: 4     AZTEEG_X3_PRO: 8
430 430
 // Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
431
-#define DIGIPOT_I2C_MOTOR_CURRENTS {0.68, 0.68, 1.18, 1.27, 1.27}
431
+#define DIGIPOT_I2C_MOTOR_CURRENTS {0.22, 0.22, 0.39, 0.42, 0.42}
432 432
 
433 433
 //===========================================================================
434 434
 //=============================Additional Features===========================
@@ -670,6 +670,10 @@
670 670
   #define UBL_MESH_MAX_X (X_MAX_POS - (UBL_MESH_INSET))
671 671
   #define UBL_MESH_MIN_Y (Y_MIN_POS + UBL_MESH_INSET)
672 672
   #define UBL_MESH_MAX_Y (Y_MAX_POS - (UBL_MESH_INSET))
673
+
674
+  // If this is defined, the currently active mesh will be saved in the
675
+  // current slot on M500.
676
+  #define UBL_SAVE_ACTIVE_ON_M500
673 677
 #endif
674 678
 
675 679
 // @section extras
@@ -795,7 +799,7 @@
795 799
                                               // Longer length for bowden printers to unload filament from whole bowden tube,
796 800
                                               // shorter length for printers without bowden to unload filament from extruder only,
797 801
                                               // 0 to disable unloading for manual unloading
798
-  #define FILAMENT_CHANGE_LOAD_FEEDRATE 10    // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast
802
+  #define FILAMENT_CHANGE_LOAD_FEEDRATE 6     // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast
799 803
   #define FILAMENT_CHANGE_LOAD_LENGTH 0       // Load filament length over hotend in mm
800 804
                                               // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend,
801 805
                                               // Short or zero length for printers without bowden where loading is not used
@@ -1260,8 +1264,91 @@
1260 1264
   #define USER_DESC_4 "Heat Bed/Home/Level"
1261 1265
   #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
1262 1266
 
1263
-  //#define USER_DESC_5 "Home & Info"
1264
-  //#define USER_GCODE_5 "G28\nM503"
1267
+  #define USER_DESC_5 "Home & Info"
1268
+  #define USER_GCODE_5 "G28\nM503"
1269
+#endif
1270
+
1271
+//===========================================================================
1272
+//============================ I2C Encoder Settings =========================
1273
+//===========================================================================
1274
+/**
1275
+ *  I2C position encoders for closed loop control.
1276
+ *  Developed by Chris Barr at Aus3D.
1277
+ *
1278
+ *  Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder
1279
+ *  Github: https://github.com/Aus3D/MagneticEncoder
1280
+ *
1281
+ *  Supplier: http://aus3d.com.au/magnetic-encoder-module
1282
+ *  Alternative Supplier: http://reliabuild3d.com/
1283
+ *
1284
+ *  Reilabuild encoders have been modified to improve reliability.
1285
+ */
1286
+
1287
+//#define I2C_POSITION_ENCODERS
1288
+#if ENABLED(I2C_POSITION_ENCODERS)
1289
+
1290
+  #define I2CPE_ENCODER_CNT         1                       // The number of encoders installed; max of 5
1291
+                                                            // encoders supported currently.
1292
+
1293
+  #define I2CPE_ENC_1_ADDR          I2CPE_PRESET_ADDR_X     // I2C address of the encoder. 30-200.
1294
+  #define I2CPE_ENC_1_AXIS          X_AXIS                  // Axis the encoder module is installed on.  <X|Y|Z|E>_AXIS.
1295
+  #define I2CPE_ENC_1_TYPE          I2CPE_ENC_TYPE_LINEAR   // Type of encoder:  I2CPE_ENC_TYPE_LINEAR -or-
1296
+                                                            // I2CPE_ENC_TYPE_ROTARY.
1297
+  #define I2CPE_ENC_1_TICKS_UNIT    2048                    // 1024 for magnetic strips with 2mm poles; 2048 for
1298
+                                                            // 1mm poles. For linear encoders this is ticks / mm,
1299
+                                                            // for rotary encoders this is ticks / revolution.
1300
+  //#define I2CPE_ENC_1_TICKS_REV     (16 * 200)            // Only needed for rotary encoders; number of stepper
1301
+                                                            // steps per full revolution (motor steps/rev * microstepping)
1302
+  //#define I2CPE_ENC_1_INVERT                              // Invert the direction of axis travel.
1303
+  #define I2CPE_ENC_1_EC_METHOD     I2CPE_ECM_NONE          // Type of error error correction.
1304
+  #define I2CPE_ENC_1_EC_THRESH     0.10                    // Threshold size for error (in mm) above which the
1305
+                                                            // printer will attempt to correct the error; errors
1306
+                                                            // smaller than this are ignored to minimize effects of
1307
+                                                            // measurement noise / latency (filter).
1308
+
1309
+  #define I2CPE_ENC_2_ADDR          I2CPE_PRESET_ADDR_Y     // Same as above, but for encoder 2.
1310
+  #define I2CPE_ENC_2_AXIS          Y_AXIS
1311
+  #define I2CPE_ENC_2_TYPE          I2CPE_ENC_TYPE_LINEAR
1312
+  #define I2CPE_ENC_2_TICKS_UNIT    2048
1313
+  //#define I2CPE_ENC_2_TICKS_REV   (16 * 200)
1314
+  //#define I2CPE_ENC_2_INVERT
1315
+  #define I2CPE_ENC_2_EC_METHOD     I2CPE_ECM_NONE
1316
+  #define I2CPE_ENC_2_EC_THRESH     0.10
1317
+
1318
+  #define I2CPE_ENC_3_ADDR          I2CPE_PRESET_ADDR_Z     // Encoder 3.  Add additional configuration options
1319
+  #define I2CPE_ENC_3_AXIS          Z_AXIS                  // as above, or use defaults below.
1320
+
1321
+  #define I2CPE_ENC_4_ADDR          I2CPE_PRESET_ADDR_E     // Encoder 4.
1322
+  #define I2CPE_ENC_4_AXIS          E_AXIS
1323
+
1324
+  #define I2CPE_ENC_5_ADDR          34                      // Encoder 5.
1325
+  #define I2CPE_ENC_5_AXIS          E_AXIS
1326
+
1327
+  // Default settings for encoders which are enabled, but without settings configured above.
1328
+  #define I2CPE_DEF_TYPE            I2CPE_ENC_TYPE_LINEAR
1329
+  #define I2CPE_DEF_ENC_TICKS_UNIT  2048
1330
+  #define I2CPE_DEF_TICKS_REV       (16 * 200)
1331
+  #define I2CPE_DEF_EC_METHOD       I2CPE_ECM_NONE
1332
+  #define I2CPE_DEF_EC_THRESH       0.1
1333
+
1334
+  //#define I2CPE_ERR_THRESH_ABORT  100.0                   // Threshold size for error (in mm) error on any given
1335
+                                                            // axis after which the printer will abort. Comment out to
1336
+                                                            // disable abort behaviour.
1337
+
1338
+  #define I2CPE_TIME_TRUSTED        10000                   // After an encoder fault, there must be no further fault
1339
+                                                            // for this amount of time (in ms) before the encoder
1340
+                                                            // is trusted again.
1341
+
1342
+  /**
1343
+   * Position is checked every time a new command is executed from the buffer but during long moves,
1344
+   * this setting determines the minimum update time between checks. A value of 100 works well with
1345
+   * error rolling average when attempting to correct only for skips and not for vibration.
1346
+   */
1347
+  #define I2CPE_MIN_UPD_TIME_MS     100                     // Minimum time in miliseconds between encoder checks.
1348
+
1349
+  // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise.
1350
+  #define I2CPE_ERR_ROLLING_AVERAGE
1351
+
1265 1352
 #endif
1266 1353
 
1267 1354
 //===========================================================================

Loading…
취소
저장