Please be gentle... I don't do much C++ and am trying to tidy up some code.
I'm trying to compile the code below in Arduino Studio, and it keeps throwing an error:
no matching function for call to 'devPort::devPort()'
on the following line:
Sensor(String type, float adjustment, devPort port) {
I've tried moving the devPort part to a new .cpp file and #include'ing it, but I get the same error.
I also tried:
Sensor(String type, float adjustment, devPort::devPort port)
But still the same error.
class devPort { // There will be 10 'Port's, all pre-defined as unavailable until the boardtype is known
public:
devPort(String name, int pin1, int pin2, int mode) {
this->name = name;
this->pin1 = pin1;
this->pin2 = pin2;
this->mode = mode;
}
String name;
int pin1;
int pin2;
int mode; // -1 = Disabled, 0 = SDA/SCL, 1=DAC, 2=ADC, 3=GPIO
};
// The 'Sensor's will be stored in the flash memory
class Sensor {
public:
Sensor(String type, float adjustment, devPort port) { // <--- This is where it complains
this->type = type;
this->adjustment = adjustment;
this->port = port;
}
String type; // Derived from *sensorTypes
float adjustment; // +/- adjustment value
devPort port; // Custom Port
};
I would expect that it should just allow this (and I've tried moving them above/below each other in case of linear compilation).