Backstory
I set up the BLTouch module as explained in the guide that came with it - that included unplugging the Z axis switch, and replacing it with a pair of wires from the BLTouch module.
I managed to burn the firmware available from Creality, however this didn't have an offset for the fact the BLTouch module is offset from the hotend, and I couldn't manually edit the .hex file to add in offsets. I tried using the G Code command to update it on the EEPROM, but that didn't work and it always probed off the edge of the bed.
I then decided to flash new firmware based directly off Marlin 1.1.x, as there are some videos on Youtube about how to do this. I used the pink USB ISP supplied with the BLTouch to flash the Arduino bootloader to the motherboard, and now I can use the Arduino IDE to program the board.
I uploaded my configured Marlin firmware (see below), but it isn't working properly.
Problem
When I home the printer, the X and Y stops go to the switches, bump and zero correctly. However, when the Z axis is homing, the BLTouch probe stays retracted, and it starts heading for home - I forcefully shut down my printer when this happens because I know there's nothing to stop it from crashing into the print head and breaking things.
How do I configure my firmware to use the BLTouch module as the Z stop probe?
Although the probe clicks in and out a few times when I power on the printer, I'm not entirely sure that it is even working - going to the BLTouch menu and choosing Cmd: Deploy doesn't have an effect.
On the up side, when it goes to the centre to home (due to Z_SAFE_HOMING), the BLTouch module is over the centre of the build plate instead of the hotend.
Configuration
You can see the Marlin repository I'm trying to use here on Gitlab, or a direct link to the diff between the inital Marlin configuration and my changes.
These are some hopefully relevant configuration changes I've made:
// Configuration.h
//#define USE_XMIN_PLUG
//#define USE_YMIN_PLUG
#define USE_ZMIN_PLUG
#define USE_XMAX_PLUG
#define USE_YMAX_PLUG
#define BLTOUCH
#define X_PROBE_OFFSET_FROM_EXTRUDER -44 // X offset: -left +right [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER -6 // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 5.7 // Z offset: -below +above [the nozzle]
#define Z_HOMING_HEIGHT 4
#define Z_SAFE_HOMING
// pins_MELZI_CREALITY.h
#define SERVO0_PIN 20 // Wondering if this is correct?
These settings have been left as default, but they look relevant maybe:
/**
* Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
*
* Enable this option for a probe connected to the Z Min endstop pin.
*/
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
/**
* Z_MIN_PROBE_ENDSTOP
*
* Enable this option for a probe connected to any pin except Z-Min.
* (By default Marlin assumes the Z-Max endstop pin.)
* To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below.
*
* - The simplest option is to use a free endstop connector.
* - Use 5V for powered (usually inductive) sensors.
*
* - RAMPS 1.3/1.4 boards may use the 5V, GND, and Aux4->D32 pin:
* - For simple switches connect...
* - normally-closed switches to GND and D32.
* - normally-open switches to 5V and D32.
*
* WARNING: Setting the wrong pin may have unexpected and potentially
* disastrous consequences. Use with caution and do your homework.
*
*/
//#define Z_MIN_PROBE_ENDSTOP
/**
* Number of servos
*
* For some servo-related options NUM_SERVOS will be set automatically.
* Set this manually if there are extra servos needing manual control.
* Leave undefined or set to 0 to entirely disable the servo subsystem.
*/
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command