mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress
This commit is contained in:
parent
e5b386b9e5
commit
6c6b26e33e
@ -48,6 +48,7 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
|||||||
self.Schedule[Scheduler][self.CallID] = {}
|
self.Schedule[Scheduler][self.CallID] = {}
|
||||||
self.Schedule[Scheduler][self.CallID].Function = ScheduleFunction
|
self.Schedule[Scheduler][self.CallID].Function = ScheduleFunction
|
||||||
self.Schedule[Scheduler][self.CallID].Arguments = ScheduleArguments
|
self.Schedule[Scheduler][self.CallID].Arguments = ScheduleArguments
|
||||||
|
self.Schedule[Scheduler][self.CallID].StartTime = timer.getTime() + ( Start or 0 )
|
||||||
self.Schedule[Scheduler][self.CallID].Start = Start + .001
|
self.Schedule[Scheduler][self.CallID].Start = Start + .001
|
||||||
self.Schedule[Scheduler][self.CallID].Repeat = Repeat
|
self.Schedule[Scheduler][self.CallID].Repeat = Repeat
|
||||||
self.Schedule[Scheduler][self.CallID].Randomize = Randomize
|
self.Schedule[Scheduler][self.CallID].Randomize = Randomize
|
||||||
@ -80,9 +81,9 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
|||||||
local ScheduleFunction = Schedule.Function
|
local ScheduleFunction = Schedule.Function
|
||||||
local ScheduleArguments = Schedule.Arguments
|
local ScheduleArguments = Schedule.Arguments
|
||||||
local Start = Schedule.Start
|
local Start = Schedule.Start
|
||||||
local Repeat = Schedule.Repeat
|
local Repeat = Schedule.Repeat or 0
|
||||||
local Randomize = Schedule.Randomize
|
local Randomize = Schedule.Randomize or 0
|
||||||
local Stop = Schedule.Stop
|
local Stop = Schedule.Stop or 0
|
||||||
local ScheduleID = Schedule.ScheduleID
|
local ScheduleID = Schedule.ScheduleID
|
||||||
|
|
||||||
local Status, Result
|
local Status, Result
|
||||||
@ -102,7 +103,7 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
|||||||
local StartTime = CurrentTime + Start
|
local StartTime = CurrentTime + Start
|
||||||
|
|
||||||
if Status and (( Result == nil ) or ( Result and Result ~= false ) ) then
|
if Status and (( Result == nil ) or ( Result and Result ~= false ) ) then
|
||||||
if Repeat and Repeat ~= 0 and ( not Stop ) or ( Stop and CurrentTime <= StartTime + Stop ) then
|
if Repeat ~= 0 and ( not Stop ) or ( Stop and CurrentTime <= StartTime + Stop ) then
|
||||||
local ScheduleTime =
|
local ScheduleTime =
|
||||||
CurrentTime +
|
CurrentTime +
|
||||||
Repeat +
|
Repeat +
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
--- Simple repeat scheduling of a function.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- Author: FlightControl
|
||||||
|
-- Date Created: 13 Dec 2016
|
||||||
|
--
|
||||||
|
-- # Situation
|
||||||
|
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results.
|
||||||
|
-- Create a new SCHEDULER object.
|
||||||
|
-- Check the DCS.log.
|
||||||
|
--
|
||||||
|
-- # Test cases:
|
||||||
|
--
|
||||||
|
-- 1. The log should contain "Hello World Repeat" lines that is fired off 1 second after mission start and is repeated every 1 seconds.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- # Status: TESTED - 13 Dec 2016
|
||||||
|
|
||||||
|
local TestScheduler = SCHEDULER:New( nil,
|
||||||
|
function()
|
||||||
|
BASE:E( "Hello World Repeat")
|
||||||
|
end, {}, 1, 1
|
||||||
|
)
|
||||||
Binary file not shown.
@ -0,0 +1,44 @@
|
|||||||
|
--- Object Repeat Scheduling.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- Author: FlightControl
|
||||||
|
-- Date Created: 13 Dec 2016
|
||||||
|
--
|
||||||
|
-- # Situation
|
||||||
|
-- Uses the Tracing functions from BASE within the DCS.log file. Check the DCS.log file for the results.
|
||||||
|
-- Create a new SCHEDULER object.
|
||||||
|
-- Check the DCS.log.
|
||||||
|
--
|
||||||
|
-- Three Test objects are created.
|
||||||
|
--
|
||||||
|
-- # Test cases:
|
||||||
|
--
|
||||||
|
-- 1. Object Test1 should start after 1 seconds showing every second "Hello World Repeat 1".
|
||||||
|
-- 2. Object Test2 should start after 2 seconds showing every 2 seconds "Hello World Repeat 2" and stop after one minute.
|
||||||
|
-- 3. Object Test3 should start after 10 seconds showing with a 10 seconds randomized interval of 10 seconds "Hello World Repeat 3" and stop after one minute.
|
||||||
|
--
|
||||||
|
-- # Status: TESTED - 13 Dec 2016
|
||||||
|
|
||||||
|
local TEST_BASE = {
|
||||||
|
ClassName = "TEST_BASE",
|
||||||
|
}
|
||||||
|
|
||||||
|
function TEST_BASE:New( Message, Start, Repeat, Randomize, Stop )
|
||||||
|
self = BASE:Inherit( self, BASE:New() )
|
||||||
|
|
||||||
|
self.TestScheduler = SCHEDULER:New( self,
|
||||||
|
function( Object, Message )
|
||||||
|
Object:E( Message )
|
||||||
|
end, { Message }, Start, Repeat, Randomize, Stop
|
||||||
|
)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local Test1 = TEST_BASE:New( "Hello World Repeat 1", 1, 1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
local Test2 = TEST_BASE:New( "Hello World Repeat 2", 2, 2, 0, 60 )
|
||||||
|
|
||||||
|
local Test3 = TEST_BASE:New( "Hello World Repeat 3", 10, 10, 1.0, 60 )
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user