/* Places the sensor event in a text buffer for data logging purposes, with the following comma-separated format: SENSOR ID, SENSOR TYPE, TIMESTAMP (ms), D0, D1, D2, D3.  */
size_t sensorsLogSensorsEvent(char *buffer, const size_t len, const sensors_event_t *event)
/* Places the sensor event in a text buffer for data logging purposes, with the following comma-separated format: SENSOR ID, SENSOR TYPE, TIMESTAMP (ms), D0, D1, D2, D3.  */
size_t sensorsLogSensorsEvent(char *buffer, const size_t len, const sensors_event_t *event)
{
  size_t written;
  memset(buffer, 0x00, len);
  written = snprintf(buffer, len, "%d,%d,%d,%f,%f,%f,%f%s",
    (int)event->sensor_id,
    (int)event->type,
    (int)event->timestamp,
    event->data[0],
    event->data[1],
    event->data[2],
    event->data[3],
    CFG_PRINTF_NEWLINE);
  return written;
}