 #include "Cosa/VWI/Codec/ManchesterCodec.hh"
 #include "Cosa/VWI/Codec/BitstuffingCodec.hh"
 #include "Cosa/VWI/Codec/Block4B5BCodec.hh"
-#include "Cosa/Trace.hh"
 #include "Cosa/RTC.hh"
 #include "Cosa/Watchdog.hh"
 

void loop()
{
  // Send message with luminance and temperature
  sample_t sample;
  sample.luminance = luminance.sample();
  sample.temperature = temperature.sample();
  int8_t nr = trx.send(&sample, sizeof(sample), SAMPLE_CMD);
  update(nr);
  
  // Send message with battery voltage and statistics every 10 messages
  if (sent % 10 == 0) {
    stat_t stat;
    stat.voltage = AnalogPin::bandgap(1100);
    stat.sent = sent;
    stat.resent = resent;
    stat.received = received;
    stat.failed = failed;
    nr = trx.send(&stat, sizeof(stat), STAT_CMD);
    update(nr);
  }

  // Take a nap
  MSLEEP(200);
}

struct sample_t {
  uint16_t luminance;
  uint16_t temperature;
  
  sample_t(uint16_t lum, uint16_t temp)
  {
    luminance = lum;
    temperature = temp;
  }
};

const uint8_t STAT_CMD = 2;
