-
• #2
All you need to do is...
- Copy
_examplePlugin.js
to a new JS file in theplugins
folder Replace the contents of the
init
function with something like:Espruino.Core.App.addIcon({ id: "sendTime", icon: "star", title : "Send the current Time", order: 300, area: { name: "code", position: "bottom" }, click: sendTime });
Then add a
sendTime
function that calls:Espruino.Core.Serial.write(`\x03\x10setTime(....)\n`, false, function() { Espruino.Core.Notifications.success(`Sent the time`, true); });
And I think you'll be done. It might be a nice thing to have as an option, so you could copy the code from https://github.com/espruino/EspruinoWebIDE/blob/master/js/plugins/codeLink.js which puts an option in Settings which shows/hides the icon when toggled
- Copy
-
• #3
Great, just added a sendTime.js, looks like I missed something ....because the clock icon does not show here on http://mabecker.github.io/EspruinoWebIDE/
-
• #4
Looking at
view-source:https://mabecker.github.io/EspruinoWebIDE/
you never includesendTime.js
as a script there? -
• #5
Ups, missed that one .... Thanks. Now it works. Let me know if you like to include this into the original WebIDE.
-
• #6
add screen shot
1 Attachment
-
• #7
Thanks! Well, someone asked a while ago (I think it was part of 'Projects'?) if there could be a way to upload some predefined commands from a menu, like setting time,
reset(), load(), require("Storage").eraseAll()
and I'm sure others.If a menu was added so you clicked a button and then clicked again on the command you wanted, do you think that'd be good enough for you?
Also, if it was, what other commands would be useful?
This is what the WebIDE is gererating and sending if When sending code, set Espruino's clock to the current time is checked.
How to implement this feature into the WebIDE as a standalone function witn an icon like Set Espruino Time?