Closed bsiever closed 3 years ago
Any plans for MicroPython support?
Hi @AirplanegoBrr --- I wasn't planning too, but I'll try to look into it.
My original code was prototyped in Python (https://github.com/bsiever/software-based-RTC-algorithm). I think it would be pretty easy to update it a bit to work with Micro:Python's utime
. The big unknown is accuracy: I had to do some really low-level tricks to get the MakeCode version to be accurate.
@AirplanegoBrr : A quick update. I did make a Python version using utime
and tested it. (Test version here: https://github.com/bsiever/micropython-timeanddate). It lost about 4 minutes of time in about 12 hours, so it's not very accurate. I suspect this is because of the way MicroPython configures the micro:bit. I hope to look into this in a week or two, but I think accuracy will require a more complex solution than just use of Python code.
Docs / Examples at: https://bsiever.github.io/microbit-pxt-softclock/
General features
Currently I'm ignoring the special cases for leap years at centuries, although including them is just another couple of mods and and AND statement. (Code is there/correct, just commented out). It seems like the major use-cases are "calendar from 0" and "calendar from now". Should I bother with the special cases for leap years?Eh...Decided it wasn't significant.Should I include anything that translates to weekday abbreviations or names ("Mon", "Tues", etc.) and month abbreviations/names? Or is that an exercise for the user?(Decided on "exercise for the user")The "stopwatch" behavior could be handy. Should I update the package to highlight this a bit more?Added completed example.I could expose access to milli-seconds, but I didn't think it'd be useful generally. Any thoughts?Decided accuracy undermined utility.How's the Palette color? I just used a default from the playground and am open to suggestions.Calling it done.Package Prep
How can I improve documentation? See: https://bsiever.github.io/microbit-pxt-softclock/(Probably, but calling it good here for now)~~TheJust the attempts to show reporter blocks in isolation are failing.block
and in-line block environments aren't working, butblocks
does.Blocks don't always seem to render correctly. Suggestions?leftZeroPadTo()
in main.ts.Any guidance ontest.ts
for this? Or examples of effective tests are included in comparable types of extensions?Typescript vs. C++ & Performance Questions
const cdoy: uint16[] = [ ... ]
. Will this consume ram or go to code space? (I'd want code space)