Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScratchPad never saved in EEPROM #45

Closed
uNGam3R opened this issue Oct 5, 2015 · 1 comment
Closed

ScratchPad never saved in EEPROM #45

uNGam3R opened this issue Oct 5, 2015 · 1 comment

Comments

@uNGam3R
Copy link

uNGam3R commented Oct 5, 2015

Hello,

I figured out that currently, the configuration is never stored in EEPROM.
There is a little burden in the library, in cpp file, in this function:

void DallasTemperature::writeScratchPad(uint8_t* deviceAddress, const uint8_t* scratchPad)
{
_wire->reset();
_wire->select(deviceAddress);
_wire->write(WRITESCRATCH);
_wire->write(scratchPad[HIGH_ALARM_TEMP]); // high alarm temp
_wire->write(scratchPad[LOW_ALARM_TEMP]); // low alarm temp
// DS18S20 does not use the configuration register
if (deviceAddress[0] != DS18S20MODEL) _wire->write(scratchPad[CONFIGURATION]); // configuration
_wire->reset();
----- HERE SOMETHING MISSES ----
// save the newly written values to eeprom
_wire->write(COPYSCRATCH, parasite);
if (parasite) delay(10); // 10ms delay
_wire->reset();
}

After the second reset (before comment " // save the newly written values to eeprom") you should add that:
_wire->select(deviceAddress);

Otherwise, the copy command is never received.

Hope It helps.
Damien.

milesburton added a commit that referenced this issue May 24, 2016
@milesburton
Copy link
Owner

Thanks Damien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants