# NEW LOG # format=1.0.0nano $BNRDD,204,2012-09-20T16:53:58Z,776,63,33895,A,5641.7788,N,1411.8820,E,9861.20,A,109,9*46 $BNRDD,[4digit_device_id],[ISO8601_time],[cpm],[cpb],[total_count],[geiger_status],[lat],[NS],[long],[WE],[altitude],[gps_status],[nbsat],[precision] // prepare the log entry memset(buf, 0, LINE_SZ); sprintf_P(buf, PSTR("$%s,%04d,%02d-%02d-%02dT%02d:%02d:%02dZ,%ld,%ld,%ld,%c,%s,%c,%s,%c,%s,%c,%d,%ld"), \ NANO_HEADER, \ config.device_id, \ year, month, day, \ hour, minute, second, \ cpm, \ cpb, \ total_count, \ geiger_status, \ lat, NS,\ lon, WE,\ strbuffer, \ gps_status, \ nbsat == TinyGPS::GPS_INVALID_SATELLITES ? 0 : nbsat, \ precission == TinyGPS::GPS_INVALID_HDOP ? 0 : precission); len = strlen(buf); buf[len] = '\0'; // generate checksum chk = checksum(buf+1, len); // add checksum to end of line before sending if (chk < 16) sprintf_P(buf + len, PSTR("*0%X"), (int)chk); else sprintf_P(buf + len, PSTR("*%X"), (int)chk); /* compute check sum of N bytes in array s */ char checksum(char *s, int N) { int i = 0; char chk = s[0]; for (i=1 ; i < N ; i++) chk ^= s[i]; // opérateur bit à  bit XOR return chk; }