Giter Club home page Giter Club logo

tcmenu's Introduction

tcMenu - A menu library and designer for Arduino and mbed with IoT capabilities

A menu library and designer UI for Arduino and mbed that is modular enough to support different input methods, display modules and IoT / remote control methods. TcMenu is more than just an Arduino menu library, think of it as a framework for building IoT applications that includes the ability to render menus locally onto a display.

Initially, you can use the menu designer UI that is packaged with every release, and available for Windows, macOS, and Linux. The designer UI takes care of building the core menu code and putting any callback functions into your sketch file. Think of the designer like a form designer in the desktop domain. Furthermore, It's non destructive on the sketch file, so can be round tripped during development.

TheCodersCorner.com invest a lot of time and resources into making this open source product which is used by literally thousands of users. Releasing a UI, renting server space cost more than you'd think. Please consider at least making this project cost neutral to me by using either option to sponsor the project. We have some commercial offerings but these are presently very limited as I work full time.

Sponsor me on GitHub (this repository).

Buy Me A Coffee

In any fork, please ensure all text up to here is left unaltered.

Documentation

UI user guide, getting started and other documentation

Full API embedded documentation

YouTube getting started Part 1

Questions, community forum and support

Community questions can be asked in the discussions section of this repo, or using the Arduino forum. We generally answer most community questions but the responses will not be timely. Before posting into the community make sure you've recreated the problem in a simple sketch, and please consider making at least a one time donation (see links further up):

Packaged installation for Windows, Linux, and MacOS.

Releases are directly available from the releases page, there is a signed Windows version, notarized macOS version, and a package for Linux:

Get the latest TcMenu Designer release

Although most will use the above packages, it's also possible to build from source, full instructions are in the tcMenuGenerator folder. We ask that you only build from source for your own use.

Here's a couple of screen-shots of the designer UI - runs on Windows, macOS and Linux:

Menu designer for Arduino

Generating a menu from the UI for the impatient

If you don't want to read the above documentation this gives a very quick start. Open the tcMenu Designer UI and set up your Arduino directory in "Edit -> General Settings", then check the "Library Versions" tab to ensure the embedded libraries are installed / up to date.

Once the tcMenu library directory is located, the "File -> Examples" menu will load with all the examples. Load the example closest to the hardware you have. Once it's open, you'll see the menu tree structure on the left, and the details for each menu when selected on the right. Below the menu tree are buttons that manage items in the menu tree.

Once you've arranged your menu using the UI how you'd like it, choose Code -> ID & Eeprom analyser from the menu to check that you've not got any overlapping ranges, then choose Code -> Generate from the menu, choose appropriate hardware arrangements and hit generate.

The Generator is capable of round trip development too - most of the code is offloaded into associated CPP and Header files.

TcMenu still supports Uno with LiquidCrystal dfRobot shield or Ssd1306Ascii

We try to keep Uno viable for tcMenu. However, there are limitations to what we can do. You can run a full menu on an Uno, but it's unlikely that the remote Ethernet support will fit. For anything that includes remote control support, we recommend at least 64K of flash memory. We store the menu items in static RAM where it's supported by the hardware, to further reduce memory on the board.

Libraries required for tcMenu

TcMenu supports different boards and build tools. It is possible to use it directly with both platformIO and Arduino IDE. It should also work with most mbed tooling as the libraries compile on mbed.

The easiest way to get started is to install tcMenu library using library manager, all the dependencies are automatically installed. However, if you like to manually manage libraries, below are the links to their repos:

Embedded Libraries for Arduino and mbed

Additional libraries you may need depending on display

Main Java source code locations

The designer UI code base and plugins for 2.0 onwards are located in this repository. The designer, library and shipped plugins are all Apache licensed.

Input and display technologies

Here are a few examples of how the menu can look with version 2.0 of our menu library on Arduino, ESP, and mbed:

Arduino menu running on ESP32 with ILI9341 and touch screen

