eclipse-4diac / 4diac-forte

Eclipse Public License 2.0
29 stars 32 forks source link

Add a command line option to enable fakeTimer #270

Open ernstblechaPT opened 3 weeks ago

ernstblechaPT commented 3 weeks ago

As discussed in #265 this adds a command line option to enable the fakeTimer if the feature is compiled in.

ernstblechaPT commented 3 weeks ago

I had another thought: since there is the FakeTimeDev and the RMT_DEV it is possible to select the required timer based on the device used.

ernstblechaPT commented 2 weeks ago

My Idea of tying automatic enablement of the FakeTimer to the FakeTimeDev poses a problem: the command line switch would need to be turned to a "disable FakeTimer" switch which breaks my use case.

In this state this practically makes the FakeTimer unusable on systems where FORTE is not started via command line. Is there currently someone using FakeTime on any platform other than Win32/Posix that we are aware of?

cochicde commented 2 weeks ago

FakeTimeDev

I'm not sure how the FakeTimeDev is being used. I understand that you need to compile forte with FORTE_DEVICE=FakeTimeDev and you get the fakeTimer in it.

What's your use case? Do you want to also have the disable FakeTimer command line to be able to use a regular timer? In that case I think the FakeTimeDev becomes the same to a RMT_DEV, right?

ernstblechaPT commented 2 weeks ago

FakeTimeDev

I'm not sure how the FakeTimeDev is being used. I understand that you need to compile forte with FORTE_DEVICE=FakeTimeDev and you get the fakeTimer in it.

What's your use case? Do you want to also have the disable FakeTimer command line to be able to use a regular timer? In that case I think the FakeTimeDev becomes the same to a RMT_DEV, right?

I want to build one FORTE binary and have it start up as a "normal" FORTE as default - and if needed switch it to FakeTime for doing some testing

I have not problem adding a switch for testing, but the default should be the "normal" FORTE

cochicde commented 2 weeks ago

I want to build one FORTE binary and have it start up as a "normal" FORTE as default - and if needed switch it to FakeTime for doing some testing

I have not problem adding a switch for testing, but the default should be the "normal" FORTE

But do you actually need the FakeTimeDevice? I see it has the extra input for setting the time it seems. is this something that's actually being used? Do you want to be able to switch between RMT_DEV and FakeTimeDevice or actually between RMT_DEV(with normal timer) and RMT_DEV(with fakeTimer)?

ernstblechaPT commented 2 weeks ago

I want to build one FORTE binary and have it start up as a "normal" FORTE as default - and if needed switch it to FakeTime for doing some testing I have not problem adding a switch for testing, but the default should be the "normal" FORTE

But do you actually need the FakeTimeDevice? I see it has the extra input for setting the time it seems. is this something that's actually being used? Do you want to be able to switch between RMT_DEV and FakeTimeDevice or actually between RMT_DEV(with normal timer) and RMT_DEV(with fakeTimer)?

Having the FakeTimeDevice allows you to set the time during a Debug-Session for a FB via the FB-Debug view in the Debug perspective - this is a really powerful tool

cochicde commented 2 weeks ago

Having the FakeTimeDevice allows you to set the time during a Debug-Session for a FB via the FB-Debug view in the Debug perspective - this is a really powerful tool

I see two possible ways of having that:

  1. Allow multiple devices to be compiled: create some factory for the type of device being created. The selection could be then done via a command line flag being the regular RMT_DEV the default one. This will allow also to have the OPCUA_DEV device. The FakeTimeDev would need to set the timer properly in the constructor and set it back to the regular in the destructor.
  2. Extend the interface of the FakeTimeDev to allow switching timers: A boolean input could allow to select between the fake and the normal timer. This will basically convert your FakeTimeDev in to a regular RMT_DEV at runtime.