Problem with terminal widget

There was a problem setting esp8266 through the terminal widget. Entering “Y” does not happen. Tell me, what is the mistake?

} else if (String("setDat") == param.asStr()) {
     terminal.println("Выставление даты:"); 
     terminal.println("Продолжить? (Y/n)"); 
     if (String("Y") == param.asStr()) {
       if (param.asInt() > 0) {
        dy =  param.asInt();
       if (param.asInt() > 0) {
         ms =  param.asInt();
       if (param.asInt() > 0) {
         yr =  param.asInt();

Esp8266 module, library v0.6.1

I’ve done this before using a switch case statement.

The problem is that param.asStry() cannot equal both “setDat” and “Y” at the same time.
The function is only called once after pressing the return button.

So after you have input “Y” for example, then inside this function because param.asStr() is equal to “Y” not “setDat”

else if (String("setDat") == param.asStr()) {
     terminal.clear();                                                // ONLY RUNS IF param.asStr() == "setData"
     terminal.println("Выставление даты:");           // ONLY RUNS IF param.asStr() == "setData"
     terminal.println("Продолжить? (Y/n)");            // ONLY RUNS IF param.asStr() == "setData"
     if (String("Y") == param.asStr()) {                    // ONLY RUNS IF param.asStr() == "setData"
        terminal.println("день:");                               // ONLY RUNS IF param.asStr() == "Y"
1 Like

Thank you. I am new to programming, could you please write this part of the code so that it works?

Sorry I’m not going to write your code for you because it’s only a snippet, I would need the full function and would need to know exactly what you are trying to achieve.

But if you look at this thread/post:

Then you should be able to work out what you need to do.