update leveling implementation and pin config for Chiron

This commit is contained in:
Stefan Kalscheuer
2022-09-03 09:28:10 +02:00
parent 6368552ced
commit db27202614
5 changed files with 74 additions and 75 deletions

View File

@@ -1312,6 +1312,7 @@
#define U_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define U_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define V_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define V_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
#endif // if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P, KNUTWURST_4MAXP2) #endif // if ANY(KNUTWURST_MEGA, KNUTWURST_MEGA_S, KNUTWURST_MEGA_P, KNUTWURST_4MAXP2)
// Enable this feature if all enabled endstop pins are interrupt-capable. // Enable this feature if all enabled endstop pins are interrupt-capable.

View File

@@ -55,7 +55,7 @@
void restore_z_values() { void restore_z_values() {
uint16_t size = z_values_size; uint16_t size = z_values_size;
int pos = z_values_index; int pos = z_values_index;
uint8_t* value = (uint8_t*)&z_values; uint8_t* value = (uint8_t*)&bedlevel.z_values;
do { do {
uint8_t c = eeprom_read_byte((unsigned char*)pos); uint8_t c = eeprom_read_byte((unsigned char*)pos);
*value = c; *value = c;
@@ -114,10 +114,10 @@
parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max, parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
); );
bilinear_grid_spacing.set((probe_position_rb.x - probe_position_lf.x) / (abl_grid_points.x - 1), LevelingBilinear::grid_spacing.set((probe_position_rb.x - probe_position_lf.x) / (abl_grid_points.x - 1),
(probe_position_rb.y - probe_position_lf.y) / (abl_grid_points.y - 1)); (probe_position_rb.y - probe_position_lf.y) / (abl_grid_points.y - 1));
bilinear_start = probe_position_lf; LevelingBilinear::grid_start = probe_position_lf;
// Can't re-enable (on error) until the new grid is written // Can't re-enable (on error) until the new grid is written
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
@@ -125,8 +125,8 @@
probe.offset.z = dpo[Z_AXIS]; probe.offset.z = dpo[Z_AXIS];
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) z_values[x][y] = float(-1.0); for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) bedlevel.z_values[x][y] = float(-1.0);
refresh_bed_level(); bedlevel.refresh_bed_level();
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
} }
#endif // if ENABLED(KNUTWURST_TFT_LEVELING) #endif // if ENABLED(KNUTWURST_TFT_LEVELING)
@@ -2020,7 +2020,7 @@
if (CodeSeen('X')) mx = CodeValueInt(); if (CodeSeen('X')) mx = CodeValueInt();
if (CodeSeen('Y')) my = CodeValueInt(); if (CodeSeen('Y')) my = CodeValueInt();
float Zvalue = z_values[mx][my]; float Zvalue = bedlevel.z_values[mx][my];
Zvalue = Zvalue * 100; Zvalue = Zvalue * 100;
if ((!planner.movesplanned()) && (TFTstate != ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate != ANYCUBIC_TFT_STATE_SDOUTAGE)) { if ((!planner.movesplanned()) && (TFTstate != ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate != ANYCUBIC_TFT_STATE_SDOUTAGE)) {
@@ -2041,9 +2041,9 @@
// SERIAL_ECHOLNPGM("Z Up"); // SERIAL_ECHOLNPGM("Z Up");
setAxisPosition_mm(5.0, Z); setAxisPosition_mm(5.0, Z);
// report_current_position(); // report_current_position();
setAxisPosition_mm(_GET_MESH_X(mx), X); setAxisPosition_mm(LevelingBilinear::get_mesh_x(mx), X);
// report_current_position(); // report_current_position();
setAxisPosition_mm(_GET_MESH_Y(my), Y); setAxisPosition_mm(LevelingBilinear::get_mesh_y(my), Y);
// report_current_position(); // report_current_position();
setAxisPosition_mm(EXT_LEVEL_HIGH, Z); setAxisPosition_mm(EXT_LEVEL_HIGH, Z);
@@ -2073,9 +2073,9 @@
float value = constrain(CodeValue(), -1.0, 1.0); float value = constrain(CodeValue(), -1.0, 1.0);
probe.offset.z += value; probe.offset.z += value;
for (x = 0; x < GRID_MAX_POINTS_X; x++) for (x = 0; x < GRID_MAX_POINTS_X; x++)
for (y = 0; y < GRID_MAX_POINTS_Y; y++) z_values[x][y] += value; for (y = 0; y < GRID_MAX_POINTS_Y; y++) bedlevel.z_values[x][y] += value;
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
refresh_bed_level(); bedlevel.refresh_bed_level();
HARDWARE_SERIAL_PROTOCOLPGM("A31V "); HARDWARE_SERIAL_PROTOCOLPGM("A31V ");
HARDWARE_SERIAL_PROTOCOL_F(float(probe.offset.z), 2); HARDWARE_SERIAL_PROTOCOL_F(float(probe.offset.z), 2);
@@ -2093,7 +2093,7 @@
SAVE_zprobe_zoffset = probe.offset.z; SAVE_zprobe_zoffset = probe.offset.z;
settings.save(); settings.save();
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
refresh_bed_level(); bedlevel.refresh_bed_level();
} }
HARDWARE_SERIAL_ENTER(); HARDWARE_SERIAL_ENTER();
break; break;
@@ -2114,12 +2114,12 @@
if (CodeSeen('V')) { if (CodeSeen('V')) {
float new_z_value = float(constrain(CodeValue() / 100, -10, 10)); float new_z_value = float(constrain(CodeValue() / 100, -10, 10));
z_values[x][y] = new_z_value; bedlevel.z_values[x][y] = new_z_value;
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
refresh_bed_level(); bedlevel.refresh_bed_level();
} }
if (CodeSeen('S')) { if (CodeSeen('S')) {
refresh_bed_level(); bedlevel.refresh_bed_level();
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
settings.save(); settings.save();
} }
@@ -2127,7 +2127,7 @@
restore_z_values(); restore_z_values();
probe.offset.z = SAVE_zprobe_zoffset; probe.offset.z = SAVE_zprobe_zoffset;
set_bed_leveling_enabled(true); set_bed_leveling_enabled(true);
refresh_bed_level(); bedlevel.refresh_bed_level();
} }
} }
break; break;

