Seeed-Studio / Mutichannel_Gas_Sensor

This Arduino library is used for driving "Xadow - Mutichannel Gas Sensor" and "Grove - Mutichanel Gas Sensor"
Other
25 stars 25 forks source link

fix calbration convergence condition #17

Closed hkwi closed 1 month ago

hkwi commented 6 years ago

The code looks intending seeking for a stable condition that all readings are within 2 difference. The readings are unsigned int, so the calculated difference will not be nagative, instead it will be very large unsigned int.

int main(int argc, char* argv){
  unsigned int a,b;
  a = 1;
  b = 2;
  printf("%u %u", a-b, b-a);
  // 4294967295 1
}