npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nextion

v0.6.2

Published

Communicate with ITEAD's Nextion HMI Devices

Downloads

15

Readme

nextion

Communicate with ITEAD's Nextion HMI Devices

pic of nextion device

Status

  • [x] Support return data
  • [ ] Support operation commands
  • [ ] Reasonable, high-level API; don't require user to send raw commands
    • [ ] System-level abstraction
    • [ ] Component-level abstraction
  • [x] Tessel 2 support
  • [ ] Remove serialport dependency

Basic Usage

COM Port, USB-to-UART adapter, etc.

const Nextion = require('nextion');

// CH340G usually shows up at this path on macOS
Nextion.fromPort('/dev/tty.SLAB_USBtoUART')
  .then(nextion => {
    console.log('Listening...');

    nextion.on('touchEvent', data => {
      console.log(data);
    });
  });

For port auto-detection, try:

const Nextion = require('nextion');

Nextion.create()
  .then(nextion => {
    // do exciting stuff here
  });

Tessel 2

const tessel = require('tessel');
const Nextion = require('nextion/minimal');

const uart = new tessel.port.A.UART({
  baudrate: 9600
});

Nextion.fromSerial(uart)
  .then(nextion => {
    // Yipper McCheese!
  });

The nextion/minimal module is for resource-constrained systems; it's compressed and does not include source maps.

Compatibility

As long as the argument passed into Nextion.fromSerial is a Duplex stream or a duck-typed one (a la serialport), you should be able to use it. Hack away!

API docs

Events

The Nextion instance (nextion) in above examples is an EventEmitter. If the device sends any of these over the UART channel, the Nextion instance will emit a corresponding event (w/ data, if any).

  • Events (Table 2)
    • 0x65 - touchEvent: Touch event return data
    • 0x66 - pageId: Current page ID
    • 0x67 - touchCoordinate: Touch coordinate data
    • 0x68 - touchCoordinateOnWake: Touch coordinate data (on wake)
    • 0x70 - stringData: String variable data
    • 0x71 - numericData: Numeric variable data
    • 0x86 - autoSleep: Device automatically enters sleep mode
    • 0x87 - autoWake: Device automatically wakes from sleep mode
    • 0x88 - startup: Successful system startup
    • 0x89 - cardUpgrade: Start SD card upgrade
    • 0xfd - transmitFinished: Data transmit finished
    • 0xfe - transmitReady: Ready to receive data transmission

TODO: Describe shape of data for data-emitting events.

Motivation

  • Send & receive events over UART to a Nextion device (hardware reference)
  • Support Tessel 2
  • Support USB-to-UART serial adapters for debugging
  • Endgame: combine a Tessel 2 w/ a Nextion to design/implement a (mainly) JS-based home environmental control panel/dashboard.

Future:

  • Ensure support on popular ARMv6/7/8
  • Ensure support on popular (non-Tessel) MIPS devices
  • Interface into GUI designer commands

Development

  • Use environment variable DEBUG=nextion* for debug output.
  • To run end-to-end tests against a connected device, read test/e2e/README.md, then execute yarn test:e2e.
  • For serial port debugging, use DEBUG=nextion*,serialport.

Notes

ARM

If the serialport module supports the architecture, this module should work out-of-the-box, meaning RPi's and BBB's are theoretically covered.

MIPS

This shouldn't be too bad, because the Tessel 2 is MIPS-based, but we require Node.js v4. Other MIPS-based boards I've used have had trouble getting it compiled, packaged, or running at a respectable speed.

License

:copyright: 2017 Christopher Hiller. Licensed MIT.