Alors je suis parvenu à faire fonctionner mon capteur.
Je vais essayer de vous donner les différentes lignes de code modifiée/dé-commentée. Et surtout mon capteur es branché sur la pin A4.
Tout d'abord dans le fichier configuration.h :
const bool Z_MIN_ENDSTOP_INVERTING = false;
//============================= Bed Auto Leveling ===========================
#define AUTO_BED_LEVELING_GRID
// with AUTO_BED_LEVELING_GRID, the bed is sampled in a
// AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_LEVELING_GRID
//en fonction de la position de votre capteur il faut changer les différentes valeurs
// set the rectangle in which to probe disco
//au dessus de chaque roulement ==> 22 / 184 / 145 / 50
#define LEFT_PROBE_BED_POSITION 22
#define RIGHT_PROBE_BED_POSITION 184
#define BACK_PROBE_BED_POSITION 145
#define FRONT_PROBE_BED_POSITION 50
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER -21 //-22 //palpeur devant la buse
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.5 //1.95 //0 //mettre -0.5 s'il y a un palpeur
#define PROBE_SERVO_DEACTIVATION_DELAY 300 // Retirer le commentaire sur cette ligne
//Trouver ensuite ces lignes et retirez les commentaires si nécessaire.
// Number of servos
//
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command
// Servo Endstops
//
// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
//
#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 10,90} // X,Y,Z Axis Extend and Retract angles
Voilà pour les modification que j'ai eu à réaliser sur le fichier configuration.h. Ensuite, j'ai modifié le fichier pins.h. pour faire correspondre mon "servo" Z et la pin A4 (il s'agit de la pin n°33 sur la puce). Donc on cherche (ctrl+f -> Sanguinololu pin assignment) ensuite il faut trouver la ligne suivante (il s'agit de ma ligne 1229 si ça peut aider):
#define SERVO0_PIN 33 //-1
Et donc, on commente ou supprime le -1 et on met 33 à la place.
A partir de là j'ai effectué des tests sans résultat :'(. En fin de compte un autre fichier est à modifier. Le dernier fichier se nomme Marlin_main.cpp. Dans ce fichier ce que j'ai fait c'est modifier les fonction qui permettent de sortir et rentrer la tige de notre capteur. Pour cela on cherche les fonctions engage_z_probe() et retract_z_probe() (il se peut que vous n'ayez pas engage_z_probe() mais deploy_z_probe() comme j'ai vu sur internet mais je pense que la fonction reste la même...).
static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(A4); //Modification 0 correspond à la pin D0 or capteur sur la pin A4
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
}
#endif
}
static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(A4); //Modification 0 correspond à la pin D0 or capteur sur la pin A4
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
}
#endif
}
Voilà vous êtes arrivé au même point que moi. J'espère que ceci vous aura été utile et bon leveling ;).