Teacup_Firmware icon indicating copy to clipboard operation
Teacup_Firmware copied to clipboard

temp.c

Open tonnico opened this issue 9 years ago • 2 comments

While thinking how to upgrade the temp to 12-14bit I see this code: https://github.com/Traumflug/Teacup_Firmware/blob/experimental/temp.c#L246-L251

  if ((temp & 0x8002) == 0) {
    // Got "device id".
    if ((temp & 4) == 0) {
      temp = temp >> 3;
    }
  }

With this datasheet: https://cdn-shop.adafruit.com/datasheets/MAX6675.pdf

First if: Bit15 is allway zero. A dummy sign. Why testing this? Bit1 is low "to provide a device ID"? Is it generally important to test this?

Second if: We are testing Bit2. This will go high when the thermocouple opens. But should we also send a TEMP_NOT_READY in that case?

tonnico avatar Oct 19 '16 20:10 tonnico

Do you have such a sensor for testing? I don't. While I messed with some parts of this code while writing the SPI class, all the results are best guess.

If you see room for improvement, don't hesitate to change the code.

Traumflug avatar Oct 19 '16 20:10 Traumflug

Unfortunately not. However, pushed some new code. https://github.com/Traumflug/Teacup_Firmware/commit/ec969408b48f1

tonnico avatar Oct 19 '16 20:10 tonnico