[OpenTRV-dev] stats outs
Bo Herrmannsen
bo.herrmannsen at gmail.com
Sat May 30 08:41:56 BST 2015
what i'm after, just for the sake of the experiment is getting a stats
string out that is the same every time and not like the json can come in 2
or more bits...
it could prob be done with the json but that is over my head
also when you do the http call to emoncms you have to have all values at
once
2015-05-30 9:38 GMT+02:00 Damon Hart-Davis <dhd at exnet.com>:
>
> > On 30 May 2015, at 07:31, Bo Herrmannsen <bo.herrmannsen at gmail.com>
> wrote:
> >
> > btw in what file are the non json output nade up? have an idea i want to
> try
>
> They are converted to ASCII in Control.cpp for now, but those messages are
> populated from a structure, and have a particular on-wire format.
>
> Rgds
>
> Damon
>
>
>
> // Look for binary-format message.
> FullStatsMessageCore_t stats;
> getLastCoreStats(&stats);
> if(stats.containsID)
> {
> // Dump (remote) stats field '@<hexnodeID>;TnnCh[P;]'
> // where the T field shows temperature in C with a hex digit after
> the binary point indicated by C
> // and the optional P field indicates low power.
> serialPrintAndFlush(LINE_START_CHAR_RSTATS);
> serialPrintAndFlush((((uint16_t)stats.id0) << 8) | stats.id1, HEX);
> if(stats.containsTempAndPower)
> {
> serialPrintAndFlush(F(";T"));
> serialPrintAndFlush(stats.tempAndPower.tempC16 >> 4, DEC);
> serialPrintAndFlush('C');
> serialPrintAndFlush(stats.tempAndPower.tempC16 & 0xf, HEX);
> if(stats.tempAndPower.powerLow) { serialPrintAndFlush(F(";P")); }
> // Insert power-low field if needed.
> }
> if(stats.containsAmbL)
> {
> serialPrintAndFlush(F(";L"));
> serialPrintAndFlush(stats.ambL);
> }
> if(0 != stats.occ)
> {
> serialPrintAndFlush(F(";O"));
> serialPrintAndFlush(stats.occ);
> }
> serialPrintlnAndFlush();
> }
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opentrv.org.uk/pipermail/opentrv-dev/attachments/20150530/7eff9ac9/attachment.html>
More information about the OpenTRV-dev
mailing list