Skip to content

Commit

Permalink
now no longer a submodule. lib/IRremoteESP8266 upstream version v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Apr 23, 2017
1 parent 24e4f8c commit b52c5a8
Show file tree
Hide file tree
Showing 29 changed files with 4,269 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "lib/IRremoteESP8266"]
path = lib/IRremoteESP8266
url = https://github.com/markszabo/IRremoteESP8266.git
1 change: 0 additions & 1 deletion lib/IRremoteESP8266
Submodule IRremoteESP8266 deleted from a7ad7b
33 changes: 33 additions & 0 deletions lib/IRremoteESP8266/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: c
env:
- BD=esp8266:esp8266:nodemcuv2:CpuFrequency=80,FlashSize=4M3M
before_install:
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
- sleep 3
- export DISPLAY=:1.0
- wget http://downloads.arduino.cc/arduino-1.8.1-linux64.tar.xz
- tar xf arduino-1.8.1-linux64.tar.xz
- sudo mv arduino-1.8.1 /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
install:
- ln -s $PWD /usr/local/share/arduino/libraries/
- arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
- arduino --install-boards esp8266:esp8266
- arduino --board $BD --save-prefs
- arduino --pref "compiler.warning_level=all" --save-prefs
script:
- arduino --verify --board $BD $PWD/examples/IRrecvDemo/IRrecvDemo.ino
- arduino --verify --board $BD $PWD/examples/IRGCSendDemo/IRGCSendDemo.ino
- arduino --verify --board $BD $PWD/examples/IRGCTCPServer/IRGCTCPServer.ino
- arduino --verify --board $BD $PWD/examples/IRServer/IRServer.ino
- arduino --verify --board $BD $PWD/examples/IRrecvDumpV2/IRrecvDumpV2.ino
- arduino --verify --board $BD $PWD/examples/IRsendDemo/IRsendDemo.ino
- arduino --verify --board $BD $PWD/examples/JVCPanasonicSendDemo/JVCPanasonicSendDemo.ino
- arduino --verify --board $BD $PWD/examples/TurnOnDaikinAC/TurnOnDaikinAC.ino
- arduino --verify --board $BD $PWD/examples/TurnOnKelvinatorAC/TurnOnKelvinatorAC.ino
- arduino --verify --board $BD $PWD/examples/TurnOnKelvinatorAC/TurnOnMitsubishiAC.ino