Arduino menu in dark mode running on ESP32 with ILI9341 and touch screen

Arduino menu on OLED running on ESP8266 with SH1106 and touch screen

Arduino menu on LCD running on AVR

Support for rotary encoders, digital/analog joysticks and touch buttons

We fully support rotary encoder based input with no need for any additional components in many cases. You can even connect your rotary encoder on a PCF8574, AW9523 or MCP23017. Further, we even support more than one encoder.

You can configure 3 or more buttons to work like a digital joystick using button based rotary encoder emulation (Up, Down and OK buttons with optional left and right) on either board pins, i2c expander, shift register. DfRobot analog input style buttons. Either DfRobot, or other analog ladder (configurable in code).

We also support the ESP32 touch pad interface, allowing up to 9 touch buttons to be used for menu input, they currently configure as per digital joystick.

Support for matrix keyboards

Matrix Keyboards of configurable size and key combination. Pre-canned options for 4x3 and 4x4 layouts. Most of the core functions work with a matrix keyboard.

Support for touch screens

From 2.0 onwards we'll support touch screen interfaces. We have built the support so that we can add many devices later, but to start with we will support resistive touch screens using 4 inputs, and the STM32 BSP provided touch screen interface.

Drawing to LiquidCrystal (i2c or direct)

We have a fork LiquidCrystal for 20x4 or 16x2 displays - can be either directly connected, over an i2c sheild (PCF8574, MCP23017, AW9523) or on a shift register. Our version of the library integrates better with task manager, yielding frequently.

Adafruit_GFX integration for many displays

Most libraries that are compatible with Adafruit_GFX will work with tcMenu, we've tested with the following TFT's ILI9341, ST7735 and also Nokia 5110 display. We even have a quick start option that helps you get started with this option.

For mbed RTOS 5/6 we have a custom Adafruit_GFX OLED driver https://github.com/TcMenu/Adafruit-GFX-mbed-fork that supports SSD1306, SH1106.

U8G2 integration for mono display

We can render onto most buffered displays using this library. Tested with OLED devices such as SSD1306 and SH1106. We can even provide a custom I2C byte function that yields to task manager frequently, making it work better with task manager, and correctly yield on ESP boards too.

TFT_eSPI and STM32 LTDC framebuffer integration

From 2.0 onwards we'll support TFT_eSPI and STM32 LTDC framebuffer based BSP functions to provide very high performance display rendering, we've tested with these two options on both ESP32 and STM32F429, the results were highly impressive.

No local input or display techonologies

Should your app not need any local display or input technologies, you can set up tcMenu so that it does not have local input or display, or you could have a single switch or LED on the device and manage it manually. In this case you'd use the below IoT support to manage the device remotely.

Remote IoT support on Ethernet, WiFi, Serial and Bluetooth/BLE

This menu library provides complete IoT remote control, presently over serial and ethernet. We've tested the serial support with both USB serial and Bluetooth, both work acceptably well. The full menu structure is sent over the wire and the Java API provides it as a tree that can be manipulated. There is also a defined protocol for other languages. In addition to this the menu can be programatically manipulated very easily on the device.

  • RS232 endpoint that supports full control of the menu items using a Java API - example app included.
  • Ethernet endpoint that supports either Ethernet2 library or UipEthernet.
  • Ethernet endpoint for mbed that supports the mbed socket implementation.
  • ESP8266 and ESP32 based WiFi both supported.

Ready built APIs and remote control UIs for tcMenu - embedCONTROL

TcMenu was built from day one for remote control and there are a few different offerings, we'll go through each one in turn, along with their intended use case:

Java embedCONTROL UI

This desktop UI can be easily built from the source here using the instructions provided, it is also packaged for desktop those who want to use it as it exists out of the box. This offering builds on top of JavaFX, it has an automated UI that builds automatically for any menu app with form support for more advanced cases.

[https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/tcmenu-remote-connection-arduino-desktop/]

