/* Soil Sensor Data Decoding Module * Copyright 2015 OSU CGRG, Jaiswal Lab, and Tyler Lab. All rights reserved. * Written by Nick Ames */ #include "soil-sensor.h" #include "sense-net.h" /* Type codes for soil sensors. */ const int TYPECODE_SOIL_1ZONE = 1; const int TYPECODE_SOIL_2ZONE = 2; const int TYPECODE_SOIL_4ZONE = 4; /* Print a block of memory to the given stream as a hexadecimal constant, prefixed with "0x". */ static void print_hex_stream(FILE *stream, char *data, int size){ if(0 == size)return; fprintf(stream, "0x"); for(int i=0;i 1){ fprintf(stream, " %3.1f,", m.moisture_z1); } else { fprintf(stream, ","); } if(m.zones > 2){ fprintf(stream, " %3.1f,", m.moisture_z2); } else { fprintf(stream, ","); } if(m.zones > 3){ fprintf(stream, " %3.1f\n", m.moisture_z3); } else { fprintf(stream, "\n"); } return 0; }