LM339 comparator trigger SR latch
Well, you have a patchwork of different specifications for your hysteresis points: for high voltage, you asked for 4.2, your design actually yields 4.5 and you also mention 4.0. For low voltage, you asked for 3.6 and your design actually yields 3.0.
Let's assume that your thresholds in the comments - 4.2V and 3.6V - are the ones you actually want to use. You can drop the latch entirely since your Schmitt trigger itself is stateful. Then, your circuit can be (within E24 approximation)
simulate this circuit – Schematic created using CircuitLab
So far as I can tell, this matches what you expect from your battery sensor: