Why TimeInputParam has no parameterless constructor

Is there any reason why TimeInputPram does not have a parameterless constructor?

Quite inconvenient. Or am I missing something?

Possibly… or I am misunderstanding your question, which is equally possible :wink:

Have you searched this forum on topics about this particular widget and how it works? There are many… but here is one that should cover everything you need to know…

1 Like

Yes, I searched. The issue is not in the topic you mention or any other thread I found.

To be clear: The widget works just fine for me. The TimeInputParam works also quite well, but it could be more usefull if the class was a little more “complete”. Without parameterless constructor it cannot be easily used outside of the BLYNK_WRITE, also a getter for the weekday uint8_t would be usefull…

TimeInputParam startstoptime;

BLYNK_WRITE(TimeInputVPin) {
  TimeInputParam t(param);
  startstoptime = t;
}

I can for sure work around this, but why not make the TimeInputParam a little more complete?

Anyway, thanks for Blynk. Blynk is great.

1 Like

Yaaaah… I think I will leave this for the Developers to decipher :stuck_out_tongue:

Thanks. will do. but you can fix that directly in the library with a one-line fix.

TimeInputParam *StartStopTime = NULL;

BLYNK_WRITE(V1) {
  TimeInputParam t(param);
  StartStopTime = new TimeInputParam(param);
  
  // Process start time
  char s[] = "Input {Sun,Mon,Tue,Wed,Thr,Fri,Sat} HH:MM - HH:MM";

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
  sprintf(s, "Input {%s,%s,%s,%s,%s,%s,%s} %02d:%02d -> %02d:%02d",
          StartStopTime->isWeekdaySelected(1) ? wd[1] : "---",
          StartStopTime->isWeekdaySelected(2) ? wd[2] : "---",
          StartStopTime->isWeekdaySelected(3) ? wd[3] : "---",
          StartStopTime->isWeekdaySelected(4) ? wd[4] : "---",
          StartStopTime->isWeekdaySelected(5) ? wd[5] : "---",
          StartStopTime->isWeekdaySelected(6) ? wd[6] : "---",
          StartStopTime->isWeekdaySelected(7) ? wd[0] : "---",
          StartStopTimeObj->hasStartTime() ? StartStopTimeObj->getStartHour() : 99,
          StartStopTimeObj->hasStartTime() ? StartStopTimeObj->getStartMinute() : 99,
          StartStopTimeObj->hasStopTime() ? StartStopTimeObj->getStopHour() : 99,
          StartStopTimeObj->hasStopTime() ? StartStopTimeObj->getStopMinute() : 99);
  Serial.println(s);
}
> Input {Mon,---,Wed,Thr,---,Sat,---} 06:33 -> 23:32

It worked with pointer declarations.
I too would be happy if I could declare a class without a standard constructor.

@WAKISUKE please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like