Updated HeatpumpIR, to a version which uses the native Arduino IDE 1.6 PROGMEM definitions
This commit is contained in:
@@ -1,47 +1,40 @@
|
||||
#include <Arduino.h>
|
||||
#include <HisenseHeatpumpIR.h>
|
||||
|
||||
IRSender irSender(3); // IR led on Duemilanove digital pin 3
|
||||
|
||||
HisenseHeatpumpIR *heatpumpIR;
|
||||
HisenseHeatpumpIR *heatpumpIR;
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
Serial.begin(9600);
|
||||
delay(500);
|
||||
heatpumpIR = new HisenseHeatpumpIR();
|
||||
Serial.println(F("Starting"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
int i = 0;
|
||||
prog_char* buf;
|
||||
const char* buf;
|
||||
|
||||
|
||||
// Send the same IR command to all supported heatpumps
|
||||
Serial.print(F("Sending IR to "));
|
||||
// Print the model
|
||||
buf = (prog_char*)heatpumpIR->model();
|
||||
buf = heatpumpIR->model();
|
||||
// 'model' is a PROGMEM pointer, so need to write a byte at a time
|
||||
while (char modelChar = pgm_read_byte(buf++))
|
||||
{
|
||||
Serial.print(modelChar);
|
||||
}
|
||||
Serial.print(F(", info: "));
|
||||
// Print the info
|
||||
buf = (prog_char*)heatpumpIR->info();
|
||||
// Print the info
|
||||
buf = heatpumpIR->info();
|
||||
// 'info' is a PROGMEM pointer, so need to write a byte at a time
|
||||
while (char infoChar = pgm_read_byte(buf++))
|
||||
{
|
||||
Serial.print(infoChar);
|
||||
}
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
|
||||
|
||||
heatpumpIR->send(irSender, POWER_ON, MODE_HEAT, FAN_3, 30, VDIR_AUTO, HDIR_AUTO);
|
||||
delay(1500);
|
||||
heatpumpIR->send(irSender, POWER_ON, MODE_DRY, FAN_2, 20, VDIR_AUTO, HDIR_AUTO);
|
||||
@@ -50,7 +43,6 @@ void loop()
|
||||
delay(1500);
|
||||
heatpumpIR->send(irSender, POWER_ON, MODE_COOL, FAN_1, 18, VDIR_AUTO, HDIR_AUTO);
|
||||
delay(2500);
|
||||
heatpumpIR->send(irSender, POWER_OFF, NULL, NULL, NULL, NULL, NULL);
|
||||
heatpumpIR->send(irSender, POWER_OFF, MODE_COOL, FAN_1, 18, VDIR_AUTO, HDIR_AUTO);
|
||||
delay(1500);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <Arduino.h>
|
||||
#include <MideaHeatpumpIR.h> // https://github.com/ToniA/arduino-heatpumpir
|
||||
#include <Button.h> // http://playground.arduino.cc/Code/Button
|
||||
|
||||
@@ -34,8 +35,8 @@ const byte heatpumpOff = 0;
|
||||
const byte heatpumpNormal = 1;
|
||||
const byte heatpumpMaintenance = 2;
|
||||
|
||||
Button relay1 = Button(11,PULLUP); // Heatpump ON-OFF state
|
||||
Button relay2 = Button(12,PULLUP); // FP mode (maintenance heating at 8 degrees C) ON-OFF state
|
||||
Button relay1 = Button(11, INPUT_PULLUP); // Heatpump ON-OFF state
|
||||
Button relay2 = Button(12, INPUT_PULLUP); // FP mode (maintenance heating at 8 degrees C) ON-OFF state
|
||||
|
||||
IRSender irSender(9); // IR led on Duemilanove digital pin 9
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
// HeatpumpIR libraries
|
||||
#include <FujitsuHeatpumpIR.h>
|
||||
#include <PanasonicCKPHeatpumpIR.h>
|
||||
@@ -85,8 +87,7 @@ void loop()
|
||||
// Handle incoming messages from the MySensors Gateway
|
||||
void incomingMessage(const MyMessage &message) {
|
||||
|
||||
const char *irData;
|
||||
long irCommand;
|
||||
const char *irData;
|
||||
|
||||
// V_IR type message
|
||||
if (message.type==V_IR_SEND) {
|
||||
@@ -156,10 +157,10 @@ libraries\HeatpumpIR\HeatpumpIR.h for the constants
|
||||
byte fan = (irCommand & 0x00000F00) >> 8;
|
||||
byte temp = (irCommand & 0x000000FF);
|
||||
|
||||
prog_char* buf;
|
||||
const char* buf;
|
||||
Serial.print(F("Model: "));
|
||||
|
||||
buf = (prog_char*)heatpumpIR[model]->model();
|
||||
buf = heatpumpIR[model]->model();
|
||||
// 'model' is a PROGMEM pointer, so need to write a byte at a time
|
||||
while (char modelChar = pgm_read_byte(buf++))
|
||||
{
|
||||
@@ -188,14 +189,14 @@ libraries\HeatpumpIR\HeatpumpIR.h for the constants
|
||||
|
||||
if (model == 0) {
|
||||
Serial.println(F("Scheduling timer cancellation on Panasonic CKP heatpump..."));
|
||||
panasonicCKPTimer = timer.after(120000, panasonicCancelTimer, (void *)NULL); // Called after 2 minutes
|
||||
panasonicCKPTimer = timer.after(120000, panasonicCancelTimer); // Called after 2 minutes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cancel the timer on the Panasonic CKP heatpump
|
||||
void panasonicCancelTimer(void *context)
|
||||
void panasonicCancelTimer()
|
||||
{
|
||||
PanasonicCKPHeatpumpIR *panasonicCKPHeatpumpIR = new PanasonicCKPHeatpumpIR();
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <PanasonicCKPHeatpumpIR.h>
|
||||
#include <Timer.h>
|
||||
#include <Timer.h> // https://github.com/JChristensen/Timer
|
||||
|
||||
/*
|
||||
This schema demonstrates how to control the Panasonic CKP power state change. The CKP does not have discrete
|
||||
@@ -34,8 +36,8 @@ void setup()
|
||||
heatpumpIR->send(irSender, POWER_ON, MODE_HEAT, FAN_2, 24, VDIR_UP, HDIR_AUTO);
|
||||
Serial.println("The heatpump should have beeped, and the TIMER led should be ON");
|
||||
|
||||
timer.after(60000, panasonicIsOn, NULL); // Called after 1 minute
|
||||
timer.after(120000, panasonicCancelTimer, NULL); // Called after 2 minutes
|
||||
timer.after(60000, panasonicIsOn); // Called after 1 minute
|
||||
timer.after(120000, panasonicCancelTimer); // Called after 2 minutes
|
||||
|
||||
}
|
||||
|
||||
@@ -44,12 +46,12 @@ void loop()
|
||||
timer.update();
|
||||
}
|
||||
|
||||
void panasonicIsOn(void *context)
|
||||
void panasonicIsOn()
|
||||
{
|
||||
Serial.println("The heatpump should should turn ON by now, the TIMER led is still ON");
|
||||
}
|
||||
|
||||
void panasonicCancelTimer(void *context)
|
||||
void panasonicCancelTimer()
|
||||
{
|
||||
heatpumpIR->sendPanasonicCKPCancelTimer(irSender);
|
||||
Serial.println("The TIMER led should now be OFF");
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <FujitsuHeatpumpIR.h>
|
||||
#include <PanasonicCKPHeatpumpIR.h>
|
||||
#include <PanasonicHeatpumpIR.h>
|
||||
@@ -25,13 +27,13 @@ void setup()
|
||||
void loop()
|
||||
{
|
||||
int i = 0;
|
||||
prog_char* buf;
|
||||
const char* buf;
|
||||
|
||||
do {
|
||||
// Send the same IR command to all supported heatpumps
|
||||
Serial.print(F("Sending IR to "));
|
||||
|
||||
buf = (prog_char*)heatpumpIR[i]->model();
|
||||
buf = heatpumpIR[i]->model();
|
||||
// 'model' is a PROGMEM pointer, so need to write a byte at a time
|
||||
while (char modelChar = pgm_read_byte(buf++))
|
||||
{
|
||||
@@ -39,7 +41,7 @@ void loop()
|
||||
}
|
||||
Serial.print(F(", info: "));
|
||||
|
||||
buf = (prog_char*)heatpumpIR[i]->info();
|
||||
buf = heatpumpIR[i]->info();
|
||||
// 'info' is a PROGMEM pointer, so need to write a byte at a time
|
||||
while (char infoChar = pgm_read_byte(buf++))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user