View File

@@ -205,7 +205,7 @@
#include "ramps/pins_PXMALION_CORE_I3.h" // ATmega2560 env:mega2560 #include "ramps/pins_PXMALION_CORE_I3.h" // ATmega2560 env:mega2560
// PATCH START: Knutwurst // PATCH START: Knutwurst
#elif MB(TRIGORILLA_CHIRON) #elif MB(TRIGORILLA_CHIRON)
#include "ramps/pins_TRIGORILLA_CHIRON.h" // ATmega2560 env:mega2560 #include "ramps/pins_TRIGORILLA_CHIRON.h" // ATmega2560 env:mega2560 env:CHIRON env:CHIRON_TMC env:CHIRON_DGUS env:CHIRON_DGUS_TMC
// PATCH END: Knutwurst // PATCH END: Knutwurst
// //
@@ -777,7 +777,7 @@
#elif MB(LINUX_RAMPS) #elif MB(LINUX_RAMPS)
#include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release #include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release
#else #else // if MB(RAMPS_OLD)
// //
// Obsolete or unknown board // Obsolete or unknown board
@@ -867,9 +867,9 @@
#error "BOARD_MKS_MONSTER8 is now BOARD_MKS_MONSTER8_V1 or BOARD_MKS_MONSTER8_V2. Please update your configuration." #error "BOARD_MKS_MONSTER8 is now BOARD_MKS_MONSTER8_V1 or BOARD_MKS_MONSTER8_V2. Please update your configuration."
#elif defined(MOTHERBOARD) #elif defined(MOTHERBOARD)
#error "Unknown MOTHERBOARD value set in Configuration.h." #error "Unknown MOTHERBOARD value set in Configuration.h."
#else #else // if MB(MKS_13)
#error "MOTHERBOARD not defined! Use '#define MOTHERBOARD BOARD_...' in Configuration.h." #error "MOTHERBOARD not defined! Use '#define MOTHERBOARD BOARD_...' in Configuration.h."
#endif #endif // if MB(MKS_13)
#undef BOARD_MKS_13 #undef BOARD_MKS_13
#undef BOARD_TRIGORILLA #undef BOARD_TRIGORILLA
@@ -899,7 +899,7 @@
#undef BOARD_BTT_SKR_SE_BX #undef BOARD_BTT_SKR_SE_BX
#undef BOARD_MKS_MONSTER8 #undef BOARD_MKS_MONSTER8
#endif #endif // if MB(RAMPS_OLD)
// //
// Post-process pins according to configured settings // Post-process pins according to configured settings

View File

