Closed maxgerhardt closed 1 year ago
Thanks for spotting this problem and taking the time to create the PR. Much appreciated.
I'm happy with solution for second problem. But not keen on breaking backwards compatibility to get ArduinoTimer.cpp
to compile when only mbed is affected. Do you know if #include <Arduino.h>
is bringing the mbed implementation of ArduinoTimer
into the global scope?
I'd consider these alternatives first, if you haven't already:
::ArduinoTimer::ArduinoTimer()
. I don't strike this problem often enough to know if that works without trying it, which i don't have time to do right now. ArduinoTimer
into a MegunoLink namespace for mbed only. ArduinoTimer
into a MegunoLink namespace when building ArduinoTimer.cpp
then pop it into the global namespace with a using namespace MegunoLink
inside our ArduinoTimer.h
is included by anything else. That preserves compatibility. Might be a problem if the mbed
and MegunoLink
versions of ArduinoTimer.h
are used in the same place, but that seems a extreme edge case to me. What do you think?
Could work. Would need to check it out and regression test compilation (best to do with CI :) )
I've done some exploration in the develop
branch. It looks like ::
can disambiguate our ArduinoTimer
in the global scope from the mbed version in the arduino
namespace. Or at least it builds for me with a Pico Pi target.
I need to do a bit more testing though. It looks like this may be working because the arduino
namespace remains attached to the mbed ArduinoTimer
despite the using namespace arduino;
in their Arduino.h
file. I didn't realize that happened, and/or if it is relying on a particular version of C++. If it checks out, this could be a nice solution that maintains backwards compatibility.
I see CI has been implemented and fixes like https://github.com/Megunolink/MLP/commit/7027e802361c5a169ce3809d2b6bb8677264e84e on top of more were added to fix compilability -- thus closing.
Fix #12 by
ArduinoTimer
class and files toMegunoArduinoTimer
#include <Arduino.h>
instead of#include "Print.h"
inFormatting.h