port from nx40x with fix sensors issue