/ESP-RIX

Remote logging and debugging library for ESP based Arduino projects

Primary LanguageC++

Remote Information eXchange

ARDUINO-AVR ESP8266 ESP 32

Remote Information eXchange adds remote logging and debugging capabilities to your ESP based Arduino projects. This can be useful if your project is in an inaccessible location, and serial isn't available.

Installation

Arduino IDE

Clone this repo to your Arduino libraries directory. On Linux this is ~/Arduino/libraries/

VSCode PlatformIO

Add the repo link to platformio ini-file:

[env]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 74800
lib_deps = https://github.com/<user>/<repo>.git

More on PlatformIO documentation.

Usage

Include the RIX library

#include <esp-rix.h>

Listen for RIX calls at the end of your loop() function

void loop() {
	// Other loop code here

	// Rix supports 7 levels of debug messages
	rix_info("This is a INFORMATION message");
	rix_error("This is a ERROR message");

	// Rix also supports printf style messages
	rix_trace("MCU Uptime: %d minutes", millis() / 1000 / 60);

	rix_handle();
}

On a machine that shares the same WiFi as your ESP you can telnet to your ESP's IP address to view the messages.

Library options

On/Off color

Enable/disable color in output

rix_color(false); // Disable color, default: true

Max log level

Set the initial output logging level

rix_log_level(RixLevels::Information); // Default: RixLevels::Trace (5)

Set TCP port

Change the TCP port that RIX listens on

rix_tcp_port(2300); // Default: 23

Special delay function

Using delay() in your scripts may cause RIX to be less responsive. A rix_delay() method has been added as a drop-in replacement to keep your project responsive.

rix_delay(500); // Wait 500 ms

Special Wi-Fi connection function

RIX has a function to make connecting to your WiFi simple:

int ok = rix_init_wifi("MySSID", "SekritPassword");

Disabling RIX

When you're done debugging you can disable RIX entirely by adding:

# define RIX_DISABLE

before the include line. This will make all the rix_* calls no-ops, and disable logging. This means you can leave all your setup and logging calls in your code and simply disable the library at compile time.

Enable alternative log format

To enable an alternate log format (like "HHH:MM:SS:FFF LEVEL Message"), add:

# define RIX_FORMAT_EX

before the include line.

Backwards compatibility

On non-ESP boards RIX is automatically disabled. This allows you to test and debug on an ESP board, and then compile on an Arduino Nano with no changes to your code.

Inspired by

RIX was inspired by Joao Lopes' RemoteDebug which appears to be abandonned.