the task control featured by the Lego fw is weird indeed.
The same issue was about NXC in the beginning, start/stop task control was not possible.
Only when JH's Enhanced Firmware (EFW) has been changed in this respect you could use
start [taskname]
or
stop [taskname]
from any task to control any other task.
To stop a task depending on a condition you can define a global variable, a so-called semaphore. This should be set to "1" if the related task should be able to run, and set to "0" if the task is meant to stop. This semaphore can be polled inside your task and so the task himselfs "knows" when to abort or not. There are a few runtime-dependent disadvantages associated with it, but nevertheless, it's a workaround.
Related to switching the US sensor on/off , there is unfortunately another issue:
once the USS has been configured to a certain port, the US sensor is steadily, continually running in a autonomous continuous mode, thus it can't be stopped, and it's independant from reading the US sensor value or not.
Crazy, but true, and a waste of computational power, a useless stressing of the i2c bus, and an environmental ultrasonic noise pollution on top of that.
You can only change this behaviour if you
a) reconfigure the USS port to sth like "NO_Sensor", or any other different sensor, and then reconfigure it as a USS again if ou once need it (but that switching there and back takes some time to work)
b) use the USS in a single shot mode, but I'm not sure if this is possible using NXT-G (with NXC it works).
HTH!
ps
my advice: drop NXT-G and switch to NXC.
nobody who can read and write - except maybe primary school pupils - needs an icon-based programming environment
https://sourceforge.net/apps/phpbb/mind ... p?f=3&t=49