Fix support for PowerSensor3 and rename Arduino to PowerSensor
Several fixes/changes related to PowerSensor3:
-
The top-level cmake file was fixed to include the proper directory for PowerSensor3. The bug was not detected earlier because the CI did not build the PowerSensor3 code. I've updated the CI as well to build both versions.
-
As discussed with @veenboer in person, the Arduino namespace/class in PMT was renamed to PowerSensor. Wherever it pointed to a PowerSensor2-specific implementation, the new name is PowerSensor2. This does result in a clash with the PowerSensor2 submodule, which also defines a PowerSensor class (i.e. without the 2 at the end). For now I've renamed the class in PMT to PowerSensor_. Two possible solutions to this:
- Come up with a different name for the class in PMT
- Split the powersensor2 and 3 codes entirely into two subfolders. Then we could have e.g.
PowerSensorV2
andPowerSensorV3
classes.
Option 2 has some pros and cons: there would be some code duplication as the interface to PowerSensor2 and 3 is basically identical, but it would make it easier to update if the interface of PowerSensor3 changes in the future.
There is one remaining issue: The PowerSensor code only builds when both BUILD_POWERSENSOR2_PMT
and BUILD_POWERSENSOR3_PMT
are set, because sources from both are included in PowerSensor.cpp
. If we decide to split the code into two directories, this issue will resolve itself. Otherwise we could opt for a single BUILD_POWERSENSOR
flag to build both V2 and V3 in PMT.