XOD 0.34.0: Fake Internet and Real Graphics

Victor Nakoryakov
XODlang
Published in
4 min readMay 28, 2020

Hi there! The pandemic affected the development process making it slower a little bit. Nevertheless, the new 0.34.0 version of the XOD visual programming language is here. And it brings two major features: PC Internet tethering and support for graphic displays.

Internet tethering

I’m pretty sure you have used the feature of your mobile phone, which makes it a temporary Wi-Fi router for your laptop or buddy phone who ran out of the data limit. That feature is known as tethering.

XOD devs have made the similar feature but for devices. Your PC running XOD IDE now can share its internet access with a dumb board with no network connectivity features. Even if you got only good old Arduino Nano, you can start making an IoT-enabled device, test it, polish, and only after that buy a board that supports Internet connection natively to make the device truly autonomous.

Arduino Nano logs temperature to the cloud

Behind the scenes, the board keeps a UART connection with the computer running XOD IDE, thinking it talks to an ESP8266 AT-modem. XOD IDE emulates the modem protocol and performs WAN communication on behalf of the connected board.

The internet tethering feature works in the simulation mode as well. That is, you can try to start using internet services, such as XOD Cloud Feeds, without real hardware at all.

To get started with Internet tethering, read the new guide article:

Graphics

Another big thing of 0.34.0 is the support for graphics and graphic LCDs. This is a long-awaited functionality that we introduce only now because the graphics is tricky, especially on microcontrollers with poor resources, especially in the data-flow paradigm employed by XOD.

One of the main problems is RAM consumption. Many existing Arduino libraries take a straightforward approach and keep the whole image buffer in the dynamic memory. The size of the buffer depends on the size of the image and can be as large as several megabytes that is way too large to fit in many microcontrollers’ RAM. We wanted a smarter way. Let it be a bit slower, but save the precious memory.

Finally, after a series of failures, our devs have found a way to clearly and efficiently express and render graphic primitives. The main idea is keeping scene objects declarative and generative. For example, a circle holds only its center and radius, not the whole buffer of its pixels. The pixels are only computed right at the moment when a scene needs to be rendered and sent to the display. Besides that these moments are short, even during the scene rasterization, the whole buffer is not allocated in RAM: the rendering happens line-by-line, right as old Atari game machines did. In the case of 128×160 pixel display, such architecture requires a buffer for 128 pixels, not 128×160=20480 pixels.

As a result, three new items were added to the set of the standard libraries:

The libraries form a solid basis for further development: introducing new shapes, fonts, and LCD models.

ST7735 and SSD1306 showing images with XOD

Dive into details of XOD graphics rendering with new guide articles:

As usual, the release includes other small improvements and enhancements. Read the full list on GitHub.

Get the new version of XOD from the downloads page or try it directly in your browser. If you have XOD installed already, click the update message when IDE starts.

--

--