-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from markszabo/master
Update
- Loading branch information
Showing
18 changed files
with
1,644 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
## Contributors of this project | ||
- [Mark Szabo](https://github.com/markszabo/) : IR sending on ESP8266 | ||
- [Sébastien Warin](https://github.com/sebastienwarin/) (http://sebastien.warin.fr) : IR receiving on ESP8266 | ||
|
||
## Contributors of the original project (https://github.com/shirriff/Arduino-IRremote/) | ||
These are the active contributors of this project that you may contact if there is anything you need help with or if you have suggestions. | ||
|
||
- [z3t0](https://github.com/z3t0) : Active Contributor and currently also the main contributor. | ||
* Email: [email protected] | ||
* Skype: polarised16 | ||
- [shirriff](https://github.com/shirriff) : Owner of repository and creator of library. | ||
- [Informatic](https://github.com/Informatic) : Active contributor | ||
- [fmeschia](https://github.com/fmeschia) : Active contributor | ||
- [PaulStoffregen](https://github.com/paulstroffregen) : Active contributor | ||
- [crash7](https://github.com/crash7) : Active contributor | ||
- [Neco777](https://github.com/neco777) : Active contributor | ||
|
||
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed. | ||
|
||
|
||
### 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
/* | ||
Code to emulate IR Kelvinator YALIF remote control unit, which should control | ||
at least the following Kelvinator A/C units: | ||
KSV26CRC, KSV26HRC, KSV35CRC, KSV35HRC, KSV53HRC, KSV62HRC, KSV70CRC, | ||
KSV70HRC, KSV80HRC. | ||
Note: | ||
* Unsupported: | ||
- All Sleep modes. | ||
- All Timer modes. | ||
- "I Feel" button & mode. | ||
- Energy Saving mode. | ||
- Low Heat mode. | ||
- Farenheit. | ||
*/ | ||
|
||
#include <IRKelvinator.h> | ||
|
||
IRKelvinatorAC::IRKelvinatorAC(int pin) : _irsend(pin) { | ||
stateReset(); | ||
} | ||
|
||
void IRKelvinatorAC::stateReset() { | ||
for (uint8_t i = 0; i < KELVINATOR_STATE_LENGTH; i++) | ||
remote_state[i] = 0x0; | ||
remote_state[3] = 0x50; | ||
remote_state[11] = 0x70; | ||
} | ||
|
||
void IRKelvinatorAC::begin() { | ||
_irsend.begin(); | ||
} | ||
|
||
void IRKelvinatorAC::fixup() { | ||
// X-Fan mode is only valid in COOL or DRY modes. | ||
if (getMode() != KELVINATOR_COOL && getMode() != KELVINATOR_DRY) | ||
setXFan(false); | ||
checksum(); // Calculate the checksums | ||
} | ||
|
||
void IRKelvinatorAC::send() { | ||
fixup(); // Ensure correct settings before sending. | ||
_irsend.sendKelvinator(remote_state); | ||
} | ||
|
||
uint8_t* IRKelvinatorAC::getRaw() { | ||
fixup(); // Ensure correct settings before sending. | ||
return remote_state; | ||
} | ||
|
||
// Many Bothans died to bring us this information. | ||
void IRKelvinatorAC::checksum() { | ||
// For each command + options block. | ||
for (uint8_t offset = 0; offset < KELVINATOR_STATE_LENGTH; offset += 8) { | ||
uint8_t sum = KELVINATOR_CHECKSUM_START; | ||
// Sum the lower half of the first 4 bytes of this block. | ||
for(uint8_t i = 0; i < 4; i++) { | ||
sum += (remote_state[i + offset] & 0xFU); | ||
} | ||
// then sum the upper half of the next 3 bytes. | ||
for(uint8_t i = 4; i < 7; i++) { | ||
sum += (remote_state[i + offset] >> 4); | ||
} | ||
// Trim it down to fit into the 4 bits allowed. i.e. Mod 16. | ||
sum &= 0xFU; | ||
// Place it into the IR code in the top half of the 8th & 16th byte. | ||
remote_state[7 + offset] = (sum << 4) | (remote_state[7 + offset] & 0xFU); | ||
} | ||
} | ||
|
||
void IRKelvinatorAC::on() { | ||
//state = ON; | ||
remote_state[0] |= KELVINATOR_POWER; | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
void IRKelvinatorAC::off() { | ||
//state = OFF; | ||
remote_state[0] &= ~KELVINATOR_POWER; | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
void IRKelvinatorAC::setPower(bool state) { | ||
if (state) | ||
on(); | ||
else | ||
off(); | ||
} | ||
|
||
bool IRKelvinatorAC::getPower() { | ||
return ((remote_state[0] & KELVINATOR_POWER) != 0); | ||
} | ||
|
||
// Set the temp. in deg C | ||
void IRKelvinatorAC::setTemp(uint8_t temp) { | ||
temp = max(KELVINATOR_MIN_TEMP, temp); | ||
temp = min(KELVINATOR_MAX_TEMP, temp); | ||
remote_state[1] = (remote_state[1] & 0xF0U) | (temp - KELVINATOR_MIN_TEMP); | ||
remote_state[9] = remote_state[1]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
// Return the set temp. in deg C | ||
uint8_t IRKelvinatorAC::getTemp() { | ||
return ((remote_state[1] & 0xFU) + KELVINATOR_MIN_TEMP); | ||
} | ||
|
||
// Set the speed of the fan, 0-5, 0 is auto, 1-5 is the speed | ||
void IRKelvinatorAC::setFan(uint8_t fan) { | ||
fan = min(KELVINATOR_FAN_MAX, fan); // Bounds check | ||
|
||
// Only change things if we need to. | ||
if (fan != getFan()) { | ||
// Set the basic fan values. | ||
uint8_t fan_basic = min(KELVINATOR_BASIC_FAN_MAX, fan); | ||
remote_state[0] = (remote_state[0] & KELVINATOR_BASIC_FAN_MASK) | | ||
(fan_basic << KELVINATOR_FAN_OFFSET); | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
// Set the advanced(?) fan value. | ||
remote_state[14] = (remote_state[14] & KELVINATOR_FAN_MASK) | | ||
(fan << KELVINATOR_FAN_OFFSET); | ||
setTurbo(false); // Turbo mode is turned off if we change the fan settings. | ||
} | ||
} | ||
|
||
uint8_t IRKelvinatorAC::getFan() { | ||
return ((remote_state[14] & ~KELVINATOR_FAN_MASK) >> KELVINATOR_FAN_OFFSET); | ||
} | ||
|
||
uint8_t IRKelvinatorAC::getMode() { | ||
/* | ||
KELVINATOR_AUTO | ||
KELVINATOR_COOL | ||
KELVINATOR_DRY | ||
KELVINATOR_FAN | ||
KELVINATOR_HEAT | ||
*/ | ||
return (remote_state[0] & ~KELVINATOR_MODE_MASK); | ||
} | ||
|
||
void IRKelvinatorAC::setMode(uint8_t mode) { | ||
// If we get an unexpected mode, default to AUTO. | ||
if (mode > KELVINATOR_HEAT) mode = KELVINATOR_AUTO; | ||
remote_state[0] = (remote_state[0] & KELVINATOR_MODE_MASK) | mode; | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
if (mode == KELVINATOR_AUTO) | ||
// When the remote is set to Auto, it defaults to 25C and doesn't show it. | ||
setTemp(KELVINATOR_AUTO_TEMP); | ||
} | ||
|
||
void IRKelvinatorAC::setSwingVertical(bool state) { | ||
if (state) { | ||
remote_state[0] |= KELVINATOR_VENT_SWING; | ||
remote_state[4] |= KELVINATOR_VENT_SWING_V; | ||
} | ||
else { | ||
remote_state[4] &= ~KELVINATOR_VENT_SWING_V; | ||
if (! getSwingHorizontal()) | ||
remote_state[0] &= ~KELVINATOR_VENT_SWING; | ||
} | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getSwingVertical() { | ||
return ((remote_state[4] & KELVINATOR_VENT_SWING_V) != 0); | ||
} | ||
|
||
void IRKelvinatorAC::setSwingHorizontal(bool state) { | ||
if (state) { | ||
remote_state[0] |= KELVINATOR_VENT_SWING; | ||
remote_state[4] |= KELVINATOR_VENT_SWING_H; | ||
} | ||
else { | ||
remote_state[4] &= ~KELVINATOR_VENT_SWING_H; | ||
if (! getSwingVertical()) | ||
remote_state[0] &= ~KELVINATOR_VENT_SWING; | ||
} | ||
remote_state[8] = remote_state[0]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getSwingHorizontal() { | ||
return ((remote_state[4] & KELVINATOR_VENT_SWING_H) != 0); | ||
} | ||
|
||
void IRKelvinatorAC::setQuiet(bool state) { | ||
remote_state[12] &= ~KELVINATOR_QUIET; | ||
remote_state[12] |= (state << KELVINATOR_QUIET_OFFSET); | ||
} | ||
|
||
bool IRKelvinatorAC::getQuiet() { | ||
return ((remote_state[12] & KELVINATOR_QUIET) != 0); | ||
} | ||
|
||
void IRKelvinatorAC::setIonFilter(bool state) { | ||
remote_state[2] &= ~KELVINATOR_ION_FILTER; | ||
remote_state[2] |= (state << KELVINATOR_ION_FILTER_OFFSET); | ||
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getIonFilter() { | ||
return ((remote_state[2] & KELVINATOR_ION_FILTER) != 0); | ||
} | ||
|
||
void IRKelvinatorAC::setLight(bool state) { | ||
remote_state[2] &= ~KELVINATOR_LIGHT; | ||
remote_state[2] |= (state << KELVINATOR_LIGHT_OFFSET); | ||
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getLight() { | ||
return ((remote_state[2] & KELVINATOR_LIGHT) != 0); | ||
} | ||
|
||
// Note: XFan mode is only valid in Cool or Dry mode. | ||
void IRKelvinatorAC::setXFan(bool state) { | ||
remote_state[2] &= ~KELVINATOR_XFAN; | ||
remote_state[2] |= (state << KELVINATOR_XFAN_OFFSET); | ||
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getXFan() { | ||
return ((remote_state[2] & KELVINATOR_XFAN) != 0); | ||
} | ||
|
||
// Note: Turbo mode is turned off if the fan speed is changed. | ||
void IRKelvinatorAC::setTurbo(bool state) { | ||
remote_state[2] &= ~KELVINATOR_TURBO; | ||
remote_state[2] |= (state << KELVINATOR_TURBO_OFFSET); | ||
remote_state[10] = remote_state[2]; // Duplicate to the 2nd command chunk. | ||
} | ||
|
||
bool IRKelvinatorAC::getTurbo() { | ||
return ((remote_state[2] & KELVINATOR_TURBO) != 0); | ||
} |
Oops, something went wrong.