Yet Another Open Source Ventilator Using A Wiper Motor As A Servo

Hi,
This is my first post on here. Here's some code I've written and tested on a basic Volume Controlled Ventilator. It limits pressure and has an assist mode. The code / comments needs tidying up and probably has bugs. I'm working on modifying it to allow the option of a rotary encoder to lower parts, adding humidifier code, allow different (cheaper) pressure sensors and a solenoid valve for plateau pressure measurement. If I get a chance I'd like to add a web server control / display to further lower parts and simplify the build. I think it would require something like an ESP32.
Any comments on improvements are very welcome.

I've been documenting progress here,

Thanks

ventilatorwipermotorwithpid.ino.ino (22.1 KB)