@@ -53,7 +53,7 @@
#if NONE(IS_RAMPS_SMART, IS_RAMPS_DUO, IS_RAMPS4DUE, TARGET_LPC1768) #if NONE(IS_RAMPS_SMART, IS_RAMPS_DUO, IS_RAMPS4DUE, TARGET_LPC1768)
#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
#error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" // #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"
#endif #endif
#endif #endif
@@ -170,26 +170,26 @@
#endif #endif
// //
// SPI for Max6675 or Max31855 Thermocouple // SPI for MAX Thermocouple
// //
#ifndef MAX6675_SS_PIN #ifndef TEMP_0_CS_PIN
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN) #define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
#endif #endif
// //
// Augmentation for auto-assigning RAMPS plugs // Augmentation for auto-assigning RAMPS plugs
// //
#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if NONE(FET_ORDER_EEB, FET_ORDER_EEF, FET_ORDER_EFB, FET_ORDER_EFF, FET_ORDER_SF) && !PIN_EXISTS(MOSFET_D)
#if HOTENDS > 1 #if HOTENDS > 1
#if TEMP_SENSOR_BED #if TEMP_SENSOR_BED
#define IS_RAMPS_EEB #define FET_ORDER_EEB
#else #else
#define IS_RAMPS_EEF #define FET_ORDER_EEF
#endif #endif
#elif TEMP_SENSOR_BED #elif TEMP_SENSOR_BED
#define IS_RAMPS_EFB #define FET_ORDER_EFB
#else #else
#define IS_RAMPS_EFF #define FET_ORDER_EFF
#endif #endif
#endif #endif
@@ -211,16 +211,16 @@
#define HEATER_0_PIN RAMPS_D10_PIN #define HEATER_0_PIN RAMPS_D10_PIN
#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed #if ENABLED(FET_ORDER_EFB) // Hotend, Fan, Bed
#define HEATER_BED_PIN 45 // RAMPS_D8_PIN #define HEATER_BED_PIN 45 // RAMPS_D8_PIN
#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan #elif ENABLED(FET_ORDER_EEF) // Hotend, Hotend, Fan
#define HEATER_1_PIN RAMPS_D9_PIN #define HEATER_1_PIN RAMPS_D9_PIN
#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed
#define HEATER_1_PIN RAMPS_D9_PIN #define HEATER_1_PIN RAMPS_D9_PIN
#define HEATER_BED_PIN RAMPS_D8_PIN #define HEATER_BED_PIN RAMPS_D8_PIN
#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan #elif ENABLED(FET_ORDER_EFF) // Hotend, Fan, Fan
#define FAN1_PIN RAMPS_D8_PIN #define FAN1_PIN RAMPS_D8_PIN
#elif DISABLED(IS_RAMPS_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") #elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE")
#define HEATER_BED_PIN RAMPS_D8_PIN #define HEATER_BED_PIN RAMPS_D8_PIN
#if HOTENDS == 1 #if HOTENDS == 1
#define FAN1_PIN MOSFET_D_PIN #define FAN1_PIN MOSFET_D_PIN
@@ -230,11 +230,11 @@
#endif #endif
#ifndef FAN_PIN #ifndef FAN_PIN
#if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan
#define FAN_PIN RAMPS_D9_PIN #define FAN_PIN RAMPS_D9_PIN
#elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan
#define FAN_PIN RAMPS_D8_PIN #define FAN_PIN RAMPS_D8_PIN
#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed
#define FAN_PIN 4 // IO pin. Buffer needed #define FAN_PIN 4 // IO pin. Buffer needed
#else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
#define FAN_PIN RAMPS_D9_PIN #define FAN_PIN RAMPS_D9_PIN
@@ -410,7 +410,7 @@
#ifndef E7_SERIAL_RX_PIN #ifndef E7_SERIAL_RX_PIN
#define E7_SERIAL_RX_PIN -1 #define E7_SERIAL_RX_PIN -1
#endif #endif
#endif #endif // if HAS_TMC_UART
// //
// Průša i3 MK2 Multiplexer Support // Průša i3 MK2 Multiplexer Support
@@ -494,7 +494,7 @@
#define BEEPER_PIN 33 #define BEEPER_PIN 33
#endif #endif
#endif #endif // if ENABLED(CR10_STOCKDISPLAY)
#if DISABLED(NEWPANEL) #if DISABLED(NEWPANEL)
// Buttons attached to a shift register // Buttons attached to a shift register
@@ -505,7 +505,7 @@
// #define SHIFT_EN 17 // #define SHIFT_EN 17
#endif #endif
#endif #endif // if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
// //
// LCD Display input pins // LCD Display input pins
@@ -649,7 +649,7 @@
#define NEOPIXEL_PIN 25 #define NEOPIXEL_PIN 25
#endif #endif
#endif #endif // if ENABLED(MKS_MINI_12864)
#elif ENABLED(MINIPANEL) #elif ENABLED(MINIPANEL)
@@ -681,7 +681,7 @@
// Pins only defined for RAMPS_SMART currently // Pins only defined for RAMPS_SMART currently
#else #else // if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
// Beeper on AUX-4 // Beeper on AUX-4
#define BEEPER_PIN 33 #define BEEPER_PIN 33
@@ -702,7 +702,7 @@
#define KILL_PIN 41 #define KILL_PIN 41
#endif #endif
#endif #endif // if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
#endif // NEWPANEL #endif // NEWPANEL
#endif // HAS_SPI_LCD #endif // HAS_SPI_LCD

View File

@@ -27,8 +27,6 @@
#define BOARD_INFO_NAME "Anycubic RAMPS 1.4" #define BOARD_INFO_NAME "Anycubic RAMPS 1.4"
#define IS_RAMPS_EFB
// //
// Servos // Servos
// //