[NTLK] 3AM Stroll solution.. Almost..

From: Jim Witte (jswitte_at_bloomington.in.us)
Date: Sat Mar 16 2002 - 02:01:34 EST


   Okay. I've just finished hacking up 3AMOff. The project and source
is at

http://www.bloomington.in.us/~jswitte/ThreeAMOff/index.html

   The main idea is to have an idle script repeatedly check the time to
see if it's between 5 and 10 minutes after 3:15 (a reasonable bit of
time for the 3AM house-keeping duties to get done). If it is,
checkPower is called, which checks if it's running on ac, and will shut
it off if it is. This is in the viewIdleScript (at bottom).

   The "Setup Idle Script" button in the main view sets up the idle
script, which runs one time. But it doesn't run after that. I also
need to know how to put the Newt to sleep (I thought there was a
gotosleep function..)

   This may very well be a solution looking for a problem, as some people
have reported that they don't have a problem with it staying on
connected to AC. My Newt doesn't seem to come on *at all* at 3AM - I've
been testing it by resetting the clock to 2:55, putting it to sleep, and
waiting. Does the Newt only wake up for house-keeping duties if it
needs to?

Jim

viewIdleScript;
func() begin
        timeArray := self:GetTimeArray();
        tHour := timeArray[0];
        tMin := timeArray[1];
                
        print("Idling"); // debug
        //self:SetTimeFlds();
        //print( :checkTime(tHour, tMin) );

        if :checkTime(tHour, tMin) then
                begin
                    self:checkPower();
                        return kAlmostDayMilliseconds; // (1440 min/day -
10)*60*1000 ms
                end;
        else
                return idleDelay; // set to 100 ms as a test
end

-- 
Read the List FAQ/Etiquette: http://www.newtontalk.net/faq.html
Read the Newton FAQ: http://www.guns-media.com/mirrors/newton/faq/
This is the NewtonTalk mailing list - http://www.newtontalk.net



This archive was generated by hypermail 2.1.2 : Tue Apr 02 2002 - 14:02:56 EST