hi all!
can anyone tell me what function of algorithm library used in this library and can i remove that function from this library or not?
This lib is for ESP8266 or ESP32
Unlikely to work good on nano
This lib is for ESP8266 or ESP32
Unlikely to work good on nano
yes i know
i changed it to work on nano because i want to use its big A/C remote database
min() & max() are the primary functions that this library uses from <algorithm>.
You could probably remove the #include <algorithm> line safely. It's mainly there to keep the linter happy.
min()&max()are the primary functions that this library uses from<algorithm>.
You could probably remove the#include <algorithm>line safely. It's mainly there to keep the linter happy.
thanks for your response
i comment all of #include <algorithm> in all library file then when i compile library there is lot of error like "expected unqualified-id before '(' token" on the code " #define max(a,b) ((a)>(b)?(a):(b))"
how can i correct this errors??
You could create a proper max() function rather than rely on the #define version that Arduino uses by default.
e.g.
// Note: Untested code, but probably works for most cases.
// Probably needs to be put into IRremoteESP8266.h to catch everything.
uint64_t max(const uint64_t a, const uint64_t b) {
if (a > b) return a;
return b;
}
But what you are attempting is really in "unsupported" territory trying to back port this to a Nano etc etc. I'll try to help where I can but it's beyond the scope of this library.
e.g. See the last line of the README.md file that displays when you go to https://github.com/crankyoldgit/IRremoteESP8266
i.e. _"As of v2.0, the library was almost entirely re-written with the ESP8266's resources in mind."_
Alternatively ...
Following https://github.com/esp8266/Arduino/blob/master/cores/esp8266/Arduino.h#L255-L256
Try:
#undef max
#undef min
#define min(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a < _b? _a : _b; })
#define max(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a > _b? _a : _b; })
etc ...
Or ask the Arduino folk why "#include \
Or: (from http://www.cplusplus.com/reference/algorithm/max/)
template <class T> const T& max (const T& a, const T& b) {
return (a<b)?b:a;
}
@mahdinikan75 How did you go with those options?
It's the weekend. Time for another friendly ping.
@mahdinikan75 How did you go with those options?
unfortunately it's not good for me and i can't give good response from that solution.
thanks a lot for your consistency
I'm not sure what you mean by that. I've offered all the porting advice I can easily think of at this stage.
Not sure what I can do to help you further.
As I've not heard anything back from you in two+ weeks, I'm marking this issue closed/stale until you respond.
Most helpful comment
This lib is for ESP8266 or ESP32
Unlikely to work good on nano