notifications:
email:
on_success: change
on_failure: change
13 changes: 13 additions & 0 deletions lib/IRremoteESP8266/Contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Contributors of this project
### Main contributors & maintainers
- [Mark Szabo](https://github.com/markszabo/) : Initial IR sending on ESP8266
- [Sébastien Warin](https://github.com/sebastienwarin/) (http://sebastien.warin.fr) : Initial IR receiving on ESP8266
- [David Conran](https://github.com/crankyoldgit/)
- [Roi Dayan](https://github.com/roidayan/)
- [Marcos de Alcântara Marinho](https://github.com/marcosamarinho/)
- [Massimiliano Pinto](https://github.com/pintomax/)
- [Darsh Patel](https://github.com/darshkpatel/)

All contributors can be found on the [contributors site](https://github.com/markszabo/IRremoteESP8266/graphs/contributors).

### Contributors of the [original project](https://github.com/z3t0/Arduino-IRremote) can be found on the [original project's contributors page](https://github.com/z3t0/Arduino-IRremote/blob/master/Contributors.md)
152 changes: 152 additions & 0 deletions lib/IRremoteESP8266/IRDaikinESP.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/*
An Arduino sketch to emulate IR Daikin ARC433** remote control unit
Read more on http://harizanov.com/2012/02/control-daikin-air-conditioner-over-the-internet/
*/

#include <IRDaikinESP.h>

IRDaikinESP::IRDaikinESP(int pin) : _irsend(pin)
{
}

void IRDaikinESP::begin()
{
_irsend.begin();
}

void IRDaikinESP::send()
{
_irsend.sendDaikin(daikin);
}

void IRDaikinESP::checksum()
{
uint8_t sum = 0;
uint8_t i;

for(i = 0; i <= 6; i++){
sum += daikin[i];
}

daikin[7] = sum &0xFF;
sum=0;
for(i = 8; i <= 25; i++){
sum += daikin[i];
}
daikin[26] = sum &0xFF;
}

void IRDaikinESP::on()
{
//state = ON;
daikin[13] |= 0x01;
checksum();
}

void IRDaikinESP::off()
{
//state = OFF;
daikin[13] &= 0xFE;
checksum();
}

uint8_t IRDaikinESP::getPower()
{
return (daikin[13])&0x01;
}

// DAIKIN_SILENT or DAIKIN_POWERFUL
void IRDaikinESP::setAux(uint8_t aux)
{
daikin[21] = aux;
checksum();
}

uint8_t IRDaikinESP::getAux(){
return daikin[21];
}


// Set the temp in deg C
void IRDaikinESP::setTemp(uint8_t temp)
{
if (temp < 18)
temp = 18;
else if (temp > 32)
temp = 32;
daikin[14] = (temp)*2;
checksum();
}

uint8_t IRDaikinESP::getTemp()
{
return (daikin[14])/2;
}

// Set the speed of the fan, 0-5, 0 is auto, 1-5 is the speed
void IRDaikinESP::setFan(uint8_t fan)
{
// Set the fan speed bits, leave low 4 bits alone
uint8_t fanset;
daikin[16] = daikin[16] & 0x0F;
if (fan >= 1 && fan <= 5)
fanset = 0x20 + (0x10 * fan);
else
fanset = 0xA0;
daikin[16] = daikin[16] | fanset;
checksum();
}

uint8_t IRDaikinESP::getFan()
{
uint8_t fan = daikin[16] >> 4;
fan = fan - 2;
if (fan > 5)
fan = 0;
return fan;
}

uint8_t IRDaikinESP::getMode()
{/*
DAIKIN_COOL
DAIKIN_HEAT
DAIKIN_FAN
DAIKIN_AUTO
DAIKIN_DRY
*/
return (daikin[13])>>4;
}

void IRDaikinESP::setMode(uint8_t mode)
{
daikin[13]=mode<<4 | getPower();
checksum();
}

void IRDaikinESP::setSwingVertical(uint8_t swing)
{
if (swing)
daikin[16] = daikin[16] | 0x0F;
else
daikin[16] = daikin[16] & 0xF0;
checksum();
}

uint8_t IRDaikinESP::getSwingVertical()
{
return (daikin[16])&0x01;
}

void IRDaikinESP::setSwingHorizontal(uint8_t swing)
{
if (swing)
daikin[17] = daikin[17] | 0x0F;
else
daikin[17] = daikin[17] & 0xF0;
checksum();
}

uint8_t IRDaikinESP::getSwingHorizontal()
{
return (daikin[17])&0x01;
}
100 changes: 100 additions & 0 deletions lib/IRremoteESP8266/IRDaikinESP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

#include <IRremoteESP8266.h>
#include <Arduino.h>

#define DAIKIN_COOL B011
#define DAIKIN_HEAT B100
#define DAIKIN_FAN B110
#define DAIKIN_AUTO B000
#define DAIKIN_DRY B010

#define DAIKIN_POWERFUL B00000010
#define DAIKIN_SILENT B00100000

/*
Daikin AC map
byte 7= checksum of the first part (and last byte before a 29ms pause)
byte 13=mode
b7 = 0
b6+b5+b4 = Mode
Modes: b6+b5+b4
011 = Cool
100 = Heat (temp 23)
110 = FAN (temp not shown, but 25)
000 = Fully Automatic (temp 25)
010 = DRY (temp 0xc0 = 96 degrees c)
b3 = 0
b2 = OFF timer set
b1 = ON timer set
b0 = Air Conditioner ON
byte 14=temp*2 (Temp should be between 18 - 32)
byte 16=Fan
FAN control
b7+b6+b5+b4 = Fan speed
Fan: b7+b6+b5+b4
0×30 = 1 bar
0×40 = 2 bar
0×50 = 3 bar
0×60 = 4 bar
0×70 = 5 bar
0xa0 = Auto
0xb0 = Not auto, moon + tree
b3+b2+b1+b0 = Swing control up/down
Swing control up/down:
0000 = Swing up/down off
1111 = Swing up/down on
byte 17
Swing control left/right:
0000 = Swing left/right off
1111 = Swing left/right on
byte 21=Aux -> Powerful (bit 1), Silent (bit 5)
byte 24=Aux2 -> Intelligent eye on (bit 7)
byte 26= checksum of the second part
*/

#define DAIKIN_COMMAND_LENGTH 27

class IRDaikinESP
{
public:
IRDaikinESP(int pin);
//: IRsend(pin){};

void send();

void begin();
void on();
void off();
uint8_t getPower();

void setAux(uint8_t aux);
uint8_t getAux();

void setTemp(uint8_t temp);
uint8_t getTemp();

void setFan(uint8_t fan);
uint8_t getFan();

uint8_t getMode();
void setMode(uint8_t mode);

void setSwingVertical(uint8_t swing);
uint8_t getSwingVertical();
void setSwingHorizontal(uint8_t swing);
uint8_t getSwingHorizontal();

private:
// # of bytes per command
unsigned char daikin[DAIKIN_COMMAND_LENGTH] = {
0x11,0xDA,0x27,0xF0,0x00,0x00,0x00,0x20,
//0 1 2 3 4 5 6 7
0x11,0xDA,0x27,0x00,0x00,0x41,0x1E,0x00,
//8 9 10 11 12 13 14 15
0xB0,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0xE3 };
//16 17 18 19 20 21 22 23 24 25 26

void checksum();

IRsend _irsend;
};
Loading

0 comments on commit b52c5a8

Please sign in to comment.