mirror of
https://github.com/kevinveenbirkenbach/physical-interface.git
synced 2024-11-14 14:21:04 +01:00
Refactored function
This commit is contained in:
parent
7722947263
commit
65a41b3d93
@ -29,8 +29,13 @@ NewRemoteTransmitter transmitter(ritter_group_address, pin_ritter);
|
|||||||
DHT dht(pin_tmp, DHT11);
|
DHT dht(pin_tmp, DHT11);
|
||||||
IRrecv irrecv(pin_ir_reciever);
|
IRrecv irrecv(pin_ir_reciever);
|
||||||
|
|
||||||
String getDecodeType(decode_results *results){
|
/**
|
||||||
switch(results->decode_type){
|
* Associative Arrays aren't possible in C++ because of Memory.
|
||||||
|
* For this reason it's necessary to implement the function like this.
|
||||||
|
* If you get the return value "UNKNOWN", adapt the return values to the ones in decode_type_t defined in IRremoteESP8266.h
|
||||||
|
**/
|
||||||
|
String getDecodeType(decode_type_t decode_type){
|
||||||
|
switch(decode_type){
|
||||||
case NEC:
|
case NEC:
|
||||||
return String("NEC");
|
return String("NEC");
|
||||||
case SONY:
|
case SONY:
|
||||||
@ -44,7 +49,7 @@ String getDecodeType(decode_results *results){
|
|||||||
case RCMM:
|
case RCMM:
|
||||||
return String("RCMM");
|
return String("RCMM");
|
||||||
case PANASONIC:
|
case PANASONIC:
|
||||||
return String("PANASONIC" + results->address + HEX);
|
return String("PANASONIC");
|
||||||
case LG:
|
case LG:
|
||||||
return String("LG");
|
return String("LG");
|
||||||
case JVC:
|
case JVC:
|
||||||
@ -59,7 +64,7 @@ String getDecodeType(decode_results *results){
|
|||||||
|
|
||||||
void dump(decode_results *results) {
|
void dump(decode_results *results) {
|
||||||
uint16_t count = results->rawlen;
|
uint16_t count = results->rawlen;
|
||||||
Serial.print(getDecodeType(results));
|
Serial.print(getDecodeType(results->decode_type));
|
||||||
serialPrintUint64(results->value, 16);
|
serialPrintUint64(results->value, 16);
|
||||||
Serial.print(" (");
|
Serial.print(" (");
|
||||||
Serial.print(results->bits, DEC);
|
Serial.print(results->bits, DEC);
|
||||||
|
Loading…
Reference in New Issue
Block a user