Tweets
Lots still to do with the new Open Book UI concept, but one more morning of work has yielded a decent reading experience in 160 lines of application code. It’s mostly the old MVBook idea, now packaged up in a view hierarchy that’s much easier to work with. https://github.com/joeycastillo/libros/blob/main/src/app/OpenBookApplication.cpp
(original)
Replying to @josecastillo
the code so far. There are still some warts around manually setting focus, and occasionally needing to remind the window that it needs a refresh. but if I can write most of the Open Book firmware like this, it’s going to be a good time. https://github.com/joeycastillo/libros/blob/54e4694fee2327360fd85884f56fa477e8495bfd/src/main.cpp
(original)
Replying to @josecastillo
I’m going to call this an acceptable amount of win for one day of work. Center button instantiates a table view, adds it to the view hierarchy. D-pad works automagically; then center again removes the table from the hierarchy, and all those objects get deallocated. Automagically.
(original)
Replying to @josecastillo
sometimes I worry I’m showing my whole ass when I do these threads where I learn my way through a thing. truth be told, I’d never used C++ smart pointers before this morning; it was all learning by doing. I will doubtless learn more and improve it further. https://github.com/joeycastillo/libros/compare/7b513cba5a77577c3394df1a00f837f183837437...e1946bf912acccb8d1ef194f86987bf6c6941743
(original)
Replying to @josecastillo
an improvement, i think. Application owns its Window, Window owns its Views which themselves own their subviews, while maintaining weak references to their superview and associated window. If it feels like UIKit, there’s a reason: i liked it and i cribbed a lot of notes from it.
(original)
Replying to @josecastillo
I have converted precisely one (1) of my pointers to a shared / weak pointer, and I now have an immediate and visceral understanding of why optionals were invented.
(original)
Replying to @josecastillo
Technically I have the C++ STL at my disposal, with its array of shared and weak pointer options. but it is a dizzying mess of angle brackets and oddly specific APIs. I’ve been spoiled by the watch, where everything’s statically allocated at boot and it just ticks all year long.
(original)
Replying to @josecastillo
morning thought: you can do lots of fun stuff when you throw caution to the wind and don’t think about things like memory management. This works for a statically allocated single screen of UI, but it’s going to become a mess very quickly IRL. so, new task: deal with the pointers.
(original)
Replying to @josecastillo
i couldn’t help myself, i just had to port over one widget from the circuitpyui library. a basic button, but with focus targets, we manage to get a usable menu right off the bat. this isn’t real yet, like, none of this is tied to the filesystem. but the UI framework works so far.
(original)
Replying to @josecastillo
dongle found. fix tested. i work in technology.
(original)
Replying to @josecastillo
haha thought it through on the bike ride home, wrote the fix, and now I don’t have the right kind of dongle to test it out. I’ve said it before and I’ll say it again: we have built a dumb future.
(original)
Replying to @josecastillo
Coda: realized I have a cookout to go to tomorrow, so biked back to the shop after beers to port over the focus engine. Again, promising: three views, and the window translates nav button events into transitions in focus. Glitch in the refresh window, but that’s solvable. Mañana.
(original)
Replying to @josecastillo
Nested subviews and partial updates. https://github.com/joeycastillo/libros/commit/e9f828ff0a2a79de41986f2ac1c56c72d038b392
this is all very promising. But it’s a beautiful day out and I kind of want to ride a bike around in the sun so this is TO BE CONTINUED tomorrow.(original)
Replying to @josecastillo
Progress as of lunchtime: a window and a subview, buttons generating events, events invoking callbacks to move the subview around the screen. https://github.com/joeycastillo/libros/blob/4610acb4142947aa2aa54d928b85b4163190c8bb/src/main.cpp
Much still to do, but first: sandwich.(original)
Replying to @josecastillo
once again I am reminded of this essay by James Mickens: https://www.usenix.org/system/files/1311_05-08_mickens.pdf
(original)
Replying to @josecastillo
the work in progress. warning: it may not be good yet. https://github.com/joeycastillo/libros
(original)
Replying to @josecastillo
progress: a minimal application. reading buttons in, tying a particular button event to a particular callback when the window receives that button event. Of course, there’s still nothing on the screen.
next stop: windows and views.(original)
Replying to @gabrielcsapo
The idea here is that views are objects and these are methods on those objects; there aren’t really any raw function calls at all, just objects talking to other objects. Personally I find that much easier to reason about.
(original)
Replying to @josecastillo
s/active/focused/
(original)
Replying to @josecastillo
my habit is to imagine all the things that a thing will need to do, stub out methods for the things to do the things, then fill in the blanks as I go. In this case I have a pretty good idea of what I want the things to do — and a lot of code to write to make them do them.
(original)
Replying to @josecastillo
it’s not much to look at just yet, but friends: we have a run loop! so far just one task, reading button inputs. and the window doesn’t know how to draw itself. but it’s a start!
(original)
Replying to @josecastillo
(naming things is hard, but after cycling through ideas, I decided to call the new Open Book UI framework “Focus”. Works on two levels: the main UI pattern is moving focus between on-screen elements, and also it should help you focus on reading)
(original)
okay! it’s 10 AM, I’m at the shop, and I’ve blocked off my entire day for Focus.
(original)
Replying to @josecastillo
circuitpyui looks something like this; basically it has views and subviews and events that can fire to move focus around on a screen. This feels like just the kind of framework I’d want to use to build the Open Book software. (but it needs to be C++ified) https://twitter.com/josecastillo/status/1306651087152320512
(original)
I need to write a new UI framework for the Open Book, but then remembered I already sort of did this for CircuitPython with circuitpyui (which itself was heavily inspired by Apple’s UIKit). Anyway I think I’m just going to port it to C++ and call it a day. https://github.com/joeycastillo/circuitpyui
(original)
Replying to @TheSethKerr and @MakeAugusta
Feels like table stakes these days…
(original)
Replying to @ruptes
At some point. I really want to do a new version, but I want to do it right.
(original)
Replying to @josecastillo
I like the menu popping out of a drawer at the bottom, because I imagine the center button of the nav switch would go home, and down would bring in a cursor to highlight text. Up is the next best candidate for a menu action; it feels right that it would pop up from the bottom.
(original)
The old interface + some new ideas. #openbook
(original)
Replying to @josecastillo
Meanwhile, the new firmware is at day 95 and 3.07 volts. Feeling a lot more optimism for this one; both sleep and wake modes have been dramatically optimized, and the voltage hasn’t dipped below 3.05 yet even with heavy daily use. 🤞🏽
(original)
Replying to @josecastillo
Battery test, Day 200: 2.98 volts. 2.985 really; it alternates between 2.98 and 2.99. Suddenly feeling less certain about this old firmware being able to make it to the one year mark. I would have hoped to see this dip start to happen in July or August, not May. Time will tell!
(original)
BACKER UPDATE IS LIVE! Classic Casio styles, new community watch faces, and — the big news — @MakeAugusta helps us deliver 60% of the backer boards right on time. https://www.crowdsupply.com/oddly-specific-objects/sensor-watch/updates/good-news-on-the-parts-shortage-sensor-watch-field-reports-and-new-community-watch-faces
(original)
Replying to @gojimmypi
But IIRC the USB is just a USB-Serial for code upload; it can’t do things like mass storage, which is a bit limiting. But if they’re skating in the RISC-V direction I’m sure they’ll soon have something that does it all.
(original)
Replying to @josecastillo
tomorrow: UX design. It feels weird to be able to draw whatever I want on a screen, what after a year of living with 7-segment limitations. This is going to be fun.
(original)
Replying to @josecastillo
actually honestly this is not so bad, all things considered. The Open Book hardware is nicely encapsulated, and my old Arduino code isn’t too spaghetti. Cleaning it up has not been as bad as I thought it would be. This could work. I think I can build something on top of this.
(original)
Replying to @gwilymgj
Truth be told, not right now. I learned a lot since that first iteration, and I’m trying to pour that knowledge into a better version that can live up to the promise (an open source ebook you can build yourself). But it’s still months out; hardware and software are still in flux.
(original)
Replying to @josecastillo
Addressed all warnings, swapped in a better SD library and made all fixes required to build on the base Pi Pico board variant (instead of hacking around in the Arduino core). The firmware works! Now I just need to tear it down to the studs and build something better in its place.
(original)
Replying to @jit_j
(in fairness to me, up to that point I’d spent most of my career in Xcode, which comes with sane defaults)
(original)
Replying to @jit_j
Things I have learned since 2019 :)
(original)
Replying to @dcelectr
“But Master GCC,” said the novice, “Why did you not warn me of my error?”
“There was no error.”
In that moment, the novice achieved enlightenment.(original)
Replying to @dcelectr
A novice climbed the mountain to seek the counsel of Master GCC. “My function was working,” they said, “but now it is not.” Master GCC nodded, but said nothing. The silence lingered. After a time, the novice realized the function, which was of type int, failed to return a value.
(original)
Replying to @gojimmypi
hmm! If the S3 is still Tensilica, does that mean it’s going to go EOL sooner as well? I’d love to get on that RISC-V train, but my concern is they don’t yet have a RISC-V module with native USB, at least that I can tell…
(original)
Replying to @josecastillo
my goodness that’s a lot of warnings. I feel like Arduino was lying to me every time my code compiled without issue…
(original)
Replying to @anne_engineer
aha! I like that.
(original)
Replying to @josecastillo
Also wait a tick — the ESP32-S2 WROVER is not recommended for new designs? It was the new hotness like a minute and a half ago! How am I supposed to keep up with this, what module am I supposed to be using now?
(original)
Replying to @josecastillo
the issue: in the past, I stored all my language data on an external 2 megabyte SPI Flash chip. But seeing as the ESP32-S2 WROVER has 4MB of Flash, I figured I could bake the language data in with the firmware on this variant. Of course, I never got around to writing that code 😬
(original)
Replying to @josecastillo
well that is a surprisingly promising start. There are a few ugly #ifdefs, but I’m two hours in and I can build for two platforms with ease! Of course I never figured out the Babel language library for the ESP32-S2 book, so it can’t display book titles. But it’s a start!
(original)
Replying to @k0dSE
The one-time tooling cost is a couple hundred bucks, which may come with 5-10 displays or you may have to pay a few dollars per sample unit. But for a small LCD like this, pricing for a final order can be <$1 which makes it quite affordable even with the NRE costs.
(original)
Replying to @k0dSE
I’m talking to a couple of suppliers; rather than recommend anyone in particular, I’d say just search Alibaba for “custom LCD” and you’ll find suppliers to reach out to. Some have a hard MOQ of 10000, others will work with you down to 5000 or fewer, but it was surprisingly easy.
(original)
Replying to @josecastillo
The firmware, MVBook, was written in Arduino, and truth be told it was a bit of a mess even with what I knew back then. Today I’d like to move it over to the @PlatformIO_Org build system, and have the same project be able to support both the new Pi Pico and ESP32-S2 prototypes.
(original)