Sensing the current is only part of this system. We need another part as reference to limit the current flow and it must be in digital form so that we can control it using microcontroller. Yes, by using PWM from microcontroller and a simple second order low pass filter, we can make a limiter to this system. Whenever the system tries to draw the current more than limiter setting, the limiter will make sure to maintain the current flow and never exceed that level.
|Vdc = Vpwm * Duty Cycle|
ESP8266 SoC itself able to generate maximum 1KHz 10 bits PWM with 3.3v. So, if duty cycle set to be 50%, theoretically we would have 1.65V. However, we need to modify further to fit the range from 0-1v to represent 0-1A. Hence, putting a divider at second filter will do the case.