Questions about passing param to BlynkTimer's setTimeout (or any other timer func)

Hi. I am trying to create a timer for some function call and pass a parameter to it. Using global param inside a function is inapplicable in my case because this param can change before the actual deferred call of the function, but I need to use the initial value.

If we simply have some function like: void testTimer(int valToSet)
and create timer like this: timer.setTimeout(1000L, testTimer, testParameter);
where testParameter is some int var: int testParameter = 45; declared before setTimeout call,
then we have an error:
invalid conversion from 'void (*)(int)' to 'timer_callback_p {aka void (*)(void*)}' [-fpermissive]

I looked through the BlynkTimer sources and went to this solution for int vals:
function should use void * arg: void testTimer(void *valToSet)
And timer should be created like this: timer.setTimeout(1000L, testTimer, (void*)testParameter);
Then in function we need to use (intptr_t)valToSet type cast.

Or in sketch:

#include <BlynkSimpleEsp8266_SSL.h>

BlynkTimer timer;

void setup()
{
  Serial.begin(115200);

  int testParameter = 45;
  timer.setTimeout(1000L, testTimer, (void*)testParameter);
  
  testParameter = 99;
  testTimer((void*)testParameter);
}

void loop()
{
  timer.run();
}

void testTimer(void *valToSet) {
  //intptr_t n = (intptr_t)(valToSet);
  Serial.print("Test function with input: ");
  Serial.println((intptr_t)valToSet);
}

The question is: Is there a simplier way to use blynk timer parameter as arg for called function
and how to use float args (I didn’t succeed in passing float args like this)?

Thanks

That’s the way it works I’m afraid. I think it’s void though so technically you could pass anything. Ints, strings etc you just have to specify what it is in the function.

See my code here I just pass ints though.
https://community.blynk.cc/t/toolbox-lock/36689?u=justbertc

Edit:
So in your function, maybe just try casting to float?

#include <BlynkSimpleEsp8266_SSL.h>

BlynkTimer timer;

void setup()
{
  Serial.begin(115200);

  float testParameter = 45.1;
  timer.setTimeout(1000L, testTimer, (void*)testParameter);
  
  testParameter = 99.9;
  testTimer((void*)testParameter);
}

void loop()
{
  timer.run();
}

void testTimer(void *valToSet) {
  //intptr_t n = (intptr_t)(valToSet);
  Serial.print("Test function with input: ");
  Serial.println((float)valToSet);
}