Skip to content

Commit 46b43a9

Browse files
authored
Merge pull request #73 from N-Storm/master
Fix duplicate PROGMEM attribute compilation issue with ESP8266 Arduino Core 2.5.0+
2 parents 62390a8 + 444dabd commit 46b43a9

30 files changed

+222
-111
lines changed

AIRWAYHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
AIRWAYHeatpumpIR::AIRWAYHeatpumpIR()
55
{
6-
static const char PROGMEM model[] PROGMEM = "AIRWAY";
7-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"AIRWAY\",\"dn\":\"AIRWAY\",\"mT\":18,\"xT\":31,\"fs\":3}";
6+
static const char model[] PROGMEM = "AIRWAY";
7+
static const char info[] PROGMEM = "{\"mdl\":\"AIRWAY\",\"dn\":\"AIRWAY\",\"mT\":18,\"xT\":31,\"fs\":3}";
88

99
_model = model;
1010
_info = info;

AUXHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
AUXHeatpumpIR::AUXHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "AUX";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"aux\",\"dn\":\"AUX\",\"mT\":16,\"xT\":30,\"fs\":5}";
5+
static const char model[] PROGMEM = "AUX";
6+
static const char info[] PROGMEM = "{\"mdl\":\"aux\",\"dn\":\"AUX\",\"mT\":16,\"xT\":30,\"fs\":5}";
77

88
_model = model;
99
_info = info;

BGHHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
BGHHeatpumpIR::BGHHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "BGH_aud";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"BGH_aud\",\"dn\":\"BGH AUD\",\"mT\":18,\"xT\":32,\"fs\":3}";
5+
static const char model[] PROGMEM = "BGH_aud";
6+
static const char info[] PROGMEM = "{\"mdl\":\"BGH_aud\",\"dn\":\"BGH AUD\",\"mT\":18,\"xT\":32,\"fs\":3}";
77

88
_model = model;
99
_info = info;

BalluHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
BalluHeatpumpIR::BalluHeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "ballu";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"ballu\",\"dn\":\"Ballu\",\"mT\":16,\"xT\":30,\"fs\":3}";
5+
static const char model[] PROGMEM = "ballu";
6+
static const char info[] PROGMEM = "{\"mdl\":\"ballu\",\"dn\":\"Ballu\",\"mT\":16,\"xT\":30,\"fs\":3}";
77

88
_model = model;
99
_info = info;

CarrierHeatpumpIR.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ void CarrierHeatpumpIR::send(IRSender& IR, uint8_t powerModeCmd, uint8_t operati
1212
// The different models just set the model accordingly
1313
CarrierNQVHeatpumpIR::CarrierNQVHeatpumpIR() : CarrierHeatpumpIR()
1414
{
15-
static const char PROGMEM model[] PROGMEM = "carrier_nqv";
16-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"carrier_nqv\",\"dn\":\"Carrier NQV\",\"mT\":17,\"xT\":30,\"fs\":6}";
15+
static const char model[] PROGMEM = "carrier_nqv";
16+
static const char info[] PROGMEM = "{\"mdl\":\"carrier_nqv\",\"dn\":\"Carrier NQV\",\"mT\":17,\"xT\":30,\"fs\":6}";
1717

1818
_model = model;
1919
_info = info;
2020
}
2121

2222
CarrierMCAHeatpumpIR::CarrierMCAHeatpumpIR() : CarrierHeatpumpIR()
2323
{
24-
static const char PROGMEM model[] PROGMEM = "carrier_mca";
25-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"carrier_mca\",\"dn\":\"Carrier MCA\",\"mT\":17,\"xT\":30,\"fs\":4}";
24+
static const char model[] PROGMEM = "carrier_mca";
25+
static const char info[] PROGMEM = "{\"mdl\":\"carrier_mca\",\"dn\":\"Carrier MCA\",\"mT\":17,\"xT\":30,\"fs\":4}";
2626

2727
_model = model;
2828
_info = info;
@@ -31,8 +31,8 @@ CarrierMCAHeatpumpIR::CarrierMCAHeatpumpIR() : CarrierHeatpumpIR()
3131

3232
Qlima1HeatpumpIR::Qlima1HeatpumpIR() : CarrierMCAHeatpumpIR()
3333
{
34-
static const char PROGMEM model[] PROGMEM = "qlima_1";
35-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"qlima_1\",\"dn\":\"Qlima #1\",\"mT\":17,\"xT\":30,\"fs\":4, \"maint\":[10]}";
34+
static const char model[] PROGMEM = "qlima_1";
35+
static const char info[] PROGMEM = "{\"mdl\":\"qlima_1\",\"dn\":\"Qlima #1\",\"mT\":17,\"xT\":30,\"fs\":4, \"maint\":[10]}";
3636

3737
_model = model;
3838
_info = info;
@@ -42,8 +42,8 @@ Qlima1HeatpumpIR::Qlima1HeatpumpIR() : CarrierMCAHeatpumpIR()
4242

4343
Qlima2HeatpumpIR::Qlima2HeatpumpIR() : CarrierMCAHeatpumpIR()
4444
{
45-
static const char PROGMEM model[] PROGMEM = "qlima_2";
46-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"qlima_2\",\"dn\":\"Qlima #2\",\"mT\":17,\"xT\":30,\"fs\":4, \"maint\":[10]}";
45+
static const char model[] PROGMEM = "qlima_2";
46+
static const char info[] PROGMEM = "{\"mdl\":\"qlima_2\",\"dn\":\"Qlima #2\",\"mT\":17,\"xT\":30,\"fs\":4, \"maint\":[10]}";
4747

4848
_model = model;
4949
_info = info;

DaikinHeatpumpARC417IR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
DaikinHeatpumpARC417IR::DaikinHeatpumpARC417IR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "daikin_arc417";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"daikin_arc417\",\"dn\":\"Daikin ARC417\",\"mT\":18,\"xT\":30,\"fs\":6,\"maint\":[10,11,12,13,14,15,16,17]}}}";
5+
static const char model[] PROGMEM = "daikin_arc417";
6+
static const char info[] PROGMEM = "{\"mdl\":\"daikin_arc417\",\"dn\":\"Daikin ARC417\",\"mT\":18,\"xT\":30,\"fs\":6,\"maint\":[10,11,12,13,14,15,16,17]}}}";
77

88
_model = model;
99
_info = info;

DaikinHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
DaikinHeatpumpIR::DaikinHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "daikin";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"daikin\",\"dn\":\"Daikin\",\"mT\":18,\"xT\":30,\"fs\":6,\"maint\":[10,11,12,13,14,15,16,17]}}}";
5+
static const char model[] PROGMEM = "daikin";
6+
static const char info[] PROGMEM = "{\"mdl\":\"daikin\",\"dn\":\"Daikin\",\"mT\":18,\"xT\":30,\"fs\":6,\"maint\":[10,11,12,13,14,15,16,17]}}}";
77

88
_model = model;
99
_info = info;

FuegoHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
FuegoHeatpumpIR::FuegoHeatpumpIR()
55
{
6-
static const char PROGMEM model[] PROGMEM = "fuego";
7-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"fuego\",\"dn\":\"Fuego\",\"mT\":18,\"xT\":31,\"fs\":3}";
6+
static const char model[] PROGMEM = "fuego";
7+
static const char info[] PROGMEM = "{\"mdl\":\"fuego\",\"dn\":\"Fuego\",\"mT\":18,\"xT\":31,\"fs\":3}";
88

99
_model = model;
1010
_info = info;

FujitsuHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
FujitsuHeatpumpIR::FujitsuHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "fujitsu_awyz";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"fujitsu_awyz\",\"dn\":\"Fujitsu AWYZ\",\"mT\":16,\"xT\":30,\"fs\":5}";
5+
static const char model[] PROGMEM = "fujitsu_awyz";
6+
static const char info[] PROGMEM = "{\"mdl\":\"fujitsu_awyz\",\"dn\":\"Fujitsu AWYZ\",\"mT\":16,\"xT\":30,\"fs\":5}";
77

88
_model = model;
99
_info = info;

GreeHeatpumpIR.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ GreeHeatpumpIR::GreeHeatpumpIR() : HeatpumpIR()
77

88
GreeGenericHeatpumpIR::GreeGenericHeatpumpIR() : GreeHeatpumpIR()
99
{
10-
static const char PROGMEM model[] PROGMEM = "gree";
11-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"gree\",\"dn\":\"Gree\",\"mT\":16,\"xT\":30,\"fs\":3}";
10+
static const char model[] PROGMEM = "gree";
11+
static const char info[] PROGMEM = "{\"mdl\":\"gree\",\"dn\":\"Gree\",\"mT\":16,\"xT\":30,\"fs\":3}";
1212

1313
_model = model;
1414
_info = info;
@@ -17,8 +17,8 @@ GreeGenericHeatpumpIR::GreeGenericHeatpumpIR() : GreeHeatpumpIR()
1717

1818
GreeYANHeatpumpIR::GreeYANHeatpumpIR() : GreeHeatpumpIR()
1919
{
20-
static const char PROGMEM model[] PROGMEM = "greeyan";
21-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"greeyan\",\"dn\":\"Gree YAN\",\"mT\":16,\"xT\":30,\"fs\":3}";
20+
static const char model[] PROGMEM = "greeyan";
21+
static const char info[] PROGMEM = "{\"mdl\":\"greeyan\",\"dn\":\"Gree YAN\",\"mT\":16,\"xT\":30,\"fs\":3}";
2222

2323
_model = model;
2424
_info = info;
@@ -28,8 +28,8 @@ GreeYANHeatpumpIR::GreeYANHeatpumpIR() : GreeHeatpumpIR()
2828
// Support for YAA1FB, FAA1FB1, YB1F2 remotes
2929
GreeYAAHeatpumpIR::GreeYAAHeatpumpIR() : GreeHeatpumpIR()
3030
{
31-
static const char PROGMEM model[] PROGMEM = "greeyaa";
32-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"greeyaa\",\"dn\":\"Gree YAA\",\"mT\":16,\"xT\":30,\"fs\":3}";
31+
static const char model[] PROGMEM = "greeyaa";
32+
static const char info[] PROGMEM = "{\"mdl\":\"greeyaa\",\"dn\":\"Gree YAA\",\"mT\":16,\"xT\":30,\"fs\":3}";
3333

3434
_model = model;
3535
_info = info;

HisenseHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
HisenseHeatpumpIR::HisenseHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "hisense_aud";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"hisense_aud\",\"dn\":\"Hisense AUD\",\"mT\":18,\"xT\":32,\"fs\":3}";
5+
static const char model[] PROGMEM = "hisense_aud";
6+
static const char info[] PROGMEM = "{\"mdl\":\"hisense_aud\",\"dn\":\"Hisense AUD\",\"mT\":18,\"xT\":32,\"fs\":3}";
77

88
_model = model;
99
_info = info;

HitachiHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
HitachiHeatpumpIR::HitachiHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "hitachi";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"hitachi\",\"dn\":\"Hitachi\",\"mT\":16,\"xT\":32,\"fs\":4}";
5+
static const char model[] PROGMEM = "hitachi";
6+
static const char info[] PROGMEM = "{\"mdl\":\"hitachi\",\"dn\":\"Hitachi\",\"mT\":16,\"xT\":32,\"fs\":4}";
77

88
_model = model;
99
_info = info;

HyundaiHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
HyundaiHeatpumpIR::HyundaiHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "hyundai";
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"hyundai\",\"dn\":\"Hyundai\",\"mT\":16,\"xT\":30,\"fs\":3}";
5+
static const char model[] PROGMEM = "hyundai";
6+
static const char info[] PROGMEM = "{\"mdl\":\"hyundai\",\"dn\":\"Hyundai\",\"mT\":16,\"xT\":30,\"fs\":3}";
77

88
_model = model;
99
_info = info;

IRSender.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#ifdef ESP8266
1010
#include <IRsend.h> // From IRremoteESP8266 library
11+
#include <stdint.h>
1112
#endif
1213

1314
class IRSender
@@ -70,6 +71,30 @@ class IRSenderIRremoteESP8266 : public IRSender
7071
private:
7172
IRsend _ir;
7273
};
74+
75+
class IRSenderESP8266 : public IRSender
76+
{
77+
public:
78+
IRSenderESP8266(uint8_t pin);
79+
void setFrequency(int frequency);
80+
void space(int spaceLength);
81+
void mark(int markLength);
82+
83+
protected:
84+
uint32_t _halfPeriodicTime;
85+
};
86+
87+
class IRSenderESP8266Alt : public IRSender
88+
{
89+
public:
90+
IRSenderESP8266Alt(uint8_t pin);
91+
void setFrequency(int frequency);
92+
void space(int spaceLength);
93+
void mark(int markLength);
94+
95+
protected:
96+
uint32_t _halfPeriodicTime;
97+
};
7398
#endif
7499

75100
#endif

IRSenderESP8266.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include <Arduino.h>
2+
#ifdef ESP8266
3+
#include <IRSender.h>
4+
#include <core_esp8266_waveform.h>
5+
6+
// Send IR using the 'bit banging' with startWaveform function on ESP8266 etc.
7+
8+
IRSenderESP8266::IRSenderESP8266(uint8_t pin) : IRSender(pin)
9+
{
10+
pinMode(_pin, OUTPUT);
11+
}
12+
13+
14+
void IRSenderESP8266::setFrequency(int frequency)
15+
{
16+
// Enables IR output. The khz value controls the modulation frequency in kilohertz.
17+
_halfPeriodicTime = 500/frequency; // T = 1/f but we need T/2 in microsecond and f is in kHz
18+
}
19+
20+
21+
// Send an IR 'mark' symbol, i.e. transmitter ON
22+
void IRSenderESP8266::mark(int markLength)
23+
{
24+
long beginning = micros();
25+
26+
startWaveform(_pin, _halfPeriodicTime, _halfPeriodicTime, markLength);
27+
while((int)(micros() - beginning) < markLength);
28+
29+
stopWaveform(_pin);
30+
digitalWrite(_pin, LOW);
31+
}
32+
33+
34+
// Send an IR 'space' symbol, i.e. transmitter OFF
35+
void IRSenderESP8266::space(int spaceLength)
36+
{
37+
digitalWrite(_pin, LOW);
38+
39+
if (spaceLength < 16383) {
40+
delayMicroseconds(spaceLength);
41+
} else {
42+
delay(spaceLength/1000);
43+
}
44+
}
45+
#endif

IRSenderESP8266Alt.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <Arduino.h>
2+
#ifdef ESP8266
3+
#include <IRSender.h>
4+
5+
// Send IR using the 'bit banging' on ESP8266 using alternative ESP.getCycleCount() method
6+
7+
// Cycles compensation due to while cycles and polling ESP.getCycleCount()
8+
#define ESP8266_CYCLES_COMPENSATION 33
9+
10+
IRSenderESP8266Alt::IRSenderESP8266Alt(uint8_t pin) : IRSender(pin)
11+
{
12+
pinMode(_pin, OUTPUT);
13+
}
14+
15+
16+
void IRSenderESP8266Alt::setFrequency(int frequency)
17+
{
18+
// Enables IR output. The khz value controls the modulation frequency in kilohertz.
19+
_halfPeriodicTime = F_CPU / (frequency * 1000 * 2); // This one stores half period time in CPU ticks
20+
}
21+
22+
23+
// Send an IR 'mark' symbol, i.e. transmitter ON
24+
void IRSenderESP8266Alt::mark(int markLength)
25+
{
26+
long beginning = micros();
27+
28+
while((int)(micros() - beginning) < markLength){
29+
uint32_t periodStart = ESP.getCycleCount();
30+
digitalWrite(_pin, HIGH);
31+
while (ESP.getCycleCount() - periodStart < _halfPeriodicTime - ESP8266_CYCLES_COMPENSATION);
32+
33+
periodStart = ESP.getCycleCount();
34+
digitalWrite(_pin, LOW);
35+
while (ESP.getCycleCount() - periodStart < _halfPeriodicTime - ESP8266_CYCLES_COMPENSATION);
36+
}
37+
}
38+
39+
40+
// Send an IR 'space' symbol, i.e. transmitter OFF
41+
void IRSenderESP8266Alt::space(int spaceLength)
42+
{
43+
digitalWrite(_pin, LOW);
44+
45+
if (spaceLength < 16383) {
46+
delayMicroseconds(spaceLength);
47+
} else {
48+
delay(spaceLength/1000);
49+
}
50+
}
51+
#endif

IVTHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
IVTHeatpumpIR::IVTHeatpumpIR() : SharpHeatpumpIR()
55
{
6-
static const char PROGMEM model[] PROGMEM = "ivt";
7-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"ivt\",\"dn\":\"IVT AY-XP12FR-N\",\"mT\":18,\"xT\":32,\"fs\":3,\"maint\":[10]}}";
6+
static const char model[] PROGMEM = "ivt";
7+
static const char info[] PROGMEM = "{\"mdl\":\"ivt\",\"dn\":\"IVT AY-XP12FR-N\",\"mT\":18,\"xT\":32,\"fs\":3,\"maint\":[10]}}";
88

99
_model = model;
1010
_info = info;

MideaHeatpumpIR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
MideaHeatpumpIR::MideaHeatpumpIR() : HeatpumpIR()
44
{
5-
static const char PROGMEM model[] PROGMEM = "midea"; // The basic and inverter Midea's are the same, i.e. at least Pro Plus 10FP, Pro Plus 13Fp, Pro Plus 9 Inverter and Pro Plus 12 Inverter should work
6-
static const char PROGMEM info[] PROGMEM = "{\"mdl\":\"midea\",\"dn\":\"Ultimate Pro Plus\",\"mT\":16,\"xT\":30,\"fs\":4,\"maint\":[10]}";
5+
static const char model[] PROGMEM = "midea"; // The basic and inverter Midea's are the same, i.e. at least Pro Plus 10FP, Pro Plus 13Fp, Pro Plus 9 Inverter and Pro Plus 12 Inverter should work
6+
static const char info[] PROGMEM = "{\"mdl\":\"midea\",\"dn\":\"Ultimate Pro Plus\",\"mT\":16,\"xT\":30,\"fs\":4,\"maint\":[10]}";
77

88
_model = model;
99
_info = info;

0 commit comments

Comments
 (0)