Skip to content

Commit

Permalink
blocks: add confirm_run parameter for disabling running confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed Oct 13, 2020
1 parent 5b370ee commit f663a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions clover_blocks/README.md
Expand Up @@ -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:

Expand Down
5 changes: 3 additions & 2 deletions clover_blocks/www/main.js
Expand Up @@ -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),
]);
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f663a62

Please sign in to comment.