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 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 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)
// Enable this feature if all enabled endstop pins are interrupt-capable.

View File

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

View File

@@ -67,9 +67,9 @@
// Test the target within the included pins file
#ifdef __MARLIN_DEPS__
#define NOT_TARGET(V...) 0
#define NOT_TARGET(V ...) 0
#else
#define NOT_TARGET(V...) NONE(V)
#define NOT_TARGET(V ...) NONE(V)
#endif
//
@@ -205,7 +205,7 @@
#include "ramps/pins_PXMALION_CORE_I3.h" // ATmega2560 env:mega2560
// PATCH START: Knutwurst
#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
//
@@ -263,7 +263,7 @@
#include "mega/pins_GT2560_REV_B.h" // ATmega2560 env:mega2560
#elif MB(GT2560_V4)
#include "mega/pins_GT2560_V4.h" // ATmega2560 env:mega2560
#elif MB(GT2560_V4_A20)
#elif MB(GT2560_V4_A20)
#include "mega/pins_GT2560_V4_A20.h" // ATmega2560 env:mega2560
#elif MB(GT2560_V3_MC2)
#include "mega/pins_GT2560_V3_MC2.h" // ATmega2560 env:mega2560
@@ -777,7 +777,7 @@
#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
#else
#else // if MB(RAMPS_OLD)
//
// Obsolete or unknown board
@@ -858,7 +858,7 @@
#elif MB(RAMPS_LONGER3D_LK4PRO)
#error "BOARD_RAMPS_LONGER3D_LK4PRO is now BOARD_LONGER3D_LKx_PRO. Please update your configuration."
#elif MB(BTT_SKR_V2_0)
#error "BOARD_BTT_SKR_V2_0 is now BOARD_BTT_SKR_V2_0_REV_A or BOARD_BTT_SKR_V2_0_REV_B. See https://bit.ly/3t5d9JQ for more information. Please update your configuration."
#error "BOARD_BTT_SKR_V2_0 is now BOARD_BTT_SKR_V2_0_REV_A or BOARD_BTT_SKR_V2_0_REV_B. See https:// bit.ly/3t5d9JQ for more information. Please update your configuration."
#elif MB(TH3D_EZBOARD_LITE_V2)
#error "BOARD_TH3D_EZBOARD_LITE_V2 is now BOARD_TH3D_EZBOARD_V2. Please update your configuration."
#elif MB(BTT_SKR_SE_BX)
@@ -867,9 +867,9 @@
#error "BOARD_MKS_MONSTER8 is now BOARD_MKS_MONSTER8_V1 or BOARD_MKS_MONSTER8_V2. Please update your configuration."
#elif defined(MOTHERBOARD)
#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."
#endif
#endif // if MB(MKS_13)
#undef BOARD_MKS_13
#undef BOARD_TRIGORILLA
@@ -899,7 +899,7 @@
#undef BOARD_BTT_SKR_SE_BX
#undef BOARD_MKS_MONSTER8
#endif
#endif // if MB(RAMPS_OLD)
//
// 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 !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
@@ -170,26 +170,26 @@
#endif
//
// SPI for Max6675 or Max31855 Thermocouple
// SPI for MAX Thermocouple
//
#ifndef MAX6675_SS_PIN
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
#ifndef TEMP_0_CS_PIN
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
#endif
//
// 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 TEMP_SENSOR_BED
#define IS_RAMPS_EEB
#define FET_ORDER_EEB
#else
#define IS_RAMPS_EEF
#define FET_ORDER_EEF
#endif
#elif TEMP_SENSOR_BED
#define IS_RAMPS_EFB
#define FET_ORDER_EFB
#else
#define IS_RAMPS_EFF
#define FET_ORDER_EFF
#endif
#endif
@@ -211,16 +211,16 @@
#define HEATER_0_PIN RAMPS_D10_PIN
#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed
#define HEATER_BED_PIN 45 //RAMPS_D8_PIN
#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan
#if ENABLED(FET_ORDER_EFB) // Hotend, Fan, Bed
#define HEATER_BED_PIN 45 // RAMPS_D8_PIN
#elif ENABLED(FET_ORDER_EEF) // Hotend, Hotend, Fan
#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_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
#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
#if HOTENDS == 1
#define FAN1_PIN MOSFET_D_PIN
@@ -230,11 +230,11 @@
#endif
#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
#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
#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
#elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed
#define FAN_PIN 4 // IO pin. Buffer needed
#else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
#define FAN_PIN RAMPS_D9_PIN
@@ -307,17 +307,17 @@
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial1
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E4_HARDWARE_SERIAL Serial1
// #define X_HARDWARE_SERIAL Serial1
// #define X2_HARDWARE_SERIAL Serial1
// #define Y_HARDWARE_SERIAL Serial1
// #define Y2_HARDWARE_SERIAL Serial1
// #define Z_HARDWARE_SERIAL Serial1
// #define Z2_HARDWARE_SERIAL Serial1
// #define E0_HARDWARE_SERIAL Serial1
// #define E1_HARDWARE_SERIAL Serial1
// #define E2_HARDWARE_SERIAL Serial1
// #define E3_HARDWARE_SERIAL Serial1
// #define E4_HARDWARE_SERIAL Serial1
//
// Software serial
@@ -410,7 +410,7 @@
#ifndef E7_SERIAL_RX_PIN
#define E7_SERIAL_RX_PIN -1
#endif
#endif
#endif // if HAS_TMC_UART
//
// Průša i3 MK2 Multiplexer Support
@@ -494,18 +494,18 @@
#define BEEPER_PIN 33
#endif
#endif
#endif // if ENABLED(CR10_STOCKDISPLAY)
#if DISABLED(NEWPANEL)
// Buttons attached to a shift register
// Not wired yet
//#define SHIFT_CLK 38
//#define SHIFT_LD 42
//#define SHIFT_OUT 40
//#define SHIFT_EN 17
// #define SHIFT_CLK 38
// #define SHIFT_LD 42
// #define SHIFT_OUT 40
// #define SHIFT_EN 17
#endif
#endif
#endif // if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
//
// LCD Display input pins
@@ -610,9 +610,9 @@
// GLCD features
// Uncomment screen orientation
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180
//#define LCD_SCREEN_ROT_270
// #define LCD_SCREEN_ROT_90
// #define LCD_SCREEN_ROT_180
// #define LCD_SCREEN_ROT_270
// not connected to a pin
#define LCD_BACKLIGHT_PIN -1 // 65 (MKS mini12864 can't adjust backlight by software!)
@@ -630,7 +630,7 @@
#define BTN_EN1 33
#define BTN_EN2 31
//#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
// #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
// results in LCD soft SPI mode 3, SD soft SPI mode 0
#define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally.
@@ -649,7 +649,7 @@
#define NEOPIXEL_PIN 25
#endif
#endif
#endif // if ENABLED(MKS_MINI_12864)
#elif ENABLED(MINIPANEL)
@@ -662,9 +662,9 @@
// GLCD features
// Uncomment screen orientation
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180
//#define LCD_SCREEN_ROT_270
// #define LCD_SCREEN_ROT_90
// #define LCD_SCREEN_ROT_180
// #define LCD_SCREEN_ROT_270
#define BTN_EN1 40
#define BTN_EN2 63
@@ -681,7 +681,7 @@
// Pins only defined for RAMPS_SMART currently
#else
#else // if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
// Beeper on AUX-4
#define BEEPER_PIN 33
@@ -702,7 +702,7 @@
#define KILL_PIN 41
#endif
#endif
#endif // if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
#endif // NEWPANEL
#endif // HAS_SPI_LCD

View File

@@ -27,8 +27,6 @@
#define BOARD_INFO_NAME "Anycubic RAMPS 1.4"
#define IS_RAMPS_EFB
//
// Servos
//
@@ -51,7 +49,7 @@
//
// Custom Limit Switches
//
//#define ANYCUBIC_4_MAX_PRO_ENDSTOPS
// #define ANYCUBIC_4_MAX_PRO_ENDSTOPS
#if ENABLED(ANYCUBIC_4_MAX_PRO_ENDSTOPS)
#define X_MAX_PIN 43
#define Y_MIN_PIN 19