bug fixing
This commit is contained in:
parent
b1552598ea
commit
cb9e5fc361
1 changed files with 17 additions and 17 deletions
|
@ -53,18 +53,18 @@ void decodeMessage() {
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
//case 80: break;
|
//case 80: break;
|
||||||
case 81: setMode(val[0], pin); break;
|
case 81: setMode(val[0], pin); break;
|
||||||
case 82: digitalW(val[0], pin); break;
|
case 82: digitalW(val[0], pin); break;
|
||||||
case 83: digitalR(pin); break;
|
case 83: digitalR(pin); break;
|
||||||
case 84: analogW(pin, val) break;
|
case 84: analogW(val, pin); break;
|
||||||
case 85: analogR(pin) break;
|
case 85: analogR(pin); break;
|
||||||
case 86: handleRCDecimal(val, pin) break;
|
case 86: handleRCDecimal(val, pin); break;
|
||||||
case 87: sendRCTristate(val, pin); break;
|
case 87: sendRCTristate(val, pin); break;
|
||||||
case 88: irSend(val[0], val[1], lastFourToLong(val)) break;
|
case 88: irSend(val[0], val[1], lastFourToLong(val)); break;
|
||||||
case 89: irrecv.enableIRIn();
|
case 89: irrecv.enableIRIn();
|
||||||
irReceive = millis() + 10000;
|
irReceive = millis() + 10000;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(cmd == 90) {
|
} else if(cmd == 90) {
|
||||||
|
@ -117,28 +117,28 @@ void digitalR(int pin) {
|
||||||
|
|
||||||
void analogW(uint8_t val[], int pin) {
|
void analogW(uint8_t val[], int pin) {
|
||||||
|
|
||||||
if(p == -1) { if(debug) Serial.println("badpin"); return; }
|
if(pin == -1) { Serial.println("badpin"); return; }
|
||||||
pinMode(p, OUTPUT);
|
pinMode(pin, OUTPUT);
|
||||||
analogWrite(p,firsTwoToInt(val));
|
analogWrite(pin,firsTwoToInt(val));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void analogR(int pin) {
|
void analogR(int pin) {
|
||||||
|
|
||||||
if(p == -1) { Serial.println("badpin"); return; }
|
if(pin == -1) { Serial.println("badpin"); return; }
|
||||||
pinMode(p, INPUT);
|
pinMode(pin, INPUT);
|
||||||
int rval = analogRead(p);
|
int rval = analogRead(pin);
|
||||||
Serial.println(String(pin + "::" + rval));
|
Serial.println(String(pin + "::" + rval));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleRCDecimal(uint8_t val[], int pin) {
|
void handleRCDecimal(uint8_t val[], int pin) {
|
||||||
|
|
||||||
if (p == -1) { Serial.println("badpin"); return; }
|
if (pin == -1) { Serial.println("badpin"); return; }
|
||||||
unsigned int length = firsTwoToInt(val);
|
unsigned int length = firsTwoToInt(val);
|
||||||
unsigned long value = lastFourToLong(val);
|
unsigned long value = lastFourToLong(val);
|
||||||
RCSwitch rc = RCSwitch();
|
RCSwitch rc = RCSwitch();
|
||||||
rc.enableTransmit(p);
|
rc.enableTransmit(pin);
|
||||||
rc.send(value, length);
|
rc.send(value, length);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue