Changeset 19572 for trunk/FACT++/src/drivectrl.cc
- Timestamp:
- 08/20/19 12:33:46 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/drivectrl.cc
r19553 r19572 130 130 double offset; 131 131 array<double, 2> angles; 132 133 bool operator!=(const Source &cmp) 134 { 135 return 136 name != cmp.name || 137 ra != cmp.ra || 138 dec != cmp.dec || 139 mag != cmp.mag || 140 offset != cmp.offset || 141 angles[0] != cmp.angles[0] || 142 angles[1] != cmp.angles[1]; 143 } 132 144 }; 133 145 … … 2093 2105 const string name(ptr); 2094 2106 2095 const sources::const_iterator it = fSources.find(name); 2096 if (it==fSources.end()) 2097 { 2098 T::Error("Source '"+name+"' not found in list."); 2099 throw uint32_t(T::GetCurrentState()); 2100 } 2101 2102 return it; 2107 sources::const_iterator it = fSources.find(name); 2108 if (it!=fSources.end()) 2109 return it; 2110 2111 T::Warn("Source '"+name+"' not found in list... reloading database."); 2112 2113 ReloadSources(); 2114 2115 it = fSources.find(name); 2116 if (it!=fSources.end()) 2117 return it; 2118 2119 T::Error("Source '"+name+"' still not found in list."); 2120 throw uint32_t(T::GetCurrentState()); 2103 2121 } 2104 2122 … … 2237 2255 } 2238 2256 2239 int StopMovement( )2257 int StopMovement(bool reload=false) 2240 2258 { 2241 2259 fDrive.SetAcceleration(fAccMax); … … 2245 2263 2246 2264 fDrive.UpdateSource(Time(), "", false); 2265 2266 if (reload) 2267 ReloadSources(); 2247 2268 2248 2269 return State::kStopping; … … 2905 2926 2906 2927 T::AddEvent("STOP")(State::kUnavailable)(State::kAvailable)(State::kArmed)(State::kInitialized)(State::kStopping)(State::kParking)(State::kMoving)(State::kApproaching)(State::kTracking)(State::kOnTrack) 2907 (bind(&StateMachineDrive::StopMovement, this ))2928 (bind(&StateMachineDrive::StopMovement, this, false)) 2908 2929 ("Stop any kind of movement."); 2930 2931 T::AddEvent("PREPARE_GRB")(State::kUnavailable)(State::kAvailable)(State::kArmed)(State::kInitialized)(State::kStopping)(State::kParking)(State::kMoving)(State::kApproaching)(State::kTracking)(State::kOnTrack) 2932 (bind(&StateMachineDrive::StopMovement, this, true)) 2933 ("Combines STOP and RELOAD_SOURCES"); 2909 2934 2910 2935 T::AddEvent("RESET", State::kPositioningFailed, State::kAllowedRangeExceeded, State::kInvalidCoordinates, State::kHardwareWarning) … … 2995 3020 const mysqlpp::StoreQueryResult res = 2996 3021 db.query("SELECT fSourceName, fRightAscension, fDeclination, fWobbleOffset, fWobbleAngle0, fWobbleAngle1, fMagnitude FROM Source").store(); 3022 3023 auto old = fSources; 2997 3024 2998 3025 fSources.clear(); … … 3011 3038 AddSource(name, src); 3012 3039 3013 if (!print)3014 continue;3015 3016 3040 ostringstream msg; 3017 3041 msg << " " << name << setprecision(8) << ": Ra=" << src.ra << "h Dec=" << src.dec << "deg"; 3018 3042 msg << " Wobble=[" << src.offset << "," << src.angles[0] << "," << src.angles[1] << "] Mag=" << src.mag; 3019 T::Message(msg); 3043 3044 const auto it = old.find(name); 3045 if (it==old.end()) 3046 T::Message(" +"+msg.str()); 3047 else 3048 { 3049 if (print || it->second!=src) 3050 { 3051 T::Message(" c"+msg.str()); 3052 old.erase(it); 3053 } 3054 } 3055 } 3056 3057 for (auto it=old.begin(); it!=old.end(); it++) 3058 { 3059 const auto &src = it->second; 3060 3061 ostringstream msg; 3062 msg << " - " << it->first << setprecision(8) << ": Ra=" << src.ra << "h Dec=" << src.dec << "deg"; 3063 msg << " Wobble=[" << src.offset << "," << src.angles[0] << "," << src.angles[1] << "] Mag=" << src.mag; 3064 T::Message(msg.str()); 3020 3065 } 3021 3066 #else
Note:
See TracChangeset
for help on using the changeset viewer.