You don't even need that, just ask the user to close the lid and see what the sensor settles on.
How would you know the user is ready to perform the command?
You could use the camera to estimate if the laptop is closed.
Exactly my thought, but this might not be precise enough in low light conditions? So maybe best used as a fail safe (if camera is lit don't calibrate even if the user pressed confirmed)
It wouldn’t matter… just tell the user to close and open the lid before pressing enter again, and get the maximum (or minimum) value as the lid being close all the way.
like the answer to any other similar question, with a prompt?