@@ -381,6 +381,29 @@ class HighPowerStepperDriver
381381 void setCurrentMilliamps36v4 (uint16_t current)
382382 {
383383 if (current > 8000 ) { current = 8000 ; }
384+ setCurrentMilliamps36v8 (current);
385+ }
386+
387+ // / Sets the current limit for a High-Power Stepper Motor Driver 36v8.
388+ // /
389+ // / The argument to this function should be the desired current limit in
390+ // / milliamps.
391+ // /
392+ // / WARNING: The 36v4 can supply up to about 8 A per coil continuously;
393+ // / higher currents might be sustainable for short periods, but can eventually
394+ // / cause the MOSFETs to overheat, which could damage them. See the driver's
395+ // / product page for more information.
396+ // /
397+ // / This function allows you to set a current limit of up to 16 A (16000 mA),
398+ // / but we strongly recommend against using a current limit higher than 8 A
399+ // / (8000 mA) unless you are careful to monitor the MOSFETs' temperatures
400+ // / and/or restrict how long the driver uses the higher current limit.
401+ // /
402+ // / This function takes care of setting appropriate values for ISGAIN and
403+ // / TORQUE to get the desired current limit.
404+ void setCurrentMilliamps36v8 (uint16_t current)
405+ {
406+ if (current > 16000 ) { current = 16000 ; }
384407
385408 // From the DRV8711 datasheet, section 7.3.4, equation 2:
386409 //
@@ -390,11 +413,12 @@ class HighPowerStepperDriver
390413 //
391414 // TORQUE = (256 * ISGAIN * Risense * Ifs) / 2.75 V
392415 //
393- // The 36v4 has an Risense of 30 milliohms, and "current" is in milliamps,
394- // so:
416+ // The 36v4 and 36v8 have an Risense of 30 milliohms, and "current" is
417+ // in milliamps, so:
395418 //
396419 // TORQUE = (256 * ISGAIN * (30/1000) ohms * (current/1000) A) / 2.75 V
397420 // = (7680 * ISGAIN * current) / 2750000
421+ // = (768 * (ISGAIN/40) * current) / 6875
398422 //
399423 // We want to pick the highest gain (5, 10, 20, or 40) that will not
400424 // overflow TORQUE (8 bits, 0xFF max), so we start with a gain of 40 and
0 commit comments