This would require a few things:
- Algorithm: A way to search for this maximum duration that is relatively fast (this can only be done in a smart but brute-force fashion, as a longer bottom-time can lead to longer decompression times, thus gas usage is not easily predicted).
- With multi-level dives: which section of the dive will have this automatic duration calculation?
- With multi-level dives: can multiple sections have this automatic behavior? Would the total duration be equally divided by these sections?
- How would the UI for a feature like this look?