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

Fix settings #133

Merged
merged 13 commits into from
Jan 9, 2023
Merged

Fix settings #133

merged 13 commits into from
Jan 9, 2023

Conversation

tomkooij
Copy link
Contributor

@tomkooij tomkooij commented Dec 31, 2022

This tries to fix the settings pages for non-CVE devices
(Hopefully CVE devices as well, but I cannot test on CVE devices)

TODO:

Fixes #129
Fixes #126
Fixes #119

This "special case" seems erroneous. It breaks autotemp settings page.
Datatype 0x0f is a float from a single raw byte divided by 2.
"is_float2"
float8: length "1" (single raw byte) with divider
float16: length 2, with divider.
float32: length 4, with divider.
@tomkooij
Copy link
Contributor Author

tomkooij commented Dec 31, 2022

This removes float2, float10 etc from settings and implements float8, float16, float32 according to raw byte length with a separate divisor. This is now more equal to status page handling of floats.

This could really use a refactor with a common function to convert raw bytes to int/uint/float.

Note that this treats all "floats" as signed raw bytes. I'll add a signed/unsigned to the TODO.

@arjenhiemstra
Copy link
Owner

Looks good and works fine on CVE devices

@tomkooij tomkooij mentioned this pull request Jan 5, 2023
@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 5, 2023

Unfortunately 2ac4bfa does not work correctly. Not all floats are casted to signed ints properly.
(Resulting in very large values instead of negative values).
This may not be a new bug, but it needs fixing anyway.

@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 5, 2023

It seems casting "signed" raw bytes (negative values, 0x0000FC18 => -1000) to floats now works.

I'll do a more thorough check tomorrow.

Signed ints i.e. (0xfffffc18) = -1000
Must be cast from singed ints to float/double:
static_cast<double>((int32_t) value);
Add 133 Reserved
Add 177 Reserved
79 Blocking time heating to cooling
80 Blocking time cooling to heating
81 Min outdoor temp to change to cooling
82 Command test heating cooling
@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 6, 2023

This seems to work, finally.

I added autotemp settings for fw12. but I have fw10... So that is untested. The settings are very desireable however, so I asked on Tweakers forum if someone has a fw12 autotemp.

@arjenhiemstra
Copy link
Owner

Great work, thanks!
Did you add the settings changes by hand?

@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 6, 2023

Great work, thanks! Did you add the settings changes by hand?

Yes... painful work. Please don't tell me there is some kind of automation for this.

The WPU 5G v37 has 237 setting values. Hence, the index must be
uint8_t not int8_t
@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 6, 2023

Argh... Setting 179 on WPU is datatype 0x80 (signed 1byte integer).
It is not converted to signed value properly in the settings page (it does work on the debug page).

Some more work to do...

4 raw itho bytes are casted into an int64 to preserve sign and
prevent overflows.
@tomkooij
Copy link
Contributor Author

tomkooij commented Jan 6, 2023

I seem to have catched and fixed the remaining overflow errors.

I merged this into the latest 2.4.4-beta4 and I'll try to use this "live" on my WPU and autotemp for a while and see if I can break it again. I cannot test changing all setting values, so that is still a bit untested. I did however test changing values that were previously broken.

int64_t cast_raw_bytes_to_int
@WouterJN
Copy link

WouterJN commented Jan 6, 2023

Hi @tomkooij can you share a bin file that I can test? On version 2.4.4-beta4 at my WPU with WPUsetting9 some of my settings still look incorrect;

Screenshot 2023-01-06 at 18 12 07

@arjenhiemstra
Copy link
Owner

I seem to have catched and fixed the remaining overflow errors.

I merged this into the latest 2.4.4-beta4 and I'll try to use this "live" on my WPU and autotemp for a while and see if I can break it again. I cannot test changing all setting values, so that is still a bit untested. I did however test changing values that were previously broken.

Thanks a lot! I’ll pull in this PR and test it somewhere after this weekend.

@arjenhiemstra
Copy link
Owner

Hi @tomkooij can you share a bin file that I can test? On version 2.4.4-beta4 at my WPU with WPUsetting9 some of my settings still look incorrect;

Screenshot 2023-01-06 at 18 12 07

Beta4 does not include this PR, will be in beta5 somewhere next week

@arjenhiemstra arjenhiemstra merged commit 6cb218c into arjenhiemstra:master Jan 9, 2023
@arjenhiemstra
Copy link
Owner

arjenhiemstra commented Jan 9, 2023

This seems to work on my CVE and DemandFlow devices correctly, thanks for all the work!

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