看过yeelink有关程序,多个传感器采集数据时,最后一行是
// This method calculates the number of digits in the
// sensor reading. Since each digit of the ASCII decimal
// representation is a byte, the number of digits equals
// the number of bytes:
int getLength(int someValue) {
// there's at least one byte:
int digits = 1;
// continually divide the value by ten,
// adding one to the digit count for each
// time you divide, until you're at 0:
int dividend = someValue /10;
while (dividend > 0) {
dividend = dividend /10;
digits++;
}
// return the number of digits:
return digits;
}
对于这个注释,理解不是很明白,digits = 1跟传感器数量有关系吗?如果是四个传感器,是不是digits为4呢,我要实现四个传感器采集的数据上传至yeelink用户中心,请大家解答一下,我想听听你们的看法