puuu / ESPiLight

ESPiLight - pilight 433.92 MHz protocols library for Arduino
GNU General Public License v3.0
109 stars 41 forks source link

Doesn't work with TTGO T-Call (ESP32) #47

Open Terxeno opened 4 years ago

Terxeno commented 4 years ago

Hi! I try to use ESPiLite c TTGO T-Call (ESP32) and srx882, but unfortunately nothing works, there is no answer at all. Although the same code works on The Wemos D1 mini. Tried different pins, different code, but all the same does not work.

#define RECEIVER_PIN 27
#define TRANSMITTER_PIN -1

#include <ESPiLight.h>

ESPiLight rf(TRANSMITTER_PIN);

String getValue(String id, String message) {
  String value = "";
  int idIndex = message.indexOf('"' + id + '"' + ':');

  if (idIndex != -1) {
    int valueIndex = idIndex + id.length() + 3;
    value = message.substring(valueIndex, message.indexOf(",", valueIndex));  
  } 
  return value;
}

void rfCallback(const String &protocol, const String &message, int status, int repeats, const String &deviceID) {
  if (status == VALID && protocol.equals("arctech_screen_old")) {

    String t = getValue("unit", message);
   // Blynk.virtualWrite(V0, t);
    Serial.println("unit: " + t);

    String h = getValue("state", message);
    Serial.println("state: " + h);
   // Blynk.virtualWrite(V1, h);
  }
   Serial.println("rfCallback ends");

}

void setup() {
  Serial.begin(115200);

  rf.setCallback(rfCallback);
  rf.initReceiver(RECEIVER_PIN);
}

void loop() {
  rf.loop();
}
Terxeno commented 4 years ago

Spent four days finding the problem! Finally found, as the documentation says:

https://github.com/espressif/esp-idf/tree/f91080637/examples/peripherals/pcnt

After connecting to pin 18, everything worked!