port new lock mode and sos mode from set_and_remember

Some inspiration from set_and_remember for up_and_down :-)