NXC: Keep Alive
-
- Posts: 103
- Joined: 29 Sep 2010, 17:14
- Location: US
NXC: Keep Alive
How does the Keep Alive function work in NXC? I looked it up in the .defs and poked around with it, but I couldn't figure it out.
fuzzball27 >>-->
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC: Keep Alive
I don't know, but I am guessing it has to do with the shutoff timer that the NXT uses. Normally if you don't use the NXT for a set amount of time (10 minutes for example), then it shuts off. Pressing the buttons seems to reset the 10 minute timer, and probably that command does the same thing.
BTW, it is by no means limited to just a 10 minute timer with Lego FW.
BTW, it is by no means limited to just a 10 minute timer with Lego FW.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC: Keep Alive
Yep, exactly what mattallen37 said!
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
-
- Posts: 103
- Joined: 29 Sep 2010, 17:14
- Location: US
Re: NXC: Keep Alive
Alright so I'm guessing if I did something like this would it do the job:
I wonder if receiving Remote BT firmware commands still works? (eg. Master sends "RemoteSetOutputState" to brick running "KeepAlive" Function.)
Code: Select all
task main () {
while(true) {
KeepAlive();
Wait(10*6000);
}
}
fuzzball27 >>-->
-
- Posts: 103
- Joined: 29 Sep 2010, 17:14
- Location: US
Re: NXC: Keep Alive
Never mind! I found a better way to do it in the .defs "RemoteKeepAlive"
But I'm getting a strange error...
Here's my code segment:
Here's the error:
But I'm getting a strange error...
Here's my code segment:
Code: Select all
while (true) {
Wait(6000*5)
Acquire (BT_Mutex);
RemoteKeepAlive(CONN_BT0);
Release (BT_Mutex);
}
Code: Select all
#Error: Preprocessor macro function does not match instance (__connectionSCDCWrite(_conn,__DCKeepAlivePacket,_result))
fuzzball27 >>-->
Re: NXC: Keep Alive
If by "remote BT firmware commands" you mean the "direct commands", then yes: This still works while RXE programs (produced by e.g. NXC or NXT-G) are running. This is true for all direct commands. And from my tests, the direct commands don't even afffect the running RXE's performance...fuzzball27 wrote: I wonder if receiving Remote BT firmware commands still works? (eg. Master sends "RemoteSetOutputState" to brick running "KeepAlive" Function.)
Btw, you don't really need the keep alive if you set the NXT's sleep timer / auto off to "never", then it stays always on...
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
Re: NXC: Keep Alive
I think that if you set the sleep timer value to 0 within the NXC program it never goes off.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: NXC: Keep Alive
I believe that this has been fixed in one of the more recently posted test releases. The fix will be in the next official release as well. Once I get my boolean expression code generation up to par I should be about ready for an official release.fuzzball27 wrote:Code: Select all
#Error: Preprocessor macro function does not match instance (__connectionSCDCWrite(_conn,__DCKeepAlivePacket,_result))
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: NXC: Keep Alive
If you want to have an NXC program keep *this* brick awake regardless of its user-configured sleep timer value then you have your program call ResetSleepTimer() periodically (i.e., in a loop that executes throughout the lifespan of your program's execution). Or you can call SysKeepAlive. See the help for these two functions.fuzzball27 wrote:How does the Keep Alive function work in NXC? I looked it up in the .defs and poked around with it, but I couldn't figure it out.
If you want to have an NXC program keep some other brick awake by sending it a direct command (KeepAlive) via Bluetooth then you have your program call RemoteKeepAlive. You do not use RemoteKeepAlive to keep *this* brick awake.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 103
- Joined: 29 Sep 2010, 17:14
- Location: US
Re: NXC: Keep Alive
My intention was to Keep a Separate brick alive.If you want to have an NXC program keep *this* brick awake regardless of its user-configured sleep timer...
fuzzball27 >>-->
Who is online
Users browsing this forum: No registered users and 6 guests