The method getSerial(), I got a serial number is so long, I want to rewrite it with a simple number....
Are there any methods like setSerial() to change it?
Altho you didn't say which device you have, but I think it returns the MAC of the device in all cases.
Question is: what do you want to accomplish. You can use for example storage to save configuration like a shorter device name in flash. And read that in the onInit().
What device are you using?
But I'm afraid not. The serial number is usually based on the underlying hardware, so cannot be changed - that's the whole point.
If you want it smaller, use .substr(...) to take only a small fraction of it.
I have a STM32F4DISCOVERY board. Yes, I want to have a unique identity whick like MAC ADDRESS in the board, but I don't want to define it in code. I see process.env.SERIAL is a good position to store.
Thank you, your suggestion is good for me.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem