NXC ForceOff to turn off the NXT
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
NXC ForceOff to turn off the NXT
Is the ForceOff command the best way to power off an NXT while tasks are running? I made a program execute at startup by naming it "! Startup", and I made the NXT shut off by pressing the exit button. I just want to be sure that ForceOff is the best way to do this.
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 ForceOff to turn off the NXT
I would use PowerDown() or SleepNow() from the IOCtrl module:
http://bricxcc.sourceforge.net/nbc/nxcd ... tions.html
I doubt there is any significant difference in what the firmware does when you turn off the NXT via the IOCtrl module vs turning it off via the UI module (which is where ForceOff lives).
John Hansen
http://bricxcc.sourceforge.net/nbc/nxcd ... tions.html
I doubt there is any significant difference in what the firmware does when you turn off the NXT via the IOCtrl module vs turning it off via the UI module (which is where ForceOff lives).
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC ForceOff to turn off the NXT
Okay, thank you.
Edit: is it fine that I see pixel lines appear and then disappear when turning off the NXT this way (any of the three ways)? How/why does the FW's user menu shut-off not do that?
Edit: is it fine that I see pixel lines appear and then disappear when turning off the NXT this way (any of the three ways)? How/why does the FW's user menu shut-off not do that?
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 ForceOff to turn off the NXT
I don't know whether the abrupt shutoff is at all harmful. I'd be surprised if it was but I'm not a hardware guy. Do you see the lines when you use ForceOff?
In c_ui.c there is code like this:
This causes the firmware to call cUiOff() in Functions.inl:
So you could do something to the display flags before calling PowerDown().
I am pretty sure that the display will be properly reset to default values when you turn the NXT back on.
John Hansen
In c_ui.c there is code like this:
Code: Select all
// Check for "force" off
if (IOMapUi.ForceOff != FALSE)
{
IOMapUi.ForceOff = FALSE;
VarsUi.Function = FUNC_NO_OFF;
VarsUi.Parameter = MENU_INIT;
VarsUi.State = 0;
IOMapUi.State = DRAW_MENU;
}
Code: Select all
SetDisplayFlags(0); // should turn off the display, disable refresh, use normal memory
Wait(MS_1); // give firmware a chance to process the previous IOMap change
PowerDown(); // turn off
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC ForceOff to turn off the NXT
That makes no difference, even waiting 5ms.
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 ForceOff to turn off the NXT
I am not sure why you are worried Considering the NXT doesn't get messed up if you yank the batteries out, I doubt the firmware will do anything worse than that.
- Xander
- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC ForceOff to turn off the NXT
At this point, it's not so much that I am worried, as I am curious how the FW user menu doesn't make the lines on the screen.
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
Who is online
Users browsing this forum: Semrush [Bot] and 3 guests