Skip to content

Commit 07432aa

Browse files
committed
byte to uint8_t for ESP8266 3.0 compatibility
1 parent 9dba549 commit 07432aa

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Diff for: src/SparkFunMLX90614.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ int16_t IRTherm::calcRawTemp(float calcTemp)
329329
tempFloat = calcTemp;
330330
}
331331
// Then multiply by 0.02 degK / bit
332-
tempFloat *= 50;
332+
tempFloat *= 50.0;
333333
rawTemp = (int16_t) tempFloat;
334334
}
335335
return rawTemp;
@@ -351,15 +351,15 @@ float IRTherm::calcTemperature(int16_t rawTemp)
351351
retTemp -= 273.15;
352352
if (_defaultUnit == TEMP_F)
353353
{
354-
retTemp = retTemp * 9.0 / 5.0 + 32;
354+
retTemp = retTemp * 9.0 / 5.0 + 32.0;
355355
}
356356
}
357357
}
358358

359359
return retTemp;
360360
}
361361

362-
bool IRTherm::I2CReadWord(byte reg, int16_t * dest)
362+
bool IRTherm::I2CReadWord(uint8_t reg, int16_t * dest)
363363
{
364364
_i2cPort->beginTransmission(_deviceAddress);
365365
_i2cPort->write(reg);
@@ -388,23 +388,23 @@ bool IRTherm::I2CReadWord(byte reg, int16_t * dest)
388388
}
389389
}
390390

391-
bool IRTherm::writeEEPROM(byte reg, int16_t data)
391+
bool IRTherm::writeEEPROM(uint8_t reg, int16_t data)
392392
{
393393
// Clear out EEPROM first:
394394
if (I2CWriteWord(reg, 0) != 0)
395395
return 0; // If the write failed, return 0
396-
delay(5); // Delay tErase
396+
delay(10); // Delay tErase at least 5 ms
397397

398398
uint8_t i2cRet = I2CWriteWord(reg, data);
399-
delay(5); // Delay tWrite
399+
delay(10); // Delay tWrite at least 5 ms
400400

401401
if (i2cRet == 0)
402402
return true;
403403
else
404404
return false;
405405
}
406406

407-
uint8_t IRTherm::I2CWriteWord(byte reg, int16_t data)
407+
uint8_t IRTherm::I2CWriteWord(uint8_t reg, int16_t data)
408408
{
409409
uint8_t crc;
410410
uint8_t lsb = data & 0x00FF;

Diff for: src/SparkFunMLX90614.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ class IRTherm
188188

189189
// Abstract function to write 16-bits to an address in the MLX90614's
190190
// EEPROM
191-
bool writeEEPROM(byte reg, int16_t data);
191+
bool writeEEPROM(uint8_t reg, int16_t data);
192192

193193
// Abstract functions to read and write 16-bit values from a RAM
194194
// or EEPROM address in the MLX90614
195-
bool I2CReadWord(byte reg, int16_t * dest);
196-
uint8_t I2CWriteWord(byte reg, int16_t data);
195+
bool I2CReadWord(uint8_t reg, int16_t * dest);
196+
uint8_t I2CWriteWord(uint8_t reg, int16_t data);
197197

198198
// crc8 returns a calculated crc value given an initial value and
199199
// input data.

0 commit comments

Comments
 (0)