Java / JVM API

There is a java API for accessing the menu remotely, source includes JavaDoc to help getting started. There is an example JavaFX UI built with it within the above Repo. Include the following into your maven build file:

    <dependency>
        <groupId>com.thecoderscorner.tcmenu</groupId>
        <artifactId>tcMenuJavaAPI</artifactId>
    </dependency>

C# API

The C# API is relatively complete and can do most of what the Java API can do, it is well tested and stable.

Repo: https://github.com/TcMenu/tcmenu-dotnet-sdk

Python API

There is now a Python API thanks to @vzahradnik - https://github.com/TcMenu/tcmenu-python-sdk

JavaScript and TypeScript

There is also an early version of a TypeScript API that can be used from any JavaScript environment. https://github.com/TcMenu/embedcontrolJS. In the future, we may better package this API to a package manager.

There is also a Webserver/HTML based app that you can deploy, but it only really works from a Raspberry PI with the embedded Java support. It is somewhat limited in what it offers. After careful evaluation we decided NOT to support ESP32 and STM32 for this app at the moment as it is too large for them.

Working with menus using the CLI

The most recent builds of TcMenu Designer include a CLI that has support for creating projects, adding and removing items, verifying and generating menus. Building and Generating menus from the CLI

Loading and saving menu items

tcMenu can also save menu item state to EEPROM storage. On AVR that will generally be internal EEPROM, on 32 bit boards generally an AT24 i2c EEPROM.

Developer setup

See the developer guide

tcmenu's People

Contributors

davetcc avatar dependabot[bot] avatar ptapping avatar vzahradnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tcmenu's Issues

Productionise the protocol ready for wider usage

For remote connections there are a few things that need to happen to make it production ready. These are listed below:

  • A basic level of authentication should be available that at least uses a key or pass-code before accepting connections. This is not for over internet situations, rather just for simple LAN security.
  • Each menu should have a UUID generated by the designer application, this should never change during the application lifetime.
  • When a menu item is updated remotely, the server should respond with a special update that also forms as an acknowledgment too.

Add capability for menu to be controlled remotely by RS232

We need to write a connector facility into the menu that allows them to be controlled remotely. Initial implementation will be RS232 with the Java API publicly available.

Initial protocol will be a text based protocol using simple tag value pairs that is very easy to decode. This will also allow other languages with less competent network and byte order handling to have easy APIs.

The remote layer and protocol shall be replaceable at runtime, such that other implementations can be later added.

The main dialogs and controllers should be tested using integration tests.

Given that the UI Generator has now become pretty much the defacto way to generate menus, at least a degree of testing needs to be added to it, to provide some degree of automated testing, saving a lot of time during release, and increasing confidence in release quality.

This first JIRA should set the stage by testing some core flows in the UI, along with the other associated JIRA that will ensure the generator itself is fully tested.

TcMenu generator not able to express lcd backlight

At the moment the combination of no backlight setting on LiquidCrystalIO and no option for it in the generator means it is not possible to set the backlight out of the box.

The workaround is to manually set the backlight on the IO device by keeping a reference to it, and setting the backlight pin as output with the appropriate setting.

Support the notion of read-only and local-only in the designer

The designer should be able to set the read-only and local-only status of any menu item and create code for that case.

This is in progress, so far done is the work in the UI to render the extra fields and the work in the API to hold these fields.

Left to do, change the generator to generate suitable code.

Support ESP8266 WIFI chip

Support the ESP 8266 wifi chip integrating with the example.

This should be able to configure and use the ESP8266 based wifi library.

In the example app, show how to indicate using an icon if there's a connected client, and indicate the signal strength.

Complete the plugin refactoring in designer

The designer UI plugin facilities should be completed so that they can be shipped in separate jar files completely separate to the main UI. It is still an open question if one or more than one should be used for the initial basic set.

