Problems with the millis() function

An observation.

You do not need to explicitly call the serialEvent() function. It is called automatically at the end of the loop() function.

It looks like the parsujpolecenia() function is never being called. Could this be because the serialEvent() function is being called twice by the loop() function which causes the Serial buffer to be empty when your explicit call to the function occurs

As an experiment, rename the serialEvent() function to prevent it being called at the end of loop()

The last parameter in the cmd=1667,64,25,2400,1 command calls the pan() function for “0” or timelaps() for “1”.
It seems that the parsecommand() and serialEvent() functions work correctly. This can be checked by setting the last parameter to “0”. These functions also worked correctly in the old version with “delay”.

Start small and simple. One step at a time.
What you want is none of that.

I repeat myself:

The minimum of your engagement should be to at least make an own attempt
to add serial printing to your code.

It doesnt matter if this code-version does not compile.
If you post this code-version together with the compiler-error-message help will rush in.

The only thing that is very unlikely to happen is to post some kind of information and hoping for a new code-version written by a user.

I only have a problem with the use of millis(). And I asked for help in this regard , hoping to be shown and explained to me.

The minimum of your engagement should by to at least make an own attempt
to add serial printing to your code.

I don't understand this allegation. After all, for the timelaps() function, the serial port starts and shows that only one picture was taken. On the serial port, please send a command such as cmd=1667,64,25,2400,1. There should be 25 pictures taken at an interval of 2.4 sec.
The pan() function works fine, so there is no need to change or add anything.

How many times do you expect timelaps() to be called?

Once per cmd?
Once per MsecPeriod?
Once per loop?

As written, it looks like to only gets called once per command.

Typically when using millis() to schedule events, you re-write all your code to be called very frequently, and let your functions use millis() or other logic to do only the things that need doing. It is an important trick useful for doing more than one thing at (apparently) the same time. But if your code is written to do only one thing at a time, it complicates things and isn't much more useful than delay().

Also: MsecPeriod is always zero because of this:

OK. There is a fundamental difference between using delay() and non-blocking timing.
@the experienced users:

The thinking-wrong-about-it starts with writing too short

"use function millis()"

The first thought with this sentence is:

"OK I replace delay() with millis() and then I got it working."

As you experienced users all know. No this is much too less.

And this means a beginner that comes from delay() has to be told

EXPLICITLY

non-blocking timing BASED on millis() works fundamentally different

Here is a tutorial that explains it

Another Dunning-Kreuger millis coder. Only codes for perceived needs.

Aha. --- ... --- Never heard of it before. Read about it.
Aha. --- ... ---

Not sure who you mean. It is directly below my posting # 28.
Could be a reaction to my post #28.
Though I do net really understand your comment. Me saying this - in your eyes - might be just another proof that I am suffering "Dunning-Krueger"

Anyway I would appreciate if you explain in easy to understand words what you want to say with

and with

Worrying that you might be doing a Dunning-Kreuger is a good indication that you are capable of learning.

So what is your opinion about the comment of user @GoForSmoke ?
Would you mind writing your interpretation?

I meant that if one thinks that they might be doing a Dunning-Kreuger in a particular situation, it is a sign that they are not.

The OP, Stephan, the OP sees no need for non-blocking just wants some help with millis.

But micros() is 250x more accurate.

If precision counts and a 71.some minute or less interval is okay.. use micros()!

Are you confusing accuracy with precision ?