incompatible types in assignment of ‘void*’ to ‘char [5]’
And that refers to which line ?char timeinput[5]Shouldn’t there be a ‘;’ there ?inputMessage.toCharArray(timeinput,5);If ‘inputMessage’ is “12:34” then the CharArray should be 6 characters, 5 + 1 for the terminator. Of course you could do the parsing just using the ‘String’ class, using substring() and toInt()
I have muddled through and found a solution that is not graceful, but works. if anyone has a suggestion on how to make this more elegant it would be appreciated
else if (request->hasParam(PARAM_INPUT_2)) {
inputMessage = request->getParam(PARAM_INPUT_2)->value();
inputParam = PARAM_INPUT_2;
// inputParam = memmove(&inputParam[2], &inputParam[3], strlen(inputParam) - 2);
int timeinput1 = (inputMessage.charAt(0) - '0')*1000;
int timeinput2 = (inputMessage.charAt(1) - '0')*100;
int timeinput3 = (inputMessage.charAt(3) - '0')*10;
int timeinput4 = inputMessage.charAt(4) - '0';
int starttime = timeinput1+timeinput2+timeinput3+timeinput4;
I'm sure you can do this kind of tokenised splitting with the String class as well. I'm just pre-programmed to NOT use String. I accept on the ESP8226 it's not a problem.
Do what you like with the separate hrs and mins parts once you have parsed them.
Combine them into a bastardised unholy child of the devil with result = hrs * 100 + mins if you want.
Edit: The French tried decimal time once. It didn't work out so well for them. About as well as requesting the prime meridian should run through Paris....
I’m sure you can do this kind of tokenised splitting with the String class as well. I’m just pre-programmed to NOT use String. I accept on the ESP8226 it’s not a problem.
In fact there was (and probably still is) an issue with strtok() in the ESP core (which tends to show up whenever people use / are referred to use, Robin’s Serial Input Basics) so if parsing it like this is the plan, i would suggest using the ‘String’ class, it has almost no issues on an ESP, and none if used locally (rather than globally)
that is not graceful, but works. if anyone has a suggestion on how to make this more elegant
the issue is in the ‘:’ half way, and i am also a little curious what happens when the hours are less than 10.
i would do something like this to prevent any unwanted result from that event like this:
inputMessage = request->getParam(PARAM_INPUT_2)->value();
uint8_t i = 0;
uint16_t starttime = 0;
while (i < inputMesaage.length()) {
char c = inputMessage.charAt(i);
if ((c >= '0') && (c <= '9')) {
starttime = (starttime * 10) + (c - '0');
}
i++;
}