In some models of the D1 mini the D4 pin cant be used, for the encoder because it is used by the board to boot up [The model i had issued with](https://es.aliexpress.com/item/1005006365878568.html?spm=a2g0o.order_list.order_list_main.60.239a194dBfwZRm&gatewayAdapt=glo2esp)