Random Musings of a Coffee Technologist
Tumblr has the best business-people among its user base. We ship everything.

Tumblr has the best business-people among its user base. We ship everything.

JavaScript Device Update

I was hoping to have this feature done by now, but I got hit with other projects so work has gone a bit slower than expected not because there has been any technical trouble with the implementation but only because I’ve had less uninterrupted time in an appropriate mindset to work on it. Still, there has been some progress and I wanted to let people know the current state of the feature.

The Name

When the feature was first pitched to me, it was a pretty limited piece of functionality: make it possible to provide a bit of JavaScript to implement a communications protocol to talk to devices on a serial port without having to deal with all of the boilerplate involved with integrating new device support to the rest of the program. There was a little more to it in the set of nice to have functionality, but that was the key bit. I used the working name of “Unsupported Serial Device” since the reason you’d want this is to communicate with hardware that doesn’t have support built in. That’s a terrible name, and I considered some other options, but somewhere along the line I realized that the bit about communicating over a serial port was an unimportant detail. That’s the first use case that I’m considering and the only one that I care about for the next release, but it’s rather limiting to think about it in such terms. There are a lot of devices that present themselves over an interface that looks like a serial port, but there are other devices that are only documented for interactions through a vendor provided library. Why not allow the same functionality through a QLibrary wrapper? There are devices that use USB HID, why not let people talk to that? Output piped from an external program? Files? Active X components? I’m not going to waste time working on those until someone actually wants it, but once support for any one of those is available, support for any of the others is a fairly trivial extension. So Serial can safely be dropped from the name and Unsupported seems like a scary thing to put in a name. There’s a lack of clarity there. The intent is to say that I can’t help you with someone else’s code to work with devices that I don’t have available to test against, not that the interface itself is prone to breakage, which it really shouldn’t be. Alien (as in support is not native to the application) and Other aren’t much better, but eventually I decided on JavaScript Device as something that is reasonably clear about what the feature is.

Architecture

The design of the feature is pretty straightforward. There are two configuration widgets that follow the same pattern as that for every other device. One widget is used for entering the device script and it provides a space for configuration settings that the device script can look for. This gives people the option of either hard coding everything for their own particular setup and tweaking the script when things change or writing a more general script that can be shared with others who would just need to put their own configuration settings into a table. The other configuration widget has space available for specifying settings that can vary on a per-channel basis. The channel nodes need to exist in the configuration because other parts of the program will use that to hook everything up properly for UI and logging. There are a couple things that I don’t like about these configuration widgets which will be changed before the feature gets merged into the development branch, but this is mostly done and tested.

When the logging view encounters a JavaScript device in the configuration, it instantiates an object that abstracts the device. This provides two interfaces. There’s an interface presented to the logging view that can be used to get the information needed to set up the UI and generally make things work. Then there’s an interface that’s presented to the device script so that it’s easy to get access to how things have been configured. This is mostly done and not adequately tested. There are some details about this abstraction that I’d like to see pushed out to the other device abstractions as well if only to remove a lot of crud from the script that sets up the logging view, but that’s something to work on later.

Modifications to the logging view are mostly done and waiting on the device abstraction to be finished before this is tested.

Then there’s just the matter of making sure that everything needed to make practical use of the feature is available in the host environment and making sure that there aren’t any performance issues for the class of devices this feature is targeted toward. This is mostly not done, but it’s going to follow the same patterns as everything else that’s already exposed through the host environment so I’m not worried about this. I have a couple devices picked out that I’ll put together some example scripts for before the feature goes to release and there’s another person who will also be looking at that with another device and will hopefully get back to me before the release this feature ends up in goes out.

Expectation

There’s really very little left to do here. There’s a little bit more to the feature than is presented here, but the code footprint is pretty small. My schedule is still messed up so I’m not going to put together an estimate of when it will be done, but in terms of estimated hours of work left to do, it’s a pretty low number. The complexity of the scripts will depend on the device. Some of these are just open the port and listen for data so the script would do that, buffer received data until there was enough to interpret, pack up the measurements, and send those out on the appropriate channel. Others would need to write out to the port either at the beginning or periodically, some might need to do some bit bashing on either side, some might want to buffer multiple measurements to do some post-processing before sending a lower rate but cleaned up signal out on the channel. I’d like to make the stuff most commonly needed as easy to handle as possible so hopefully people who use this will provide some feedback to help with that, but it’s still going to be programming. There’ll just be a lot less of it to do. Unsupported hardware that people have asked about in the past has all been pretty low measurement rate things, so while the performance isn’t going to be as good as if the support were added on the C++ side of things, that’s going to be more in a memory/CPU utilization sense and probably not so much in the sense that people are likely to notice. No impact at all once the logging view is up for people who don’t use this feature.

appliedcoffeetechnology:

Someone abandoned their unicorn at the shop today. If you recognize this unicorn, please come back and take it home with you. For now it’s keeping a similarly abandoned dragon company. If you recognize that as your missing dragon, please stop in and take it away.

The unicorn is no longer present but the dragon is. If you know someone who has been looking for this dragon for a very long time, please let them know where it is.

appliedcoffeetechnology:

Someone abandoned their unicorn at the shop today. If you recognize this unicorn, please come back and take it home with you. For now it’s keeping a similarly abandoned dragon company. If you recognize that as your missing dragon, please stop in and take it away.

The unicorn is no longer present but the dragon is. If you know someone who has been looking for this dragon for a very long time, please let them know where it is.

Photo info:
Camera: LG Electronics LGP505
 — Focal Length: 4mm
An improbable coffee menu.

An improbable coffee menu.

myespressodeco:

(via Pin by Espresso Deco on Coffee Talk | Pinterest)

This recently became my 4th video to get more than 2K views, but surprisingly there are no comments on it at all. It would be nice to get a better sense of how well this technique works more generally. In my case it works better than it ought to, but that’s with machines that were explicitly designed to enable this sort of technique and it would be nice to get a better sense of what conditions are required for this to be useful and also where it just doesn’t work. As it is, I think most of the people using this feature are using it to better calibrate measurements on a single roaster rather than the two roaster use case presented here.

Sometimes I give advice.

Sometimes I give advice.

cookingchannel:

Can’t afford the trip down to Florida to swim with the dolphins? Swim with these dolphin-esque bananas instead. 

Never swam with dolphins. Sharks sure, but not dolphins.

cookingchannel:

Can’t afford the trip down to Florida to swim with the dolphins? Swim with these dolphin-esque bananas instead.

Never swam with dolphins. Sharks sure, but not dolphins.

poselikeateam:

mikedett91:

thetrevorproject:

freshcleanfit:

Here are some wintry animals reminding you to have a nice day and please take care of yourself because you are lovely!

We’re big fans of self-care.

I will reblog this every time it pops up on my dash!

This legitimately just reminded me that I need to take my medication thank you kind animals