The Sequencer webpage has a "Stop after current run" button that is very useful. Unfortunately there is a race condition where mhttpd can update "/Sequencer/State/Stop after run", but it is then reset to the original value by the sequencer. (If mhttpd does the update any time between sequencer calling
This happens very often, and makes the button either useless, annoying, or misleading, depending on the specific outcome.
The immediate solution is simply to edit the end of
/* get steering parameters, since they might have been changed in between */ SEQUENCER seq1; size = sizeof(seq1); db_get_record(hDB, hKeySeq, &seq1, &size, 0); seq.running = seq1.running; seq.finished = seq1.finished; seq.paused = seq1.paused; /* update current line number */ db_set_record(hDB, hKeySeq, &seq, sizeof(seq), 0);
to include the extra line:
seq.stop_after_run = seq1.stop_after_run;
I've tested the above fix and it fixes the problem.
However, I am sure the same bug can also happen in reverse, where mhttpd reads the state, the sequencer updates ODB with a new line number (for example), then mhttpd updates the paused/stop_after_run flags based on the old state. I would suggest that mhttpd uses
db_set_value instead of
db_set_record to avoid these issues, but perhaps a deeper look is required.