Ignore:
Timestamp:
11/20/12 14:35:00 (12 years ago)
Author:
tbretz
Message:
Fixed a problem that if time of locking was more than 24h ago one had to unlock twice.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/drivectrl.cc

    r14617 r14669  
    11511151    }
    11521152
     1153    int ShiftSunRise()
     1154    {
     1155        const Time sunrise = fSunRise;
     1156
     1157        fSunRise = GetSunRise(Time());
     1158        if (!fSunRise)
     1159            return T::kSM_FatalError;
     1160
     1161        if (sunrise==fSunRise)
     1162            return Drive::State::kLocked;
     1163
     1164        ostringstream msg;
     1165        msg << "Next sun-rise will be at " << fSunRise;
     1166        T::Info(msg);
     1167
     1168        return Drive::State::kLocked;
     1169    }
     1170
    11531171    int Execute()
    11541172    {
     
    11611179
    11621180        if (T::GetCurrentState()==Drive::State::kLocked)
    1163             return Drive::State::kLocked;
    1164 
     1181            return ShiftSunRise();
    11651182
    11661183        if (T::GetCurrentState()>Drive::State::kLocked)
    11671184        {
    1168             Time now;
    1169             if (now>fSunRise)
     1185            if (Time()>fSunRise)
    11701186            {
    11711187                SendCommand("PREPS Park", false);
    1172 
    1173                 fSunRise = GetSunRise(now);
    1174                 if (!fSunRise)
    1175                     return T::kSM_FatalError;
    1176 
    1177                 ostringstream msg;
    1178                 msg << "Next sun-rise will be at " << fSunRise;
    1179                 T::Info(msg);
    1180 
    11811188                return Drive::State::kLocked;
    11821189            }
Note: See TracChangeset for help on using the changeset viewer.