These plugins will contain all the code generators for displays, remotes and input. These will be automatically added to the Code generator. The idea of an I’d will be replaced by uuid, making it easy to handle shared plugins.

One of the open source projects should be used as the exemplar for others building a plugin.

Add menuitem types for Floats, Remote status and Action types

Float menu item: read only item that is backed by a floating point 32 bit value. Useful for status etc. Number of decimal places should be settable.

Remote menu item: for rendering information about who's connected remotely onto the menu itself.

Action menu item: for cases where no state is needed, just fire an event when selected.

The embedded arduino code should have basic unit tests

Common theme here, the Arduino code should have some basic unit tests that provide a degree of confidence that the library is working properly. To start with maybe something that confirms proper functioning of the menu manager / items would be enough.

Minor improvements to editor and controller UI usability

There are a number of minor improvements needed in both UI's

  • Make the controller UI production ready by making editability better, and use a sustainable method of handling updates.
  • Add new sub-menus to the designer UI for recently edited projects, all sketch directories that contain menu (EMF) files and all examples packed in tcMenu.
  • Auto save after generation, source of lost changes!
  • Ensure structure is not dirty before any menu load operation

Completely decouple CPP language from the menu structure generator

The last area of hardwired code generation is in the menu structure initializers in the Java generation code. This needs to be replaced with a more generic system that will make it cleaner on 32-bit boards, especially ESP8266 where the compiler really doesn't like all the progmem declarations (which make no sense on 32-bit boards that are not Harvard arch. anyway.

For visual micro compatibility the menu definition files need to be changed

In order to compile in visual micro the .cpp and .h files containing the menu definition (which are currently the same name as the project) need to be renamed. They will be renamed in 1.2 to projectName-menu.h & cpp

This needs to be done in each of the examples too in order to avoid confusion. A note on the release must indicate that the old files be removed.

Embedded code wont compile without AdaFruitGFX and AT24Cx libraries

At the moment there is an oversight in the distribution and library structure. This means that AT24Cx and AdaFruitGFX libraries always must be on the path, but are not included with tcMenu / IoAbstraction. Workaround: copy these two libs into your libraries directory manually for now..

AT24:
Look into how to package AT24Cx as part of TcMenu and IoAbstraction such that no such installation problems are

AdaGFX:
Move the renderer into a separate module of it's own, or look at making the renderer so that it's copied into the users program directory with sensible defaults. This would make more sense as then custom rendering is much easier, and will probably be quite common.

Dependence on availableForWrite being available in core on Stream class.

Not really a bug, but something to look at in that there is a dependence on a very recent commit to the Print.h file - availableForWrite.

See how things pan out to see if its supported on at least AVR, SAMD and ESP8266.
Workaround: go to board manager in your IDE (Arduino IDE at the top of the board options) and update your boards.

Generated Menu item names should include submenu

When naming a menu variable it should include the submenu for example

If the submenu were named settings and the item named contrast:

menuSettingsContrast.

To be determined: should only the immediate submenu be included in this or every submenu back to root? Doing recursive back to root would end up with

menuSettingsAdvancedItemName.

One option would be a setting to control this that had three options:

  • Do not include submenu name
  • Include only nearest submenu name
  • recursively include all submenu names.

Issue with editing the name on large menu structures in UI

It appears that on large menu structures the name editing does not work as expected. The below appears to work on smaller menus, but the menu in question is quite large. Create a unit test that tests this case with over 200 items in three level nestings.

Copied from forum:

  1. I have an item named "1Light 1".
  2. I backspace the first "1" so it looks like "Light 1".
  3. I type "1" and only the entry field updates everything else still says "Light 1".
  4. I type "0" after the "1" and everything updates and says "10Light 1".
  5. I backspace the "0" and only the field updates to "1Light 1". Everything else looks like "10Light 1".
  6. I backspace the "1" and everything updates to "Light 1".
  7. I write "1" once more to try to get to my original "1Light 1" but it only shows up in the field everything else says "Light 1"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.