# Formula given for Z-Probe calibration seems wrong

I was playing with the z probe settings last night trying to get it to work but the method given in the Z-Probing page about probe calibration can't provide a reasonable value as the result seems always smaller than actual and sometimes even negative. I guess either my understanding of the value provided by the probe is wrong or the formula itself have problems.

So I did my own calculation trying to figure out how it works.

Assuming the probe reading (PR0) provided by G30 P0 is the Z travel (ZT0) plus Z probe height (ZH0), so
PR0 = ZT0 + ZH0

Whereas the real Z distance from nozzle to bed should be the same Z travel (ZT0) plus real Z probe height (ZH1), and should equals to the Z reading (ZR0) from the printer plus the delta between printer Z and real Z
Z = ZT0 + ZH1 = ZR0 + delta

Then we use the metal block of known height (MH) to measure delta, when the nozzle touches the metal block placed on the bed, the printer Z reading (ZR1) plus delta should equals to the known height MH.
ZR1 + delta = MH
so
delta = MH - ZR1

so,
ZT0 + ZH1 = ZR0 + MH - ZR1
then
ZH1 = ZR0 + MH - ZR1 - ZT0 = ZR0 + MH - ZR1 - PR0 + ZH0
This formula does give me accurate result.

Now let's compare it with what's provided in the page.
Replace variable names with what's used in the Z-Probing page,
PR0 = Z0
ZH0 = ZHold
ZH1 = ZHnew
MH = ref_height
ZR0 = Zold
ZR1 = Znew
My formula becomes
ZHnew = ZHold - Z0 - Znew + Zold + ref_height

Whereas the formula in the page is
ZHnew = ZHold + Z0 + Znew - Zold - ref_height

It seems some of the signs are reversed. Not sure if it's an error or my understanding of the some of the values are wrong.