Files
yocto_rpi/sandbox_c/src/format.c
T
druppy ba41deb9ec
Build RPi image / build (push) Successful in 10s
Sandbox - ephemeral runner + shared cache / cargo (push) Successful in 1m27s
Sandbox - cmake + ccache on the pool / build (push) Successful in 10s
Add sandbox_c cmake project + ccache workflow for pool testing
2026-10-24 22:54:55 +02:00

8 lines
297 B
C

#include "temperature.h"
#include <stdio.h>
int format_reading(const Reading *in, char *buf, size_t len) {
if (!in || !buf || len < 16) return 1;
int n = snprintf(buf, len, "{\"sensor\":\"%s\",\"celsius\":%.2f}", in->sensor, in->celsius);
return (n < 0 || (size_t)n >= len) ? 2 : 0;
}