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

Bug found in parameter P6 - Temperature of 110°C is less than 27°C #26

Open
rtek1000 opened this issue Mar 23, 2023 · 1 comment
Open

Comments

@rtek1000
Copy link

rtek1000 commented Mar 23, 2023

Original code: https://github.com/mister-grumbler/w1209-firmware/blob/master/ts.c

        if (getMenuDisplay() == MENU_ROOT) {
            int temp = getTemperature();
            itofpa (temp, (char*) stringBuffer, 0);
            setDisplayStr ( (char*) stringBuffer);

            if (getParamById (PARAM_OVERHEAT_INDICATION) ) {
                if (temp < getParamById (PARAM_MIN_TEMPERATURE) ) {
                    setDisplayStr ("LLL");
                } else if (temp > getParamById (PARAM_MAX_TEMPERATURE) ) { // <------------- Temperature of 110°C is less than 27°C
                    setDisplayStr ("HHH");
                }
            }

I noticed that the value returned in getParamById(PARAM_MAX_TEMPERATURE) is "110", but the temperature is a value multiplied by 10, to shift the decimal digit. So I believe I would have to multiply the getParamById() value by 10 to compare.

        if (getMenuDisplay() == MENU_ROOT) {
            int temp = getTemperature();
            temp = getParamById (PARAM_MAX_TEMPERATURE); // <------ For test only
            
            itofpa (temp, (char*) stringBuffer, 0);
            setDisplayStr ( (char*) stringBuffer);

            if (getParamById (PARAM_OVERHEAT_INDICATION) ) {
                if (temp < getParamById (PARAM_MIN_TEMPERATURE) ) {
                    setDisplayStr ("LLL");
                } else if (temp > getParamById (PARAM_MAX_TEMPERATURE) ) {
                    setDisplayStr ("HHH");
                }
            }

With this test, the value of 110ºC of parameter P2 appeared on the display with the value 11.0 (which is smaller than the value of 27.0ºC).

@rtek1000
Copy link
Author

I made modifications, added functions and improvements such as button debounce, code available at:

https://github.com/rtek1000/W1209-firmware-modified

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

1 participant