blocks: add confirm_run parameter for disabling running confirmation

This commit is contained in:
Oleg Kalachev
2020-10-13 15:14:41 +03:00
parent 5b370ee96b
commit f663a62c1e
2 changed files with 4 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ Parameters read by frontend:
* `~navigate_tolerance` (*float*) distance tolerance in meters, used for navigate-like blocks (default: 0.2).
* `~sleep_time` (*float*) duration of sleep in loop cycles, used for navigate-like blocks (default: 0.2).
* `~confirm_run` (*bool*) enable confirmation to run the program (default: true).
These parameters also can be set as URL GET-parameters, for example:

View File

@@ -39,7 +39,8 @@ var workspace = Blockly.inject('blockly', {
function readParams() {
return Promise.all([
ros.readParam('navigate_tolerance', true, 0.2),
ros.readParam('sleep_time', true, 0.2)
ros.readParam('sleep_time', true, 0.2),
ros.readParam('confirm_run', true, true),
]);
}
@@ -123,7 +124,7 @@ ros.ros.on('close', update);
ready.then(() => runButton.disabled = false);
window.runProgram = function() {
if (!confirm('Run program?')) return;
if (ros.params.confirm_run && !confirm('Run program?')) return;
runRequest = true;
update();