Report Bugs Here

Moderator: Mmiscool

User avatar
By forlotto
#49570 Good catch ....

You are correct it has changed ....

I wonder if this was an intentional change in the map or something else?

Thanks for pointing this out any thing like this is great I think takes some of the load of the devs with error correction. The thing with code if the garbage in is legit but wrong you'll get the wrong garbage out. There is no error checking for this other than human eyes.
User avatar
By livetv
#49615
forlotto wrote:I wonder if this was an intentional change in the map or something else?


I wouldn't know.

I'd suggest this code like this instead of the current LookUpNodeMCUPins function:

Code: Select allbyte LookUpNodeMCUPins(String Name)
{
  byte nodemcuPins[8] = { 16,5,4,0,2,14,12,13,15 };
  if (Name.charAt(0) == F("D"))
  {
    PinReturnValue = nodemcuPins[Name.charAt(1)-48];
  }
  else
  {
    if (Name == F("RX")) PinReturnValue =  3;
    if (Name == F("TX")) PinReturnValue =  1;
  }
  return PinReturnValue;
}


I think this would take less code space and execute faster. Just not sure where nodemcuPins should be declared. Also, I suspect that the code calling this function may already test that first character and it might be faster to fold this function back into the calling routine. I can't tell because I haven't figured out where to find the rest of the code.