From fabdb6a51e80aa12ca11f8a8e8fb6a5ce40983aa Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 9 Aug 2020 16:43:08 -0400 Subject: [PATCH] DIGIPOTSS in motter current array with PWM, stored to eeprom, and G34 tested --- Marlin/src/gcode/calibrate/G34_M422.cpp | 6 ++++++ Marlin/src/module/settings.cpp | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 8e501326b6..922e01d3e4 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -602,10 +602,14 @@ void GcodeSuite::M422() { if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Final Z Move"); do_blocking_move_to_z(zgrind, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE)); + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Backoff"); // Back off end plate, back to normal motion range if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Backoff"); do_blocking_move_to_z(zpounce, MMM_TO_MMS(GANTRY_CALIBRATION_FEEDRATE)); + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Restore Current"); // Reset current to original values #if _REDUCE_CURRENT @@ -635,6 +639,8 @@ void GcodeSuite::M422() { #endif #endif + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands"); #ifdef GANTRY_CALIBRATION_COMMANDS_POST if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Running Post Commands"); gcode.process_subcommands_now_P(PSTR(GANTRY_CALIBRATION_COMMANDS_POST)); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 8b4b3af92f..638c2a1b25 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -2127,6 +2127,7 @@ void MarlinSettings::postprocess() { if (!validating) COPY(stepper.motor_current_setting, motor_current_setting); #endif + SERIAL_ECHOLN("DIGIPOTS Loaded"); } // @@ -2817,6 +2818,16 @@ void MarlinSettings::reset() { DEBUG_ECHOLNPGM("Digipot Written"); #endif + // + // DIGIPOTS + // + SERIAL_ECHOLN("Writing Digipot"); + #if HAS_DIGIPOTSS + static constexpr uint32_t tmp_motor_current_setting[] = DIGIPOT_MOTOR_CURRENT; + LOOP_L_N(q, COUNT(tmp_motor_current_setting)) + stepper.digipot_current(q, tmp_motor_current_setting[q]); + #endif +SERIAL_ECHOLN("Digipot Written"); // // CNC Coordinate System //