• I'm not sure if it is a bug - it's not like _options is publicised, and it's easy to manually set serial up at boot yourself and get it created.

    I guess the question is, does everyone want ~6 of their variables to be used up all the time on Serial1._options when a very small percentage of people will use it.

    The other bad point is if it was set and then you saved, Espruino would detect that it was there and would then automatically set up the Serial port at boot from then on - wasting power until you explicitly disabled it even if you hadn't connected serial.

    I think on balance it's better as-is. You can always do Serial1.options||{}

  • I think on balance it's better as-is.

    Currently together with missing _option and the powersaving feature it is not possible to find out if serial is really initialized or not. So I may or may not save power (depending on whether serial was attached at boot time) but cannot figure it out later from code.

    But yes, the solution to make it deterministic is to setup() it always again at boot time to have it enabled or setup() and immediately unsetup() to have it disabled.

About

Avatar for Gordon @Gordon started