Thanks Matias!

I've dropped the code into a gist if anyone is interested in using it.
It's c++ but of course wouldn't take much to turn in a C with structs. and
of course modify it in other ways to your own needs.

You simply call one of these methods..

void log(const char * source, const char * instance, const char * action,
char * detail);
void log(const char * source, const char * instance, const char * action,
char * detail, int value);

the second is simply a convenience to print a message with an integer.
source, instance and action should be constant / non moving. if they do
move the pointer compare (not string compare) will simply miss and it will
go to a new line.  if it runs out of lines it simply replaces the last
time. total lines is defined by a constant as this affects the amount of
memory it's going to consume.

https://gist.github.com/slipperyseal/2903dea1c34b21476dab4e2aab963467

CC


On Tue, 18 Aug 2020 at 09:50, Matias N. <mat...@imap.cc> wrote:

> I really liked your telemetry app with colored output you shown on the
> video.
>
> On Mon, Aug 17, 2020, at 20:47, Christian Catchpole wrote:
> > something to consider with querying the terminal for capabilities /
> > terminal size etc, is where there is no terminal actually connected at
> the
> > time.  this would cause it to hang or require timeouts or other
> > complications. but i guess querying might only occur after user input.
> > Again, as long as its all optional, people can apply what they like.
> >
> > this is something i really love about NuttX. nice and lean baseline but
> so
> > much discoverable behind kconfig options.
> >
> > again, i'll put together a basic proposal for ANSI support in NSH and see
> > what people think of the implementation.
> >
> >
> > On Tue, 18 Aug 2020 at 05:06, Gregory Nutt <spudan...@gmail.com> wrote:
> >
> > > A basic terminfo/termcaps  could be very trivial
> > >
> > > > A more general solution would be handy but what is there really in
> the
> > > > embedded world that doesn't support vt100? There more code there is,
> the
> > > > more interesting ways it can go wrong :-)
> > >
> > > I have sometimes used cat /dev/ttyS0 on the host as a terminal.
> > >
> > > I seen some simple Linux terminals that do not support VT-100.
> > >
> > > The NuttX cu terminal does not support VT-100 commands.
> > >
> > > There are several.
> > >
> > >
> > >
> >
>

Reply via email to