Skip to content

Conversation

@milesburton
Copy link
Owner

Merged with RobTillart

pzahradn and others added 8 commits July 2, 2013 11:05
This was referenced Jul 8, 2015
@RobTillaart
Copy link
Contributor

@milesburton
Had another look at the code and most things are style related. One might use a style formatter to get it consistent e.g. - http://astyle.sourceforge.net/astyle.html#_General_Information

I found one function with a bug in it. (already existed)

void DallasTemperature::blockTillConversionComplete(uint8_t bitResolution, const uint8_t* deviceAddress){
    int delms = millisToWaitForConversion(bitResolution);
    if (deviceAddress != NULL && checkForConversion && !parasite){
        unsigned long timend = millis() + delms;
        while(!isConversionAvailable(deviceAddress) && (millis() < timend));
    } else {
        delay(delms);
    }
}

should be

void DallasTemperature::blockTillConversionComplete(uint8_t bitResolution, const uint8_t* deviceAddress){
    int delms = millisToWaitForConversion(bitResolution);
    if (deviceAddress != NULL && checkForConversion && !parasite){
        unsigned long now = millis();
        while(!isConversionAvailable(deviceAddress) && (millis() - delms < now));
    } else {
        delay(delms);
    }
}

As times may only be subtracted otherwise the comparison fails when the uint32_t rolls over.

for the rest it looks good to me.

@milesburton
Copy link
Owner Author

Ah that would be useful. I'll take a look at that formatter. I'll make those modifications and merge later today.

Updated blockTillConversionComplete to fix bug
@milesburton
Copy link
Owner Author

Okay cool, I'm going to merge this change then create a new branch to sort out the style and rollover bug

@milesburton milesburton reopened this Jul 16, 2015
milesburton added a commit that referenced this pull request Jul 16, 2015
@milesburton milesburton merged commit 84be5e8 into master Jul 16, 2015
@milesburton milesburton deleted the RobTillaart-master branch July 16, 2015 15:15
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

Successfully merging this pull request may close these issues.

4 participants