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

Class extension/inheritance #19

Open
jordanj-pl opened this issue Sep 13, 2019 · 0 comments
Open

Class extension/inheritance #19

jordanj-pl opened this issue Sep 13, 2019 · 0 comments

Comments

@jordanj-pl
Copy link

Hello everyone, I was trying to extend OpenTherm class by adding additional requests. Unfortunately when I run the extended class communication with boiler does not work. Exemplary code is attached here below. Do I do something wrong?

Du summarise. When I run
OpenTherm *ot = new OpenTherm(1,2); ot->begin(handler);
it works. When I use the extension i.e.
OpenThermExtension *ot = new OpenThermExtension(1,2); ot->begin(handler);
it does not. Obviously it compiles without any warning.

`
class OpenThermExtension : public OpenTherm {
public:
OpenThermExtension(int in, int out);
float getOutsideTemperature();
};

OpenThermExtension::OpenThermExtension(int in, int out) {
OpenTherm(in, out, false);
}

float OpenThermExtension::getOutsideTemperature() {
unsigned long request = buildRequest(OpenThermMessageType::READ_DATA, OpenThermMessageID::Toutside, 0);
unsigned long response = sendRequest(request);
Serial.println("Response: " + String(response));
float temp = getTemperature(request);
return temp;

}
`

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