NXC: Keep Alive
Posted: 18 Aug 2011, 01:57
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.
Give a child a robot, he'll play for an hour. Teach him to build, and he'll play forever.
https://mindboards.org:443/
Code: Select all
task main () {
while(true) {
KeepAlive();
Wait(10*6000);
}
}
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))
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.)
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))
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.
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...