Hello, im looking at the code but could not find (under my limitations) how does marlin evaluate an endstop trigger event. i have modded the classic endstop with an opto switch i had lying arround. the curious bit comes from the fact that while i was recalculating the Z offset i saw the led brightness was proportional to the the opto endstop trigger level (height), yet M119 did not report the event until a few 0.0Xmm lower.
i saw a few lines calling READ
bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING);
but im failing at see at which level this will be true